Received: by 10.213.65.68 with SMTP id h4csp837038imn; Fri, 23 Mar 2018 18:22:32 -0700 (PDT) X-Google-Smtp-Source: AG47ELsdmXS8KpcBunKbXlKmYf0rnB/2RzIF0w11A7PBjxob4SJfPmG89KWyLg6Ms/PSBvaLZAW8 X-Received: by 2002:a17:902:a589:: with SMTP id az9-v6mr31256856plb.283.1521854552561; Fri, 23 Mar 2018 18:22:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521854552; cv=none; d=google.com; s=arc-20160816; b=cSSkunoCBqXEf9OgjyBbm35hie+RohM6CJ9cAZwPJdB5UB/NBItHw1MmQlsQxcnZh5 k2wM1K9+lVlvuElFao8kZ+csu4q/e9pSXKN8spTon7Emf2er01M/vmyFGTkg2FgJUPvG im2HlIY+g/6r/qgKXgNX6w6/Pn6h2qmWOtRO4BsBlcpDEh82LBWy4CDMIsZDI1hShbKB 3fDdmIAyweaW/RCBOR9KfkhnJDSSEMcKk+jLSUhUidUHW30uWRFxeDMbPOOkg2Ae/03H w/yyJKqHvcCvTSbB4pcb1jOujxOqU5y7/Z6HYek5wUdL355wkfr5dLAUb7EtgJddwDqd kevg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dmarc-filter:arc-authentication-results; bh=fy/ccFJKao0p28vZWsjXMZQp7ITM1P1zBJy48zu1UgU=; b=YwqhUBFUMdlLaq+4pXSEnnbdqHzM6S6/swiajDp0j1ArzKh9d3F/cdzxjQPAaCCb+W 6ArQTqeAF6WpZsGsj/0pTY4/rMQQnOmC6uSvHN3YAvVCGGhmn0rwaaqQVekPbdjJq4pr K1IopOmOVo3bm1gcDnCaxm0CT4PSWCicm5YMb6E+2ikMz8bMzTImrX2GyODitnhhhUjQ UreG/B0POiu7GQQZLmQxMy4KOPVfp9ggmZ8Y57EiThhpi4d3/cV3i6mPOCmCucv/pSwG L2xLbLDPTAlUpQdLSMPWn26737lQcjnkqD6c2kVhPo+qKiA7euHNIFoeWyTrBn2RVXkM i8Hg== ARC-Authentication-Results: i=1; mx.google.com; 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 k62si7006323pgd.39.2018.03.23.18.22.17; Fri, 23 Mar 2018 18:22:32 -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; 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 S1752077AbeCXBVJ (ORCPT + 99 others); Fri, 23 Mar 2018 21:21:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:59026 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751668AbeCXBVI (ORCPT ); Fri, 23 Mar 2018 21:21:08 -0400 Received: from vmware.local.home (cpe-172-100-180-131.stny.res.rr.com [172.100.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ED4842183B; Sat, 24 Mar 2018 01:21:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ED4842183B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=rostedt@goodmis.org Date: Fri, 23 Mar 2018 21:21:05 -0400 From: Steven Rostedt To: Joel Fernandes Cc: Thomas Gleixner , LKML , "Paul E. McKenney" , Peter Zijlstra , Josh Triplett , Mathieu Desnoyers , Lai Jiangshan Subject: Re: rcu: Add might_sleep() check to synchronize_rcu() Message-ID: <20180323212105.40766d1c@vmware.local.home> In-Reply-To: References: <20180323172843.763579a9@gandalf.local.home> <20180323174023.60579f45@gandalf.local.home> X-Mailer: Claws Mail 3.15.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 23 Mar 2018 15:57:04 -0700 Joel Fernandes wrote: > > diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c > > index 194a7483bb93..857b494bee29 100644 > > --- a/net/l2tp/l2tp_core.c > > +++ b/net/l2tp/l2tp_core.c > > @@ -1677,6 +1677,8 @@ void __l2tp_session_unhash(struct l2tp_session *session) > > { > > struct l2tp_tunnel *tunnel = session->tunnel; > > > > + might_sleep(); > > + > > /* Remove the session from core hashes */ > > if (tunnel) { > > /* Remove from the per-tunnel hash */ > > Thanks Thomas and Steven, also shouldn't this code be calling > synchronize_rcu_bh instead of synchronize_rcu, to complement the > rcu_read_lock_bh? In which situations would you call one versus the > other? Probably, as the comment above rcu_read_lock_bh is: * rcu_read_lock_bh() - mark the beginning of an RCU-bh critical section * * This is equivalent of rcu_read_lock(), but to be used when updates * are being done using call_rcu_bh() or synchronize_rcu_bh(). Since * both call_rcu_bh() and synchronize_rcu_bh() consider completion of a * softirq handler to be a quiescent state, a process in RCU read-side * critical section must be protected by disabling softirqs. It appears that the reason to use rcu_read_lock_bh() is if you are calling synchronize_rcu_bh(). Otherwise, one could just be using straight rcu_read_lock(). -- Steve