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 76648A0544; Tue, 7 Jun 2022 03:36:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1E7F340156; Tue, 7 Jun 2022 03:36:24 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 6B0E0400EF; Tue, 7 Jun 2022 03:36:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654565781; x=1686101781; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=R2JtfP+ikQ6zBIIT8Gd5/5TH/fdClFtg+kC4cz0F268=; b=bgy2Y+5VHbSbfGi155GMxVaSa5SizN0MejFGPtEwyl/VwZ3GFDhzEzpN v1dwCGzx4DKfdmRMRSHZG6qrTSLNbL9QZmE0kT6xSTwnn8xqviu1wkejL 6ziigIfvOdGInPgiqm0Du+59ooQnVmTd+4Q0ajUvp+2WQaLGRH9gLRLNv T4nP2vBNzF+3IaPQWJyFIDxwdhumYHwJLX2C7AHrcEzWOTLrEZuEEA9V4 S+5brpTbBU708mvoCrJdr6S/Tbh5iuwMLZ9/mzBi1JOgwsgzxF173syN3 U+Rp/FEummHE1+wLWb9dABYcxTIUIbzNKCBxXH08aoY6MBbRGkIBgLrSJ A==; X-IronPort-AV: E=McAfee;i="6400,9594,10370"; a="302063789" X-IronPort-AV: E=Sophos;i="5.91,282,1647327600"; d="scan'208";a="302063789" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2022 18:36:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,282,1647327600"; d="scan'208";a="554689226" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by orsmga006.jf.intel.com with ESMTP; 06 Jun 2022 18:36:18 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Mon, 6 Jun 2022 18:36:18 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Mon, 6 Jun 2022 18:36:18 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.108) 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.2308.27; Mon, 6 Jun 2022 18:36:17 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FWWaGShLrVD/b/wOHmxNpo1BDpqH8Y6q4/xQT3hLXk2pPM8qax2HewYmhMxK4MAYey97NQ/3HSjIx7X2TdJ5aU1/sKIa2E1xg/lZpNLtii3HX/VIFuS3YkV95jfFQfROkaAgkl51PeIly/ElJoNvM+x+jzglMkOoRCc875t/VE31nI1NniQHqR0Zq2A/q4LGnpAMFOIMwudsvoBZ6Q4qGrMDHqLJlpa0gSP6QmfveLkLLkcbuHvzwtBLheepXWaTHfCqURnaRbYjDDchHUOVKQYp31Q/yAcbS1Tic5M+Q2YJvOmfcNgDZxU5nX2eKKM738w/QGVjk4keM3KMEDaz/w== 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=mPzAyLAbwPt8gggndVxL7N8BADNj5WNkL0cLpS2OFb0=; b=nInUvd9tWelMbN7h0NseLg7o2lIfXzEMA5+9gsWL6MXb9+Spcz2rfGIWMhHFQCU2cwgmIuB6nY2/w+9vETnw/ER16Yai91rS0pwNGMj8nbYDiDukVcnKZALmdvABeiQRw1MMKITdnHMTJ3s3s23YSXCfVILEiWlgEsXenqmpdSob9tXEMtGCLN99ndXv4UpYFYb1FV2U4hnNfWvI53yRrz0AfsW2IkEIH6B1jUemVXrIR5SdkDm4kyNRzdSFe+pGY9aQp6iCn0uRHHQRkJyB2nqJH4ghM/GNED43tOsTvCuuvZsAlXxZC1beuGVgoRMZopW3Fe/x2tsQ+wAZHO9dZA== 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 Received: from DM6PR11MB3530.namprd11.prod.outlook.com (2603:10b6:5:72::19) by DM5PR11MB1977.namprd11.prod.outlook.com (2603:10b6:3:108::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.13; Tue, 7 Jun 2022 01:36:12 +0000 Received: from DM6PR11MB3530.namprd11.prod.outlook.com ([fe80::3d0e:6e37:569:cd07]) by DM6PR11MB3530.namprd11.prod.outlook.com ([fe80::3d0e:6e37:569:cd07%6]) with mapi id 15.20.5314.019; Tue, 7 Jun 2022 01:36:11 +0000 From: "Huang, Wei" To: Stephen Hemminger CC: "dev@dpdk.org" , "thomas@monjalon.net" , "nipun.gupta@nxp.com" , "hemant.agrawal@nxp.com" , "stable@dpdk.org" , "Xu, Rosen" , "Zhang, Tianfei" , "Zhang, Qi Z" Subject: RE: [PATCH v5 1/5] drivers/raw: introduce AFU raw device driver Thread-Topic: [PATCH v5 1/5] drivers/raw: introduce AFU raw device driver Thread-Index: AQHYcYrSsBplv7poB0mR3pczzalPw61Ck9GAgAClUuA= Date: Tue, 7 Jun 2022 01:36:11 +0000 Message-ID: References: <1652939560-15786-1-git-send-email-wei.huang@intel.com> <1653629824-4535-1-git-send-email-wei.huang@intel.com> <1653629824-4535-2-git-send-email-wei.huang@intel.com> <20220606083821.5c8903b3@hermes.local> In-Reply-To: <20220606083821.5c8903b3@hermes.local> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.500.17 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: fae4fd5a-1ea1-4769-e8c8-08da48261a9d x-ms-traffictypediagnostic: DM5PR11MB1977:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: n3kZHoFHasXCjZ7GaXupfKSa5sn2kMizvzEV7sJWfoWN2ay+2WqlyeKhlTCAd6XENU03Qx0WMXfzD8Xt4x2IVIrECFzMwgIE2VPJKwSwlfbPgmli2dG/DSInVZH7AaGWDzJQpEuoxLdNyuU3BQ/biMt56UC2HdGjXazOMy2M2kt9QaDu8Q+fVg5dzqReARiXGfjqgt0E2fQBlbOW70MgFWK8C+iHPXO+2qqmbyT4O7IPk1UVTqZfPS4gSZAZtmcwwdmabhtnnVqEUocW71MmehVvmQ04HvO8fLLBk8+KmdWkoHR4JptJh0AQKzXqg6qB+8RgIDA1jrLZ0GpB5DTcmLwm6MIQ7Pv6qqtwDttioP+qnEH+0cwAo+tNXubVVQEgvaQSWoNsqtxUadI3isS+78FvJXBmt9wo3fSdwfVQbFPmpT6442jlRg0mey5iT63ii5Q2CTrbBNdPmeSr8qQXIJ8RXtBa2Y8JTzQlFfkRdvt6dgXhZ7qEZPW7JPkeIHy7B1vI4XNfY08xcQag5jgGlZuhfI/DpjYj2BxrOOMUJtHvbEfIupKD8TDAJFDz+qtaAYbxuDQgflffi7KFjTJZNxq++Afm2Pk50WEawAGdQ+XyFsp7QsOitobU623uOqSKbVkV9c38KvjUOAwJuT5UJ4WIDwqEqONtIlxBhGRm+aozUkZF8tDXCPtuiD7sQ5g8DMQpQ0VUbWkarMdwVldI4g== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB3530.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(122000001)(508600001)(82960400001)(8936002)(55016003)(6506007)(86362001)(7696005)(53546011)(26005)(9686003)(83380400001)(107886003)(8676002)(4326008)(186003)(5660300002)(71200400001)(316002)(6916009)(64756008)(76116006)(66446008)(66476007)(66946007)(66556008)(38100700002)(52536014)(33656002)(2906002)(54906003)(38070700005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?nxsGQ57E4D4qSYALQFFVbtrVumb9jH0SpxnrOXr+stx3nW3CjmdRhur++MkR?= =?us-ascii?Q?AvW7Bv8dWmARbKyRqbG/J9AQaAlx6ObKC4HuwlMzWXZ2PoW42ESvrIZj5fel?= =?us-ascii?Q?Fnm3rWthdeUPPWS2yYwNCzfsjddU4gy+Yy45OOH+/SqiTc7eCot/bB6qDMNU?= =?us-ascii?Q?+Oe2G3D/4VUFOFoRHHKsAdtpi3CgAmvSaANvwzxgcjwLrH9ExN/NaFLBwqv8?= =?us-ascii?Q?ZkE6J3bxZMZOWeXmImp3V0XrWpZzMfLGmqXkBF8JnqraAaW+cPnRKQaiNB4p?= =?us-ascii?Q?FQTymjSOIPOWq9UxPSmMbq5qse3tkbZiGI+474DHu2YeSNy1wc0vt9Pt/g/d?= =?us-ascii?Q?XuolkNvqglATUJVkB9PIbIZvVr9lrLt4jqcgRd1ji5iajwBXX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woA9TuzGJ/QHClkrEYmdMR1H+0hABJu0qOncekBVJ?= =?us-ascii?Q?PLQ9cbq1DqlHy0XWEh90A2aBL/1RTpaxZx5v+oxXDBYXwyHI/hU2aFiZUGbE?= =?us-ascii?Q?xbafsDfG6IOsxsi41SOztKGdLllwAGX0B7DberpIN/0GMlPOhkM6nnpohiHf?= =?us-ascii?Q?Vvh9v3I9cov+dbCUEFx4d3w3luiAzosRgJdi0pvKCUaSo7/IAKBNeXDxFzhQ?= =?us-ascii?Q?LPd8dJemAAxlpkwxcgema5ZXDJZVgf9+lOTpIL6fxLfBnJP61QlLa9PDS/pA?= =?us-ascii?Q?u0RIEzOxX7PRs1lNOpg3ADzWuo8k0wDtfD9+aS4lqj7zsdG3dr10sG1NqpLV?= =?us-ascii?Q?buC8jBmg6gmlspuPYsqfKnTsyB7IyPF7AQkXOeR3Y0oGxGEjDwYfE7Dagyq2?= =?us-ascii?Q?U68h1txyaVRmAYyfi9H6KqJR50NfHO7JWCa9Br8vVwRjWUACxYEWJziEYG1S?= =?us-ascii?Q?X5C8kUs4zA=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB3530.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fae4fd5a-1ea1-4769-e8c8-08da48261a9d X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jun 2022 01:36:11.8391 (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: fwF77EZp6ojVbxnlrrtAZgx3z2nhXwjwEOA/44f937ZyCb3PXDlThXhg7IwTbJ4VQqSrgldpdil3CzoNoe4QPg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1977 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 > -----Original Message----- > From: Stephen Hemminger > Sent: Monday, June 6, 2022 23:38 > To: Huang, Wei > Cc: dev@dpdk.org; thomas@monjalon.net; nipun.gupta@nxp.com; > hemant.agrawal@nxp.com; stable@dpdk.org; Xu, Rosen > ; Zhang, Tianfei ; Zhang, Qi > Z > Subject: Re: [PATCH v5 1/5] drivers/raw: introduce AFU raw device driver >=20 > On Fri, 27 May 2022 01:37:00 -0400 > Wei Huang wrote: >=20 > > +static inline int afu_mf_trylock(struct afu_mf_rawdev *dev) { > > + int32_t x =3D 0; > > + > > + if (!dev || !dev->shared) > > + return -ENODEV; > > + > > + x =3D __atomic_load_n(&dev->shared->lock, __ATOMIC_RELAXED); > > + > > + if ((x !=3D 0) || (__atomic_compare_exchange_n(&dev->shared->lock, > &x, 1, > > + 1, __ATOMIC_ACQUIRE, > __ATOMIC_RELAXED) =3D=3D 0)) > > + return -EBUSY; > > + > > + return 0; > > +} > > + > > +static inline void afu_mf_unlock(struct afu_mf_rawdev *dev) { > > + if (!dev || !dev->shared) > > + return; > > + > > + __atomic_store_n(&dev->shared->lock, 0, __ATOMIC_RELEASE); } >=20 > What other subsystem is this shared with? > Is there a good reason it can't just use existing spinlock? This lock is used in multi-process situation, it prevent AFU from being ope= rated by two DPDK process simultaneously. I can use spinlock to replace it, thanks.