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: Thu, 30 May 2024 02:03:20 -0700
From: Ankur Arora <ankur.a.arora@...cle.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Ankur Arora <ankur.a.arora@...cle.com>, linux-kernel@...r.kernel.org,
        tglx@...utronix.de, torvalds@...ux-foundation.org, paulmck@...nel.org,
        rostedt@...dmis.org, mark.rutland@....com, juri.lelli@...hat.com,
        joel@...lfernandes.org, raghavendra.kt@....com, sshegde@...ux.ibm.com,
        boris.ostrovsky@...cle.com, konrad.wilk@...cle.com,
        Andy Lutomirski
 <luto@...nel.org>
Subject: Re: [PATCH v2 10/35] entry: irqentry_exit only preempts for
 TIF_NEED_RESCHED


Peter Zijlstra <peterz@...radead.org> writes:

> On Mon, May 27, 2024 at 05:34:56PM -0700, Ankur Arora wrote:
>> Use __tif_need_resched(RESCHED_NOW) instead of need_resched() to be
>> explicit that this path only reschedules if it is needed imminently.
>>
>> Also, add a comment about why we need a need-resched check here at
>> all, given that the top level conditional has already checked the
>> preempt_count().
>>
>> Cc: Peter Zijlstra <peterz@...radead.org>
>> Cc: Andy Lutomirski <luto@...nel.org>
>> Originally-by: Thomas Gleixner <tglx@...utronix.de>
>> Link: https://lore.kernel.org/lkml/87jzshhexi.ffs@tglx/
>> Signed-off-by: Ankur Arora <ankur.a.arora@...cle.com>
>> ---
>>  kernel/entry/common.c | 11 ++++++++++-
>>  1 file changed, 10 insertions(+), 1 deletion(-)
>>
>> diff --git a/kernel/entry/common.c b/kernel/entry/common.c
>> index bcb23c866425..c684385921de 100644
>> --- a/kernel/entry/common.c
>> +++ b/kernel/entry/common.c
>> @@ -307,7 +307,16 @@ void raw_irqentry_exit_cond_resched(void)
>>  		rcu_irq_exit_check_preempt();
>>  		if (IS_ENABLED(CONFIG_DEBUG_ENTRY))
>>  			WARN_ON_ONCE(!on_thread_stack());
>> -		if (need_resched())
>> +
>> +		/*
>> +		 * Check if we need to preempt eagerly.
>> +		 *
>> +		 * Note: we need an explicit check here because some
>> +		 * architectures don't fold TIF_NEED_RESCHED in the
>> +		 * preempt_count. For archs that do, this is already covered
>> +		 * in the conditional above.
>> +		 */
>> +		if (__tif_need_resched(RESCHED_NOW))
>>  			preempt_schedule_irq();
>
> Seeing how you introduced need_resched_lazy() and kept need_resched() to
> be the NOW thing, I really don't see the point of using the long form
> here?

So, the reason I used the lower level interface here (and the scheduler)
was to spell out exactly was happening here.

Basically keep need_resched()/need_resched_lazy() for the none-core code.

--
ankur

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ