[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <737b07582ef2a4b2f134a1a931b6621ff96adb77.camel@pengutronix.de>
Date: Wed, 21 Jun 2023 18:12:16 +0200
From: Lucas Stach <l.stach@...gutronix.de>
To: Sui Jingfeng <suijingfeng@...ngson.cn>,
Sui Jingfeng <18949883232@....com>,
Russell King <linux+etnaviv@...linux.org.uk>,
Christian Gmeiner <christian.gmeiner@...il.com>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>
Cc: linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org,
etnaviv@...ts.freedesktop.org,
Philipp Zabel <p.zabel@...gutronix.de>,
Bjorn Helgaas <bhelgaas@...gle.com>
Subject: Re: [PATCH v10 07/11] drm/etnaviv: Add support for the dma coherent
device
Am Mittwoch, dem 21.06.2023 um 23:41 +0800 schrieb Sui Jingfeng:
> On 2023/6/21 23:23, Lucas Stach wrote:
> > Am Mittwoch, dem 21.06.2023 um 22:44 +0800 schrieb Sui Jingfeng:
> > > Hi,
> > >
> > > On 2023/6/21 18:00, Lucas Stach wrote:
> > > > > diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.h b/drivers/gpu/drm/etnaviv/etnaviv_drv.h
> > > > > index 9cd72948cfad..644e5712c050 100644
> > > > > --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.h
> > > > > +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.h
> > > > > @@ -46,6 +46,12 @@ struct etnaviv_drm_private {
> > > > > struct xarray active_contexts;
> > > > > u32 next_context_id;
> > > > >
> > > > > + /*
> > > > > + * If true, the GPU is capable of snooping cpu cache. Here, it
> > > > > + * also means that cache coherency is enforced by the hardware.
> > > > > + */
> > > > > + bool dma_coherent;
> > > > > +
> > > > No need for this, I think. Just use dev_is_dma_coherent() where you
> > > > need to know this.
> > > >
> > > No, we want this value cached by the driver.
> > >
> > Why? dev_is_dma_coherent() is a header-only function with a single
> > pointer chasing operation. Your cache is also a single pointer chasing
> > access, just that we now need storage for this information in both
> > struct device and struct etnaviv_gpu.
>
>
> You don't need store it in struct etnaviv_gpu.
>
> As this variable is shared across the device, so it is better to be put
> in the struct etnaviv_drm_private.
>
> I don't think another 4 bytes allocation is something what we can't pay for.
>
>
> My patch doesn't mentioned that it need to store it inside of struct
> etnaviv_gpu, do I?
You are right, I was mistaken about the etnaviv struct this is added
to. However there is still the fundamental question: what's the gain of
this cache? The information is already available in struct device and
will be accessed with the same amount of loads if you care that much
about micro-optimization.
Regards,
Lucas
Powered by blists - more mailing lists