From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 704E142596; Thu, 14 Sep 2023 13:13:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3D73F402E7; Thu, 14 Sep 2023 13:13:07 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 9A8B0402AD for ; Thu, 14 Sep 2023 13:13:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694689985; x=1726225985; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=K5oR4Evngdj499kneLtuwnrw1/nwJXZCGea6hxcc5yA=; b=jFcKxEgBso63EEyHYY7PZLGRxU4qR2tnut2orsspp52PlRYCVLUArfau s+HbcYEpDAWWA49S0fZdKuaF+yBsgOElT+N1lzoVG/iDSKc4iQu29sr43 BcxmvP9RwweH4iRcFhJu7cUR2x9ALWHGI/tFhpnN+ryahFM6xDJO0raCh 5DQ0gYF1y62qZA5IqU4lupmN8UgsO6mQBRH0SuOKXLgyBpmFO8n49FSFM uSlgVzJeQHUZ98rWXtReijEkwwqdYGuJgyWmMu4X4gUmNv0MpZYDPKI58 0UqztzLT8LJMdWyn+Ec7XdtsUUAnfyP6iH1t2T3cWMQ3ccpNRy1WJYi62 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10832"; a="359182746" X-IronPort-AV: E=Sophos;i="6.02,145,1688454000"; d="scan'208";a="359182746" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2023 04:13:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10832"; a="868201546" X-IronPort-AV: E=Sophos;i="6.02,145,1688454000"; d="scan'208";a="868201546" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga004.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 14 Sep 2023 04:13:01 -0700 Received: from orsmsx603.amr.corp.intel.com (10.22.229.16) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Thu, 14 Sep 2023 04:13:01 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32 via Frontend Transport; Thu, 14 Sep 2023 04:13:01 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.43) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Thu, 14 Sep 2023 04:13:00 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SPjIPtYPMcim/geWm/lYDK2alYv1wIOPcdTtpVwKXp/Q8aErCJWsSGUsWV90Tg6JFJp6NBlaxiDszRP87yO/O9W4yRT/SRX66yM1YA85MtY0wrDVuswrtllujeZ6pr54XJLeaWX0EGw5lobJANUFYLqSxY47mOlbLmr2Je4Ka1Cthe6Mu9aB5ehxksV/mh0DHKC9XKwpvKlxBdLGW4vsCh4qBUtmhknRMTPgEIs40eYhl3TZxt6WWAgdn6YPdCMMwjU+2cROxmwDW3fPO8dxr3JaBBNAZ6Hfl4L2hBVR244fEi8aTY8dfgjZ+S/JNOObySKPmERlWYSkK2nsc60PMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3DhToUpmDCGKRSUtbQg8OohU7RnMd/MbjDPQjj6dPuU=; b=ZU0ryhISxGSd0rzS2O/KrlgaorDC22JfvlOM8KlEwDD6XAqBKWBfPh54yJLTby4ZmgV1xvdK2XTQV/QMT6uXu9EtyHObORDqLYJ6Nb0koLLMMQgPmjiF9VGu8Xgv7eoj5t2upF+IJ/j8h7k3HrYORrtm0G1Mw0U8589syRlVVEC4+vQAneVGMjJDyvkCnS0zKx7cv1WmdEU2QBFnQb3NxIVxXOk4hDe+Wodv10Jri+Xq88Tn5T8zVtjfpdosOdwKPc5M0+XHuNPj9gpTjwjeRAJrrTqN6Hj3VRQ8n9JrajrmddiXyGW+Dp3CNNAOMoVbP1I9pMK7hz3oC/8lEtGnXg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) by CH3PR11MB8382.namprd11.prod.outlook.com (2603:10b6:610:173::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.34; Thu, 14 Sep 2023 11:12:59 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::43d1:af60:464:347]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::43d1:af60:464:347%5]) with mapi id 15.20.6768.029; Thu, 14 Sep 2023 11:12:59 +0000 Date: Thu, 14 Sep 2023 12:12:53 +0100 From: Bruce Richardson To: Harry van Haaren CC: , Subject: Re: [PATCH v2 1/2] event/sw: fix ordering corruption with op release Message-ID: References: <20230831164736.2472671-2-harry.van.haaren@intel.com> <20230914105852.82471-1-harry.van.haaren@intel.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20230914105852.82471-1-harry.van.haaren@intel.com> X-ClientProxiedBy: DU2PR04CA0183.eurprd04.prod.outlook.com (2603:10a6:10:28d::8) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|CH3PR11MB8382:EE_ X-MS-Office365-Filtering-Correlation-Id: 5c600090-4580-4516-628e-08dbb5138de5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EeIh2gkYMoaLBbYSuQ88GsbxR/lG5w73LXmnM8/XN+sQfY9o9nRvC9HQAhD3FhSepTJnSPh11hkduV8xP7bSl5GFku6ENX/mbQ6Jh7pSsPTRC0s0u6iUILei6r3lNqQooZjHeX7b4A/N7T4qgKqfF+rrzaeKFBZtiMTWb6M1cCJ+gyjoWiSeyWz3egfgY1+K/ysmEcHr95MjFydADyMqKI2ahnSQCFoTFKEACMOT7Nstzs2dYD1W2GY3hEYdLDIUNBoZPWjHtaFt3+0vSrjr8+bL6HM3Yq5zRBoFsx5+NA6y8fQ3MlAxsN+z/K3RSnRLq+c4gb/mABauqP3T/OfkghCQyYJYEhoBov44h66UEK7QOeoz1dXk9uWYOqjyqdDwlFfveklnLc9BuvlDq0HG0lPP2LMDnrDuDpZESvXPY8AU/D4EbytjyUzGPkYm+Qky7V89Bn4Cu4QJQugBtf9epE+kUlrRSpaSM4KTY0iw2Vfz8904dVWlaPSvmCBHUtAwMrlPYGz2JQlNsjX6w1AJgWcc8ErNrzbywYPAHhe65F55asgn3HiFuisD09kAXvmv X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7309.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(376002)(136003)(396003)(366004)(346002)(451199024)(1800799009)(186009)(6506007)(6666004)(6486002)(83380400001)(66556008)(26005)(6512007)(2906002)(5660300002)(66946007)(8676002)(107886003)(66476007)(6636002)(316002)(4326008)(478600001)(8936002)(6862004)(44832011)(86362001)(38100700002)(82960400001)(41300700001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?3MXCDSjwW7zje/wuYAQefE0xbhJ034AbyFnh0duyj0raQcJ9KROKEUe7ygkt?= =?us-ascii?Q?zYRgaRAZM5TiOFKW5CKzvR8BfFdXvnumtKnSDtVIfmWN5GuTYFwggkCKmRMh?= =?us-ascii?Q?mtcHkYS21u3Sfae2ii1AAW7x25qu7GyS69uYvJrmECEhnx90+nu8kJ0Z4x79?= =?us-ascii?Q?jeuo1kKlDUxFcNsN+xhoOrJTw0cVZDcAJLhxkXdUU7qVWXf//ZobK2+er19N?= =?us-ascii?Q?P5UGy5jmDQOiSq2HmJnsgWV5zeUzpCBe061Fhx1NtT7A0a9e4lMweRAh86A7?= =?us-ascii?Q?Z8qBxwz/IzgU+8RdDQqRQ1NAnPAXXKrAmeVM7jMfffopnbRIt1BDl8OWJwm5?= =?us-ascii?Q?vooUiYa/0HB4x+sgTlJlQKT0labcTG3axs4Is6ypvemwsnFEAbc6Yxtm4jIF?= =?us-ascii?Q?aeI4xiOBU6utMnpPcrf/sgMsDTSR6lhL62ss9aaXEq812BzRkSN/2glwex7D?= =?us-ascii?Q?y76IwqeBGMGuFGqx0kluP1aO1YvHp995l4gE97ilFSN/cdlF05GXbnSeKXVT?= =?us-ascii?Q?tFQR+g0yhbOVQbZ7w+Xk9VB8F7znl9cv28wUcjR2MGGIzjSamwqeoo6hmWBw?= =?us-ascii?Q?AFiexA8ENtMSNnwwfPM8MkGFOMBdJKEGzfVfKlu/Q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F+pxE0+JFoVlvfJ9l1Wloc8vayLjz5ViWH6zJEX?= =?us-ascii?Q?kLF/VCrYmqZ7xYlN77gIsHwvxCUAzvGsLj78oXan2T49EGNAe71dc6B1Tdf8?= =?us-ascii?Q?Tg=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 5c600090-4580-4516-628e-08dbb5138de5 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2023 11:12:59.4721 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Jy2juFw3K6TdaarhjBUQHASfnm/+esYsKtRQZS/jO9DnJH/QQxLqwdrydfgPm2iLsUa4si/AsG+Q6V0OG3w3SepoqverPV4TYttwL6ezAZU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR11MB8382 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Thu, Sep 14, 2023 at 11:58:51AM +0100, Harry van Haaren wrote: > This commit changes the logic in the scheduler to always > reset reorder-buffer (and QID/FID) entries when writing > them. This avoids stale ROB/QID/FID data re-use, which > previously caused ordering issues. > > Before this commit, release events left the history-list > in an inconsistent state, and future events with op type of > forward could be incorrectly reordered. > > Suggested-by: Bruce Richardson > Signed-off-by: Harry van Haaren > Acked-by: Bruce Richardson Couple of very minor style comments below. > --- > > v2: > - Rework fix to simpler suggestion (Bruce) > - Respin patchset to "apply order" (Bruce) > > --- > drivers/event/sw/sw_evdev_scheduler.c | 15 +++++++++++---- > 1 file changed, 11 insertions(+), 4 deletions(-) > > diff --git a/drivers/event/sw/sw_evdev_scheduler.c b/drivers/event/sw/sw_evdev_scheduler.c > index de6ed21643..21c360770e 100644 > --- a/drivers/event/sw/sw_evdev_scheduler.c > +++ b/drivers/event/sw/sw_evdev_scheduler.c > @@ -90,8 +90,10 @@ sw_schedule_atomic_to_cq(struct sw_evdev *sw, struct sw_qid * const qid, > sw->cq_ring_space[cq]--; > > int head = (p->hist_head++ & (SW_PORT_HIST_LIST-1)); > - p->hist_list[head].fid = flow_id; > - p->hist_list[head].qid = qid_id; > + p->hist_list[head] = (struct sw_hist_list_entry) { > + .qid = qid_id, > + .fid = flow_id, > + }; > > p->stats.tx_pkts++; > qid->stats.tx_pkts++; > @@ -162,8 +164,13 @@ sw_schedule_parallel_to_cq(struct sw_evdev *sw, struct sw_qid * const qid, > qid->stats.tx_pkts++; > > const int head = (p->hist_head & (SW_PORT_HIST_LIST-1)); > - p->hist_list[head].fid = SW_HASH_FLOWID(qe->flow_id); > - p->hist_list[head].qid = qid_id; > + const uint32_t fid = SW_HASH_FLOWID(qe->flow_id); > + p->hist_list[head] = (struct sw_hist_list_entry) { > + .qid = qid_id, > + .fid = fid, > + }; > + > + You're adding some extra whitespace here. Can probably be fixed on apply. And one final minor nit: if doing a new version, you can remove the temporary variable for "fid". In my suggestion I only added it because I had the assignment done on a single line and didn't want to wrap. Since you've split the temporary struct across multiple lines, the temporary variable isn't needed as the SW_HASH_FLOWID will fit on the assignment line.