[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] Subject: x86/PAT: Report PAT on CPUs that support PAT without MTRR
- To: Juergen Gross <jgross@xxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Thu, 14 Jul 2022 08:28:38 +0200
- 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=oFcPL/umJ+5KuC79w/CHfNJulm3P2EJlDY+FDAewpq0=; b=dxsPRA72J3RfPqWljx0tqjPV2SnmQteChvkV+9aMGI3Iq9EpSXhibRuXbZyI47QB4bL2gq3+lk3Wbt53eqF+FIoEvuqn3NbqQkb3JXEBMP1L5uyWmyhUNigguIJNjCLKzdVyDNQlIC4QghSPpCiTJs+mpS3GS1tObZUrVtPc3FmceqT+ml/cRLzALW5HB6paFq4801kLV0j5xr5RGNm1724jxPg5jg8Ft+BuItUOCsTcO4/0yYNwKjH3vu8vvQCOK04nI+8TErktnLgIy551kfbyc/YxGDWrdxWD3RrwoEZL/x5KYHinM7j3Ze7gWowBhPv0cknmYO/6GeMphhL3dw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QqTqMTAFVOS6hELOasuAtCMQchggV2oG+GQ3DA59npH9S3NWZABjJULmcLN03J0VbyFCbFrEs6ywmFPfYTrYNfBvdWhGCEv4xDrk3JHviqSzIYYuvXbbBIOghWIjggqILRASOE6wh8BGcqa2PCfhP1vOgsCzbkz+Cr4nlmS7XAuCiaeVTdxqHsBfL/WQG6uszaj1RcSSgx+36NjgmAC0anPZzss8ttKq5NYW3SYQLqcwaXF1Hl+3OnmEOBtypzBMPSrKjrYDx2aQ9PCTOTC9tvmPbYszL4KwRy6h8GGrEfVGdjoyV9vOc9NccTNtwlkmw4fdoglztKd/hiV59gAAIw==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, Andy Lutomirski <luto@xxxxxxxxxx>, Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Borislav Petkov <bp@xxxxxxxxx>, x86@xxxxxxxxxx, "H. Peter Anvin" <hpa@xxxxxxxxx>, Dan Williams <dan.j.williams@xxxxxxxxx>, "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx>, Tom Lendacky <thomas.lendacky@xxxxxxx>, Jane Chu <jane.chu@xxxxxxxxxx>, Tianyu Lan <Tianyu.Lan@xxxxxxxxxxxxx>, Randy Dunlap <rdunlap@xxxxxxxxxxxxx>, Sean Christopherson <seanjc@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Chuck Zmudzinski <brchuckz@xxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, stable@xxxxxxxxxxxxxxx
- Delivery-date: Thu, 14 Jul 2022 06:28:52 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 14.07.2022 07:40, Juergen Gross wrote:
> On 13.07.22 03:36, Chuck Zmudzinski wrote:
>> @@ -292,7 +294,7 @@ void init_cache_modes(void)
>> rdmsrl(MSR_IA32_CR_PAT, pat);
>> }
>>
>> - if (!pat) {
>> + if (!pat || pat_force_disabled) {
>
> Can we just remove this modification and ...
>
>> /*
>> * No PAT. Emulate the PAT table that corresponds to the two
>> * cache bits, PWT (Write Through) and PCD (Cache Disable).
>> @@ -313,6 +315,16 @@ void init_cache_modes(void)
>> */
>> pat = PAT(0, WB) | PAT(1, WT) | PAT(2, UC_MINUS) | PAT(3, UC) |
>> PAT(4, WB) | PAT(5, WT) | PAT(6, UC_MINUS) | PAT(7, UC);
>> + } else if (!pat_bp_enabled) {
>
> ... use
>
> + } else if (!pat_bp_enabled && !pat_force_disabled) {
>
> here?
>
> This will result in the desired outcome in all cases IMO: If PAT wasn't
> disabled via "nopat" and the PAT MSR has a non-zero value (from BIOS or
> Hypervisor) and PAT has been disabled implicitly (e.g. due to lack of
> MTRR), then PAT will be set to "enabled" again.
Just to mention it explicitly: If the value _read_ from the MSR is zero,
we're hosed anyway, as then we can only express a single memory type (UC)
in all PTEs. The zero case we mean to deal with is when reading the MSR
wasn't valid to try.
Jan
|