[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a51cb70623c4c2441bb8df8385f56c99392b8435.camel@pengutronix.de>
Date: Fri, 15 May 2020 12:24:47 +0200
From: Lucas Stach <l.stach@...gutronix.de>
To: Paul Cercueil <paul@...pouillou.net>,
Christian Gmeiner <christian.gmeiner@...il.com>
Cc: LKML <linux-kernel@...r.kernel.org>, stable@...r.kernel.org,
Russell King <linux+etnaviv@...linux.org.uk>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
The etnaviv authors <etnaviv@...ts.freedesktop.org>,
DRI mailing list <dri-devel@...ts.freedesktop.org>
Subject: Re: [PATCH] drm/etnaviv: fix perfmon domain interation
Am Freitag, den 15.05.2020, 12:12 +0200 schrieb Paul Cercueil:
> Hi Christian,
>
> Le ven. 15 mai 2020 à 12:09, Christian Gmeiner
> <christian.gmeiner@...il.com> a écrit :
> > Am Mo., 11. Mai 2020 um 14:38 Uhr schrieb Christian Gmeiner
> > <christian.gmeiner@...il.com>:
> > > The GC860 has one GPU device which has a 2d and 3d core. In this
> > > case
> > > we want to expose perfmon information for both cores.
> > >
> > > The driver has one array which contains all possible perfmon domains
> > > with some meta data - doms_meta. Here we can see that for the GC860
> > > two elements of that array are relevant:
> > >
> > > doms_3d: is at index 0 in the doms_meta array with 8 perfmon
> > > domains
> > > doms_2d: is at index 1 in the doms_meta array with 1 perfmon
> > > domain
> > >
> > > The userspace driver wants to get a list of all perfmon domains and
> > > their perfmon signals. This is done by iterating over all domains
> > > and
> > > their signals. If the userspace driver wants to access the domain
> > > with
> > > id 8 the kernel driver fails and returns invalid data from doms_3d
> > > with
> > > and invalid offset.
> > >
> > > This results in:
> > > Unable to handle kernel paging request at virtual address 00000000
> > >
> > > On such a device it is not possible to use the userspace driver at
> > > all.
> > >
> > > The fix for this off-by-one error is quite simple.
> > >
> > > Reported-by: Paul Cercueil <paul@...pouillou.net>
> > > Tested-by: Paul Cercueil <paul@...pouillou.net>
> > > Fixes: ed1dd899baa3 ("drm/etnaviv: rework perfmon query
> > > infrastructure")
> > > Cc: stable@...r.kernel.org
> > > Signed-off-by: Christian Gmeiner <christian.gmeiner@...il.com>
> > > ---
> > > drivers/gpu/drm/etnaviv/etnaviv_perfmon.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c
> > > b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c
> > > index e6795bafcbb9..35f7171e779a 100644
> > > --- a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c
> > > +++ b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c
> > > @@ -453,7 +453,7 @@ static const struct etnaviv_pm_domain
> > > *pm_domain(const struct etnaviv_gpu *gpu,
> > > if (!(gpu->identity.features & meta->feature))
> > > continue;
> > >
> > > - if (meta->nr_domains < (index - offset)) {
> > > + if ((meta->nr_domains - 1) < (index - offset)) {
> > > offset += meta->nr_domains;
> > > continue;
> > > }
> > > --
> > > 2.26.2
> > >
> >
> > ping
>
> I'll merge it tomorrow if there's no further feedback.
Huh? Etnaviv patches are going through the etnaviv tree.
We now have two different solutions to the same issue. I first want to
dig into the code to see why two developers can get confused enough by
the code to come up with totally different fixes.
Regards,
Lucas
Powered by blists - more mailing lists