[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v1 2/8] x86/xen: simplify xen_oldmem_pfn_is_ram()
- To: David Hildenbrand <david@xxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx
- From: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
- Date: Wed, 29 Sep 2021 10:22:07 -0400
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.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; bh=cNa49YG+pdjys2nA8WWc5jfkEudTq1iUfeKyNbDTooA=; b=fmNe3Dki4C+OZI58WwwDszwu0c7DwdWod7h+d1VI8YztFtcwuOcFejDSgsmvDrX+Mz+Y92IqPXu3V079WWHQmoT3iwqbJvJXhNKDLlvVuDiiaSHvxG7eWpsQn6hoTAOqild3NUuopqWee3URYquoMqjTyTGYkJpPGFqFDU/cCfLsrWFwqFgnS3B6x+BA0dSuuqVwrgBoCe1MfjDmdbpAb0IuksVwsnX/A2y4l+eKAgyLVjaThltQz4sRURqadErO6tauqyuYYTNXyEzEE3SVe4ACIXS9xrPjm9GHcyn7mZZ6Ztp2SnxZl81PuPCsBrDUASVNjBcmcaVZVbBNofb1qw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j7sLU61+kNwi9sNIJFY0/QXNmz8DombIWW9jFiaMNA5Os5KPFWUVGKhnbqQewtpy4GXLrL7gGJItiDXfBrIx7/Jot22pdYgl2PrEOhasPZFo8gNiERQGusxkKcg4vA5AZ67oD8fTLf4/UvSt3tgkWmUrWurjzGkn4ua7L7nBLZ8gB907kOnv9rzSTxJem5nL9Ah866TaAsDojn7oqCocij28APZsopH0HIJ3R1AE6Vrs0BSYU8XZkwKf9QS2qZ0m+lH5+rhZ82ft8Y+73fOLHwcU7yzig4J+KrWsxCsAlL5dmyafoiTH72ZgnzZqxaig7aq/06RCfvIwldEfTLiZIg==
- Authentication-results: kvack.org; dkim=none (message not signed) header.d=none;kvack.org; dmarc=none action=none header.from=oracle.com;
- Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, "H. Peter Anvin" <hpa@xxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "Michael S. Tsirkin" <mst@xxxxxxxxxx>, Jason Wang <jasowang@xxxxxxxxxx>, Dave Young <dyoung@xxxxxxxxxx>, Baoquan He <bhe@xxxxxxxxxx>, Vivek Goyal <vgoyal@xxxxxxxxxx>, Michal Hocko <mhocko@xxxxxxxx>, Oscar Salvador <osalvador@xxxxxxx>, Mike Rapoport <rppt@xxxxxxxxxx>, "Rafael J. Wysocki" <rafael.j.wysocki@xxxxxxxxx>, x86@xxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx, kexec@xxxxxxxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx, linux-mm@xxxxxxxxx
- Delivery-date: Wed, 29 Sep 2021 15:01:00 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 9/29/21 5:03 AM, David Hildenbrand wrote:
> On 29.09.21 10:45, David Hildenbrand wrote:
>>>
>> Can we go one step further and do
>>
>>
>> @@ -20,24 +20,11 @@ static int xen_oldmem_pfn_is_ram(unsigned long pfn)
>> struct xen_hvm_get_mem_type a = {
>> .domid = DOMID_SELF,
>> .pfn = pfn,
>> + .mem_type = HVMMEM_ram_rw,
>> };
>> - int ram;
>> - if (HYPERVISOR_hvm_op(HVMOP_get_mem_type, &a))
>> - return -ENXIO;
>> -
>> - switch (a.mem_type) {
>> - case HVMMEM_mmio_dm:
>> - ram = 0;
>> - break;
>> - case HVMMEM_ram_rw:
>> - case HVMMEM_ram_ro:
>> - default:
>> - ram = 1;
>> - break;
>> - }
>> -
>> - return ram;
>> + HYPERVISOR_hvm_op(HVMOP_get_mem_type, &a);
>> + return a.mem_type != HVMMEM_mmio_dm;
I was actually thinking of asking you to add another patch with pr_warn_once()
here (and print error code as well). This call failing is indication of
something going quite wrong and it would be good to know about this.
>> }
>> #endif
>>
>>
>> Assuming that if HYPERVISOR_hvm_op() fails that
>> .mem_type is not set to HVMMEM_mmio_dm.
I don't think we can assume that argument described as OUT in the ABI will not
be clobbered in case of error
>>
>
> Okay we can't, due to "__must_check" ...
so this is a good thing ;-)
-boris
|