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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c1e5bd3b-cefc-4e74-ae7f-b8ffebe8c745@igalia.com>
Date: Thu, 9 Jan 2025 01:04:49 +0900
From: Changwoo Min <changwoo@...lia.com>
To: Peter Zijlstra <peterz@...radead.org>, Changwoo Min <multics69@...il.com>
Cc: tj@...nel.org, void@...ifault.com, arighi@...dia.com, mingo@...hat.com,
 kernel-dev@...lia.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v7 2/6] sched_ext: Implement scx_bpf_now()

Hello,

On 25. 1. 8. 17:50, Peter Zijlstra wrote:
> 
> That is, I rather think you need:
> 
>> +static inline void scx_rq_clock_update(struct rq *rq, u64 clock)
>> +{
>> +	if (!scx_enabled())
>> +		return;
>> +	WRITE_ONCE(rq->scx.clock, clock);
>> +	smp_store_release(&rq->scx.flags, rq->scx.flags | SCX_RQ_CLK_VALID);
>> +}
> 
> and:
> 
> 	if (smp_load_acquire(&rq->scx.flags) & SCX_RQ_CLK_VALID) {
>> +		/*
>> +		 * If the rq clock is valid, use the cached rq clock.
>> +		 *
>> +		 * Note that scx_bpf_now() is re-entrant between a process
>> +		 * context and an interrupt context (e.g., timer interrupt).
>> +		 * However, we don't need to consider the race between them
>> +		 * because such race is not observable from a caller.
>> +		 */
>> +		clock = READ_ONCE(rq->scx.clock);
> 
> Such that if you ovbserve VALID, you must then also observe the clock.

Thank you for catching this out! I will change it as suggested in
the next version.

Regards,
Changwoo Min

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ