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: <b55f0797-72d3-7638-7494-3dc9f1583ba8@linux.intel.com>
Date:   Mon, 2 Dec 2019 20:42:18 +0300
From:   Alexey Budankov <alexey.budankov@...ux.intel.com>
To:     Peter Zijlstra <peterz@...radead.org>,
        Andi Kleen <ak@...ux.intel.com>
Cc:     kan.liang@...ux.intel.com, mingo@...hat.com, acme@...nel.org,
        tglx@...utronix.de, bp@...en8.de, linux-kernel@...r.kernel.org,
        eranian@...gle.com, vitaly.slobodskoy@...el.com
Subject: Re: [RFC PATCH 3/8] perf: Init/fini PMU specific data


On 02.12.2019 19:43, Peter Zijlstra wrote:
> On Mon, Dec 02, 2019 at 07:38:00PM +0300, Alexey Budankov wrote:
>>
>> On 02.12.2019 17:59, Andi Kleen wrote:
>>>>
>>>> This is atricous crap. Also it is completely broken for -RT.
>>>
>>> Well can you please suggest how you would implement it instead?
>>
>> FWIW,
>> An alternative could probably be to make task_ctx_data allocations
>> on the nearest context switch in, and obvious drawback is slowdown on
>> this critical path, but it could be amortized by static branches.
> 
> Context switch is under a raw_spinlock_t too.

Indeed, under rq->lock (some of runqueue locks, I suppose), but 
as far locking order is not violated a thread shouldn't deadlock.
On the other side it could probably hurt concurrency and 
it is more preferable to have task_ctx_data memory pre-allocated 
by the time it is assigned on a context switch in.

What if we would create some pool of preallocated task_ctx_data 
objects on the first system wide perf_event_open() syscall
and after that:
- already existing threads would take task_ctx_data objects from
  the pool without additional locking on the nearest
  context switch in;
- newly created threads would allocate task_ctx_data themselves,
  atomically checking some global state, possibly at PMU object
- task_ctx_data deallocation would be performed by threads
  themselves, at some safe points in time;

Thanks,
Alexey

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ