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 lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 916E2C3DA6E for ; Mon, 8 Jan 2024 14:47:18 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.663559.1033516 (Exim 4.92) (envelope-from ) id 1rMquE-0001Ip-8d; Mon, 08 Jan 2024 14:47:10 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 663559.1033516; Mon, 08 Jan 2024 14:47:10 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rMquE-0001Ii-66; Mon, 08 Jan 2024 14:47:10 +0000 Received: by outflank-mailman (input) for mailman id 663559; Mon, 08 Jan 2024 14:47:09 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rMquD-0001GW-49 for xen-devel@lists.xenproject.org; Mon, 08 Jan 2024 14:47:09 +0000 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [2a00:1450:4864:20::22b]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id cb7c7c4b-ae34-11ee-9b0f-b553b5be7939; Mon, 08 Jan 2024 15:47:07 +0100 (CET) Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2cd56dac1adso10353441fa.2 for ; Mon, 08 Jan 2024 06:47:07 -0800 (PST) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id dp37-20020a0566381ca500b0046b4976c3ccsm2222810jab.138.2024.01.08.06.47.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 Jan 2024 06:47:06 -0800 (PST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: cb7c7c4b-ae34-11ee-9b0f-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1704725227; x=1705330027; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=qBXcbuxcbGslj3Eq8Kn1uWjpLhwG0M/KZtqzHxQOPP0=; b=a3oQgdCNfLr+pTjmNHeNyqGFk+9slPPgwcpuIrpXwYhD1rv7Ic2bhboyH729Mfads5 HvHm83udwT0NwWzxza5tX0jmxBAvD5FmS51Ty4G7+GsNKFfXylzkIPnJJmkoiTzMkDZS Ld7WpJ1h0g/I1uQQ9VSOO3gHG2kRaWkjsmRsXRiD8hY/bdeRNVgtypPxYAnxGCVwf/QN xRMZ+PpO37NgkdIQy3g261kIv5yqRfUHMtd/tJ4hgv99yLBKbCDBClYyPq94D+GnXbwO 6mQ5cEbAbDRdf+1KuSWcb86AiVmCaSkqoYtFrzOosIz5tmd2qVnXL/0OsDwr2f4qyDUk 3ylQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704725227; x=1705330027; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qBXcbuxcbGslj3Eq8Kn1uWjpLhwG0M/KZtqzHxQOPP0=; b=qfij6RjSNqO32BY9cyrkzQzXbLWLQ52+rsfMt0qUTx0gRY5Z3WX5VwPOWv5N+MFIRu lzVcsp97jhFrY8XB9PN7d0hNqC9B6fi7eJ2ohLDk371WYqzyWUhTmb2iRQhflSOlsGiN +w+CX14bsKICSNm1vCKzYwrY4Ih+ixmB1Y6URVXU4GYPTpgnTQ3dlX/4Md37dwifvYMr xX+z4yVJAJttHYf/Sn63dyeximbVYW4KBmtlle66mfszQ3B9okgzQsVg9/Z52XVUaZ/p PwCcMESHaR/4bWP/8G9NeukKcI6E2m1sKsBdb3Iyb5JsrAGuuREJCC20YJtcbmLhnNWR HKMg== X-Gm-Message-State: AOJu0Yx00iYt9uqP6y+iN+K99FpVeWRBUS528tzSguKlgXGwNV51pL8r CbR3IToiRUVKrJtocM5EFyUBU3fRP65qk0LILUnyH7hNWQ== X-Google-Smtp-Source: AGHT+IHiL/URIUOYDElLOx9ZdJFlomqnatzcJgkeedN/mfVIrMybyfc6yqnfgh77ZWPwAXEANjMKbA== X-Received: by 2002:a2e:8710:0:b0:2cc:a7ee:ce68 with SMTP id m16-20020a2e8710000000b002cca7eece68mr1891332lji.67.1704725226735; Mon, 08 Jan 2024 06:47:06 -0800 (PST) Message-ID: <6889e19d-c6d4-43f0-9752-738d2a54e311@suse.com> Date: Mon, 8 Jan 2024 15:47:06 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] NUMA: limit first_valid_mfn exposure Content-Language: en-US To: Julien Grall Cc: Andrew Cooper , George Dunlap , Stefano Stabellini , Wei Liu , "xen-devel@lists.xenproject.org" References: <224db25e-bd4c-4415-aff8-6ff3e84343d8@suse.com> <0872306a-fefb-424b-b27a-b67ba21828c7@suse.com> <829125ea-c220-47e9-a9f4-343126787f27@xen.org> From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj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L9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <829125ea-c220-47e9-a9f4-343126787f27@xen.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 08.01.2024 15:13, Julien Grall wrote: > Hi Jan, > > On 08/01/2024 11:43, Jan Beulich wrote: >> On 08.01.2024 12:37, Julien Grall wrote: >>> On 08/01/2024 11:31, Jan Beulich wrote: >>>> Address the TODO regarding first_valid_mfn by making the variable static >>>> when NUMA=y, thus also addressing a Misra C:2012 rule 8.4 concern (on >>>> x86). >>>> >>>> Signed-off-by: Jan Beulich >>>> --- >>>> Julien suggests something like >>>> >>>> STATIC_IF(CONFIG_NUMA) unsigned long first_valid_mfn; >>>> >>>> but I view this as non-scalable (or at least I can't see how to >>>> implement such in a scalabale way) and hence undesirable to introduce. >>> >>> I don't really see the scalability problem. Can you explain a bit more? >> >> Well, when seeing your original suggestion, I first considered it quite >> reasonable. But when thinking how to implement it, I couldn't see what >> >> #define STATIC_IF(cfg) >> >> should expand to. That's simply because a macro body cannot itself have >> pre-processor directives. Hence all I could think of was >> >> #ifdef CONFIG_NUMA >> # define static_if_CONFIG_NUMA static >> #else >> # define static_if_CONFIG_NUMA >> #endif >> #define STATIC_IF(cfg) static_if_ ## cfg >> >> And I think it is easy to see how this wouldn't scale across CONFIG_xyz. >> Plus that that point STATIC_IF() itself would be pretty much redundant. >> But maybe I'm simply overlooking the obvious ... > > You can use the same trick as for IS_ENABLED. The code below will select > static or nothing: > > #define static_enabled(cfg) _static_enabled(cfg) > #define _static_enabled(value) __static_enabled(__ARG_PLACEHOLDER_##value) > #define __static_enabled(arg1_or_junk) ___static_enabled(arg1_or_junk > static,) > #define ___static_enabled(__ignored, val, ...) val > > #define STATIC_IF(option) static_enabled(option) > > I have tested both with CONFIG_NUMA and !CONFIG_NUMA to confirm the > visibility of the variable will be correct. Hmm, okay. Then my 2nd scalability concern, in another dimension: What if static-ness ends up depending on two (or more) CONFIG_*? Jan