From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751288AbcBLFNa (ORCPT ); Fri, 12 Feb 2016 00:13:30 -0500 Received: from mail-lb0-f182.google.com ([209.85.217.182]:36140 "EHLO mail-lb0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750707AbcBLFN2 (ORCPT ); Fri, 12 Feb 2016 00:13:28 -0500 Date: Fri, 12 Feb 2016 14:11:35 +0900 From: Sergey Senozhatsky To: Petr Mladek Cc: Sergey Senozhatsky , Andrew Morton , Jan Kara , Tejun Heo , Kyle McMartin , Dave Jones , Calvin Owens , linux-kernel@vger.kernel.org, Sergey Senozhatsky , "Paul E. McKenney" Subject: Re: [RFC][PATCH v3 4/4] printk: set may_schedule for some of console_trylock callers Message-ID: <20160212051135.GA570@swordfish> References: <1453536913-9545-1-git-send-email-sergey.senozhatsky@gmail.com> <1453536913-9545-5-git-send-email-sergey.senozhatsky@gmail.com> <20160211144105.GM3305@pathway.suse.cz> <20160211150217.GA527@swordfish> <20160211161000.GN3305@pathway.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160211161000.GN3305@pathway.suse.cz> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (02/11/16 17:10), Petr Mladek wrote: [..] > > well, I believe it's ok. __rcu_read_lock() for CONFIG_PREEMPT_RCU > > does current->rcu_read_lock_nesting++, so rcu_preempt_depth() works > > as expected. otherwise, for !CONFIG_PREEMPT_RCU kernel, > > __rcu_read_lock() does > > > > if (IS_ENABLED(CONFIG_PREEMPT_COUNT)) > > preempt_disable() > > > > > > - if we run "CONFIG_PREEMPT_RCU" then rcu_preempt_depth() > > works here. > > > > - if we run "!CONFIG_PREEMPT_RCU && CONFIG_PREEMPT_COUNT" > > then preemptible() works for us > > > > - if we run "!CONFIG_PREEMPT_RCU && !CONFIG_PREEMPT_COUNT" > > then preemptible() is always 0. > > I feel convinced. But we should somehow document it. I think how > to do it effectively. I think that the following text would help > me if I read it: > > /* > * Safe context for rescheduling is detected only when > * PREEMPT_COUNT is enabled. preemptible() always returns > * false otherwise. > * > * RCU read sections must be detected separately. They > * have a separate preemption counter when PREEMPT_RCU > * is enabled. > */ > > I wanted to highlight why exactly the check returns 0 in !PREEMPT_COUNT > kernel. I missed this a bit in you original comment. But feel free > to change it as you like. good point. thanks! will re-spin the patch set later today, have no reliable internet connection at the moment. -ss