[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v1 2/3] xen/smp: Rewrite on_selected_cpus() to be lockless
- To: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Thu, 9 Apr 2026 10:09:18 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=cl4In8M/dS3DGCtPmp6KkKZvPtzKXfkMeLwqaqijPDM=; b=ZhH1odhu3YfTvZ4c3BHMBmpN0HVsVGV4bcXH3JC0qrpUNw7COp2MVrX+Z0oDrkPGjZtKjwH3gSeAv01W5n200mPwJvNk7ii3GGrqGuOSe/iLg1U8YzihuERWkEzTJZv83eGedFJOvtcUPT71N+hl+EGoMrSnaRtzLh43gt8LF9+w7ZySQOVdjzKWXQ9XJN4ojsCx8UmfaYXDAFySacFFxFfv2YZhwMVqJ8JZ+QbqNtlzpSY+6bGH57J5k+nNIbU/7TUSSNVDpQORv4bxG1Cx0vfNlW6GrDtK9eJurddhWhqYr9eXamoSS39UMI0eeMqhmXNTskXOlecwNA8mqgr86g==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IVDEqEqriwoihwW8jPkx6Grl6xH4lsUtSmRnRlCazO/6q9IM2lB9xunPAvKdikkXzuRBWJyDqRxFls59fRw3RtjK6tolR29C0AWFE0IjBn9Gsmc1FI/YxgNABhcIFA3Kf2AYvvBgGNjNsdwJv9Yc5ggLmOvG52/bmv3L+AYhsTyvYEUxINP8Ye4Let6FUoRBHl0DePuH3IHjq/Z3sCnsb9XXEXvl967zzoJAoAepPzy73Oed97dox6+lUSVj2KySWno8l1u9MFc2n52V/upHcO0cYdbBecXP2NGxA5RODnJw5a55TUoIEjgRO/2Z+6J+iX7sAoEqrtXTe7gDFLKiOg==
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
- Delivery-date: Thu, 09 Apr 2026 08:09:32 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Wed, Apr 01, 2026 at 05:35:20PM +0100, Ross Lagerwall wrote:
> on_selected_cpus() holds a global lock even if the function is to be
> called on non-overlapping CPUs. This is a scalability bottleneck so to
> avoid that:
>
> 1. Remove the global lock.
> 2. Make call_data_struct per-CPU.
> 3. Track which CPUs are currently running on_selected_cpus() using a
> global CPU mask. This tells CPUs running the interrupt which per-CPU
> call_data_structs to look at.
>
> Since the call data is now per-CPU, skip waiting for CPUs to "check in"
> for async calls. Instead, delay it until the next time
> on_selected_cpus() is called by which point there should be nothing to
> wait for.
One concern I have about this approach is loosing the fairness that
the usage of the spin lock provided. Without the spinlock, and with
the usage of for_each_cpu ( i, &tasks ) to process any pending tasks,
it means the tasks from lower CPUs will always get preference over
the tasks from higher CPUs, regardless of when they have been
queued.
Ideally we need some kind of mechanism that can do a FIFO style
processing of the pending tasks, otherwise we are introducing a
performance penalty to high CPU IDs compared to low ones, and that's
likely to get worse as systems get bigger.
Thanks, Roger.
|