History

Merge tag 'io_uring-5.8-2020-07-01' of git://git.kernel.dk/linux-block

Pull io_uring fixes from Jens Axboe: "One fix in here, for a regression in 5.7 where a task is waiting in the kernel for a condition, but that condition won't become true until task_work is run. And the task_work can't be run exactly because the task is waiting in the kernel, so we'll never make any progress. One example of that is registering an eventfd and queueing io_uring work, and then the task goes and waits in eventfd read with the expectation that it'll get woken (and read an event) when the io_uring request completes. The io_uring request is finished through task_work, which won't get run while the task is looping in eventfd read" * tag 'io_uring-5.8-2020-07-01' of git://git.kernel.dk/linux-block: io_uring: use signal based task_work running task_work: teach task_work_add() to do signal_wake_up()

Linus Torvalds committed 6 years ago

Commit c93493b2 parents cd77006 ce593a65 files · +52 −15Browse files

Showing the changes to kernel (2 of 5 files). Show all

Unified · Split

2 files
  1. kernel/signal.c +7 −3
  2. kernel/task_work.c +14 −2
kernel/signal.c+7−3
@@ -2529,9 +2529,6 @@ bool get_signal(struct ksignal *ksig) · 2528 unmodified lines
2529 struct signal_struct *signal = current->signal;2529 struct signal_struct *signal = current->signal;
2530 int signr;2530 int signr;
2531 2531
2532 if (unlikely(current->task_works))
2533 task_work_run();
2534
2535 if (unlikely(uprobe_deny_signal()))2532 if (unlikely(uprobe_deny_signal()))
2536 return false;2533 return false;
2537 2534
@@ -2544,6 +2541,13 @@ bool get_signal(struct ksignal *ksig) · 6 unmodified lines
2544 2541
2545relock:2542relock:
2546 spin_lock_irq(&sighand->siglock);2543 spin_lock_irq(&sighand->siglock);
2544 current->jobctl &= ~JOBCTL_TASK_WORK;
2545 if (unlikely(current->task_works)) {
2546 spin_unlock_irq(&sighand->siglock);
2547 task_work_run();
2548 goto relock;
2549 }
2550
2547 /*2551 /*
2548 * Every stopped thread goes here after wakeup. Check to see if2552 * Every stopped thread goes here after wakeup. Check to see if
2549 * we should notify the parent, prepare_signal(SIGCONT) encodes2553 * we should notify the parent, prepare_signal(SIGCONT) encodes
kernel/task_work.c+14−2
@@ -25,9 +25,10 @@ static struct callback_head work_exited; /* all we need is ->next == NULL */ · 24 unmodified lines
25 * 0 if succeeds or -ESRCH.25 * 0 if succeeds or -ESRCH.
26 */26 */
27int27int
28task_work_add(struct task_struct *task, struct callback_head *work, bool notify)28task_work_add(struct task_struct *task, struct callback_head *work, int notify)
29{29{
30 struct callback_head *head;30 struct callback_head *head;
31 unsigned long flags;
31 32
32 do {33 do {
33 head = READ_ONCE(task->task_works);34 head = READ_ONCE(task->task_works);
@@ -36,8 +37,19 @@ task_work_add(struct task_struct *task, struct callback_head *work, bool notify) · 2 unmodified lines
36 work->next = head;37 work->next = head;
37 } while (cmpxchg(&task->task_works, head, work) != head);38 } while (cmpxchg(&task->task_works, head, work) != head);
38 39
39 if (notify)40 switch (notify) {
41 case TWA_RESUME:
40 set_notify_resume(task);42 set_notify_resume(task);
43 break;
44 case TWA_SIGNAL:
45 if (lock_task_sighand(task, &flags)) {
46 task->jobctl |= JOBCTL_TASK_WORK;
47 signal_wake_up(task, 0);
48 unlock_task_sighand(task, &flags);
49 }
50 break;
51 }
52
41 return 0;53 return 0;
42}54}
43 55

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t