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

RE: [XEN RFC PATCH 04/40] xen/arm: return default DMA bit width when platform is not set


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Wei Chen <Wei.Chen@xxxxxxx>
  • Date: Fri, 13 Aug 2021 06:54:16 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.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-SenderADCheck; bh=lahISmC2Rj4Z/MZivjs2/ulJG1zQFRm3Al1OekUNb24=; b=HTP/hl88RC4Y/RXWL0MfVcFJNDmqdFmUxOQhbTRqkewIwjfQDecnr6nFV26cJbTi18WfZWq/COfmSbYMkimrP0yvithL1QGYe1yo5eTqLnbLya9Syc2KtDBcF6NHoUx7Zn+JH2plTJXVGBuJTcSJh3/otLc2EcZY5/L55g9us5PKbeG1H0kT2EYh8CpeNYTbUuquYsZj1Du2sV38lY9K07QSpOxVJujerXSVTyuwJ+MVVdrYJdwwoQzpwwAFu2zeUreKoDEDzI4iMhJPFTmarqiu7Vu7tuXJDsPSL4eVnQOVsXIsf/EgKGsLCoiX+Ejw1ZE5YcMg94M2B2IKSQttAg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hrYSTBhgxYasOuxsbzZSEqJYtKUU9D14xdJyV07P1kXgEYyOS0qSMU32Oc9nEqTJeTFM3bENbcveaO1vxORRkRN5gL4/UXY0mdX8uwX1/4Ehpwui3hbtEr/EDkpMiA53AqrM4WczuCy9qLfoPKZJ7K6CMcN8pbiEJXSzbhmtjz69Tw9r7a5RC/u7qs0TwI9SuYUfxux0f5/RCrhX/VRxMVF0NbOZKQKZEI/oied5NG+dYmR0IArRVeUGN+1wsDiWA5JN5i1Mog2/Ul5wjxHx4fcFBlTE1oybeFsatZwVP8K4Zbo77p3A+YVNbLL8qDjcdnal57FE32byA4yAdTx+fA==
  • Authentication-results-original: suse.com; dkim=none (message not signed) header.d=none;suse.com; dmarc=none action=none header.from=arm.com;
  • Cc: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, "julien@xxxxxxx" <julien@xxxxxxx>
  • Delivery-date: Fri, 13 Aug 2021 06:54:30 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: suse.com; dkim=none (message not signed) header.d=none;suse.com; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHXjpsgsRofIZVQlECQrMelX8MpkqtuIUAAgALdEnA=
  • Thread-topic: [XEN RFC PATCH 04/40] xen/arm: return default DMA bit width when platform is not set

Hi Jan,

> -----Original Message-----
> From: Jan Beulich <jbeulich@xxxxxxxx>
> Sent: 2021年8月11日 18:54
> To: Wei Chen <Wei.Chen@xxxxxxx>
> Cc: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>; xen-
> devel@xxxxxxxxxxxxxxxxxxxx; sstabellini@xxxxxxxxxx; julien@xxxxxxx
> Subject: Re: [XEN RFC PATCH 04/40] xen/arm: return default DMA bit width
> when platform is not set
> 
> On 11.08.2021 12:23, Wei Chen wrote:
> > --- a/xen/arch/arm/platform.c
> > +++ b/xen/arch/arm/platform.c
> > @@ -27,6 +27,7 @@ extern const struct platform_desc _splatform[],
> _eplatform[];
> >  /* Pointer to the current platform description */
> >  static const struct platform_desc *platform;
> >
> > +extern unsigned int dma_bitsize;
> 
> This is a no-go: Declarations need to live in a header which the producer
> and all consumers include. Else ...

Ok, I will place it to a header.

> 
> > --- a/xen/common/page_alloc.c
> > +++ b/xen/common/page_alloc.c
> > @@ -227,7 +227,7 @@ static bool __read_mostly scrub_debug;
> >   * Bit width of the DMA heap -- used to override NUMA-node-first.
> >   * allocation strategy, which can otherwise exhaust low memory.
> >   */
> > -static unsigned int dma_bitsize;
> > +unsigned int dma_bitsize;
> 
> ... a change here (of e.g. the type) will go unnoticed by the compiler,
> and the consumer of the variable may no longer work correctly.
> 

Sorry, I am not very clear about this comment.

> Also I'm afraid the description does not make clear why this variable
> is what you want to use. Connected to this is the question why you need
> to consume it on Arm in the first place, when x86 never had the need.
> 

Different Arm platforms may have different DMA bitsize. So in my previous
thought, If Arm platform doesn't provide any DMA bitsize info, I will
return the system DMA bitsize (dma_bitsize) in arch_get_dma_bitsize.
But your comment made me think again. My current change may have fallen
into a logical loophole. dma_bitsize as a high level variable, it's
value depends on xen boot command line or arch_get_dma_bitsize.
I can't use it for arch_get_dma_bitsize's input.

So I think, in next version, I will discard the changes of dma_bitsize,
just keep the changes in arch_get_dma_bitsize to return 0, when platform
hasn't specify the DMA bitsize. Just like:

unsigned int arch_get_dma_bitsize(void)
 {
-    return ( platform && platform->dma_bitsize ) ? platform->dma_bitsize : 32;
+    return ( platform && platform->dma_bitsize ) ? platform->dma_bitsize
+                                                 : 0;
 }

Thanks,
Wei Chen

> Jan


 


Rackspace

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