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

RE: [PATCH v2 03/26] xen/x86: consolidate vram tracking support


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: "Penny, Zheng" <penny.zheng@xxxxxxx>
  • Date: Thu, 11 Sep 2025 07:54:54 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.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=JDzPS/Z2uaPUG4een3NzAEtR6RDB+qL4qcB85Dcl/So=; b=FuwqKiQbRocREBy2NSWFhV7iWC8s/q1jqpTP/QJ4/v94uyI1Nu+hm69zOl+c0KDI1NHrBkY8s93TB94/AQlkmE1l8czwWuI+KnYEdzYqFJ4HmKAHdgyYd+fMb3kyc5lrjjD8BqWG1mNvgRc81dofqtJHQn9CRTT3PqgkjwRDQRny4RDI1Vy/o8DglTmnuei3agdYAhC0EyB+IPvnTO0BUWjjIJKywOnuuYQgKClJXgyz3k32Un8CJjpZdgUvxBLDv50jubncNiBxcEZ2HuxkwxkaANqSZzFD7drWnIfKPh+rZeraNEf1vJyAUjAQvH5xIGLJv4s9ALWgVtaWMnvx7w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vmvaiaOP3E8XfOtCefa0mZXnULGUzo5mjG/4H2Cl7PECofTQdKLJejzvvx/T4bKHJv8OhLpOrdzJlkkIkDgQ7HyPVPNqXkch96PmMVJphcFAUHmBdqdw8IljD2ASz1J4WvQZj9MnbJfm/RBAdHzYanPKtNHH6xyuvKOVHVh2r6mmZEEOJHfkBdpD2gJ3nI4ecQT8qhkVOWpS+RNzdo3OuhexIIsr8a3KVmgHckf7b7zNGmTKciSZr2g0rGUy+1jFipOZspEbs1u+GoUX4xvMdFBs+MkamZ+j08rixAjj4T+Tiy0A9s5Vg+UCA2cRrQsSDoorDwVuFLquOYbdO9X+/Q==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: "Huang, Ray" <Ray.Huang@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 11 Sep 2025 07:55:04 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Msip_labels: MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_Enabled=True;MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d;MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_SetDate=2025-09-11T07:06:27.0000000Z;MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_Name=Open Source;MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_ContentBits=3;MSIP_Label_f265efc6-e181-49d6-80f4-fae95cf838a0_Method=Privileged
  • Thread-index: AQHcIiYBT2pZeRIoyka2sfY1lhJyobSMdHkAgAEcX0CAAAljMA==
  • Thread-topic: [PATCH v2 03/26] xen/x86: consolidate vram tracking support

[Public]

> -----Original Message-----
> From: Penny, Zheng
> Sent: Thursday, September 11, 2025 3:16 PM
> To: Jan Beulich <jbeulich@xxxxxxxx>
> Cc: Huang, Ray <Ray.Huang@xxxxxxx>; Andrew Cooper
> <andrew.cooper3@xxxxxxxxxx>; Roger Pau Monné <roger.pau@xxxxxxxxxx>; xen-
> devel@xxxxxxxxxxxxxxxxxxxx
> Subject: RE: [PATCH v2 03/26] xen/x86: consolidate vram tracking support
>
>
>
> > -----Original Message-----
> > From: Jan Beulich <jbeulich@xxxxxxxx>
> > Sent: Wednesday, September 10, 2025 10:09 PM
> > To: Penny, Zheng <penny.zheng@xxxxxxx>
> > Cc: Huang, Ray <Ray.Huang@xxxxxxx>; Andrew Cooper
> > <andrew.cooper3@xxxxxxxxxx>; Roger Pau Monné <roger.pau@xxxxxxxxxx>;
> > xen- devel@xxxxxxxxxxxxxxxxxxxx
> > Subject: Re: [PATCH v2 03/26] xen/x86: consolidate vram tracking
> > support
> >
> > On 10.09.2025 09:38, Penny Zheng wrote:
> > > Flag PG_log_dirty is for paging log dirty support, not vram tracking 
> > > support.
> > > However data structure sh_dirty_vram{} and function
> > > paging_log_dirty_range() designed for vram tracking support, are
> > > guarded with
> > PG_log_dirty.
> > > We release both from PG_log_dirty, and also move
> > > paging_log_dirty_range(), remamed with p2m_log_dirty_range(), into
> > > p2m.c, where
> > it logically belongs.
> >
> > Aren't these two independent changes? One to deal with struct
> > sh_dirty_vram, the other to move and rename paging_log_dirty_range()?
> > Irrespective, in the interest of making progress:
> > Acked-by: Jan Beulich <jbeulich@xxxxxxxx> with ...
> >
> > > --- a/xen/arch/x86/include/asm/p2m.h
> > > +++ b/xen/arch/x86/include/asm/p2m.h
> > > @@ -1110,6 +1110,10 @@ static inline int p2m_entry_modify(struct
> > > p2m_domain *p2m, p2m_type_t nt,
> > >
> > >  #endif /* CONFIG_HVM */
> > >
> > > +/* get the dirty bitmap for a specific range of pfns */
> >
> > ... comment style corrected here (happy to do so while committing).
> >
> > Aiui the patch is independent of the earlier two, and hence could go
> > in ahead of them. Sadly once again nothing like this is stated anywhere, so
> please confirm.
> >
>
> Yes, it could go in ahead of them. I'll split it into two commits, and I will 
> do this
> immediately to send regardless of this patch serie.
>
> > > --- a/xen/arch/x86/include/asm/paging.h
> > > +++ b/xen/arch/x86/include/asm/paging.h
> > > @@ -133,13 +133,20 @@ struct paging_mode {
> > >      (DIV_ROUND_UP(PADDR_BITS - PAGE_SHIFT - (PAGE_SHIFT + 3), \
> > >                    PAGE_SHIFT - ilog2(sizeof(mfn_t))) + 1)
> > >
> > > -#if PG_log_dirty
> > > +#ifdef CONFIG_HVM
> > > +/* VRAM dirty tracking support */
> > > +struct sh_dirty_vram {
> > > +    unsigned long begin_pfn;
> > > +    unsigned long end_pfn;
> > > +#ifdef CONFIG_SHADOW_PAGING
> > > +    paddr_t *sl1ma;
> > > +    uint8_t *dirty_bitmap;
> > > +    s_time_t last_dirty;
> > > +#endif
> > > +};
> > > +#endif
> >
> > Subsequently I think we will want to do more cleanup here. Us using a
> > shadow mode struct also in HAP code is bogus and, afaics, wasteful.
> > The three latter members are used only by shadow code, so HAP could
> > have its own, smaller variant of the type. And each type could be
> > private to the hap/ and shadow/ subtrees respectively.
> >
>
> Understood.

Reading relative codes, found that we have a "struct sh_dirty_vram *dirty_vram" 
in "struct hvm_domain",
If we defined different type "struct hap_dirty_vram" and "struct sh_dirty_vram" 
private to the hap/ and shadow/ subtrees respectively, either we add different 
type in "struct hvm_domain", or we change it to the "void *" there and do the 
type casting on referring... maybe the former is safer or any better suggestion?

>
> > Jan

 


Rackspace

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