lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 20 Oct 2023 11:58:58 +0000
From:   "Huang, Kai" <kai.huang@...el.com>
To:     "kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "mingo@...hat.com" <mingo@...hat.com>,
        "dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
        "x86@...nel.org" <x86@...nel.org>, "bp@...en8.de" <bp@...en8.de>
CC:     "Edgecombe, Rick P" <rick.p.edgecombe@...el.com>,
        "Reshetova, Elena" <elena.reshetova@...el.com>,
        "rafael@...nel.org" <rafael@...nel.org>,
        "Nakajima, Jun" <jun.nakajima@...el.com>,
        "peterz@...radead.org" <peterz@...radead.org>,
        "sathyanarayanan.kuppuswamy@...ux.intel.com" 
        <sathyanarayanan.kuppuswamy@...ux.intel.com>,
        "thomas.lendacky@....com" <thomas.lendacky@....com>,
        "Hunter, Adrian" <adrian.hunter@...el.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "kexec@...ts.infradead.org" <kexec@...ts.infradead.org>,
        "linux-coco@...ts.linux.dev" <linux-coco@...ts.linux.dev>
Subject: Re: [PATCH 03/13] cpu/hotplug, x86/acpi: Disable CPU hotplug for ACPI
 MADT wakeup

On Tue, 2023-10-10 at 10:24 +0000, Huang, Kai wrote:
> >  /* Physical address of the Multiprocessor Wakeup Structure mailbox */
> > @@ -74,6 +75,9 @@ int __init acpi_parse_mp_wake(union acpi_subtable_headers *header,
> >  
> > 
> >  	acpi_mp_wake_mailbox_paddr = mp_wake->base_address;
> >  
> > 
> > +	/* Disable CPU onlining/offlining */
> > +	cpu_hotplug_not_supported();
> > +
> 
> Both onlining/offlining are prevented, or just offlining?
> 
> The previous patch says:
> 
> 	It does not prevent the initial bring up of the CPU, but it stops 
> 	subsequent offlining.
> 
> And ...
> 
> [...]
> 
> 
> > --- a/kernel/cpu.c
> > +++ b/kernel/cpu.c
> > @@ -1522,7 +1522,7 @@ static int cpu_down_maps_locked(unsigned int cpu, enum cpuhp_state target)
> >  	 * If the platform does not support hotplug, report it explicitly to
> >  	 * differentiate it from a transient offlining failure.
> >  	 */
> > -	if (cc_platform_has(CC_ATTR_HOTPLUG_DISABLED) || !cpu_hotplug_supported)
> > +	if (!cpu_hotplug_supported)
> >  		return -EOPNOTSUPP;
> >  	if (cpu_hotplug_disabled)
> >  		return -EBUSY;
> 
> ... here cpu_down_maps_locked() only prevents offlining if I am reading
> correctly.
> 
> Also, can we rename cpu_hotplug_supported to cpu_offline_supported to match the
> behaviour better?
> 
> Anyway, isn't it a little bit odd to have:
> 
> 	if (!cpu_hotplug_supported)
>  		return -EOPNOTSUPP;
>  	if (cpu_hotplug_disabled)
>  		return -EBUSY;
> 
> ?

I probably have missed something important, but I don't quite understand what's
the reason to have the CC_ATTR_HOTPLUG_DISABLED at the beginning, and now
replace it with cpu_hotplug_not_supported()?

From the changelog:

	Currently hotplug prevented based on the confidential computing
	attribute which is set for Intel TDX. But TDX is not the only possible
	user of the wake up method.

CC_ATTR_HOTPLUG_DISABLED is only used by TDX guest, but MADT can be used by non-
TDX guest too.

Anyway, if the purpose is just to prevent CPU from going offline, can this be
done by registering a cpuhp callback?

	static int madt_wakeup_offline_cpu(unsigned int cpu)
	{
		return -EOPNOTSUPP;
	}

	...

	err = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "madt-wakeup",
			NULL, madt_wakeup_offline_cpu);
	if (err) {
		pr_err("Register CPU hotplug callback failed.\n");
		/* BUG() ??? */
	}

This doesn't pollute the common CPU hotplug code, thus to me looks more clear?


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ