[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/3] x86/shadow: unlock P2M slightly earlier in shadow_track_dirty_vram()


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Mon, 27 Apr 2026 10:47:23 +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=HdhKD9Hjp3DkWiquxnpg8dCFR5hVKu3lK3WhVBX3GQ8=; b=R73mAjrxQDuFdQh6Buh1tEvUtU47JcVBPblkjihg9HErML3+xVVeqCZtrJK0Zj6xGvvMWeO074mtpEZw966Njb/ZO3IVVcDTU4+kacMRnXWsIHxDUjsQGSl2An1/29ZEI/dDO7/Jf5GI84LiiT8BDxnOyjkULOWNyDxrhvI78fKJlsC8TP3fHZjYzDZZLfHFDT7kX6CAVNMCuExzMHxNXf9FOKAtBKEVHvOGaHDhNDrPG3tc9vRvt8PQarIEgC+1VWSLoQvISMV9dBhbCug00KwTYUsqi6/R9SJEOTsnOg4zjXJ9DqDi0bI6Qo2IuyaiKOLrqkxwf665d1DFwaFu1Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=aFy8kr5cV3wHbDsiXEtK1X++k35KLuwz1Qv1B4YNFmnvmxQ4fww2yqFa1Ot2PkcQqff+jyQ2POvosfw5Pryf4ADsMppcGQYVd+0zvk3s0NSEp+SExVYKlW8Du/EO+n4ob8iegVlTOT+aksYHr6GqhAbUbgzCAM3vld55zsR9PFss6RdcFwDkdtetbbQtzjNJrnjRgk9DNsfZBWAkv4cB7nLHDFUtpX7qT1XE3shW5RZHlDe1vpG83KupJf82229KHvJEUhXaFK0IKCP+fL6r2YfBp47j1i7NlnK89lFjNuvxjpQNRcc3DJmmSF801JJSuT9IFT5OuVa4HPnMtXxk5w==
  • 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" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Mon, 27 Apr 2026 08:47:35 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, Feb 03, 2026 at 05:49:35PM +0100, Jan Beulich wrote:
> There's no need to call vfree() with the lock still held.
> 
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

> ---
> In fact for the purposes of the function the P2M lock could really be
> obtained merely in read mode, and it could be dropped immediately in both
> the main "if()" and its "else if()". If only there wasn't the error
> handling after copy_to_guest(): Dropping the paging lock ahead of that
> call, we rely solely on the P2M lock to also guard the changing of
> d->arch.hvm.dirty_vram.sh and what it points to. Question is why dropping
> the paging lock (but continuing to hold the P2M lock) is necessary there
> in the first place.

I wouldn't spend a lot of time trying to optimize this, we already
know HVM shadow is ATM not very optimized, and generally recommend
HAP.

If we could turn the p2m lock into read-mode, maybe at the expense of
expanding the paging locked region that would likely be slightly better?

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.