[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [PATCH v2 5/9] xen/x86: use arch_get_memory_map to get information from E820 map
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Wei Chen <Wei.Chen@xxxxxxx>
- Date: Wed, 13 Jul 2022 10:37:58 +0000
- Accept-language: en-US
- Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
- Arc-message-signature: i=2; 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=uGi+tMeXa0dkMg9eds+7MPut3Nzf9R8DwN4XqsDiXKg=; b=nDVLRUWiIyQR2vRFwXkKUH7HrF1npXzpsEq8w8C4eXoim5MwXlQnS0Xjp/cLM7wFQx98z4I9qZpw2Jh2XYu/kOBs7tFkCrC/TvgXIFUzFaGvv62DPGgJe32dJFYSIhNSnwwaiuCkQMUz5DpvOISzVOQYo10Tf6OiFuOk4ihTKJGc1Fsp+UZzB4I8L16TpHtBIaintT5siHaqcTpg5TBSwIDRg5D/QfECZSWZmCv8EMqVBWUf8NRFg4uSTwMfaBO8f6nfhXCsaaIEG29hzvcRTAlneDF+GgDSIYm8n2k+UPELxJ4FSdNd9LvWOFHUIQEvER+ecx6j3X0NIL8ncPUpJg==
- 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=uGi+tMeXa0dkMg9eds+7MPut3Nzf9R8DwN4XqsDiXKg=; b=JSWRLLXiGJtbFUXY+qFuAwumfdsek4qcSehiZOqzP+hu86y6YVqqWquw4JEgfBgeoL4nkvYzJQ1pIRv0b4fVobp2cnB1oBxo9/TZllR+ywV1N1wajfmyJfLQp3zTRADsV/aYLmF41TJIud3NkMtNdOFo0KwEGUPgHNH2eQ8XHL2GVtO8TFRHOWUQqBaGTMeOu3hOjjbL49kfE4gauXorXBPD/chJUI7FY7aIa6zHUs/NKGX0MDHjSWH/DmPuRjBnvQUglMsp0wD1fOsYdJeLGvcXhV7AHbSXwuSMUCUYxVXNzMWtXpdDOJmuI1IRGcEMCM6orKD9BIZVlItg9IWDjw==
- Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=V2GKrKUu0hzm2ZK3LYg3dM4t51kJDx1MWxp309skHqJr8FUhBDjpUrN4jbOLqbLVVOA3en1wsIdr9ItVpuVIAK+qZWLHsF0AyLJ/zTdZfEUQrdE1F4GJZJXcVtVucvP3xu0baxHSt18/L8dXy3p4UVHxo9aFNm75JdYhP1k/1sP/SW4uvJ7R594m1s63twxzE8ZNLDv7IHsR1RCjCLGIDTENi4zV/k4DB4nUkJQNVImfo8td7LUULKW5x/bZyziyQnNOgSD2uEk7zFz6Nt8rEV9Z7pp+STLYIVwZCOOQ7izEByZ2am3e0ILGqQjHvFwNjQ8I4J+8j34Y1YMLhDC/KQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kxwyMU6Rf7sUZZeH4wmTM9frYoB7pTOrfWK+tNc9YvnVtUbukYrpjkz0WML+KdcNzu1orTr3ZnvboensTvpPm8Qxaoq124fzfWai+w7GuDHdRealjNguOeBXgN/F7HNGpXKm5JEbGfKtW5LTB3KK85KTkIxtWFPccTAlpFx1Z+Tj08uSFEqxfzSisg7Sje1akSWVjvFAMzmPwsgsJOou3YpOaJaTgDPzICIfBo8Pjozd4Dptl3gJQeCmlaAlfUAaicXuW24SHi8bBVbbUhTsfGURSf7lWlrnvMJpeMPhcbmsYs1pTnJy5sGk9LkuafRytnXyfq9P/XqouXycMHcIqQ==
- Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Cc: nd <nd@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Wed, 13 Jul 2022 10:38:23 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Nodisclaimer: true
- Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Thread-index: AQHYktrCVaKtwgivsk2Qg94d9JgqNq16xCUAgAFbxFA=
- Thread-topic: [PATCH v2 5/9] xen/x86: use arch_get_memory_map to get information from E820 map
Hi Jan,
> -----Original Message-----
> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: 2022年7月12日 21:40
> To: Wei Chen <Wei.Chen@xxxxxxx>
> Cc: nd <nd@xxxxxxx>; Andrew Cooper <andrew.cooper3@xxxxxxxxxx>; Roger Pau
> Monné <roger.pau@xxxxxxxxxx>; Wei Liu <wl@xxxxxxx>; George Dunlap
> <george.dunlap@xxxxxxxxxx>; Julien Grall <julien@xxxxxxx>; Stefano
> Stabellini <sstabellini@xxxxxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxx
> Subject: Re: [PATCH v2 5/9] xen/x86: use arch_get_memory_map to get
> information from E820 map
>
> On 08.07.2022 16:54, Wei Chen wrote:
> > @@ -82,3 +83,25 @@ unsigned int __init arch_get_dma_bitsize(void)
> > flsl(node_start_pfn(node) + node_spanned_pages(node) /
> 4 - 1)
> > + PAGE_SHIFT, 32);
> > }
> > +
> > +/*
> > + * This function provides the ability for caller to get one RAM entry
> > + * from architectural memory map by index.
> > + *
> > + * This function will return zero if it can return a proper RAM entry.
> > + * otherwise it will return -ENODEV for out of scope index, or return
> > + * -EINVAL for non-RAM type memory entry.
> > + */
>
> I think the comment also wants to spell out that the range is
> exclusive at the end (assuming that's suitable for Arm; else now
> would perhaps be the time to change it).
>
Did you mean we have to mention the range is [star, end)?
If yes, I will add related comment. And...
> > +int __init arch_get_memory_map(unsigned int idx, paddr_t *start,
> paddr_t *end)
> > +{
> > + if ( idx >= e820.nr_map )
> > + return -ENODEV;
>
> Perhaps better -ENOENT?
>
Ack.
> > + if ( e820.map[idx].type != E820_RAM )
> > + return -EINVAL;
>
> I'm sorry, this should have occurred to me already when commenting on
> v1: "get_memory_map" doesn't really fit this "RAM only" restriction.
> Maybe arch_get_ram_range()? Or maybe others have some good naming
> suggestion?
arch_get_ram_range makes sense to me. I will update in next version.
>
> > + *start = e820.map[idx].addr;
> > + *end = e820.map[idx].addr + e820.map[idx].size;
>
...In this case, I think we don't need to adjust this line to:
*end = e820.map[idx].addr + e820.map[idx].size - 1;
As we have mentioned the range is [start, end).
> Nit: Would be shorter to read if you (re)used *start.
>
Ack.
> Jan
|