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 98FEBC5B552 for ; Tue, 10 Jun 2025 08:26:37 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1010594.1388726 (Exim 4.92) (envelope-from ) id 1uOuJO-0000TW-50; Tue, 10 Jun 2025 08:26:26 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1010594.1388726; Tue, 10 Jun 2025 08:26:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uOuJN-0000TP-WB; Tue, 10 Jun 2025 08:26:25 +0000 Received: by outflank-mailman (input) for mailman id 1010594; Tue, 10 Jun 2025 08:26:24 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uOuJM-0000TJ-8r for xen-devel@lists.xenproject.org; Tue, 10 Jun 2025 08:26:24 +0000 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [2a00:1450:4864:20::329]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 97d66064-45d4-11f0-a306-13f23c93f187; Tue, 10 Jun 2025 10:26:23 +0200 (CEST) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-450dd065828so34588385e9.2 for ; Tue, 10 Jun 2025 01:26:23 -0700 (PDT) Received: from ?IPV6:2003:ca:b734:b49b:5992:e13c:c106:5fe0? (p200300cab734b49b5992e13cc1065fe0.dip0.t-ipconnect.de. [2003:ca:b734:b49b:5992:e13c:c106:5fe0]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4521370936esm133663955e9.20.2025.06.10.01.26.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 10 Jun 2025 01:26:22 -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" X-Inumbo-ID: 97d66064-45d4-11f0-a306-13f23c93f187 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1749543983; x=1750148783; 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=8OtPQd3BNGsbzCYQd7Cgvi5Cg+O5c+T2fPfHfNlcul8=; b=bKzeDZf/9XQ29g3ESVYxXsnMzcbthwTyP1kAoPEj+u5cbHjChJ1A7a0rdmHG+psuW0 y7BGBjXDH6JuO4/iP1mvrYL9KMVuKtcwqXkJQnNhi1omKOoh+tsvfdzwSOM1r4JMhV2H aVCmE1kPQNq70McqttFz/MsXu4oHK0EIFvYn+fN1aivmLzWey1nNaEFvsmQEOMRVTaYA ct3Q/quhBlC1eeaXP3zuztfvz9yvSZaNU8S2eD0tFd4psHvJq3B2gxbftG5RRTnZDDsH /EVztYYhgtCDxnZ5HSZm5thwSlitYdwh+a5Y7yyk8xchQNmKF6OvaF9AbNb+eIRKd2Z1 725g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749543983; x=1750148783; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=8OtPQd3BNGsbzCYQd7Cgvi5Cg+O5c+T2fPfHfNlcul8=; b=vZ+iaGkjaRR5pIy3WrFWF3MWkjdbDQmRJN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+IFyk04OF2d0aTUnSZNb7vhYnP/WewiwxKAkvPJASxvHReRWoeXSxb6IopI1N3+f7i6N7YFZjw== X-Received: by 2002:a05:600c:c163:b0:43c:fd27:a216 with SMTP id 5b1f17b1804b1-452fa7ed515mr113449025e9.23.1749543982676; Tue, 10 Jun 2025 01:26:22 -0700 (PDT) Message-ID: <11ea9475-d963-473d-a85b-d1c461e7b213@suse.com> Date: Tue, 10 Jun 2025 10:26:22 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v9 2/3] xen/domain: adjust domain ID allocation for Arm To: dmkhn@proton.me Cc: Julien Grall , andrew.cooper3@citrix.com, anthony.perard@vates.tech, roger.pau@citrix.com, sstabellini@kernel.org, teddy.astie@vates.tech, dmukhin@ford.com, xen-devel@lists.xenproject.org References: <20250528225030.2652166-1-dmukhin@ford.com> <20250528225030.2652166-3-dmukhin@ford.com> <63087c42-d709-4e53-a2c3-8b812f13190a@xen.org> <30c01c78-5a5e-435f-9b1c-faca3af04a76@suse.com> Content-Language: en-US From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRM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QL In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 10.06.2025 10:02, dmkhn@proton.me wrote: > On Tue, Jun 10, 2025 at 08:53:12AM +0200, Jan Beulich wrote: >> On 06.06.2025 23:29, Julien Grall wrote: >>> Hi Denis, >>> >>> On 05/06/2025 23:05, Julien Grall wrote: >>>> Hi Denis, >>>> >>>> On 28/05/2025 23:50, dmkhn@proton.me wrote: >>>>> From: Denis Mukhin >>>>> >>>>> From: Denis Mukhin >>>>> >>>>> Remove the hardcoded domain ID 0 allocation for hardware domain and replace it >>>>> with a call to get_initial_domain_id() (returns the value of hardware_domid on >>>>> Arm). >>>> >>>> I am not entirely why this is done. Are you intending to pass a different domain ID? If so... >>>> >>>>> >>>>> Update domid_alloc(DOMID_INVALID) case to ensure that get_initial_domain_id() >>>>> ID is skipped during domain ID allocation to cover domU case in dom0less >>>>> configuration. That also fixes a potential issue with re-using ID#0 for domUs >>>>> when get_initial_domain_id() returns non-zero. >>>>> >>>>> Signed-off-by: Denis Mukhin >>>>> --- >>>>> Changes since v8: >>>>> - rebased >>>>> --- >>>>>   xen/arch/arm/domain_build.c             | 4 ++-- >>>>>   xen/common/device-tree/dom0less-build.c | 9 +++------ >>>>>   xen/common/domain.c                     | 4 ++-- >>>>>   3 files changed, 7 insertions(+), 10 deletions(-) >>>>> >>>>> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c >>>>> index e9d563c269..0ad80b020a 100644 >>>>> --- a/xen/arch/arm/domain_build.c >>>>> +++ b/xen/arch/arm/domain_build.c >>>>> @@ -2035,9 +2035,9 @@ void __init create_dom0(void) >>>> >>>> ... naming like create_dom0() probably wants to be renamed. >>>> >>>> That said, I am not convinced a domain other than 0 should have full privilege by default. So I would argue it should stay as ... >>>> >>>>>       if ( !llc_coloring_enabled ) >>>>>           flags |= CDF_directmap; >>>>> -    domid = domid_alloc(0); >>>>> +    domid = domid_alloc(get_initial_domain_id()); >>>> >>>> ... 0. >>> >>> Looking at the implementation of get_initial_domain_id(), I noticed the behavior was changed for x86 by [1]. >>> >>> Before, get_initial_domain_id() was returning 0 except for the PV shim. >>> But now, it would could return the domain ID specified on the command line (via hardware_dom). >>> >>> From my understanding, the goal of the command line was to create the hardware domain *after* boot. So initially we create dom0 and then initialize the hardware domain. With the patch below, this has changed. >>> >>> However, from the commit message, I don't understand why. It seems like we broke late hwdom? >>> >>> For instance, late_hwdom_init() has the following assert: >>> >>>     dom0 = rcu_lock_domain_by_id(0); >>>     ASSERT(dom0 != NULL); >>> >>> Jan, I saw you were involved in the review of the series. Any idea why this was changed? >> >> I simply overlooked this aspect when looking at the change. You're right, things >> were broken there. Unless a simple and clean fix can be made relatively soon, I >> think this simply needs reverting (which may mean to revert any later commits >> that depend on that). I can't help noting that in this console rework there were >> way too many issues, and I fear more than just this one may have slipped >> through. I therefore wonder whether taken as a whole this was/is worth both the >> submitter's and all the reviewers' time. > > Yes, sorry, I overlooked late_hwdom_init() modification. > > IMO, the clean fix would be adding another command line parameter > `control_domid` (with default value 0), make get_initial_domain_id() return it > instead of current `hardware_domid` and update late_hwdom_init() to use > `control_domid` insted of open-coded 0. No, no new command line option will address this. Original behavior needs to be restored (either by correcting the earlier change or, as said, be reverting). Jan