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]
Message-ID: <0a767d20-624d-494e-96b9-5e2a379550fc@linux.intel.com>
Date: Wed, 30 Oct 2024 14:33:31 +0100
From: Patryk Wlazlyn <patryk.wlazlyn@...ux.intel.com>
To: Dave Hansen <dave.hansen@...el.com>, x86@...nel.org
Cc: linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
 rafael.j.wysocki@...el.com, len.brown@...el.com,
 artem.bityutskiy@...ux.intel.com, dave.hansen@...ux.intel.com
Subject: Re: [PATCH v2 2/3] x86/smp: Allow forcing the mwait hint for play
 dead loop

>> +void smp_set_mwait_play_dead_hint(unsigned int hint)
>> +{
>> +    WRITE_ONCE(play_dead_mwait_hint, hint);
>> +}
>
> This all feels a bit hacky and unstructured to me.
>
> Could we at least set up a few rules here?  Like, say what the hints
> are, what values can they have?  Where do they come from?  Can this get
> called more than once?  Does it _need_ to be set?  What's the behavior
> when it is not set?  Who is responsible for calling this?

The other idea is to first check if currently loaded idle driver provides
enter_dead() callback first and leave the current, deepest mwait hint
computation code as a fallback.

Does that sound less hacky?

Unfortunately, it comes with a little problem. In case of kexec, we need to
have a way to exit from the mwait loop and enter hlt to prevent offlined CPU
from crashing when the old memory is being overwritten.

I think, we can solve it by bringing the CPU back online before we proceed
with kexec, but I would appreciate some feedback from someone who is more
familiar with kexec, before merging that.

We may also signal that by touching the resched flag on which enter_dead()
code will monitor in case of mwait and enter hlt right after, but that's a
bit hackier IMO.


> What good does the smp_ prefix do?  I don't think _callers_ care whether
> this is getting optimized out or not.

The prefix makes it a little bit cleaner by not exporting new global symbol
with "set_mwait_play_dead_hint" name.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ