From patchwork Wed Jan 15 12:41:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Madhuparna Bhowmik X-Patchwork-Id: 11334411 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 06E84139A for ; Wed, 15 Jan 2020 12:57:55 +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 D74852073A for ; Wed, 15 Jan 2020 12:57:54 +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="auOyDPgV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D74852073A 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 1iriEA-0001mQ-9q; Wed, 15 Jan 2020 12:56:54 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1irhzu-0008Ng-Dv for xen-devel@lists.xenproject.org; Wed, 15 Jan 2020 12:42:10 +0000 X-Inumbo-ID: 71d72d22-3794-11ea-ac27-bc764e2007e4 Received: from mail-pj1-x1044.google.com (unknown [2607:f8b0:4864:20::1044]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 71d72d22-3794-11ea-ac27-bc764e2007e4; Wed, 15 Jan 2020 12:42:09 +0000 (UTC) Received: by mail-pj1-x1044.google.com with SMTP id n59so7670907pjb.1 for ; Wed, 15 Jan 2020 04:42:09 -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=S3wXxo3Bh9oayGWM8jZCD/Gnpt0hNiPJrwn1QYGnm2M=; b=auOyDPgVe8RTFRbA5W4EWOXH32dZQVkLy+zdkE2NamNJ/gwg8H60PNu7Lv559iQMy8 +Uf1+gYH+3O1bRayk3SvFe+zasRl5E+RgFunTFI3s7zr7bU7UuUa1QBxGBGG0LzjsDze bQi12uwfRkAMQ5ouovUAbj1CdKvwlrV11g8viM4XpvGwjw2uUTQyDBK5JpP66aykCgEz vY4fGSxWClC5AyfgITKjn2lhV5F/HnF4oPzRneGRvIa3bOxw9iqRyEE2i+Uo3Kw/jc2L Y+091uGOMmax/zqpjYMMcGDh7guRcl1dBh8eCVyHEDYj1tDqyt/XpXF5PcMLIDmaHqeV 6Ijg== 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=S3wXxo3Bh9oayGWM8jZCD/Gnpt0hNiPJrwn1QYGnm2M=; b=bGe3/V95J6pBO47CG5RqfsoUy4C1GFjyUhkgjlu9Zvjtm5W2ybVPG+FxRh78Nnk81C iblmw+E0K/4xIhz/A2ZTORA0fDQcaLc3dSoIHjWLftjQQIxTX5VcVbw8eCodCuawMWPN HKNqXHWsHIvfGhLMMa4Mly2u5xt5nTmKg5qJyJqm4Pqx5RvV/+ZRdAwqAzbHSZrs3b56 8zsp+QzzJDGta0M57PzV5GANsRhOHE/MiBUIEO0r2UzJffANLRqeFObysU8SfdpOyy2L E/k1h97ETSI+8Chw2XgcCJXtcgcEHKMRzNVePha+D+HjJ29bCLl1ENeNAca2nt085cPI f/Vg== X-Gm-Message-State: APjAAAUE4E3xAlHGG2USYIwdc4S/sZH3PjhGxChE343V8DaMC0xttlmN a6/9eamXzu+x80r7pQdhXYw= X-Google-Smtp-Source: APXvYqzyYSD1kqH06PWZT5j+hjPxOJVeYfDpiBoVq5NBAlR42H2eqCY0MexVhcMO00FKLXtnuMtjCw== X-Received: by 2002:a17:902:bd08:: with SMTP id p8mr31051161pls.39.1579092128653; Wed, 15 Jan 2020 04:42:08 -0800 (PST) Received: from madhuparna-HP-Notebook.nitk.ac.in ([2402:3a80:1ee2:fbb9:75ba:e01f:bdbc:c547]) by smtp.gmail.com with ESMTPSA id y23sm12638990pjj.3.2020.01.15.04.42.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2020 04:42:08 -0800 (PST) From: madhuparnabhowmik04@gmail.com To: wei.liu@kernel.org, paul@xen.org, davem@davemloft.net Date: Wed, 15 Jan 2020 18:11:28 +0530 Message-Id: <20200115124129.5684-1-madhuparnabhowmik04@gmail.com> X-Mailer: git-send-email 2.17.1 X-Mailman-Approved-At: Wed, 15 Jan 2020 12:56:53 +0000 Subject: [Xen-devel] [PATCH] net: xen-netbank: 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 --- 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..30709bc9d170 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);