lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGETcx89BRdSP6FKjDPU0zapt0ET9_PUr6bjZb9EA-jYn0maFw@mail.gmail.com>
Date:   Thu, 6 Aug 2020 11:05:32 -0700
From:   Saravana Kannan <saravanak@...gle.com>
To:     Marc Zyngier <maz@...nel.org>
Cc:     John Stultz <john.stultz@...aro.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Jason Cooper <jason@...edaemon.net>,
        Matthias Brugger <matthias.bgg@...il.com>,
        Andy Gross <agross@...nel.org>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        Android Kernel Team <kernel-team@...roid.com>,
        lkml <linux-kernel@...r.kernel.org>,
        linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
        "moderated list:ARM/Mediatek SoC support" 
        <linux-mediatek@...ts.infradead.org>,
        linux-arm-msm <linux-arm-msm@...r.kernel.org>,
        Hanks Chen <hanks.chen@...iatek.com>,
        CC Hwang <cc.hwang@...iatek.com>,
        Loda Chou <loda.chou@...iatek.com>, steev@...i.org,
        Nial Peters <uceenpe@....ac.uk>
Subject: Re: [PATCH v3 2/4] irqchip/qcom-pdc: Switch to using
 IRQCHIP_PLATFORM_DRIVER helper macros

On Thu, Aug 6, 2020 at 5:12 AM Marc Zyngier <maz@...nel.org> wrote:
>
> On 2020-08-06 02:24, John Stultz wrote:
> > On Wed, Aug 5, 2020 at 1:19 PM Saravana Kannan <saravanak@...gle.com>
> > wrote:
> >> On Wed, Aug 5, 2020 at 12:44 AM John Stultz <john.stultz@...aro.org>
> >> wrote:
> >> > On Fri, Jul 17, 2020 at 5:06 PM Saravana Kannan <saravanak@...gle.com> wrote:
> >> > >
> >> > > Switch the driver to use the helper macros. In addition to reducing the
> >> > > number of lines, this also adds module unload protection (if the driver
> >> > > is compiled as a module) by switching from module_platform_driver to
> >> > > builtin_platform_driver.
> >> > >
> >> > > Signed-off-by: Saravana Kannan <saravanak@...gle.com>
> >> > > ---
> >> > >  drivers/irqchip/qcom-pdc.c | 26 +++-----------------------
> >> > >  1 file changed, 3 insertions(+), 23 deletions(-)
> >> > >
> >> > > diff --git a/drivers/irqchip/qcom-pdc.c b/drivers/irqchip/qcom-pdc.c
> >> > > index 5b624e3295e4..c1c5dfad57cc 100644
> >> > > --- a/drivers/irqchip/qcom-pdc.c
> >> > > +++ b/drivers/irqchip/qcom-pdc.c
> >> > > @@ -432,28 +432,8 @@ static int qcom_pdc_init(struct device_node *node, struct device_node *parent)
> >> > >         return ret;
> >> > >  }
> >> > >
> >> > > -static int qcom_pdc_probe(struct platform_device *pdev)
> >> > > -{
> >> > > -       struct device_node *np = pdev->dev.of_node;
> >> > > -       struct device_node *parent = of_irq_find_parent(np);
> >> > > -
> >> > > -       return qcom_pdc_init(np, parent);
> >> > > -}
> >> > > -
> >> > > -static const struct of_device_id qcom_pdc_match_table[] = {
> >> > > -       { .compatible = "qcom,pdc" },
> >> > > -       {}
> >> > > -};
> >> > > -MODULE_DEVICE_TABLE(of, qcom_pdc_match_table);
> >> > > -
> >> > > -static struct platform_driver qcom_pdc_driver = {
> >> > > -       .probe = qcom_pdc_probe,
> >> > > -       .driver = {
> >> > > -               .name = "qcom-pdc",
> >> > > -               .of_match_table = qcom_pdc_match_table,
> >> > > -               .suppress_bind_attrs = true,
> >> > > -       },
> >> > > -};
> >> > > -module_platform_driver(qcom_pdc_driver);
> >> > > +IRQCHIP_PLATFORM_DRIVER_BEGIN(qcom_pdc)
> >> > > +IRQCHIP_MATCH("qcom,pdc", qcom_pdc_init)
> >> > > +IRQCHIP_PLATFORM_DRIVER_END(qcom_pdc)
> >> > >  MODULE_DESCRIPTION("Qualcomm Technologies, Inc. Power Domain Controller");
> >> > >  MODULE_LICENSE("GPL v2");
> >> >
> >> > <sigh>
> >> > So this is where I bashfully admit I didn't get a chance to try this
> >> > patch series out, as I had success with a much older version of
> >> > Saravana's macro magic.
> >> >
> >> > But unfortunately, now that this has landed in mainline, I'm seeing
> >> > boot regressions on db845c. :( This is in the non-modular case,
> >> > building the driver in.
> >>
> >> Does that mean the modular version is working? Or you haven't tried
> >> that yet? I'll wait for your reply before I try to fix it. I don't
> >> have the hardware, but it should be easy to guess this issue looking
> >> at the code delta.
> >
> > I've not yet tested with modules with your patch.
> >
> >> The only significant change from what your probe function is doing is
> >> this snippet. But it'd be surprising if this only affects the builtin
> >> case.
> >>
> >> + if (par_np == np)
> >> +         par_np = NULL;
> >> +
> >> + /*
> >> + * If there's a parent interrupt controller and  none of the parent
> >> irq
> >> + * domains have been registered, that means the parent interrupt
> >> + * controller has not been initialized yet.  it's not time for this
> >> + * interrupt controller to initialize. So, defer probe of this
> >> + * interrupt controller. The actual initialization callback of this
> >> + * interrupt controller can check for specific domains as necessary.
> >> + */
> >> + if (par_np && !irq_find_matching_host(np, DOMAIN_BUS_ANY))
> >> +         return -EPROBE_DEFER;
> >
> > Yep. We're getting caught on the irq_find_matching_host() check. I'm a
> > little lost as when I look at the qcom,pdc node in the dtsi its not
> > under a parent controller (instead the soc node).
> > Not sure if that's an issue in the dtsi or if par_np check needs to
> > ignore the soc node and pass null?
>
> I think you have nailed it. This checks for a domain attached to
> the driver we are about to probe, and this domain cannot possibly
> exist. Instead, it is the *parent* this should check for, as we
> depend on it for successful probing.

Duh! Looks like I made a copy-paste/typo error. The comment clearly
says I'm trying to check the parent and then I end up checking the
node getting registered. I'm sure this will fix it.

Actually Nial sent an email a few hours after your and he had found
the same issue. He even tested the fix with an irqchip driver and it
fixed the probe issue.

I'm assuming you'll put up the patch yourself. Please let me know if
you need me to send one.

Thanks,
Saravana

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ