Re: [PATCH 18/15] kvm: Replace vcpu->swait with rcuwait

From
Peter Zijlstra <peterz@infradead.org>
Date
2020-03-22 22:34:00
Also in
linux-pci, linux-usb, linuxppc-dev, lkml, netdev
Reply to
Davidlohr Bueso, 2020-03-22
On Sun, Mar 22, 2020 at 09:33:17AM -0700, Davidlohr Bueso wrote:
On Fri, 20 Mar 2020, Peter Zijlstra wrote:
quoted
On Fri, Mar 20, 2020 at 01:55:26AM -0700, Davidlohr Bueso wrote:
quoted
-	swait_event_interruptible_exclusive(*wq, ((!vcpu->arch.power_off) &&
-				       (!vcpu->arch.pause)));
+	rcuwait_wait_event(*wait,
+			   (!vcpu->arch.power_off) && (!vcpu->arch.pause),
+			   TASK_INTERRUPTIBLE);
quoted
-	for (;;) {
-		prepare_to_swait_exclusive(&vcpu->wq, &wait, TASK_INTERRUPTIBLE);
-
-		if (kvm_vcpu_check_block(vcpu) < 0)
-			break;
-
-		waited = true;
-		schedule();
-	}
-
-	finish_swait(&vcpu->wq, &wait);
+	rcuwait_wait_event(&vcpu->wait,
+			   (block_check = kvm_vcpu_check_block(vcpu)) < 0,
+			   TASK_INTERRUPTIBLE);
Are these yet more instances that really want to be TASK_IDLE ?
Hmm probably as it makes sense for a blocked vcpu not to be contributing to
the loadavg. So if this is the only reason to use interruptible, then yes we
ought to change it.

However, I'll make this a separate patch, given this (ab)use isn't as obvious
as the PS3 case, which is a kthread and therefore signals are masked.
The thing that was a dead give-away was that the return value of the
interruptible wait wasn't used.
Thread (72 messages) 72 messages, 17 authors, last reply 2020-03-22
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help