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 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 4C04F109B489 for ; Tue, 31 Mar 2026 15:54:05 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1269149.1558267 (Exim 4.92) (envelope-from ) id 1w7bPe-0000b1-UF; Tue, 31 Mar 2026 15:53:54 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1269149.1558267; Tue, 31 Mar 2026 15:53:54 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w7bPe-0000au-PX; Tue, 31 Mar 2026 15:53:54 +0000 Received: by outflank-mailman (input) for mailman id 1269149; Tue, 31 Mar 2026 15:53:53 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1w7bPd-0000ao-5x for xen-devel@lists.xenproject.org; Tue, 31 Mar 2026 15:53:53 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1w7bPc-008tDB-I4 for xen-devel@lists.xenproject.org; Tue, 31 Mar 2026 17:53:52 +0200 Received: from [10.42.69.2] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 69cbedfb-e002-0a2a0a5209dd-0a2a4502cd5c-22 for ; Tue, 31 Mar 2026 17:53:52 +0200 Received: from [209.85.128.43] (helo=mail-wm1-f43.google.com) by tlsNG-720697.mxtls.expurgate.net with ESMTPS (eXpurgate 4.55.2) (envelope-from ) id 69cbee10-63bb-0a2a45020019-d155802bd51c-3 for ; Tue, 31 Mar 2026 17:53:52 +0200 Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-486fb112c09so54677035e9.1 for ; Tue, 31 Mar 2026 08:53:52 -0700 (PDT) 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 5b1f17b1804b1-4887e967badsm55461665e9.14.2026.03.31.08.53.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 31 Mar 2026 08:53:51 -0700 (PDT) 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" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=suse.com header.i="@suse.com" header.h="Content-Transfer-Encoding:In-Reply-To:Autocrypt:From:Content-Language:References:Cc:To:Subject:User-Agent:MIME-Version:Date:Message-ID" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1774972432; x=1775577232; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=fNRanloXQ19oIIHAgQidmrgH/LvEZVRiIP7N7oI/i3Y=; b=WzH81CUDtuf2eLXV1PsT9HjtYiL25t/aBCid7kI6a7mCJzvyB8bvGMprbrvNOpvpXe 0Je4h5EZ00/tbdeYT2NQR0Tmz0MpupbxY33sK1rc//1UNoTVMKgfziAYwxjktQb3Mt+v rg2CY4+anJFOVI81fhZbA9p2J/cvSsLnWomXL+FykSfPbJz9u0ECevkZ1BoFqK4gVqfB 5n03bDSdn6aVO/fj56s28ThTUXhRy+Yk0GUyXX2xlwuCRxPj0Bug1Koh6MfhITPmGnhk dLrCcW4pJTeTLUazh4FQyPfZ8vTWjtpL6uZU0NXa17ZDsjs7W6AoMZ60wyHMAN5zUHuh 7C4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774972432; x=1775577232; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=fNRanloXQ19oIIHAgQidmrgH/LvEZVRiIP7N7oI/i3Y=; b=mW36lvVUn8+QFHoxjfvJN0EDidVlwQSc5PSZlCHYzE8hp91FYH1Pcpc3WV+R8vyXKk 1FiyNTjl9U4vUvogCwbsbMWiullAApMrGg6KSuvCs6K8uX0YbJgeJVxv3kHeK5iy/9ws RtN/YzU+oN6+dywGtC1VvlXu0afqf8QCGP8wNmA2e9QOcviQBzupDI9YUcuZBfx5qrvB 9MpEm5nxma8bMEl9ABPg8gn8opPCrA3RRawdXMJff3UrPkJYwy9+yvhUDphZprEsf+74 kTaX4Em9vNl99nSXWLqR2WFttpGjlkGw/+5axh8+cf19QlCpQhgC1s/hXsYvzamnrsVE WksA== X-Forwarded-Encrypted: i=1; AJvYcCUwLcLKZ0TLw+qm2NLsjdmVB6k9O9x8Whm7BkyL3YRBGT5U9TtpytOTfjSkqjK7vFd3ZykMvITxlG8=@lists.xenproject.org X-Gm-Message-State: AOJu0YwTvRT3xQgGuYq1Yb5Ul+vh26966opS06SawyF5EkQCaGD0tL1X Hh+PWjt2u81uSYvPdXJpL9ym3Q3IIFQEnCld4SPOXmuEEywNqRMcp1SD5PDQ0z81vg== X-Gm-Gg: ATEYQzxiSOTxgPdmxYC3CB8mZK+08LVllcdSOARsvomrgK8+C32jXXtQP9pt0+3Glja AWOhqp4EumqT2weOGuakwq9zdM24WLHJbbF85ZNoYt8T6Jb85GmyGc3RjyiQcRAclHMLOgOpcvp JMGUcNi6haH66Yqo8PMyaOAnrnRwiOa9YaGqRQCs66Ds8ImhVsY78MU8h4SGJ/nc1j1wYwjj01X 19iZjMIo9IiMZIX0q922mN7J+QkZFSAb0QaszQJ0/A+mqqWQoGI2YeHeOVuLmMvg2/gLl7/Utx+ dEJB8TnqD1N6/Wj9Z5yvNH/r90eTdenXxnWRDoz991f4UkOPEHlGFY+j32CE6NAXpTXSNZnysxU s5VmQmbLBrFAHUryILX6bVEil18gSkNMpp9SA0Yhf6iny47OeByAthyW5gPidBeMn6STE2hU9QS AWQDjoJcVWp1PcDAFMINJvlO9yC3TPCWJhEPTj+yUlHFBUnphscInQqNzVXL/fpCJAPsXPhsjP6 GKNcLYP1MlrdHQ= X-Received: by 2002:a05:600c:4205:b0:488:7784:d06 with SMTP id 5b1f17b1804b1-48877840d50mr46870985e9.31.1774972431809; Tue, 31 Mar 2026 08:53:51 -0700 (PDT) Message-ID: Date: Tue, 31 Mar 2026 17:53:50 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 07/11] xen: move domain_use_host_layout() to common code To: Oleksii Kurochko Cc: Romain Caritey , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Andrew Cooper , Anthony PERARD , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= , xen-devel@lists.xenproject.org References: <533d01db2b36b8357cd87e99a64a6e66dbdd1db4.1774281309.git.oleksii.kurochko@gmail.com> <6df9470e-4969-48d1-bf0c-c6569a5e5577@suse.com> <57581b7d-cb9f-444c-9321-63b2fc3d09f0@gmail.com> Content-Language: en-US From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0N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AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <57581b7d-cb9f-444c-9321-63b2fc3d09f0@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-purgate-ID: tlsNG-720697/1774972432-4149FDB8-82194609/0/0 X-purgate-type: clean X-purgate-size: 2582 On 31.03.2026 17:20, Oleksii Kurochko wrote: > On 3/30/26 5:13 PM, Jan Beulich wrote: >> On 23.03.2026 17:29, Oleksii Kurochko wrote: >>> domain_use_host_layout() is not really architecture-specific, so move it >>> from the Arm header to the common header xen/domain.h and provide a common >>> implementation in xen/common/domain.c. domain_use_host_layout() potentially >>> is needed for x86 [1]. >> >> No matter that this may indeed be true, ... >> >>> Turn the macro into a function to avoid header dependency issues. >> >> ... this introduces unreachable code on x86, i.e. a Misra rule 2.1 violation. > > Do we have some deviation tag for such cases when the code temporary > isn't used? I'm sorry, but it'll take me about as long as you to find out. I wonder about "temporary" though: Do you have a clear understanding as to when that will change? >>> @@ -2544,6 +2544,12 @@ void thaw_domains(void) >>> >>> #endif /* CONFIG_SYSTEM_SUSPEND */ >>> >>> +bool domain_use_host_layout(struct domain *d) >>> +{ >>> + return is_domain_direct_mapped(d) || >>> + (paging_mode_translate(d) && is_hardware_domain(d)); >>> +} >> >> The placement of paging_mode_translate() doesn't match ... >> >>> --- a/xen/include/xen/domain.h >>> +++ b/xen/include/xen/domain.h >>> @@ -62,6 +62,22 @@ void domid_free(domid_t domid); >>> #define is_domain_direct_mapped(d) ((d)->cdf & CDF_directmap) >>> #define is_domain_using_staticmem(d) ((d)->cdf & CDF_staticmem) >>> >>> +/* >>> + * Is the auto-translated domain using the host memory layout? >>> + * >>> + * domain_use_host_layout() is always False for PV guests. >> >> ... the description of the function. > > But why the placement should be different? If you focus on auto-translated, then imo paging_mode_translate() better would guard everything. > is_domain_direct_mapped() is false for PV guests (and for other guest > types on x86). > > So if domain_use_host_layout() is fully depends on > paging_mode_translate(d) && is_hardware_domain(d) and for which > paging_mode_translate() is false if it is PV guest. > Thereby domain_use_host_layout() is false too. > >> >> Further, the first sentence above suggests the caller has to check >> paging_mode_translate() before calling, which as per the implementation >> clearly isn't the intention. > > Sorry, I don't follow you here. By starting the comment with "Is the auto-translated domain using", you imply the caller checked for that aspect already. At least the way I read it. Jan