[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v1.1] evtchn: add early-out to evtchn_move_pirqs()
- To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Tue, 26 Apr 2022 12:33:45 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CwmrpSe4Pw1W+yGYAm1bkOFDuNoRZOMh4sYLYOv9c1Q=; b=M5utKc4lyUOZmypDSJJE/T5uklOqMy83J07QS+hE+nPeloMaKIR46qM+eMNpYTZHH/5gLfPEVMuZpRLfJMrf3HUFu+WIFP9bh1ntelk9E212knqovkmrq1qw/ReMKSvfqzrrLxxNHH5wY89NGG6P1unVS9fiiAFbsScxYkvqntm4lQzZeWG3W8r/wxwZ++KdEmPdXEbC1AknNZEmhxmkZSNwaTuFmA7XZIbLbpzZZKUjzZq4F1XVrF4wjRo3hoKVwRvQOhx7cvO3cDFPelf5R0LXBs1NQIOw7s1f1+0o3nuuybl3QiQWjipcf/lbHVYSNRfEEvZQtz0OUJ+LSr8Yuw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iEZswY+zDzt6D+JLGSv8NcbdQ0m40KbmEURIuHq+kl/c578jd5/zAA5OL8Ey6UIi1b/rQX8/7Y0tnZwDd79awy+BdRY5pXID/F5rUR+j1CZv5oFdPH9QQqA0acZu0B4nWT/D9c8fNjMygCOmRmPUrorN0rxrrSkez3S6Y3zDazguwvVoXPy50FEIqH9HN9rNI1wW7vfSlLvOxgemqI7my8RqmWfSrqcqO2bsPXwIbmnPbmVf6mr5RNKf64vTLkXgL8BbJt6qdAAIBBpQRov9aNdoo+n+ccjm1bSuQzaPOwAoccGKV1rzmS2ltYqBmMkfRwsCHF9bD08ehIuR4qwZlw==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Dario Faggioli <dfaggioli@xxxxxxxx>
- Delivery-date: Tue, 26 Apr 2022 10:33:54 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
See the code comment. The higher the rate of vCPU-s migrating across
pCPU-s, the less useful this attempted optimization actually is. With
credit2 the migration rate looks to be unduly high even on mostly idle
systems, and hence on large systems lock contention here isn't very
difficult to observe (as was the case for a failed 4.12 osstest flight).
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Tested-by: Luca Fancellu <luca.fancellu@xxxxxxx>
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -1559,6 +1559,16 @@ void evtchn_move_pirqs(struct vcpu *v)
unsigned int port;
struct evtchn *chn;
+ /*
+ * The work done below is an attempt to keep pIRQ-s on the pCPU-s that the
+ * vCPU-s they're to be delivered to run on. In order to limit lock
+ * contention, check for an empty list prior to acquiring the lock. In the
+ * worst case a pIRQ just bound to this vCPU will be delivered elsewhere
+ * until the vCPU is migrated (again) to another pCPU.
+ */
+ if ( !v->pirq_evtchn_head )
+ return;
+
spin_lock(&d->event_lock);
for ( port = v->pirq_evtchn_head; port; port = chn->u.pirq.next_port )
{
|