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: <f5b0fffa-423a-4571-be6c-383399274328@efficios.com>
Date:   Thu, 26 Oct 2023 14:36:36 -0400
From:   Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To:     Steven Rostedt <rostedt@...dmis.org>,
        Peter Zijlstra <peterz@...radead.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ankur Arora <ankur.a.arora@...cle.com>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        linux-mm@...ck.org, x86@...nel.org, akpm@...ux-foundation.org,
        luto@...nel.org, bp@...en8.de, dave.hansen@...ux.intel.com,
        hpa@...or.com, mingo@...hat.com, juri.lelli@...hat.com,
        vincent.guittot@...aro.org, willy@...radead.org, mgorman@...e.de,
        jon.grimm@....com, bharata@....com, raghavendra.kt@....com,
        boris.ostrovsky@...cle.com, konrad.wilk@...cle.com,
        jgross@...e.com, andrew.cooper3@...rix.com,
        Joel Fernandes <joel@...lfernandes.org>,
        Youssef Esmat <youssefesmat@...omium.org>,
        Vineeth Pillai <vineethrp@...gle.com>,
        Suleiman Souhlal <suleiman@...gle.com>,
        Ingo Molnar <mingo@...nel.org>,
        Daniel Bristot de Oliveira <bristot@...nel.org>
Subject: Re: [POC][RFC][PATCH v2] sched: Extended Scheduler Time Slice

On 2023-10-26 07:14, Steven Rostedt wrote:
> On Thu, 26 Oct 2023 12:59:44 +0200
> Peter Zijlstra <peterz@...radead.org> wrote:
> 
>> On Wed, Oct 25, 2023 at 11:54:13PM -0400, Steven Rostedt wrote:
>>
>>>   static void extend(void)
>>>   {
>>> 	rseq_map.cr_flags = 1;
>>>   }
>>>
>>>   static void unextend(void)
>>>   {
>>> 	unsigned long prev;
>>>
>>> 	prev = xchg(&rseq_map.cr_flags, 0);
>>
>> So you complain about overhead and then you add one of the most
>> expensive ops possible here? xchg has an implicit LOCK prefix and you
>> really don't need LOCK prefix here.
> 
> Peter, this is the user space side, where I cut and pasted the code from
> the file I attached.
> 
> That has:
> 
> static inline unsigned long
> xchg(volatile unsigned *ptr, unsigned new)
> {
>          unsigned ret = new;
> 
> 	asm volatile("xchg %b0,%1"

which has an implicit lock prefix (xchg with a memory operand is a 
special-case):

Quoting Intel manual:

"If a memory operand is referenced, the processor’s locking protocol is 
automatically implemented for the duration of the exchange operation, 
regardless of the presence or absence of the LOCK prefix or of the value 
of the IOPL. (See the LOCK prefix description in this chapter for more 
information on the locking protocol.)"

Thanks,

Mathieu


> 		     : "+r"(ret), "+m"(*(ptr))
> 		     : : "memory");
>          return ret;
> }
> 
> -- Steve
> 
> 
>>
>>> 	if (prev & 2) {
>>> 		tracefs_printf(NULL, "Yield!\n");
>>> 		sched_yield();
>>> 	}
>>>   }
> 

-- 
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ