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 F18E8A0543 for ; Mon, 6 Jun 2022 17:38:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E6B764161A; Mon, 6 Jun 2022 17:38:26 +0200 (CEST) Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by mails.dpdk.org (Postfix) with ESMTP id 855BD4069C for ; Mon, 6 Jun 2022 17:38:25 +0200 (CEST) Received: by mail-pl1-f178.google.com with SMTP id o6so7315352plg.2 for ; Mon, 06 Jun 2022 08:38:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/5TnI7QKXbEEdspDB2TS3h7vXKZF4ckZ9v91QOS0Kfk=; b=gi+LZjy0fswK5icI1xpAmI3TJVOcybbf9YsmmBqzyYaGDAIk2LRucFPYZ8EIlaTx0h kq034JzhFzIbBLLWvXCO33XFKNbgKMbW918wee6Yr/F9/dccai7VRH6nevJdNi7tJP+v A9UENlU9vkzvo2xAHFUy3lOyP1UJP477ydBGoDaqYXwYEOPhyv0niuNs2L4ZuBR7lMYq TcTK431r5+1xCUUd8eFYkqUtzxaugQSymsg0VoK904HJCisTy95iDjyHfADVfztyqmyF 3SAiVyOPpPfSTfNn69mvfZ/UzAirnntDtw7a1kCrU5EBJ+4iIroOILnzgE07apHJbmTX PBAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/5TnI7QKXbEEdspDB2TS3h7vXKZF4ckZ9v91QOS0Kfk=; b=tr1ceY3FOURgd9LF+yoI+ZofpH5QvDLAdPbgtpf9qJnbEF7z8tefz8DufkXBtHoBGL XzuMhazful/CpJM0pwhzPIgTaAhl+0cdt9erZII1TnzInsN80xzLNC4/o3YVjFUavuqi 7Q41u+GXBNoy9H9in0AJ5yHFPtW23NVg6wvaNB18xMHXhi2CcbkPtJ1G146mCf8hFefw 2OPSqR8XNeIcktgy3MBWoxZNyYMumVxDpoaJM3FM/wWZBT8KymtGa12ivQERFE5EPLJR cP9zeAq5QqZbWNGTmLPkXneYt3i5A4thCdP0iI86GmvdOxn+ifdlG9nPLueSTU44s65f k/cw== X-Gm-Message-State: AOAM530B2DPByOcpXxVKNX9bJ37CWUKxRA0aUXenLGQFBU4BNj0SRQak U7Mkz14hlLB5S6iLtvQOTYUZoQ== X-Google-Smtp-Source: ABdhPJw022Y3/eae3OhpXvWmQqqtVd/KeCZzCf9MjToNEX6eVN6/ChLOwQoEitxo8ung3UcOmZf2Zw== X-Received: by 2002:a17:902:9f96:b0:163:dc33:6b72 with SMTP id g22-20020a1709029f9600b00163dc336b72mr25008271plq.34.1654529904537; Mon, 06 Jun 2022 08:38:24 -0700 (PDT) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id e63-20020a621e42000000b0051bbb661782sm10133625pfe.192.2022.06.06.08.38.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 08:38:24 -0700 (PDT) Date: Mon, 6 Jun 2022 08:38:21 -0700 From: Stephen Hemminger To: Wei Huang Cc: dev@dpdk.org, thomas@monjalon.net, nipun.gupta@nxp.com, hemant.agrawal@nxp.com, stable@dpdk.org, rosen.xu@intel.com, tianfei.zhang@intel.com, qi.z.zhang@intel.com Subject: Re: [PATCH v5 1/5] drivers/raw: introduce AFU raw device driver Message-ID: <20220606083821.5c8903b3@hermes.local> In-Reply-To: <1653629824-4535-2-git-send-email-wei.huang@intel.com> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On Fri, 27 May 2022 01:37:00 -0400 Wei Huang wrote: > +static inline int afu_mf_trylock(struct afu_mf_rawdev *dev) > +{ > + int32_t x = 0; > + > + if (!dev || !dev->shared) > + return -ENODEV; > + > + x = __atomic_load_n(&dev->shared->lock, __ATOMIC_RELAXED); > + > + if ((x != 0) || (__atomic_compare_exchange_n(&dev->shared->lock, &x, 1, > + 1, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED) == 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); > +} What other subsystem is this shared with? Is there a good reason it can't just use existing spinlock?