From patchwork Wed Jan 15 15:55:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Madhuparna Bhowmik X-Patchwork-Id: 11335225 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A0F91184C for ; Wed, 15 Jan 2020 15:57:41 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7D36B2187F for ; Wed, 15 Jan 2020 15:57:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="pfZQgYjB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D36B2187F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1irl29-00014f-91; Wed, 15 Jan 2020 15:56:41 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1irl27-00014a-C5 for xen-devel@lists.xenproject.org; Wed, 15 Jan 2020 15:56:39 +0000 X-Inumbo-ID: 9d23ef90-37af-11ea-b89f-bc764e2007e4 Received: from mail-pf1-x442.google.com (unknown [2607:f8b0:4864:20::442]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 9d23ef90-37af-11ea-b89f-bc764e2007e4; Wed, 15 Jan 2020 15:56:38 +0000 (UTC) Received: by mail-pf1-x442.google.com with SMTP id w62so8712102pfw.8 for ; Wed, 15 Jan 2020 07:56:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=HwV9sGACUDknSqn3rZRjdfv8PQfY2jtJrBDpPLg25bE=; b=pfZQgYjBcjyCtn6E2E//UIWWV7YF8uAjc6ggh4p5mbPc/GNDh/t8TClwCoKqEY9iKm 31WcNv/TU4fwcs85/hvITBoBQwLVXKXc/pq1wY9AFtXF2yclNcKLougfpxo4Rk7HthPf JKGNTLguhyvB97/Am9L/CUP3MrCj/46w4fxjcRfkXO25T4sy6vMUxLTAtfX+DvZ+ztaN 0TJinWp2KwiFxkOa5ztbYrQZYs73Hv1EuT6dgymCzvzr+fdm6LEZUH2G+6yYELu7EAOO KM6yEegZ79mbzuNRVufVKJ2z4+wCZyjhs7MRMvV9HWkgyOvBGAQgQiMD9SVbFGb4EqZn upRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=HwV9sGACUDknSqn3rZRjdfv8PQfY2jtJrBDpPLg25bE=; b=FSwen/eE0jIsoCBDlP7QVB+d2Q3exsL723sTA5nVezBsjU5/RXTxK4HyCOKPuvD+Fk 2pklKs+LsJz7fRGbEBtt+cFbeDCFUWLih75SC/UCIxg9G7Dr5gRSi97jEZq6ICPcQY/1 3oiAd8JOOD87f1AdxvMXEEq6HEI0qahBO8TQXiv9THTbkF0pJQ9iO0EUUwPOB5dI0Un7 3sdi7ZmrojkiIKHWJHtPht/8e+982E8DqaS6dQBhD7JnFYIDmg1S5pd37hRixVd8e7AX RLKUIHfpUdC9XYqDf+Zx9BgWAKD5vOrfa41/WW2Ts7Yyyz7/qb/lpQidfqdrp2uH+2df FnSQ== X-Gm-Message-State: APjAAAVzNKwo10zWny8vKUBPshM2A6Cia6Idj8q/kbl5KoI4yatiNtOL 0uI+i2EJrwFPoe+zVWefI48= X-Google-Smtp-Source: APXvYqwfBfFNxEYPBk1P4r0u33EcwZqChtsYsDBcPVXmULzU6XIoKIK5xPGRQ8bZGAylr4brUje92g== X-Received: by 2002:a63:4b50:: with SMTP id k16mr34152524pgl.386.1579103797712; Wed, 15 Jan 2020 07:56:37 -0800 (PST) Received: from madhuparna-HP-Notebook.nitk.ac.in ([2402:3a80:1ee8:ed72:75ba:e01f:bdbc:c547]) by smtp.gmail.com with ESMTPSA id b8sm22755599pfr.64.2020.01.15.07.56.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2020 07:56:37 -0800 (PST) From: madhuparnabhowmik04@gmail.com To: wei.liu@kernel.org, paul@xen.org Date: Wed, 15 Jan 2020 21:25:53 +0530 Message-Id: <20200115155553.13471-1-madhuparnabhowmik04@gmail.com> X-Mailer: git-send-email 2.17.1 Subject: [Xen-devel] [PATCH] net: xen-netback: hash.c: Use built-in RCU list checking X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: paulmck@kernel.org, frextrite@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, joel@joelfernandes.org, xen-devel@lists.xenproject.org, linux-kernel-mentees@lists.linuxfoundation.org, Madhuparna Bhowmik MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Madhuparna Bhowmik list_for_each_entry_rcu has built-in RCU and lock checking. Pass cond argument to list_for_each_entry_rcu. Signed-off-by: Madhuparna Bhowmik Acked-by: Wei Liu --- drivers/net/xen-netback/hash.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/xen-netback/hash.c b/drivers/net/xen-netback/hash.c index 10d580c3dea3..6b7532f7c936 100644 --- a/drivers/net/xen-netback/hash.c +++ b/drivers/net/xen-netback/hash.c @@ -51,7 +51,8 @@ static void xenvif_add_hash(struct xenvif *vif, const u8 *tag, found = false; oldest = NULL; - list_for_each_entry_rcu(entry, &vif->hash.cache.list, link) { + list_for_each_entry_rcu(entry, &vif->hash.cache.list, link, + lockdep_is_held(&vif->hash.cache.lock)) { /* Make sure we don't add duplicate entries */ if (entry->len == len && memcmp(entry->tag, tag, len) == 0) @@ -102,7 +103,8 @@ static void xenvif_flush_hash(struct xenvif *vif) spin_lock_irqsave(&vif->hash.cache.lock, flags); - list_for_each_entry_rcu(entry, &vif->hash.cache.list, link) { + list_for_each_entry_rcu(entry, &vif->hash.cache.list, link, + lockdep_is_held(&vif->hash.cache.lock)) { list_del_rcu(&entry->link); vif->hash.cache.count--; kfree_rcu(entry, rcu);