mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: Borislav Petkov <bp@alien8.de>
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Michael Kelley <mikelley@microsoft.com>
Subject: Re: [PATCH v5 11/15] x86/mtrr: construct a memory map with cache modes
Date: Thu, 20 Apr 2023 17:10:03 +0200	[thread overview]
Message-ID: <bb77023b-8dd0-0551-5c16-92f184568161@suse.com> (raw)
In-Reply-To: <20230420145451.GFZEFSO6VmvXdK/qi9@fat_crate.local>


[-- Attachment #1.1.1: Type: text/plain, Size: 3108 bytes --]

On 20.04.23 16:54, Borislav Petkov wrote:
> On Thu, Apr 20, 2023 at 03:57:43PM +0200, Juergen Gross wrote:
>> So you are suggesting that prefetching can happen across one wrong speculated
>> branch, but not across two of them? And you are not worrying about prefetches
>> past the end of a copy with size > 0?
> 
> Maybe it will, maybe it won't.
> 
> I am worried about calling a function unnecessarily. I'm worried about
> calling the asm version __memmove() with zero length unnecessarily. I'm
> worried about executing the return thunk unnecessarily:
> 
> ffffffff8104c749:       48 83 c4 28             add    $0x28,%rsp
> ffffffff8104c74d:       e9 72 2a 9b 00          jmp    ffffffff819ff1c4 <__x86_return_thunk>
> ffffffff8104c752:       31 c0                   xor    %eax,%eax
> ffffffff8104c754:       e9 6b 2a 9b 00          jmp    ffffffff819ff1c4 <__x86_return_thunk>
> ffffffff8104c759:       0f 1f 80 00 00 00 00    nopl   0x0(%rax)
> 
> Just say that you don't want to do this simple check and I will do it
> myself because I'm tired of debating.

I just want to make sure to understand your concerns and that the reasoning
is sane.

You seem to feel rather strong here, so I'll add the test.

> 
>> "If two or more variable memory ranges match and one of the memory types is UC,
>> the UC memory type used."
>>
>> So technically no problem, apart from lower performance.
> 
> How do you come from "Write-combining to UC memory is not allowed" to
> "lower performance"?
> 
> Not allowed is not allowed. Geez.

Yes. And using UC instead of WC usually means lower performance of writes.

>> Would you be fine with adding that as an additional patch?
>>
>> I believe if we really want that, then we should be able to disable such a
>> cleanup. So it should be an add-on anyway.
> 
> Sure, whatever.

Okay, thanks.

I think this will need another final loop over the MTRRs to check against the
constructed map if a MTRR is completely useless.

Another question: in case we detect such a hidden MTRR, should it be disabled
in order to have more MTRRs available for run-time adding?

> 
>> I'm not against adding such additional checks. I wouldn't like to force them
>> into this series right now, because we need this series for Hyper-V isolated
>> guest support.
> 
> We will add this series when they're ready. If Hyper-V needs them
> immediately they can take whatever they want and do whatever they want.
> 
> Or you can do a simpler fix for Hyper-V that goes before this, if you
> want to address Hyper-V.
> 
>> Just to say it explicitly: you are concerned for the case that a complete
>> MTRR is hidden beneath another one (e.g. a large UC MTRR hiding a smaller
>> MTRR with another type, or a variable MTRR being hidden by fixed MTRRs)?
> 
> I am concerned about catching any and all inconsistencies with the MTRRs
> and catching them right. If we're going to spend all this time on this,
> then let's do it right, once and for all and do it in a manner that can
> be improved in the future.

Okay.


Juergen


[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3149 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

  reply	other threads:[~2023-04-20 15:10 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-01  6:36 [PATCH v5 00/15] x86/mtrr: fix handling with PAT but without MTRR Juergen Gross
2023-04-01  6:36 ` [PATCH v5 01/15] x86/mtrr: split off physical address size calculation Juergen Gross
2023-04-01  6:36 ` [PATCH v5 02/15] x86/mtrr: optimize mtrr_calc_physbits() Juergen Gross
2023-04-01  6:36 ` [PATCH v5 03/15] x86/mtrr: replace some constants with defines Juergen Gross
2023-04-03 16:03   ` Borislav Petkov
2023-04-05  7:55     ` Juergen Gross
2023-04-05 20:26       ` Borislav Petkov
2023-04-11 13:32         ` Juergen Gross
2023-04-01  6:36 ` [PATCH v5 04/15] x86/mtrr: support setting MTRR state for software defined MTRRs Juergen Gross
2023-04-03  2:25   ` Huang, Kai
2023-04-03  7:10     ` Juergen Gross
2023-04-03  9:27       ` Huang, Kai
2023-04-03  9:35         ` Juergen Gross
2023-04-03  9:44           ` Huang, Kai
2023-04-03  9:43         ` Huang, Kai
2023-04-11 13:20   ` Borislav Petkov
2023-04-11 13:31     ` Juergen Gross
2023-04-11 17:14       ` Borislav Petkov
2023-04-11 13:59     ` Michael Kelley (LINUX)
2023-04-11 14:04       ` Juergen Gross
2023-04-11 14:26         ` Borislav Petkov
2023-04-11 15:57           ` Juergen Gross
2023-04-11 17:15             ` Borislav Petkov
2023-04-12  8:30               ` Juergen Gross
2023-04-11 14:25       ` Borislav Petkov
2023-04-01  6:36 ` [PATCH v5 05/15] x86/hyperv: set MTRR state when running as SEV-SNP Hyper-V guest Juergen Gross
2023-04-02  2:36   ` Michael Kelley (LINUX)
2023-04-01  6:36 ` [PATCH v5 06/15] x86/xen: set MTRR state when running as Xen PV initial domain Juergen Gross
2023-04-01  6:36 ` [PATCH v5 07/15] x86/mtrr: replace vendor tests in MTRR code Juergen Gross
2023-04-12  8:45   ` Borislav Petkov
2023-04-12 10:25     ` Juergen Gross
2023-04-01  6:36 ` [PATCH v5 08/15] x86/mtrr: have only one set_mtrr() variant Juergen Gross
2023-04-12 12:30   ` Borislav Petkov
2023-04-12 12:56     ` Juergen Gross
2023-04-12 20:09       ` Borislav Petkov
2023-04-01  6:36 ` [PATCH v5 09/15] x86/mtrr: allocate mtrr_value array dynamically Juergen Gross
2023-04-12 21:11   ` Borislav Petkov
2023-04-13 10:07     ` Juergen Gross
2023-04-01  6:36 ` [PATCH v5 10/15] x86/mtrr: add get_effective_type() service function Juergen Gross
2023-04-01  6:36 ` [PATCH v5 11/15] x86/mtrr: construct a memory map with cache modes Juergen Gross
2023-04-20 12:15   ` Borislav Petkov
2023-04-20 12:30     ` Juergen Gross
2023-04-20 12:30       ` Juergen Gross
2023-04-20 13:01       ` Borislav Petkov
2023-04-20 13:57         ` Juergen Gross
2023-04-20 14:54           ` Borislav Petkov
2023-04-20 15:10             ` Juergen Gross [this message]
2023-04-21 11:23               ` Borislav Petkov
2023-04-21 14:35                 ` Juergen Gross
2023-04-01  6:36 ` [PATCH v5 12/15] x86/mtrr: use new cache_map in mtrr_type_lookup() Juergen Gross
2023-04-01  6:36 ` [PATCH v5 13/15] x86/mtrr: don't let mtrr_type_lookup() return MTRR_TYPE_INVALID Juergen Gross
2023-04-01  6:36 ` [PATCH v5 14/15] x86/mm: only check uniform after calling mtrr_type_lookup() Juergen Gross
2023-04-01  6:36 ` [PATCH v5 15/15] x86/mtrr: remove unused code Juergen Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bb77023b-8dd0-0551-5c16-92f184568161@suse.com \
    --to=jgross@suse.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikelley@microsoft.com \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®