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>] [day] [month] [year] [list]
Message-ID: <CANsc=4X_KrPEYVPuqPBgATNsY3a3M4Penur+9S1JSJ_MUvfxGg@mail.gmail.com>
Date:	Thu, 26 Sep 2013 17:38:11 -0400
From:	Adrien Vergé <adrienverge@...il.com>
To:	linux-kernel@...r.kernel.org
Subject: Scheduling new work during a context switch

Hi,

I am modifying the perf internals to avoid the overhead due to a
second copy, when using Intel's BTS (execution tracing). Mainly, I
have a buffer that fills during the execution of the traced process,
and I sometimes need to save its contents.

When my buffer should be emptied, I schedule a task to copy the buffer
contents to disk later. This action should be performed:
- Whenether the buffer is full (in a IRQ handler).
- Whenether the traced task is scheduled out. This is when it blocks.

The problem is, deferring work in a work queue with schedule_work()
during a context switch (in schedule()) leads to a deadlock, because
both want to hold the same lock (&(&pool->lock)->rlock).
I also tried to pre-schedule the task, make it
wait_event_interruptible(), and wake_up() it during the context
switch, but there is also a deadlock due to already-held &p->pi_lock
in try_to_wake_up().

I am certainly doing something not the way it should be done. Is there
a correct way to defer work during a context switch?

Thanks!

Adrien
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ