From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB9EBC433F5 for ; Mon, 14 Mar 2022 20:35:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239124AbiCNUgQ (ORCPT ); Mon, 14 Mar 2022 16:36:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231499AbiCNUgP (ORCPT ); Mon, 14 Mar 2022 16:36:15 -0400 Received: from mail-yb1-xb29.google.com (mail-yb1-xb29.google.com [IPv6:2607:f8b0:4864:20::b29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BBF0329B0 for ; Mon, 14 Mar 2022 13:35:03 -0700 (PDT) Received: by mail-yb1-xb29.google.com with SMTP id v130so33157389ybe.13 for ; Mon, 14 Mar 2022 13:35:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cEwC2oWm7E+TdYn9pjXIfdcT9lJnbB3JTmkCY2AgKHQ=; b=Q2+LiluU9906bLSTT9h7OPB+28HX9RJk5Fgi3kilfKrvbwjlosf57o8SIG6ZWFvzqQ tVFolIcruqmBocumtKnTmn4WMd8G/hQ79tHr9nt+/kouRiR+yYoAXB0vr9zZU8HtwBff YqFQqVQm95SK6Hc7+E7yFkuasGlFrhn8zOjLyQX+FNgupbJakVqrVyagedXH9lewlB7S 9x/gXxulgTdQTzapN/u8sFp8z//hSXcJIeTQEMXiqjmqoIvJS6ziQOFHYr0oMWZHg0NR 1uA1UCpXNAZQc4OsgyPSyF7EuPj/krnO3JxvDZq+d4HGyT4u9+qOYoZ01rb46QhYL8Ie afvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cEwC2oWm7E+TdYn9pjXIfdcT9lJnbB3JTmkCY2AgKHQ=; b=Roynn/GJz2VaFOMqM5m1GQcEhJqBxuA5p34guLRKUvwnybBsqvUjWzH0TNiQ0m1yEB CpsSjixbBmsz37g866inI7BGBjjOhxrqz2rAG/WvDqLxobnbq/YF6EZfeBLSiHcw7ycx bISH9GE7hO95ZKUsXyRdJOtcSJrkpDWOU29fIadevP53cpVC0UOZh73kZ81vgtl06SSX 0wkEpHAMYjRleDAGTl/dsK0q661ueQv1f+fE/mhYMUIZ1B4WQI39Prtq4VX3O6wpk/Ib mUVYGj+1PmRWz35kqj03/K5XEY9WTK6lHRCSmQA03o6UNktGEjt1BlC2FVkDWL9VPyoO Gg7A== X-Gm-Message-State: AOAM530yNTPyeSqnXFCLGXK47q2i7qypdaLWKtk36JD1KcijXLCc8fSd yMKAI8Vo9RzM+iyLxTPJtFj9qDhwknCAqVpaLImU4aeesM0= X-Google-Smtp-Source: ABdhPJzFxCOwbIwtBX8TR6abtHqC4NXg1xaPBpeedRiqRdOwsDIrT9iA/qqoJDHu/WTIhvwFdqYHiaek7j0a38LEKq0= X-Received: by 2002:a25:d50c:0:b0:627:660c:1874 with SMTP id r12-20020a25d50c000000b00627660c1874mr19610951ybe.625.1647290102968; Mon, 14 Mar 2022 13:35:02 -0700 (PDT) MIME-Version: 1.0 References: <20220314133738.269522-1-frederic@kernel.org> <20220314133738.269522-3-frederic@kernel.org> <20220314200641.GV4285@paulmck-ThinkPad-P17-Gen-1> In-Reply-To: <20220314200641.GV4285@paulmck-ThinkPad-P17-Gen-1> From: Marco Elver Date: Mon, 14 Mar 2022 21:34:26 +0100 Message-ID: Subject: Re: [PATCH 2/3] preempt/dynamic: Introduce preempt mode accessors To: paulmck@kernel.org Cc: Frederic Weisbecker , LKML , Valentin Schneider , Peter Zijlstra , Neeraj Upadhyay , Boqun Feng , Uladzislau Rezki , Joel Fernandes Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 14 Mar 2022 at 21:06, Paul E. McKenney wrote: > > On Mon, Mar 14, 2022 at 03:44:39PM +0100, Marco Elver wrote: > > On Mon, 14 Mar 2022 at 14:37, Frederic Weisbecker wrote: > > > > > > From: Valentin Schneider > > > > > > CONFIG_PREEMPT{_NONE, _VOLUNTARY} designate either: > > > o The build-time preemption model when !PREEMPT_DYNAMIC > > > o The default boot-time preemption model when PREEMPT_DYNAMIC > > > > > > IOW, using those on PREEMPT_DYNAMIC kernels is meaningless - the actual > > > model could have been set to something else by the "preempt=foo" cmdline > > > parameter. > > > > > > Introduce a set of helpers to determine the actual preemption mode used by > > > the live kernel. > > > > > > Suggested-by: Marco Elver > > > Signed-off-by: Valentin Schneider > > > Signed-off-by: Frederic Weisbecker > > > Cc: Uladzislau Rezki > > > Cc: Joel Fernandes > > > Cc: Boqun Feng > > > Cc: Peter Zijlstra > > > Cc: Neeraj Upadhyay > > > --- > > > include/linux/sched.h | 16 ++++++++++++++++ > > > kernel/sched/core.c | 11 +++++++++++ > > > 2 files changed, 27 insertions(+) > > > > > > diff --git a/include/linux/sched.h b/include/linux/sched.h > > > index 508b91d57470..d348e886e4d0 100644 > > > --- a/include/linux/sched.h > > > +++ b/include/linux/sched.h > > > @@ -2096,6 +2096,22 @@ static inline void cond_resched_rcu(void) > > > #endif > > > } > > > > > > +#ifdef CONFIG_PREEMPT_DYNAMIC > > > + > > > +extern bool preempt_mode_none(void); > > > +extern bool preempt_mode_voluntary(void); > > > +extern bool preempt_mode_full(void); > > > + > > > +#else > > > + > > > +#define preempt_mode_none() IS_ENABLED(CONFIG_PREEMPT_NONE) > > > +#define preempt_mode_voluntary() IS_ENABLED(CONFIG_PREEMPT_VOLUNTARY) > > > +#define preempt_mode_full() IS_ENABLED(CONFIG_PREEMPT) > > > + > > > > Shame this was somehow forgotten. > > There was a v3 of this patch that fixed a bunch of things (e.g. making > > these proper functions so all builds error if accidentally used in > > #if). > > > > https://lore.kernel.org/lkml/20211112185203.280040-3-valentin.schneider@arm.com/ > > > > Is it also possible to take all the rest of that series (all 4 > > patches) from Valentin? > > Me, I am assuming that #2/3 is an experimental test so that I am able > to easily whack this series over the head with rcutorture. ;-) I might be out of the loop here. All I can add is that any issues that are a consequence of the preempt mode accessors are only testable if the preemption model is actually changed at runtime and AFAIK rcutorture doesn't do that. But as noted, this patch wasn't the latest version and there were issues with it fixed by Valentin's latest v3 (from November, but had never been picked up anywhere). Thanks, -- Marco