From: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
To: Nicolas Pitre <nicolas.pitre@linaro.org>
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>,
Kukjin Kim <kgene.kim@samsung.com>,
Marc Zyngier <marc.zyngier@arm.com>,
Christoph Lameter <cl@linux.com>, Mark Brown <broonie@kernel.org>,
linux-next@vger.kernel.org, linux-kernel@vger.kernel.org,
Tejun Heo <tj@kernel.org>,
Kyungmin Park <kyungmin.park@samsung.com>
Subject: Re: linux-next: Tree for Sep 1
Date: Thu, 11 Sep 2014 12:24:20 +0200 [thread overview]
Message-ID: <3042750.N601vfolIq@amdc1032> (raw)
In-Reply-To: <alpine.LFD.2.11.1409101356270.16533@knanqh.ubzr>
Hi,
On Wednesday, September 10, 2014 01:59:47 PM Nicolas Pitre wrote:
> On Wed, 10 Sep 2014, Russell King - ARM Linux wrote:
>
> > On Fri, Sep 05, 2014 at 03:27:51PM -0400, Nicolas Pitre wrote:
> > > On Tue, 2 Sep 2014, Christoph Lameter wrote:
> > >
> > > > On Tue, 2 Sep 2014, Christoph Lameter wrote:
> > > >
> > > > > Oww.. This is double indirection deal there. A percpu offset pointing to
> > > > > a pointer?
> > > > >
> > > > > Generally the following is true (definition from
> > > > > include/asm-generic/percpu.h that is used for ARM for raw_cpu_read):
> > > > >
> > > > > #define raw_cpu_read_4(pcp) (*raw_cpu_ptr(&(pcp)))
> > > >
> > > > I think what the issue is that we dropped the fetch of the percpu offset
> > > > in the patch. Instead we are using the address of the variable that
> > > > contains the offset. Does this patch fix it?
> > > >
> > > >
> > > > Subject: irqchip: Properly fetch the per cpu offset
> > > >
> > > > The raw_cpu_read() conversion dropped the fetch of the offset
> > > > from base->percpu_base in gic_get_percpu_base.
> > > >
> > > > Signed-off-by: Christoph Lameter <cl@linux.com>
> > > >
> > > > Index: linux/drivers/irqchip/irq-gic.c
> > > > ===================================================================
> > > > --- linux.orig/drivers/irqchip/irq-gic.c
> > > > +++ linux/drivers/irqchip/irq-gic.c
> > > > @@ -102,7 +102,7 @@ static struct gic_chip_data gic_data[MAX
> > > > #ifdef CONFIG_GIC_NON_BANKED
> > > > static void __iomem *gic_get_percpu_base(union gic_base *base)
> > > > {
> > > > - return raw_cpu_read(base->percpu_base);
> > > > + return raw_cpu_read(*base->percpu_base);
> > >
> > > Isn't the pointer dereference supposed to be performed _outside_ the per
> > > CPU accessor?
> >
> > I think this is correct.
> >
> > Let's start from the depths of raw_cpu_read(), where the pointer is
> > verified to be the correct type:
> >
> > #define __verify_pcpu_ptr(ptr) \
> > do { \
> > const void __percpu *__vpp_verify = (typeof((ptr) + 0))NULL; \
> > (void)__vpp_verify; \
> > } while (0)
> >
> > So, "ptr" should be of type "const void __percpu *" (note the __percpu
> > annotation there, which makes it sparse-checkable.)
> >
> > The next level up is this:
> >
> > #define __pcpu_size_call_return(stem, variable) \
> > ({ \
> > typeof(variable) pscr_ret__; \
> > __verify_pcpu_ptr(&(variable)); \
> >
> > So, we pass the address of the variable to the verification function.
> > That makes it a void-typed variable - "const void __percpu".
> >
> > #define raw_cpu_read(pcp) __pcpu_size_call_return(raw_cpu_read_, pcp)
> >
> > So this also makes "pcp" a "const void __percpu".
> >
> > Now, what type is base->percpu_base?
> >
> > void __percpu * __iomem *percpu_base;
> >
> > The thing we want to be per-cpu is a "void __iomem *" pointer. However,
> > we have a pointer to the per-cpu instance. That's the "void __percpu *"
> > bit.
> >
> > So, for this to match the requirements for raw_cpu_read(), we need to
> > do one dereference to end up with "void __percpu".
> >
> > Hence, to me, the patch looks correct.
>
> Good, I now agree. If needed:
>
> Acked-by: Nicolas Pitre <nico@linaro.org>
>
> > Whether it works or not is a /completely/ different matter. As has been
> > pointed out, the only place this code gets used is on a very small number
> > of platforms, which I don't have, and that gives me zero way to test it.
> > If it's Exynos which is affected by this, we need to call on Samsung to
> > test this patch.
>
> AFAICS it was tested already and confirmed working.
Yes, it was tested on ODROID U3 board (ARM Exynos4412 SoC based):
https://lkml.org/lkml/2014/9/3/552
FWIW:
Tested-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> > Now, this code was introduced by Marc Zyngier in order to support Exynos,
> > probably the result of another patch on the mailing list from Samsung.
> > (I've added Marc and another Samsung guy to the Cc list.) Whatever,
> > *someone* needs to verify this but it needs to be done with the affected
> > hardware. Whether Marc can, or whether it has to be someone from Samsung,
> > I don't care which.
> >
> > /Or/ we deem the code unmaintained, broken, and untestable, and we start
> > considering ripping it out of the mainline kernel on the basis that no
> > one cares about it anymore.
>
> The problem was reported by someone who tested linux-next on the
> affected platform, so it must still be used.
Yes, the issue was reported by me originally together with a proposed fix
(different than the final one done by Christoph):
https://lkml.org/lkml/2014/9/2/261
FWIW:
Reported-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
next prev parent reply other threads:[~2014-09-11 10:24 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-01 23:07 linux-next: Tree for Sep 1 Mark Brown
2014-09-02 13:16 ` Bartlomiej Zolnierkiewicz
2014-09-02 13:19 ` Bartlomiej Zolnierkiewicz
2014-09-02 14:07 ` Christoph Lameter
2014-09-02 15:00 ` Christoph Lameter
2014-09-03 16:09 ` Bartlomiej Zolnierkiewicz
2014-09-04 17:11 ` Tejun Heo
2014-09-04 17:59 ` Christoph Lameter
2014-09-05 18:17 ` Russell King - ARM Linux
2014-09-05 11:31 ` Jason Cooper
2014-09-05 23:48 ` Tejun Heo
2014-09-09 0:37 ` Tejun Heo
2014-09-10 14:15 ` Christoph Lameter
2014-09-10 15:04 ` Jason Cooper
2014-09-10 16:18 ` Nicolas Pitre
2014-09-10 16:21 ` Christoph Lameter
2014-09-10 16:19 ` Christoph Lameter
2014-09-05 19:27 ` Nicolas Pitre
2014-09-08 14:15 ` Christoph Lameter
2014-09-10 17:41 ` Russell King - ARM Linux
2014-09-10 17:59 ` Nicolas Pitre
2014-09-11 10:24 ` Bartlomiej Zolnierkiewicz [this message]
2014-09-10 18:11 ` Marc Zyngier
2014-09-11 11:01 ` Bartlomiej Zolnierkiewicz
2014-09-11 11:17 ` Marc Zyngier
2014-09-14 5:40 ` Jason Cooper
2014-09-18 12:51 ` Bartlomiej Zolnierkiewicz
2014-09-19 3:52 ` Tejun Heo
2014-09-02 14:58 ` Jason Cooper
-- strict thread matches above, loose matches on Subject: below --
2015-09-01 8:21 Stephen Rothwell
2017-09-01 6:39 Stephen Rothwell
2021-09-01 8:17 Stephen Rothwell
2022-09-01 7:18 Stephen Rothwell
2025-09-01 5:08 Stephen Rothwell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3042750.N601vfolIq@amdc1032 \
--to=b.zolnierkie@samsung.com \
--cc=broonie@kernel.org \
--cc=cl@linux.com \
--cc=kgene.kim@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=marc.zyngier@arm.com \
--cc=nicolas.pitre@linaro.org \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox