Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4755017imm; Mon, 15 Oct 2018 22:30:49 -0700 (PDT) X-Google-Smtp-Source: ACcGV60dgCvzEmigF3738qzinq2hn6Xx4cJqZOX15bgIe3WK5wGmUe8hTZGp5O31Vur6jbda+qrF X-Received: by 2002:a62:7e81:: with SMTP id z123-v6mr20566917pfc.139.1539667849495; Mon, 15 Oct 2018 22:30:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539667849; cv=none; d=google.com; s=arc-20160816; b=l6xkZzZ5jABGcWlI4ibe7m6o3tVz4c9uT4Bz1d+lrUi2kKY3ekv18gdv5tJVs+Fm6v v5u3Qj9eUj0JwBaJ30QE0zJPNdykgzbVmQOPk83vNZaSvlOX+BP2GiqUaa2jAe1A0PvM 5Dz6+7gQ+hoV102kWMGQfstZ++bl0BiL+3htKUTts8Ocf018/sDFf0YGY9EzAxaDF3In jyHeXg/yWNPpKm4HE03Oz+0OFLUtXKEJXq+oDP1/UoZ7Ck6hkLBMZq8m9J30UBUabWhv o0K+3yRvvzbB4fRd+1sNAXhuMMgZlcAMqxO15ey51PvXwzfauo0CfJnlZgwwdBetLzQ3 vcPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=hT/WJu9STplUfy08+85ywKyPPy0EnpKa8gDq1HiCx6c=; b=PEXVm36Y4WK5+FVdB2clukNK+G14GQCCOh5c6nelBkDjgLcrOKEFYSbrZvUho+UUWe nTyW1gKsW9x6LWYHA/q0LOkdVw+l2RZC27hZiE6Cwv7RO6kKKhBfq2g7/WHximOnM0hx ZTm1EvbGWlPY7lQaD2EeuzuER8fG++q1x9y18IfulQ+kEc8ZZJs84WNkTeq/rqOwleku DlBgt+AB0zK270++UZCHuBdpOe3FUKzZC2eO5E3LZ4KrG6xy5+EswLM3u7jN87n/swhh ogwa22h70dr+JY2OHhJTPjlOhn6lxiJ5kLWiq+Jp36xj3LwQ7wg0d7X+t/ahHx9FGaph irew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=DifW7hw2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 62-v6si13315496pla.203.2018.10.15.22.30.33; Mon, 15 Oct 2018 22:30:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=DifW7hw2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728054AbeJPNR2 (ORCPT + 99 others); Tue, 16 Oct 2018 09:17:28 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:36284 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727280AbeJPNR1 (ORCPT ); Tue, 16 Oct 2018 09:17:27 -0400 Received: by mail-pf1-f193.google.com with SMTP id l81-v6so10849979pfg.3 for ; Mon, 15 Oct 2018 22:28:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=hT/WJu9STplUfy08+85ywKyPPy0EnpKa8gDq1HiCx6c=; b=DifW7hw2g2OaNA52UpmUGCGQR7tzH8euxdssKf02hDixqLl7vMpco9tXXXrr9w2l9x QyZ3+l0BitrAwEtMcwy2iVq+TEBO2JHkveMzCPCEycv7nDBh71q+p9nL2Mrnx+XVAysG hPQQR2mOW1MGgufLyU2Pd1uUseD7Z5htozMUc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=hT/WJu9STplUfy08+85ywKyPPy0EnpKa8gDq1HiCx6c=; b=KgcLCiXpLbe8aKR/n+sf4l1rDzxAWDGu/cTCnYUFobp+EuPmkatVyolj/j0UGNsQo7 MxdgLJBTFh5JOk0MXtJ/9YgUAWApdxE2hLXvHl9t/DWW23xNDwsMRju57ruGrNtQ2ANa kQpkC/mvYutekpexCItEYfkDJSxlcA5zNLZQeNDhaqA9FzlUtNYXLr77v0Tk9RzQZvdE AILmDArbiFukITKTtzPcCwtfBdtzBrofqSP/t8V4t6NtyQr2QdDoAz/2M9CW6sX5/SbV avuYhEEVzSa4sSC8UnFE3Qfw23b/HtExKux8rDIIg8+HSH/KxVZfQEI0Hmno/uN1SCHX 8uOQ== X-Gm-Message-State: ABuFfoje2Ct30dGh79//C5gmhs3Nm5Pz/2nSrcKdl6HWQV3rUGMHUfON YAP2g2bfKWIMlx2tTep5JfgcMQ== X-Received: by 2002:a62:8f:: with SMTP id 137-v6mr20486712pfa.24.1539667726470; Mon, 15 Oct 2018 22:28:46 -0700 (PDT) Received: from localhost ([2620:0:1000:1601:3aef:314f:b9ea:889f]) by smtp.gmail.com with ESMTPSA id j3-v6sm11552791pfn.175.2018.10.15.22.28.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 15 Oct 2018 22:28:45 -0700 (PDT) Date: Mon, 15 Oct 2018 22:28:44 -0700 From: Joel Fernandes To: Frederic Weisbecker Cc: LKML , Sebastian Andrzej Siewior , Peter Zijlstra , "David S . Miller" , Linus Torvalds , Thomas Gleixner , "Paul E . McKenney" , Ingo Molnar , Frederic Weisbecker , Mauro Carvalho Chehab , rostedt@goodmis.org Subject: Re: [RFC PATCH 12/30] rcu: Prepare rcu_read_[un]lock_bh() for handling softirq mask Message-ID: <20181016052844.GA25151@joelaf.mtv.corp.google.com> References: <1539213137-13953-1-git-send-email-frederic@kernel.org> <1539213137-13953-13-git-send-email-frederic@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1539213137-13953-13-git-send-email-frederic@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 11, 2018 at 01:11:59AM +0200, Frederic Weisbecker wrote: > This pair of function is implemented on top of local_bh_disable() that > is going to handle a softirq mask in order to apply finegrained vector > disablement. The lock function is going to return the previous vectors > enabled mask prior to the last call to local_bh_disable(), following a > similar model to that of local_irq_save/restore. Subsequent calls to > local_bh_disable() and friends can then stack up: > > bh = local_bh_disable(vec_mask); > bh2 = rcu_read_lock_bh() { > bh2 = local_bh_disable(...) > return bh2; > } > ... > rcu_read_unlock_bh(bh2) { > local_bh_enable(bh2); > } > local_bh_enable(bh); > > To prepare for that, make rcu_read_lock_bh() able to return a saved vector > enabled mask and pass it back to rcu_read_unlock_bh(). We'll plug it > to local_bh_disable() in a subsequent patch. > Signed-off-by: Frederic Weisbecker > Cc: Ingo Molnar > Cc: Sebastian Andrzej Siewior > Cc: Thomas Gleixner > Cc: Peter Zijlstra > Cc: Linus Torvalds > Cc: David S. Miller > Cc: Mauro Carvalho Chehab > Cc: Paul E. McKenney > --- > crypto/pcrypt.c | 5 ++-- > drivers/infiniband/ulp/ipoib/ipoib_main.c | 5 ++-- > drivers/net/hyperv/rndis_filter.c | 5 ++-- > drivers/net/macsec.c | 12 +++++---- > drivers/net/vrf.c | 19 ++++++++------ > drivers/vhost/net.c | 5 ++-- > include/linux/rcupdate.h | 5 ++-- > include/net/arp.h | 10 ++++--- > include/net/ip6_fib.h | 1 + > include/net/ndisc.h | 10 ++++--- > include/net/neighbour.h | 1 + > kernel/padata.c | 5 ++-- > kernel/rcu/rcuperf.c | 2 +- > kernel/rcu/rcutorture.c | 2 +- > net/caif/caif_dev.c | 5 ++-- > net/core/dev.c | 7 ++--- > net/core/neighbour.c | 37 +++++++++++++++----------- > net/core/pktgen.c | 5 ++-- > net/decnet/dn_route.c | 27 +++++++++++-------- > net/ipv4/fib_semantics.c | 5 ++-- > net/ipv4/ip_output.c | 7 ++--- > net/ipv4/netfilter/ipt_CLUSTERIP.c | 5 ++-- > net/ipv6/addrconf.c | 21 ++++++++------- > net/ipv6/ip6_fib.c | 4 +-- > net/ipv6/ip6_flowlabel.c | 43 ++++++++++++++++++------------- > net/ipv6/ip6_output.c | 12 +++++---- > net/ipv6/route.c | 15 ++++++----- > net/ipv6/xfrm6_tunnel.c | 5 ++-- > net/l2tp/l2tp_core.c | 33 ++++++++++++++---------- > net/llc/llc_core.c | 5 ++-- > net/llc/llc_proc.c | 13 +++++++--- > net/llc/llc_sap.c | 5 ++-- > net/netfilter/ipset/ip_set_core.c | 10 ++++--- > net/netfilter/ipset/ip_set_hash_gen.h | 15 ++++++----- > net/netfilter/nfnetlink_log.c | 17 ++++++++---- > 35 files changed, 229 insertions(+), 154 deletions(-) > > diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c > index f8ec3d4..490358c 100644 > --- a/crypto/pcrypt.c > +++ b/crypto/pcrypt.c > @@ -73,12 +73,13 @@ struct pcrypt_aead_ctx { > static int pcrypt_do_parallel(struct padata_priv *padata, unsigned int *cb_cpu, > struct padata_pcrypt *pcrypt) > { > + unsigned int bh; > unsigned int cpu_index, cpu, i; > struct pcrypt_cpumask *cpumask; > > cpu = *cb_cpu; > > - rcu_read_lock_bh(); > + bh = rcu_read_lock_bh(); > cpumask = rcu_dereference_bh(pcrypt->cb_cpumask); > if (cpumask_test_cpu(cpu, cpumask->mask)) > goto out; > @@ -95,7 +96,7 @@ static int pcrypt_do_parallel(struct padata_priv *padata, unsigned int *cb_cpu, > *cb_cpu = cpu; > > out: > - rcu_read_unlock_bh(); > + rcu_read_unlock_bh(bh); > return padata_do_parallel(pcrypt->pinst, padata, cpu); > } This complicates the RCU API for -bh and doesn't look pretty at all. Is there anything better we can do so we don't have to touch existing readers at all? Also, I thought softirqs were kind of a thing of the past, and threaded interrupts are the more preferred interrupt bottom halves these days, especially for -rt. Maybe that was just wishful thinking on my part :-) thanks, - Joel