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 66A51C04FE0 for ; Fri, 21 Jul 2023 15:09:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231801AbjGUPJS (ORCPT ); Fri, 21 Jul 2023 11:09:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231829AbjGUPJH (ORCPT ); Fri, 21 Jul 2023 11:09:07 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A90F272E for ; Fri, 21 Jul 2023 08:08:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689952098; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=SD81e7NZBdmvFs/0moOEoRHsNzw2ypppSDOfYt+K9oA=; b=M+lv7dXzGR1DA2bh/bJ3lVvlZn78YmOe4ED8trQ5aLvl5sbQDuGMezYb5NcUh8Vy903zLX OAVTW7M3gKzLNAkgQKj2IQZrDgCily2lBYIhsQfXlmFgSr2XvIugFz6Fbxi8JeVQ2oIR5K KPZDOx+EkI20/jLi8JPNkBW7RTIONXk= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-482-U0g8TpW5OJCKr6-IqOOXMw-1; Fri, 21 Jul 2023 11:08:15 -0400 X-MC-Unique: U0g8TpW5OJCKr6-IqOOXMw-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-3fbe4cecd66so10678325e9.1 for ; Fri, 21 Jul 2023 08:08:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689952094; x=1690556894; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SD81e7NZBdmvFs/0moOEoRHsNzw2ypppSDOfYt+K9oA=; b=UMqujZGoCGM1LRKvPdgOMm9YQzMVXKk4aLHlpHdR5UBb0fukomNAPA0dpvqjzI1MSC eIayE+ADmuPNEogz6CTXWpa5mWisoedchW8WpbpB5WsCCTdndEJhAga9r39ynflUsRrn k3xHliSpkJTOSgZTxgDavQI/x3EodGLbITlsC9B8qD56/usm5hWG2ftRkWDKS6+slxe5 B1B4NQ5CnT7rwHG5KCLE85H0z4TMoD5jObwpdbhra/Hl+Eg4pXJFj6s7cHRp1mNPFCRQ NT3SovQwn05K8hahRcdOIwPzbIp/cAZNi86xTTOzKOVJP9QuKWL9wdUtl8GAzQ0v5lCj dERA== X-Gm-Message-State: ABy/qLZ6DscTwyRnhTOua3jVuPbW8BD59CJQqwFiGuVqMlnMY1wMv3AJ FFCTHrc4vKlRftD2Fum2XBza2xA6acKIcqAjXEjLaI+2iVj60iww7gPWWrH2bl1sRcT2xurIgll OI7yJZ2hooy8RVhuK7mKSVffpxgiEjlOq X-Received: by 2002:a7b:c455:0:b0:3fc:627:ea31 with SMTP id l21-20020a7bc455000000b003fc0627ea31mr1714661wmi.38.1689952094108; Fri, 21 Jul 2023 08:08:14 -0700 (PDT) X-Google-Smtp-Source: APBJJlF9fiPWFBcIAw2j2QV4lTYmt4mtAVTwBGD8BbL2O21cgVm0IYBel5tSTfnfWuFcEvQp7qgXww== X-Received: by 2002:a7b:c455:0:b0:3fc:627:ea31 with SMTP id l21-20020a7bc455000000b003fc0627ea31mr1714619wmi.38.1689952093765; Fri, 21 Jul 2023 08:08:13 -0700 (PDT) Received: from vschneid.remote.csb ([149.12.7.81]) by smtp.gmail.com with ESMTPSA id q7-20020a5d5747000000b0031434936f0dsm4459951wrw.68.2023.07.21.08.08.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 08:08:12 -0700 (PDT) From: Valentin Schneider To: paulmck@kernel.org Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, bpf@vger.kernel.org, x86@kernel.org, rcu@vger.kernel.org, linux-kselftest@vger.kernel.org, Steven Rostedt , Masami Hiramatsu , Jonathan Corbet , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Paolo Bonzini , Wanpeng Li , Vitaly Kuznetsov , Andy Lutomirski , Peter Zijlstra , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Andrew Morton , Uladzislau Rezki , Christoph Hellwig , Lorenzo Stoakes , Josh Poimboeuf , Jason Baron , Kees Cook , Sami Tolvanen , Ard Biesheuvel , Nicholas Piggin , Juerg Haefliger , Nicolas Saenz Julienne , "Kirill A. Shutemov" , Nadav Amit , Dan Carpenter , Chuang Wang , Yang Jihong , Petr Mladek , "Jason A. Donenfeld" , Song Liu , Julian Pidancet , Tom Lendacky , Dionna Glaze , Thomas =?utf-8?Q?Wei=C3=9Fschuh?= , Juri Lelli , Daniel Bristot de Oliveira , Marcelo Tosatti , Yair Podemsky Subject: Re: [RFC PATCH v2 16/20] rcu: Make RCU dynticks counter size configurable In-Reply-To: <28d4abb7-8496-45ec-b270-ea2b6164537b@paulmck-laptop> References: <20230720163056.2564824-1-vschneid@redhat.com> <20230720163056.2564824-17-vschneid@redhat.com> <28d4abb7-8496-45ec-b270-ea2b6164537b@paulmck-laptop> Date: Fri, 21 Jul 2023 16:08:10 +0100 Message-ID: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-trace-kernel@vger.kernel.org On 21/07/23 07:10, Paul E. McKenney wrote: > On Fri, Jul 21, 2023 at 09:17:53AM +0100, Valentin Schneider wrote: >> On 20/07/23 17:30, Valentin Schneider wrote: >> > index bdd7eadb33d8f..1ff2aab24e964 100644 >> > --- a/kernel/rcu/Kconfig >> > +++ b/kernel/rcu/Kconfig >> > @@ -332,4 +332,37 @@ config RCU_DOUBLE_CHECK_CB_TIME >> > Say Y here if you need tighter callback-limit enforcement. >> > Say N here if you are unsure. >> > >> > +config RCU_DYNTICKS_RANGE_BEGIN >> > + int >> > + depends on !RCU_EXPERT >> > + default 31 if !CONTEXT_TRACKING_WORK >> >> You'll note that this should be 30 really, because the lower *2* bits are >> taken by the context state (CONTEXT_GUEST has a value of 3). >> >> This highlights the fragile part of this: the Kconfig values are hardcoded, >> but they depend on CT_STATE_SIZE, CONTEXT_MASK and CONTEXT_WORK_MAX. The >> static_assert() will at least capture any misconfiguration, but having that >> enforced by the actual Kconfig ranges would be less awkward. >> >> Do we currently have a way of e.g. making a Kconfig file depend on and use >> values generated by a C header? > > Why not just have something like a boolean RCU_DYNTICKS_TORTURE Kconfig > option and let the C code work out what the number of bits should be? > > I suppose that there might be a failure whose frequency depended on > the number of bits, which might be an argument for keeping something > like RCU_DYNTICKS_RANGE_BEGIN for fault isolation. But still using > RCU_DYNTICKS_TORTURE for normal testing. > > Thoughts? > AFAICT if we run tests with the minimum possible width, then intermediate values shouldn't have much value. Your RCU_DYNTICKS_TORTURE suggestion sounds like a saner option than what I came up with, as we can let the context tracking code figure out the widths itself and not expose any of that to Kconfig. > Thanx, Paul