[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 02/22] x86/setup: move vm_init() before acpi calls


  • To: Julien Grall <julien@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 21 Dec 2022 11:22:31 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NN4rqa5f//cyYJR1TPNFGxp+m/dVWPt10wWchdvfObE=; b=LWZVXbMyEcTN+XSoJOm6EpCl3JAtXqetNgsOQypw9jCkw7FdfIMzSBgAUYSqscUzQipuQzGjTFczl2+bMOPONx4y0M7C/CG1qZSsqXmYTlGeUPec2UKlQWYSLtYGsE8u6UsUB1yY+SwOFXj2kjEAtv0x8QNqsbzDlCblRkYj+cBQMr6bW5VzGfgG7aksNmqKMwApRUCXaQ8zB4ipYPBjOBe80v6gBWCAK9i91UL4zrl93CySDg8Fp6pK2uZCyakTkvUiJ+4ZJZwuYbfmr4BYDQocfkVwXIZ9nuycQuR9XqS1qLtzj/5/8bGweEqCKkIQmS4JW9ElaK7ldPh9o82w5w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D/Kq8Ye79YxPSfLiT1CXLoI56ew7QAPKXRIDbjUCTig0hVZId+hYrk+iW8Qd5p5cheyBN8rUicdSOvg+SJQcj5tZZPOHPZH9UYrI88upSnWN37muuwo4hyDpjXL1SivPEDDQ+MNCRY1zvJNVzb18e9CXoC6MHAKKroC7WGS0z/+FFVazBjTcV0xRwzrcqLZuzhXE2n7tGRHKBYbeztkykfvrXV4A/49dXsSFSX09fhyghAYKoSmrWyq5d9Q8A4GCSnhpt4QVBPhJITrJSsPWjRgQElmwaW43NaUeR3uJJJaSKJyVhQCwdeT4+ILVjftmRg0AKX5gaBtccG5ieYfxmQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Wei Liu <wei.liu2@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, David Woodhouse <dwmw2@xxxxxxxxxx>, Hongyan Xia <hongyxia@xxxxxxxxxx>, Julien Grall <jgrall@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 21 Dec 2022 10:22:38 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 21.12.2022 11:18, Julien Grall wrote:
> On 20/12/2022 15:08, Jan Beulich wrote:
>> On 16.12.2022 12:48, Julien Grall wrote:
>>> --- a/xen/common/vmap.c
>>> +++ b/xen/common/vmap.c
>>> @@ -34,9 +34,20 @@ void __init vm_init_type(enum vmap_region type, void 
>>> *start, void *end)
>>>   
>>>       for ( i = 0, va = (unsigned long)vm_bitmap(type); i < nr; ++i, va += 
>>> PAGE_SIZE )
>>>       {
>>> -        struct page_info *pg = alloc_domheap_page(NULL, 0);
>>> +        mfn_t mfn;
>>> +        int rc;
>>>   
>>> -        map_pages_to_xen(va, page_to_mfn(pg), 1, PAGE_HYPERVISOR);
>>> +        if ( system_state == SYS_STATE_early_boot )
>>> +            mfn = alloc_boot_pages(1, 1);
>>> +        else
>>> +        {
>>> +            struct page_info *pg = alloc_domheap_page(NULL, 0);
>>> +
>>> +            BUG_ON(!pg);
>>> +            mfn = page_to_mfn(pg);
>>> +        }
>>> +        rc = map_pages_to_xen(va, mfn, 1, PAGE_HYPERVISOR);
>>> +        BUG_ON(rc);
>>
>> The adding of a return value check is unrelated and not overly useful:
>>
>>>           clear_page((void *)va);
>>
>> This will fault anyway if the mapping attempt failed.
> 
> Not always. At least on Arm, map_pages_to_xen() could fail if the VA was 
> mapped to another physical address.

Oh, okay.

> This seems unlikely, yet I think that relying on clear_page() to always 
> fail when map_pages_to_xen() return an error is bogus.

Fair enough, but then please at least call out the change (and the reason)
in the description. Even better might be to make this a separate change,
but I wouldn't insist (quite likely I wouldn't have made this a separate
change either).

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.