Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp16556rwb; Wed, 21 Sep 2022 16:37:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5jbOmjOd/ncRKhjwvF5dwRhTTlOGFtuJIidn3HFEu3bGd6fOKhz9USAMW3wE7Tn+QDCR0x X-Received: by 2002:a63:2b48:0:b0:434:eb45:9c6a with SMTP id r69-20020a632b48000000b00434eb459c6amr552582pgr.508.1663803470469; Wed, 21 Sep 2022 16:37:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663803470; cv=none; d=google.com; s=arc-20160816; b=ZESTH42ME264Xyn1SVK68woptsQIVj9i0tTqJ8F+TaKOZOGlqla1SNDX1dNZhkaGpl jFx7mw8ai/63h+cHdwYWMjcKNfXooMF4+GL9WACXsd1pQTAeagWFuIIGHMNTeeWZiXIA eN4hgHnheYQo+G7Cj9f0Bd4P+O77Ih9AeHgV1hpJO/MYYOJmpiilaCMMYUgXUnm0IN/L 5drMP09FqlgUZlkIfeQUZy47THN5YivaHcFv5PLSWg/w7og+Xgn1iXfahQlo8mopyPLN 4r9jT0vtY3Nd+YgzUqDM6w4lApmXUIjBzuP7DNZlpHoE8vGWQiDmbBBO7oAfzQbbnCiX 7wwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=7lllsxqL1Z8n8Dg553/FFg8dbdTgVvD/nc2m5UNCHCE=; b=Kz4sB7cs1ueShFq2kvhDpqrOLhJ2VC5V057w+k5BzdtNFEuk0YPaf88gHzdFvOldwB 7Sdk0xSFh9FwuWuzUTM2ZOQ3vLKaD1KJwi2ajINKa8xl6itceYLeLK8LtQsJ61TpF1lQ K2E9kpF/VjCcCq/hpovWUMh3O3XC4mo/56d93chEdzviSm/J//E4XnzGn4TfOq/j9fGE Lk+bOIluB6gUFkZadOLMo/ZStcul+2EAg+pofIoF5k0WuAt7x1AaPXhl1G9F3JKBEFMZ Y6czwt/DNSgylETpN+YnEyADQnag439b+O+XR2cOdIWatzf4wEF9VYAIVTK++uBZfLRm mdag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="bY/Hentl"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k11-20020a636f0b000000b0042b75fe1886si4249531pgc.630.2022.09.21.16.37.25; Wed, 21 Sep 2022 16:37:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="bY/Hentl"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229705AbiIUXJ6 (ORCPT + 99 others); Wed, 21 Sep 2022 19:09:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbiIUXJ4 (ORCPT ); Wed, 21 Sep 2022 19:09:56 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 432AA7DF7B; Wed, 21 Sep 2022 16:09:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663801795; x=1695337795; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=5cyZOuXI8ihAJ7BKnFi1CysrJo6d0Rl8C0GHZe45LqQ=; b=bY/HentlwwEXTYdUiVnhrHTjjv+heFdNgr73aEIviVB39RC14fylzVd5 ZeAR1G50V0PUVTrtrKgPE3PrP80I3p83ZM7mfwGVGqQLzEzlFCSufukda k9N4hp0f+ve7p5VDtvTNg31bf55/zRLlqL8+nya9pgkMbgTvNRo+AsJz8 muMNgkOyN9w7g9JcfXQmFSjg+GJpH+/5BKMSXdMx6laZL9gOUbDpnaCqt JlB5w18/dr+nMzbjk79qoblc3OyhQ/jF7azitmUevTvGxZ/lOXEOJFzAy F9ejXNCIDrbluR6x5lHkAV9P8XvKo+bC7bmOlncbAzUgGm7j57XHlTZJ6 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10477"; a="326464721" X-IronPort-AV: E=Sophos;i="5.93,334,1654585200"; d="scan'208";a="326464721" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Sep 2022 16:09:54 -0700 X-IronPort-AV: E=Sophos;i="5.93,334,1654585200"; d="scan'208";a="619556540" Received: from vcostago-desk1.jf.intel.com (HELO vcostago-desk1) ([10.54.70.10]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Sep 2022 16:09:54 -0700 From: Vinicius Costa Gomes To: Vladimir Oltean , netdev@vger.kernel.org Cc: Jamal Hadi Salim , Cong Wang , Jiri Pirko , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next] net/sched: taprio: remove unnecessary taprio_list_lock In-Reply-To: <20220921095632.1379251-1-vladimir.oltean@nxp.com> References: <20220921095632.1379251-1-vladimir.oltean@nxp.com> Date: Wed, 21 Sep 2022 16:09:55 -0700 Message-ID: <87sfkkfhoc.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Vladimir Oltean writes: > The 3 functions that want access to the taprio_list: > taprio_dev_notifier(), taprio_destroy() and taprio_init() are all called > with the rtnl_mutex held, therefore implicitly serialized with respect > to each other. A spin lock serves no purpose. > > Signed-off-by: Vladimir Oltean > --- > net/sched/sch_taprio.c | 7 ------- > 1 file changed, 7 deletions(-) > > diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c > index 1ab92968c1e3..163255e0cd77 100644 > --- a/net/sched/sch_taprio.c > +++ b/net/sched/sch_taprio.c > @@ -27,7 +27,6 @@ > #include > > static LIST_HEAD(taprio_list); > -static DEFINE_SPINLOCK(taprio_list_lock); > > #define TAPRIO_ALL_GATES_OPEN -1 > > @@ -1082,7 +1081,6 @@ static int taprio_dev_notifier(struct notifier_block *nb, unsigned long event, > if (event != NETDEV_UP && event != NETDEV_CHANGE) > return NOTIFY_DONE; > > - spin_lock(&taprio_list_lock); > list_for_each_entry(q, &taprio_list, taprio_list) { > qdev = qdisc_dev(q->root); > if (qdev == dev) { Optional simplification: do you mind removing 'found' and moving the call to taprio_set_picos_per_byte() here? Anyway, Acked-by: Vinicius Costa Gomes > @@ -1090,7 +1088,6 @@ static int taprio_dev_notifier(struct notifier_block *nb, unsigned long event, > break; > } > } > - spin_unlock(&taprio_list_lock); > > if (found) > taprio_set_picos_per_byte(dev, q); > @@ -1602,9 +1599,7 @@ static void taprio_destroy(struct Qdisc *sch) > struct sched_gate_list *oper, *admin; > unsigned int i; > > - spin_lock(&taprio_list_lock); > list_del(&q->taprio_list); > - spin_unlock(&taprio_list_lock); > > /* Note that taprio_reset() might not be called if an error > * happens in qdisc_create(), after taprio_init() has been called. > @@ -1653,9 +1648,7 @@ static int taprio_init(struct Qdisc *sch, struct nlattr *opt, > q->clockid = -1; > q->flags = TAPRIO_FLAGS_INVALID; > > - spin_lock(&taprio_list_lock); > list_add(&q->taprio_list, &taprio_list); > - spin_unlock(&taprio_list_lock); > > if (sch->parent != TC_H_ROOT) { > NL_SET_ERR_MSG_MOD(extack, "Can only be attached as root qdisc"); > -- > 2.34.1 > Cheers, -- Vinicius