[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/8] x86/mm: Avoid hard-coding PAT in get_page_from_l1e()
- To: Demi Marie Obenour <demi@xxxxxxxxxxxxxxxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Tue, 6 Dec 2022 12:05:25 +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=T327dELQqzTVBqY4x4ou4K3D838C5HStDz5tDe6GBOU=; b=atrFXKDfRjNAtgayDTrG6I/yUK5FAZR3Lkgrxt2nEXnNh5sqKqah++tLXs7AutAwZbNPrttGewVj6yVFcIAvZHCkc0wv4NR0Atham5pcpVlKJOafhDAEgk/sCa51noy+PtscGTTM7plKCoRrCHyQ6+iawPkj7v1muScXcNA3CQSqRL1i8jgtPk6KV5vKZaWvX0c6S90e0NxIF9QZg0vIBartJEW0phMlzlRt1oDqcz5nJ4crvkIsZAQ16VOycsaDgHlilIjPykSmUA8vU3Ot1ouL1bowuGYl4WRtR0pkhj2JHAanQD2rlBA80tT1GynMFuPhzoNn8Df2AAEa3Ht++Q==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UiM9AUSezCgoNhmEJ6W1EcllcCFnsersspIWQFQpnsF+KNGevRjz2bDBy6NchSVw4xy9IAWaSRB9eWFsvZSvCFawfMFlmuWKV2xmiCsWVZ6Pap9CxLaKJsIyDh2+ecmk5gWPfVqd5YxwYkvxXG93Iqy1Digc+Xa4lCbAOpw7TMyEYAj2k9EmyDl/Wg7s3A8D6EXK+uqf2FhNVUdofGlxK2rk1gmEAQIoJF9ko0BX6M4zrbEIw3xef7uDh8E085j8sw9bXpqjIBb5fyB0Mb59p7hR0hB0do2tAtxXVSxFblRDyPTY5lzr2mJ67gF3L9PxlRfQAMhJ9Vg1UwKaYdH2tg==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Tim Deegan <tim@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Tue, 06 Dec 2022 11:06:02 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 06.12.2022 05:33, Demi Marie Obenour wrote:
> This still hard-codes the assumption that the two spare values are
> mapped to UC. Removing this assumption would require a more complex
> patch.
>
> Signed-off-by: Demi Marie Obenour <demi@xxxxxxxxxxxxxxxxxxxxxx>
You eliminate some assumptions at the price of introducing new ones.
With that I consider the description insufficient; really there isn't
any description here, just a statement on something you do _not_ do.
> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -961,13 +961,10 @@ get_page_from_l1e(
>
> switch ( l1f & PAGE_CACHE_ATTRS )
> {
> - case 0: /* WB */
> - flip |= _PAGE_PWT | _PAGE_PCD;
> - break;
> - case _PAGE_PWT: /* WT */
> - case _PAGE_PWT | _PAGE_PAT: /* WP */
> - flip |= _PAGE_PCD | (l1f & _PAGE_PAT);
> - break;
> + case _PAGE_WB:
> + case _PAGE_WT:
> + case _PAGE_WP:
> + flip |= (l1f & PAGE_CACHE_ATTRS) ^ _PAGE_UC;
> }
Please never drop "break" from case blocks, even if it's (at a given
point in time) the last in its switch(). That's a recipe for someone
else then forgetting to add it when another case block is added.
Jan
|