Re: [PATCH 4/5] x86/kernel: Move page table macros to new header

2024-05-23 Thread Borislav Petkov
On Thu, May 23, 2024 at 03:59:43PM +0200, Thomas Gleixner wrote: > On Wed, Apr 10 2024 at 15:48, Jason Andryuk wrote: > > --- > > arch/x86/kernel/head_64.S| 22 ++ > > arch/x86/kernel/pgtable_64_helpers.h | 28 > > That's the wrong

Re: [PATCH v13 08/35] x86/fred: Disable FRED by default in its early stage

2024-01-22 Thread Borislav Petkov
On Tue, Dec 05, 2023 at 02:49:57AM -0800, Xin Li wrote: > Warning: use of this parameter will taint the kernel > and may cause unknown problems. > > + fred[X86-64] > + Enable flexible return and event delivery Let's

Re: [PATCH v13 07/35] x86/fred: Disable FRED support if CONFIG_X86_FRED is disabled

2024-01-22 Thread Borislav Petkov
On Tue, Dec 05, 2023 at 02:49:56AM -0800, Xin Li wrote: > From: "H. Peter Anvin (Intel)" > > Add CONFIG_X86_FRED to to make > cpu_feature_enabled() work correctly with FRED. > > Originally-by: Megha Dey > Signed-off-by: H. Peter Anvin (Intel) > Tested-by: Shan Kang > Signed-off-by: Xin Li

Re: [PATCH v13 01/35] x86/cpufeatures,opcode,msr: Add the WRMSRNS instruction support

2024-01-03 Thread Borislav Petkov
On Tue, Jan 02, 2024 at 10:06:27PM +, Li, Xin3 wrote: > Do I need to send an updated patch? > Or just leave it to the maintainer who is going to take care of it? While waiting, please take a look at this:

Re: [PATCH v13 01/35] x86/cpufeatures,opcode,msr: Add the WRMSRNS instruction support

2024-01-02 Thread Borislav Petkov
On Tue, Dec 05, 2023 at 02:49:50AM -0800, Xin Li wrote: > Subject: Re: [PATCH v13 01/35] x86/cpufeatures,opcode,msr: Add the WRMSRNS > instruction support Or simply "x86/fred: Add ... " Other than that, Acked-by: Borislav Petkov (AMD) -- Regards/Gruss, Boris. https://p

Re: [linus:master] [x86/entry] be5341eb0d: WARNING:CPU:#PID:#at_int80_emulation

2023-12-19 Thread Borislav Petkov
On Tue, Dec 19, 2023 at 04:49:14PM +0800, kernel test robot wrote: > [ 13.481107][ T48] WARNING: CPU: 0 PID: 48 at int80_emulation > (arch/x86/entry/common.c:164) > [ 13.481454][ T48] Modules linked in: > [ 13.481655][ T48] CPU: 0 PID: 48 Comm: init Tainted: G N >

Re: [PATCH v12 24/37] x86/idtentry: Incorporate definitions/declarations of the FRED entries

2023-11-28 Thread Borislav Petkov
On Tue, Nov 28, 2023 at 10:58:50AM -0800, H. Peter Anvin wrote: > >You have a very good sense  I've been reading code of a couple of people for a couple of years. :-) > Remember that Signed-off-by: relates to the *patch flow*. Yes, you should take the time to read Documentation/process/ and

Re: [PATCH v12 24/37] x86/idtentry: Incorporate definitions/declarations of the FRED entries

2023-11-28 Thread Borislav Petkov
On Mon, Oct 02, 2023 at 11:24:45PM -0700, Xin Li wrote: > FRED and IDT can share most of the definitions and declarations so > that in the majority of cases the actual handler implementation is the > same. > > The differences are the exceptions where FRED stores exception related > information on

Re: [PATCH v12 23/37] x86/fred: Make exc_page_fault() work for FRED

2023-11-28 Thread Borislav Petkov
On Mon, Oct 02, 2023 at 11:24:44PM -0700, Xin Li wrote: > From: "H. Peter Anvin (Intel)" > > On a FRED system, the faulting address (CR2) is passed on the stack, > to avoid the problem of transient state. Thus we get the page fault ^^ Please use

Re: [PATCH v12 20/37] x86/fred: Disallow the swapgs instruction when FRED is enabled

2023-11-28 Thread Borislav Petkov
On Mon, Oct 02, 2023 at 11:24:41PM -0700, Xin Li wrote: > + * Note, LKGS loads the GS base address into the IA32_KERNEL_GS_BASE > + * MSR instead of the GS segment’s descriptor cache. As such, the :verify_diff: WARNING: Unicode char [’] (0x8217 in line: + * MSR instead of the GS

Re: [PATCH v12 16/37] x86/ptrace: Add FRED additional information to the pt_regs structure

2023-11-28 Thread Borislav Petkov
On Mon, Oct 02, 2023 at 11:24:37PM -0700, Xin Li wrote: > FRED defines additional information in the upper 48 bits of cs/ss > fields. Therefore add the information definitions into the pt_regs > structure. > > Specially introduce a new structure fred_ss to denote the FRED flags > above SS

Re: [PATCH v12 15/37] x86/ptrace: Cleanup the definition of the pt_regs structure

2023-11-28 Thread Borislav Petkov
On Mon, Oct 02, 2023 at 11:24:36PM -0700, Xin Li wrote: > -/* Return frame for iretq */ > + > + /* The IRETQ return frame starts here */ > unsigned long ip; > - unsigned long cs; > + > + union { > + u64 csx;// The full 64-bit data slot containing CS > +

Re: [PATCH v12 01/37] x86/cpufeatures: Add the cpu feature bit for WRMSRNS

2023-11-13 Thread Borislav Petkov
On Tue, Nov 14, 2023 at 12:43:38AM +, Li, Xin3 wrote: > No. tglx asked for it: > https://lkml.kernel.org/kvm/87y1h81ht4.ffs@tglx/ Aha "According to the CPU folks FRED systems are guaranteed to have WRMSRNS - I asked for that :). It's just not yet documented." so I'm going to expect that to

Re: [PATCH v12 19/37] x86/fred: Update MSR_IA32_FRED_RSP0 during task switch

2023-11-13 Thread Borislav Petkov
On Mon, Nov 13, 2023 at 12:36:04PM -0500, H. Peter Anvin wrote: > A resource cannot be consumed after the value has been written; this > is the only necessary level of serialization, equivalent to, say, RAX. Lemme see if I understand this correctly using this context as an example: after this

Re: [PATCH v12 19/37] x86/fred: Update MSR_IA32_FRED_RSP0 during task switch

2023-11-13 Thread Borislav Petkov
On Mon, Oct 02, 2023 at 11:24:40PM -0700, Xin Li wrote: > From: "H. Peter Anvin (Intel)" > > MSR_IA32_FRED_RSP0 is used during ring 3 event delivery, and needs to > be updated to point to the top of next task stack during task switch. > > Signed-off-by: H. Peter Anvin (Intel) > Tested-by: Shan

Re: [PATCH v12 01/37] x86/cpufeatures: Add the cpu feature bit for WRMSRNS

2023-11-08 Thread Borislav Petkov
On Mon, Oct 02, 2023 at 11:24:22PM -0700, Xin Li wrote: > Subject: Re: [PATCH v12 01/37] x86/cpufeatures: Add the cpu feature bit for > WRMSRNS For all your text: s/cpu/CPU/g > WRMSRNS is an instruction that behaves exactly like

Re: [PATCH v3 1/5] x86/paravirt: move some functions and defines to alternative

2023-10-25 Thread Borislav Petkov
On Wed, Oct 25, 2023 at 03:31:07PM +0200, Juergen Gross wrote: > There is > > #define nop() asm volatile ("nop") > > in arch/x86/include/asm/special_insns.h already. Then call it "nop_func" or so. > It might not be needed now, but are you sure we won't need it in future? No, I'm not. What

Re: [PATCH v3 1/5] x86/paravirt: move some functions and defines to alternative

2023-10-25 Thread Borislav Petkov
On Thu, Oct 19, 2023 at 11:15:16AM +0200, Juergen Gross wrote: > +/* Low-level backend functions usable from alternative code replacements. */ > +DEFINE_ASM_FUNC(x86_nop, "", .entry.text); > +EXPORT_SYMBOL_GPL(x86_nop); This is all x86 code so you don't really need the "x86_" prefix - "nop" is

Re: [PATCH] Revert "EDAC/mce_amd: Do not load edac_mce_amd module on guests"

2023-09-15 Thread Borislav Petkov
On Thu, Sep 14, 2023 at 10:02:05AM -0700, Elliott Mitchell wrote: > Indeed. At what point is the lack of information and response long > enough to simply commit a revert due to those lacks? At no point. > Even with the commit message having been rewritten and the link to: >

Re: [PATCH] Revert "EDAC/mce_amd: Do not load edac_mce_amd module on guests"

2023-09-07 Thread Borislav Petkov
On Thu, Sep 07, 2023 at 08:08:00PM -0700, Elliott Mitchell wrote: > This reverts commit 767f4b620edadac579c9b8b6660761d4285fa6f9. > > There are at least 3 valid reasons why a VM may see MCE events/registers. Hmm, so they all read like a bunch of handwaving to me, with those probable hypothetical

Re: [PATCH v6 00/16] x86/mtrr: fix handling with PAT but without MTRR

2023-06-01 Thread Borislav Petkov
On Thu, Jun 01, 2023 at 03:22:33PM +0200, Borislav Petkov wrote: > Now lemme restart testing. This is from another box, with the latest changes incorporated: https://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git/log/?h=rc1-mtrr --- proc-mtrr.before2011-03-04 01:03:35.243994733 +0

Re: [PATCH v6 00/16] x86/mtrr: fix handling with PAT but without MTRR

2023-06-01 Thread Borislav Petkov
On Thu, Jun 01, 2023 at 10:19:01AM +0200, Juergen Gross wrote: > Patch 2 wants this diff on top: Obviously. :-) That fixes it, thx. Now lemme restart testing. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette

Re: [PATCH v6 00/16] x86/mtrr: fix handling with PAT but without MTRR

2023-06-01 Thread Borislav Petkov
On Thu, Jun 01, 2023 at 08:39:17AM +0200, Juergen Gross wrote: > Does this translate to: "we should remove that cleanup crap"? I'd be > positive to that. :-) Why, what's wrong with that thing? -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette

Re: [PATCH v6 00/16] x86/mtrr: fix handling with PAT but without MTRR

2023-05-31 Thread Borislav Petkov
On Wed, May 31, 2023 at 11:31:37AM +0200, Juergen Gross wrote: > What it did would have been printed if pr_debug() would have been > active. :-( Lemme turn those into pr_info(). pr_debug() is nuts. > Did you check whether CONFIG_MTRR_SANITIZER_ENABLE_DEFAULT was the same in > both > kernels

Re: [PATCH v6 00/16] x86/mtrr: fix handling with PAT but without MTRR

2023-05-31 Thread Borislav Petkov
On Wed, May 31, 2023 at 09:28:57AM +0200, Juergen Gross wrote: > Can you please boot the system with the MTRR patches and specify "mtrr=debug" > on the command line? I'd be interested in the raw register values being read > and the resulting memory type map. This is exactly why I wanted this

Re: [PATCH v6 00/16] x86/mtrr: fix handling with PAT but without MTRR

2023-05-30 Thread Borislav Petkov
On Mon, May 22, 2023 at 04:17:50PM +0200, Juergen Gross wrote: > The attached diff is for patch 13. Merged and pushed out into same branch. Next issue. Diffing /proc/mtrr shows: --- proc-mtrr.6.3 2023-05-30 17:00:13.215999483 +0200 +++ proc-mtrr.after 2023-05-30 16:01:38.281997816

Re: [PATCH v6 00/16] x86/mtrr: fix handling with PAT but without MTRR

2023-05-11 Thread Borislav Petkov
On Wed, May 10, 2023 at 05:53:15PM +0200, Juergen Gross wrote: > Urgh, yes, there is something missing: > > diff --git a/arch/x86/kernel/cpu/mtrr/generic.c > b/arch/x86/kernel/cpu/mtrr/generic.c > index 031f7ea8e72b..9544e7d13bb3 100644 > --- a/arch/x86/kernel/cpu/mtrr/generic.c > +++

Re: [PATCH v6 00/16] x86/mtrr: fix handling with PAT but without MTRR

2023-05-10 Thread Borislav Petkov
On Wed, May 10, 2023 at 03:30:24PM +0200, Borislav Petkov wrote: > So this map lookup thing is wrong in this case. Btw, current tree is: https://git.kernel.org/pub/scm/linux/kernel/git/bp/bp.git/log/?h=rc1-mtrr -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette

Re: [PATCH v6 00/16] x86/mtrr: fix handling with PAT but without MTRR

2023-05-10 Thread Borislav Petkov
On Wed, May 10, 2023 at 01:36:41AM +0200, Borislav Petkov wrote: > More staring at this tomorrow, on a clear head. Yeah, I'm going to leave it as is. Tried doing a union with bitfields but doesn't get any prettier. Next crapola: The Intel box says now: [8.138683] sgx: EPC sect

Re: [PATCH v6 00/16] x86/mtrr: fix handling with PAT but without MTRR

2023-05-09 Thread Borislav Petkov
On Tue, May 09, 2023 at 10:14:37PM +0200, Borislav Petkov wrote: > On Tue, May 02, 2023 at 02:09:15PM +0200, Juergen Gross wrote: > > This series tries to fix the rather special case of PAT being available > > without having MTRRs (either due to CONFIG_MTRR being not set,

Re: [PATCH v6 00/16] x86/mtrr: fix handling with PAT but without MTRR

2023-05-09 Thread Borislav Petkov
On Tue, May 02, 2023 at 02:09:15PM +0200, Juergen Gross wrote: > This series tries to fix the rather special case of PAT being available > without having MTRRs (either due to CONFIG_MTRR being not set, or > because the feature has been disabled e.g. by a hypervisor). More weird stuff. With the

Re: [PATCH v6 00/16] x86/mtrr: fix handling with PAT but without MTRR

2023-05-03 Thread Borislav Petkov
On Wed, May 03, 2023 at 11:14:25AM -0700, Sohil Mehta wrote: > A Nit -> Documentation/process/maintainer-tip.rst suggests: > "The condensed patch description in the subject line should start with a > uppercase letter and ..." Yeah, good point. But my patch massaging script does that

Re: [PATCH v4 05/12] x86/xen: set MTRR state when running as Xen PV initial domain

2023-03-23 Thread Borislav Petkov
On Mon, Mar 06, 2023 at 05:34:18PM +0100, Juergen Gross wrote: > + for (reg = 0; reg < MTRR_MAX_VAR_RANGES; reg++) { > + op.u.read_memtype.reg = reg; > + if (HYPERVISOR_platform_op()) > + break; > + > + /* > + * Only called

Re: [PATCH v2] x86/paravirt: merge activate_mm and dup_mmap callbacks

2023-03-06 Thread Borislav Petkov
On Thu, Feb 23, 2023 at 04:05:51PM +0100, Juergen Gross wrote: > x86 maintainers, I think this patch should be carried via the tip tree. You missed a spot. I'll whack it. diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h index a8b323266179..c3ad8a526378 100644

Re: [PATCH v7 13/41] mm: Make pte_mkwrite() take a VMA

2023-03-02 Thread Borislav Petkov
On Mon, Feb 27, 2023 at 02:29:29PM -0800, Rick Edgecombe wrote: > [0] > https://lore.kernel.org/lkml/0e29a2d0-08d8-bcd6-ff26-4bea0e403...@redhat.com/#t I guess that sub-thread about how you arrived at this "pass a VMA" decision should be in the Link tag. But that's for the committer, I'd say.

Re: [PATCH v2 4/7] x86/power: Inline write_cr[04]()

2023-01-20 Thread Borislav Petkov
On Mon, Jan 16, 2023 at 03:25:37PM +0100, Peter Zijlstra wrote: > Since we can't do CALL/RET until GS is restored and CR[04] pinning is ^^ Ditto like for the previous one. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette

Re: [PATCH v2 3/7] x86/power: De-paravirt restore_processor_state()

2023-01-20 Thread Borislav Petkov
On Mon, Jan 16, 2023 at 03:25:36PM +0100, Peter Zijlstra wrote: > Since Xen PV doesn't use restore_processor_state(), and we're going to > have to avoid CALL/RET until at least GS is restored, Drop the "we": "..., and CALL/RET cannot happen before GS has been restored, ..." -- Regards/Gruss,

Re: [PATCH v2 2/7] x86/boot: Delay sev_verify_cbit() a bit

2023-01-19 Thread Borislav Petkov
On Mon, Jan 16, 2023 at 03:25:35PM +0100, Peter Zijlstra wrote: > Per the comment it is important to call sev_verify_cbit() before the > first RET instruction, this means we can delay calling this until more Make that "... this means that this can be delayed until... " And I believe this is not

Re: [PATCH v2 1/2] x86: Check return values from early_memremap calls

2023-01-04 Thread Borislav Petkov
On Thu, Nov 10, 2022 at 08:07:53AM -0800, Dave Hansen wrote: > On 11/10/22 07:45, Ross Philipson wrote: > > dt = early_memremap(initial_dtb, map_len); > > + if (!dt) { > > + pr_warn("failed to memremap initial dtb\n"); > > + return; > > + } > > Are all of these new

Re: [PATCH v3] x86/boot: skip realmode init code when running as Xen PV guest

2022-11-24 Thread Borislav Petkov
On Thu, Nov 24, 2022 at 02:30:39PM +0100, Juergen Gross wrote: > Looking at the date when 084ee1c641a0 went in I don't think it _needs_ > to go in now, but I wouldn't complain ... So if you don't have a particular and specific reason, I won't queue it for stable at all. -- Regards/Gruss,

Re: [PATCH v3] x86/boot: skip realmode init code when running as Xen PV guest

2022-11-24 Thread Borislav Petkov
On Wed, Nov 23, 2022 at 12:45:23PM +0100, Juergen Gross wrote: > When running as a Xen PV guest there is no need for setting up the > realmode trampoline, as realmode isn't supported in this environment. > > Trying to setup the trampoline has been proven to be problematic in > some cases,

Re: [PATCH] x86/xen: simplify sysenter and syscall setup

2022-10-20 Thread Borislav Petkov
On Thu, Oct 20, 2022 at 01:36:19PM +0200, Juergen Gross wrote: > xen_enable_sysenter() and xen_enable_syscall() can be simplified a lot. > > Signed-off-by: Juergen Gross > --- > arch/x86/xen/setup.c | 23 ++- > 1 file changed, 6 insertions(+), 17 deletions(-) > > diff --git

Re: [PATCH 1/2] x86: Check return values from early_memremap calls

2022-10-12 Thread Borislav Petkov
On Wed, Oct 12, 2022 at 11:13:20AM -0400, Ross Philipson wrote: > I am already using the pr_* macros in the patches. Are you asking me to do > something Yes. You do pr_X("prefix_string: msg" while you should set the prefix string and do pr_X("msg". As said, grep the tree for examples where

Re: [PATCH 1/2] x86: Check return values from early_memremap calls

2022-10-08 Thread Borislav Petkov
Adding Xen and Jailhouse people and MLs to Cc. Folks, thread starts here: https://lore.kernel.org/r/1650035401-22855-1-git-send-email-ross.philip...@oracle.com On Fri, Apr 15, 2022 at 11:10:00AM -0400, Ross Philipson wrote: > There are a number of places where early_memremap is called > but the

Re: [PATCH v3 08/10] x86/mtrr: let cache_aps_delayed_init replace mtrr_aps_delayed_init

2022-09-30 Thread Borislav Petkov
On Fri, Sep 30, 2022 at 03:11:07PM +0200, Juergen Gross wrote: > Yes, this can be done. It would practically have to be the first one just > after CPUHP_BRINGUP_CPU. Right. > The question is whether we really want to call the MTRR/PAT initialization > on hotplugged cpus only after enabling

Re: [PATCH v3 08/10] x86/mtrr: let cache_aps_delayed_init replace mtrr_aps_delayed_init

2022-09-30 Thread Borislav Petkov
On Thu, Sep 29, 2022 at 10:26:59AM +0200, Juergen Gross wrote: > So right now I'm inclined to be better on the safe side by not adding any > cpu hotplug hook, but to use just the same "delayed AP init" flag as today, > just renaming it. This would leave the delayed MTRR/PAT init in place for >

Re: [PATCH v3 08/10] x86/mtrr: let cache_aps_delayed_init replace mtrr_aps_delayed_init

2022-09-28 Thread Borislav Petkov
On Wed, Sep 28, 2022 at 06:32:20PM +0200, Juergen Gross wrote: > I can do that. Thx! -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette

Re: [PATCH v3 08/10] x86/mtrr: let cache_aps_delayed_init replace mtrr_aps_delayed_init

2022-09-28 Thread Borislav Petkov
On Wed, Sep 28, 2022 at 03:43:56PM +0200, Juergen Gross wrote: > Would you feel better with adding a new enum member CPUHP_AP_CACHECTRL_ONLINE? > > This would avoid a possible source of failure during resume in case no slot > for CPUHP_AP_ONLINE_DYN is found (quite improbable, but in theory

Re: [PATCH v3 08/10] x86/mtrr: let cache_aps_delayed_init replace mtrr_aps_delayed_init

2022-09-28 Thread Borislav Petkov
On Wed, Sep 28, 2022 at 01:14:11PM +0200, Juergen Gross wrote: > No, we don't. > > Using basically your patch, but with > > + mtrr_online = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, > + "x86/mtrr:online", > +

Re: [PATCH v3 08/10] x86/mtrr: let cache_aps_delayed_init replace mtrr_aps_delayed_init

2022-09-28 Thread Borislav Petkov
On Wed, Sep 28, 2022 at 08:16:53AM +0200, Juergen Gross wrote: > > Are sure the hotplug notifier doesn't get called in the boot and in the It doesn't because it gets registered after smp_init()... > > resume cases? ... but it gets called during resume because by that time the notifier has been

Re: [PATCH v3 08/10] x86/mtrr: let cache_aps_delayed_init replace mtrr_aps_delayed_init

2022-09-27 Thread Borislav Petkov
On Tue, Sep 27, 2022 at 02:21:17PM +0200, Juergen Gross wrote: > So replacing the bool with "(system_state != SYSTEM_RUNNING)" is fine > with you right now? We can later switch that to the "more elegant" > solution when it shows up. Ok, I think I have something. And it was staring me straight in

Re: [PATCH v3 08/10] x86/mtrr: let cache_aps_delayed_init replace mtrr_aps_delayed_init

2022-09-27 Thread Borislav Petkov
On Tue, Sep 27, 2022 at 01:25:47PM +0200, Juergen Gross wrote: > You mean by replacing it with "(system_state != SYSTEM_RUNNING)" ? Right, or maybe even something more elegant. I've been meaning to ask tglx about it as I needed it for the microcode loader too. -- Regards/Gruss, Boris.

Re: [PATCH v3 08/10] x86/mtrr: let cache_aps_delayed_init replace mtrr_aps_delayed_init

2022-09-27 Thread Borislav Petkov
On Tue, Sep 27, 2022 at 12:14:42PM +0200, Juergen Gross wrote: > Yes: cpu hotplug. You might need to elaborate here. Because I see mtrr_ap_init() on the AP hotplug path: native_cpu_up-> do_boot_cpu-> start_secondary-> smp_callin-> smp_store_cpu_info-> identify_secondary_cpu-> mtrr_ap_init

Re: [PATCH v3 08/10] x86/mtrr: let cache_aps_delayed_init replace mtrr_aps_delayed_init

2022-09-27 Thread Borislav Petkov
On Tue, Sep 27, 2022 at 10:57:37AM +0200, Juergen Gross wrote: > TBH I don't see the point of having an accessor which is just setting a > variable to "true". But if you like it better, I can keep it. Accessors are always better, no matter how silly. :) But, in trying to grok your next patch -

Re: [PATCH v3 08/10] x86/mtrr: let cache_aps_delayed_init replace mtrr_aps_delayed_init

2022-09-26 Thread Borislav Petkov
On Thu, Sep 08, 2022 at 10:49:12AM +0200, Juergen Gross wrote: > -void set_mtrr_aps_delayed_init(void) > -{ > - if (!cache_generic) > - return; > - > - mtrr_aps_delayed_init = true; > -} > - Except that you've removed the accessors and made that bool global. Which is less

Re: [PATCH v3 07/10] x86/mtrr: simplify mtrr_bp_init()

2022-09-26 Thread Borislav Petkov
On Thu, Sep 08, 2022 at 10:49:11AM +0200, Juergen Gross wrote: > diff --git a/arch/x86/kernel/cpu/mtrr/mtrr.c b/arch/x86/kernel/cpu/mtrr/mtrr.c > index 9609a0d235f8..956838bb4481 100644 > --- a/arch/x86/kernel/cpu/mtrr/mtrr.c > +++ b/arch/x86/kernel/cpu/mtrr/mtrr.c > @@ -761,13 +761,10 @@ void

Re: [PATCH v3 05/10] x86/mtrr: split generic_set_all()

2022-09-19 Thread Borislav Petkov
On Thu, Sep 08, 2022 at 10:49:09AM +0200, Juergen Gross wrote: > Split generic_set_all() into multiple parts, while moving the main > function body into cacheinfo.c. > > This prepares the support of PAT without needing MTRR support by "Prepare PAT support without ... " > moving the main

Re: [PATCH v3 03/10] x86/mtrr: replace use_intel() with a local flag

2022-09-19 Thread Borislav Petkov
On Mon, Sep 12, 2022 at 11:10:29AM +0200, Juergen Gross wrote: > In the end this variable doesn't specify which caching types are available, > but the ways to select/control the caching types. > > So what about "memory_caching_select" or "memory_caching_control" instead? _control sounds like the

Re: [PATCH v2 02/10] x86/mtrr: remove unused cyrix_set_all() function

2022-08-25 Thread Borislav Petkov
On Thu, Aug 25, 2022 at 12:41:05PM +0200, Juergen Gross wrote: > Maybe the alternative reasoning is much faster to understand: if the > Cyrix set_all() could be called, the AMD and Centaur ones would be callable, > too. Right. > Those being called would result in a NULL deref, so why should we

Re: [PATCH v2 01/10] x86/mtrr: fix MTRR fixup on APs

2022-08-22 Thread Borislav Petkov
On Mon, Aug 22, 2022 at 07:17:40AM +0200, Juergen Gross wrote: > And then there is mtrr_state_warn() in arch/x86/kernel/cpu/mtrr/generic.c > which has a comment saying: > > /* Some BIOS's are messed up and don't set all MTRRs the same! */ That thing also says: pr_info("mtrr: probably

Re: [PATCH v2 01/10] x86/mtrr: fix MTRR fixup on APs

2022-08-21 Thread Borislav Petkov
On Sun, Aug 21, 2022 at 02:25:59PM +0200, Borislav Petkov wrote: > > Fix that by using percpu variables for saving the MSR contents. > > > > Cc: sta...@vger.kernel.org > > Signed-off-by: Juergen Gross > > --- > > I thought adding a "Fixes:" tag for t

Re: [PATCH v2 01/10] x86/mtrr: fix MTRR fixup on APs

2022-08-21 Thread Borislav Petkov
On Sat, Aug 20, 2022 at 11:25:24AM +0200, Juergen Gross wrote: > When booting or resuming the system MTRR state is saved on the boot > processor and then this state is loaded into MTRRs of all other cpus. s/cpu/CPU/g Pls check all commit messages. > During update of the MTRRs the MTRR mechanism

Re: PING [PATCH 3/3] x86: decouple pat and mtrr handling

2022-08-13 Thread Borislav Petkov
On Sat, Aug 13, 2022 at 05:40:34PM -0400, Chuck Zmudzinski wrote: > I did a search for Juergen Gross on lkml and he is active submitting and > reviewing patches during the past few weeks. However, he is ignoring > comments on his patch to fix this regression. Please stop this non-sense and be

Re: PING [PATCH 3/3] x86: decouple pat and mtrr handling

2022-08-13 Thread Borislav Petkov
On Sat, Aug 13, 2022 at 12:56:44PM -0400, Chuck Zmudzinski wrote: > Why has Juergen not at least responded in some way to the > comments that Boris has made here? Why has Boris not > pinged Juergen by now, How about: it is summer here and people usually take their vacations during that time and

Re: [PATCH 3/3] x86: decouple pat and mtrr handling

2022-07-19 Thread Borislav Petkov
On Fri, Jul 15, 2022 at 04:25:49PM +0200, Juergen Gross wrote: > Today PAT is usable only with MTRR being active, with some nasty tweaks > to make PAT usable when running as Xen PV guest, which doesn't support > MTRR. > > The reason for this coupling is, that both, PAT MSR changes and MTRR >

Re: [PATCH 1/3] x86: move some code out of arch/x86/kernel/cpu/mtrr

2022-07-18 Thread Borislav Petkov
On Fri, Jul 15, 2022 at 04:25:47PM +0200, Juergen Gross wrote: > diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c > index 736262a76a12..e43322f8a4ef 100644 > --- a/arch/x86/kernel/cpu/common.c > +++ b/arch/x86/kernel/cpu/common.c I guess the move's ok but not into

Re: [PATCH 0/3] x86: make pat and mtrr independent from each other

2022-07-16 Thread Borislav Petkov
On Sat, Jul 16, 2022 at 07:32:46AM -0400, Chuck Zmudzinski wrote: > Can you confirm that with this patch series you are trying > to fix that regression? Yes, this patchset is aimed to fix the whole situation but please don't do anything yet - I need to find time and look at the whole approach

Re: [PATCH] x86/PAT: have pat_enabled() properly reflect state when running on e.g. Xen

2022-07-11 Thread Borislav Petkov
On Thu, Jul 07, 2022 at 08:38:44AM +0200, Jan Beulich wrote: > Well, right now the pvops hook for Xen swallows #GP anyway (wrongly > so imo, but any of my earlier pointing out of that has been left > unheard, despite even the code comments there saying "It may be worth > changing that"). Oh

Re: [PATCH] x86/PAT: have pat_enabled() properly reflect state when running on e.g. Xen

2022-07-05 Thread Borislav Petkov
On Tue, Jul 05, 2022 at 05:56:36PM +0200, Jan Beulich wrote: > Re-using pat_disabled like you do in your suggestion below won't > work, because mtrr_bp_init() calls pat_disable() when MTRRs > appear to be disabled (from the kernel's view). The goal is to > honor "nopat" without honoring any other

Re: [PATCH V1 3/6] xen/virtio: Add option to restrict memory access under Xen

2022-04-26 Thread Borislav Petkov
On Tue, Apr 26, 2022 at 11:36:40AM +0200, Juergen Gross wrote: > As the suggestion was to add another flag this wouldn't be a problem IMO. We had a problem already with adding one flag would break the same flag on the other guest type. That's why we added cc_vendor too. So it can be tricky. >

Re: [PATCH V1 3/6] xen/virtio: Add option to restrict memory access under Xen

2022-04-25 Thread Borislav Petkov
On Mon, Apr 25, 2022 at 11:38:36PM +0300, Oleksandr wrote: > diff --git a/include/linux/cc_platform.h b/include/linux/cc_platform.h > index efd8205..d06bc7a 100644 > --- a/include/linux/cc_platform.h > +++ b/include/linux/cc_platform.h > @@ -72,6 +72,19 @@ enum cc_attr { > * Examples

Re: [PATCH 3/5] hyperv/IOMMU: Enable swiotlb bounce buffer for Isolation VM

2021-11-16 Thread Borislav Petkov
On Tue, Nov 16, 2021 at 10:39:21AM -0500, Tianyu Lan wrote: > diff --git a/arch/x86/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c > index 35487305d8af..65bc385ae07a 100644 > --- a/arch/x86/mm/mem_encrypt.c > +++ b/arch/x86/mm/mem_encrypt.c > @@ -31,6 +31,7 @@ > #include > #include > #include

Re: [PATCH v0 42/42] notifier: Return an error when callback is already registered

2021-11-08 Thread Borislav Petkov
On Mon, Nov 08, 2021 at 03:59:26PM -0500, Alan Stern wrote: > Is there really any reason for returning an error code? For example, is > it anticipated that at some point in the future these registration calls > might fail? > > Currently, the only reason for failing... Right, I believe with

Re: [PATCH v0 00/42] notifiers: Return an error when callback is already registered

2021-11-08 Thread Borislav Petkov
On Mon, Nov 08, 2021 at 11:23:13AM -0500, Steven Rostedt wrote: > Question, how often does this warning trigger? Is it common to see in > development? Yeah, haven't seen it myself yet. But we hashed it out over IRC. :-) -- Regards/Gruss, Boris.

Re: [PATCH v0 42/42] notifier: Return an error when callback is already registered

2021-11-08 Thread Borislav Petkov
On Mon, Nov 08, 2021 at 05:12:16PM +0100, Geert Uytterhoeven wrote: > Returning void is the other extreme ;-) > > There are 3 levels (ignoring BUG_ON()/panic () inside the callee): > 1. Return void: no one can check success or failure, > 2. Return an error code: up to the caller to decide, >

Re: [PATCH v0 42/42] notifier: Return an error when callback is already registered

2021-11-08 Thread Borislav Petkov
On Mon, Nov 08, 2021 at 04:25:47PM +0100, Geert Uytterhoeven wrote: > I'm not against returning proper errors codes. I'm against forcing > callers to check things that cannot fail and to add individual error > printing to each and every caller. If you're against checking things at the callers,

Re: [PATCH v0 00/42] notifiers: Return an error when callback is already registered

2021-11-08 Thread Borislav Petkov
On Mon, Nov 08, 2021 at 03:24:39PM +0100, Borislav Petkov wrote: > I guess I can add another indirection to notifier_chain_register() and > avoid touching all the call sites. IOW, something like this below. This way I won't have to touch all the callsites and the registration routines

Re: [PATCH v0 00/42] notifiers: Return an error when callback is already registered

2021-11-08 Thread Borislav Petkov
On Mon, Nov 08, 2021 at 09:17:03AM -0500, Alan Stern wrote: > What reason is there for moving the check into the callers? It seems > like pointless churn. Why not add the error return code, change the > WARN to pr_warn, and leave the callers as they are? Wouldn't that end > up having exactly

Re: [PATCH v0 42/42] notifier: Return an error when callback is already registered

2021-11-08 Thread Borislav Petkov
On Mon, Nov 08, 2021 at 03:07:03PM +0100, Geert Uytterhoeven wrote: > I think the addition of __must_check is overkill, leading to the > addition of useless error checks and message printing. See the WARN in notifier_chain_register() - it will already do "message printing". > Many callers call

[PATCH v0 00/42] notifiers: Return an error when callback is already registered

2021-11-08 Thread Borislav Petkov
From: Borislav Petkov Hi all, this is a huge patchset for something which is really trivial - it changes the notifier registration routines to return an error value if a notifier callback is already present on the respective list of callbacks. For more details scroll to the last patch

[PATCH v0 42/42] notifier: Return an error when callback is already registered

2021-11-08 Thread Borislav Petkov
From: Borislav Petkov The notifier registration routine doesn't return a proper error value when a callback has already been registered, leading people to track whether that registration has happened at the call site: https://lore.kernel.org/amd-gfx/20210512013058.6827-1-mukul.jo...@amd.com

[PATCH v0 18/42] drivers/xen: Check notifier registration return value

2021-11-08 Thread Borislav Petkov
From: Borislav Petkov Avoid homegrown notifier registration checks. No functional changes. Signed-off-by: Borislav Petkov Cc: xen-devel@lists.xenproject.org --- drivers/xen/manage.c | 3 ++- drivers/xen/xenbus/xenbus_probe.c | 8 +--- 2 files changed, 7 insertions(+), 4

[PATCH v0 02/42] xen/x86: Check notifier registration return value

2021-11-08 Thread Borislav Petkov
From: Borislav Petkov Avoid homegrown notifier registration checks. No functional changes. Signed-off-by: Borislav Petkov Cc: xen-devel@lists.xenproject.org --- arch/x86/xen/enlighten.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/xen/enlighten.c b/arch/x86

Re: [PATCH V4 04/50] x86/xen: Add xenpv_restore_regs_and_return_to_usermode()

2021-11-02 Thread Borislav Petkov
On Tue, Nov 02, 2021 at 12:22:50PM +0100, H. Peter Anvin wrote: > It would be interesting to have an "override function with jmp" > alternatives macro. It doesn't require any changes to the alternatives > mechanism proper (but possibly to objtool): it would just insert an > alternatives entry

Re: [PATCH V4 04/50] x86/xen: Add xenpv_restore_regs_and_return_to_usermode()

2021-11-02 Thread Borislav Petkov
On Tue, Nov 02, 2021 at 05:19:46PM +0800, Lai Jiangshan wrote: > It will add a 5-byte NOP at the beginning of the native > swapgs_restore_regs_and_return_to_usermode. So? > I avoided adding unneeded code in the native code even if it is NOPs > and avoided melting xenpv-one into the native one

Re: [PATCH V4 04/50] x86/xen: Add xenpv_restore_regs_and_return_to_usermode()

2021-11-02 Thread Borislav Petkov
On Tue, Oct 26, 2021 at 10:13:34PM +0800, Lai Jiangshan wrote: > From: Lai Jiangshan > > While in the native case, PER_CPU_VAR(cpu_tss_rw + TSS_sp0) is the > trampoline stack. But XEN pv doesn't use trampoline stack, so > PER_CPU_VAR(cpu_tss_rw + TSS_sp0) is also the kernel stack. Hence source

Re: [PATCH] x86/setup: call early_reserve_memory() earlier

2021-09-16 Thread Borislav Petkov
On Thu, Sep 16, 2021 at 12:09:27PM +0300, Mike Rapoport wrote: > I think the first sentence about reserving memory before memblock > allocations are possible is important and I think we should keep it. I expanded that comment this way: /* * Do some memory reservations *before*

Re: [PATCH] x86/setup: call early_reserve_memory() earlier

2021-09-15 Thread Borislav Petkov
You forgot to Cc Mike, lemme add him. And drop stable@ too. On Tue, Sep 14, 2021 at 01:06:22PM +0200, Juergen Gross wrote: > On 14.09.21 12:03, Jan Beulich wrote: > > On 14.09.2021 11:41, Juergen Gross wrote: > > > Commit a799c2bd29d19c565 ("x86/setup: Consolidate early memory > > >

Re: [RFC PATCH V3 03/11] x86/Hyper-V: Add new hvcall guest address host visibility support

2021-05-30 Thread Borislav Petkov
On Sun, May 30, 2021 at 11:06:20AM -0400, Tianyu Lan wrote: > diff --git a/arch/x86/mm/pat/set_memory.c b/arch/x86/mm/pat/set_memory.c > index 156cd235659f..a82975600107 100644 > --- a/arch/x86/mm/pat/set_memory.c > +++ b/arch/x86/mm/pat/set_memory.c > @@ -29,6 +29,8 @@ > #include > #include >

Re: [PATCH v6 00/12] x86: major paravirt cleanup

2021-03-11 Thread Borislav Petkov
On Thu, Mar 11, 2021 at 01:50:26PM +0100, Borislav Petkov wrote: > and move the cleanups patches 13 and 14 to the beginning of the set? Yeah, 14 needs ALTERNATIVE_TERNARY so I guess after patch 5, that is. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette

Re: [PATCH v6 00/12] x86: major paravirt cleanup

2021-03-11 Thread Borislav Petkov
On Tue, Mar 09, 2021 at 02:48:01PM +0100, Juergen Gross wrote: > This is a major cleanup of the paravirt infrastructure aiming at > eliminating all custom code patching via paravirt patching. > > This is achieved by using ALTERNATIVE instead, leading to the ability > to give objtool access to the

Re: [PATCH v6 05/12] x86/alternative: support ALTERNATIVE_TERNARY

2021-03-10 Thread Borislav Petkov
On Tue, Mar 09, 2021 at 02:48:06PM +0100, Juergen Gross wrote: > diff --git a/arch/x86/include/asm/alternative.h > b/arch/x86/include/asm/alternative.h > index 89889618ae01..4fb844e29d26 100644 > --- a/arch/x86/include/asm/alternative.h > +++ b/arch/x86/include/asm/alternative.h > @@ -178,6

Re: [PATCH v6 04/12] x86/alternative: support not-feature

2021-03-10 Thread Borislav Petkov
On Wed, Mar 10, 2021 at 08:52:40AM +0100, Jürgen Groß wrote: > Did you look at patch 13? :-) Well, I usually review in increasing patch order. :-P But make that change here pls because otherwise unnecessary churn. Thx. -- Regards/Gruss, Boris.

Re: [PATCH v6 02/12] x86/paravirt: switch time pvops functions to use static_call()

2021-03-10 Thread Borislav Petkov
On Wed, Mar 10, 2021 at 08:51:22AM +0100, Jürgen Groß wrote: > It is combining the two needed actions: update the static call and > set the paravirt_using_native_sched_clock boolean. I actually meant what the point of using_native_sched_clock() is but put this comment at the wrong place, sorry.

Re: [PATCH v6 04/12] x86/alternative: support not-feature

2021-03-09 Thread Borislav Petkov
On Tue, Mar 09, 2021 at 02:48:05PM +0100, Juergen Gross wrote: > Add support for alternative patching for the case a feature is not > present on the current cpu. > > For users of ALTERNATIVE() and friends an inverted feature is specified > by applying the ALT_NOT() macro to it, e.g.: > >

Re: [PATCH v6 02/12] x86/paravirt: switch time pvops functions to use static_call()

2021-03-09 Thread Borislav Petkov
On Tue, Mar 09, 2021 at 02:48:03PM +0100, Juergen Gross wrote: > @@ -167,6 +168,17 @@ static u64 native_steal_clock(int cpu) > return 0; > } > > +DEFINE_STATIC_CALL(pv_steal_clock, native_steal_clock); > +DEFINE_STATIC_CALL(pv_sched_clock, native_sched_clock); > + > +bool

Re: [PATCH v5 11/12] x86/paravirt: switch functions with custom code to ALTERNATIVE

2021-03-08 Thread Borislav Petkov
On Mon, Mar 08, 2021 at 01:28:43PM +0100, Juergen Gross wrote: > diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h > index 36cd71fa097f..04b3067f31b5 100644 > --- a/arch/x86/include/asm/paravirt.h > +++ b/arch/x86/include/asm/paravirt.h > @@ -137,7 +137,8 @@ static

Re: [PATCH v4 07/15] x86/paravirt: switch time pvops functions to use static_call()

2021-02-01 Thread Borislav Petkov
On Wed, Jan 20, 2021 at 02:55:47PM +0100, Juergen Gross wrote: > The time pvops functions are the only ones left which might be > used in 32-bit mode and which return a 64-bit value. > > Switch them to use the static_call() mechanism instead of pvops, as > this allows quite some simplification of

Re: [PATCH v3 07/15] x86/alternative: support "not feature" and ALTERNATIVE_TERNARY

2021-01-19 Thread Borislav Petkov
On Tue, Jan 19, 2021 at 12:35:42PM +0100, Jürgen Groß wrote: > In fact this should rather be named "X86_FEATURE_TRUE", as this is its > semantics. > > And I think I can define it to the value 0x instead of using a > "real" bit for it. A real bit is cheap - a special value to pay attention to

Re: [PATCH v3 08/15] x86: add new features for paravirt patching

2021-01-14 Thread Borislav Petkov
On Thu, Jan 14, 2021 at 07:30:24PM +0100, Borislav Petkov wrote: > On Thu, Dec 17, 2020 at 09:12:57PM +0800, kernel test robot wrote: > >ld: arch/x86/kernel/alternative.o: in function `paravirt_set_cap': > > >> arch/x86/kernel/alternative.c:605

  1   2   >