From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Ron Economos <re@w6rz.net>
Cc: Guenter Roeck <linux@roeck-us.net>,
regressions@lists.linux.dev, linux-clk@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-riscv <linux-riscv@lists.infradead.org>
Subject: Re: [PATCH] clkdev: report over-sized strings when creating clkdev
Date: Mon, 27 May 2024 14:18:23 +0100 [thread overview]
Message-ID: <ZlSIH1/etwPQe+bQ@shell.armlinux.org.uk> (raw)
In-Reply-To: <28114882-f8d7-21bf-4536-a186e8d7a22a@w6rz.net>
On Mon, May 27, 2024 at 03:45:15AM -0700, Ron Economos wrote:
> On Fri, May 17, 2024 at 03:09:14PM -0700, Guenter Roeck wrote:
> > Hi,
> >
> > On Fri, Mar 15, 2024 at 11:47:55AM +0000, Russell King (Oracle) wrote:
> > > Report an error when an attempt to register a clkdev entry results in a
> > > truncated string so the problem can be easily spotted.
> > >
> > > Reported by: Duanqiang Wen <duanqiangwen@net-swift.com>
> > > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > > Reviewed-by: Stephen Boyd <sboyd@kernel.org>
> >
> > With this patch in the mainline kernel, I get
> >
> > 10000000.clock-controller:corepll: device ID is greater than 24
> > sifive-clk-prci 10000000.clock-controller: Failed to register clkdev for
> corepll: -12
> > sifive-clk-prci 10000000.clock-controller: could not register clocks: -12
> > sifive-clk-prci 10000000.clock-controller: probe with driver
> sifive-clk-prci failed with error -12
> > ...
> > platform 10060000.gpio: deferred probe pending: platform: supplier
> 10000000.clock-controller not ready
> > platform 10010000.serial: deferred probe pending: platform: supplier
> 10000000.clock-controller not ready
> > platform 10011000.serial: deferred probe pending: platform: supplier
> 10000000.clock-controller not ready
> > platform 10040000.spi: deferred probe pending: platform: supplier
> 10000000.clock-controller not ready
> > platform 10050000.spi: deferred probe pending: platform: supplier
> 10000000.clock-controller not ready
> > platform 10090000.ethernet: deferred probe pending: platform: supplier
> 10000000.clock-controller not ready
> >
> > when trying to boot sifive_u in qemu.
> >
> > Apparently, "10000000.clock-controller" is too long. Any suggestion on
> > how to solve the problem ? I guess using dev_name(dev) as dev_id parameter
> > for clk_hw_register_clkdev() is not or no longer a good idea.
> > What else should be used instead ?
>
> This issue causes a complete boot failure on real hardware (SiFive
> Unmatched). The boot only gets as far as "Starting kernel ..." with no other
> indication of what's going on.
>
> Guenter's suggested patch solves the issue.
>
> diff --git a/drivers/clk/sifive/sifive-prci.c
> b/drivers/clk/sifive/sifive-prci.c
> index 25b8e1a80ddc..20cc8f42d9eb 100644
> --- a/drivers/clk/sifive/sifive-prci.c
> +++ b/drivers/clk/sifive/sifive-prci.c
> @@ -537,7 +537,7 @@ static int __prci_register_clocks(struct device *dev,
> struct __prci_data *pd,
> return r;
> }
>
> - r = clk_hw_register_clkdev(&pic->hw, pic->name,
> dev_name(dev));
> + r = clk_hw_register_clkdev(&pic->hw, pic->name, "prci");
How about just changing this to:
r = clk_hw_register(dev, &pic->hw);
?
Since, if the device name is over-sized and thus truncated in the clk
lookup array that clkdev maintains, *nothing* will be able to match
the entry. Hence, I suspect all those clkdev registrations are
completely redundant for this driver (and do nothing other than
waste memory!)
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
WARNING: multiple messages have this Message-ID (diff)
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Ron Economos <re@w6rz.net>
Cc: Guenter Roeck <linux@roeck-us.net>,
regressions@lists.linux.dev, linux-clk@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-riscv <linux-riscv@lists.infradead.org>
Subject: Re: [PATCH] clkdev: report over-sized strings when creating clkdev
Date: Mon, 27 May 2024 14:18:23 +0100 [thread overview]
Message-ID: <ZlSIH1/etwPQe+bQ@shell.armlinux.org.uk> (raw)
In-Reply-To: <28114882-f8d7-21bf-4536-a186e8d7a22a@w6rz.net>
On Mon, May 27, 2024 at 03:45:15AM -0700, Ron Economos wrote:
> On Fri, May 17, 2024 at 03:09:14PM -0700, Guenter Roeck wrote:
> > Hi,
> >
> > On Fri, Mar 15, 2024 at 11:47:55AM +0000, Russell King (Oracle) wrote:
> > > Report an error when an attempt to register a clkdev entry results in a
> > > truncated string so the problem can be easily spotted.
> > >
> > > Reported by: Duanqiang Wen <duanqiangwen@net-swift.com>
> > > Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> > > Reviewed-by: Stephen Boyd <sboyd@kernel.org>
> >
> > With this patch in the mainline kernel, I get
> >
> > 10000000.clock-controller:corepll: device ID is greater than 24
> > sifive-clk-prci 10000000.clock-controller: Failed to register clkdev for
> corepll: -12
> > sifive-clk-prci 10000000.clock-controller: could not register clocks: -12
> > sifive-clk-prci 10000000.clock-controller: probe with driver
> sifive-clk-prci failed with error -12
> > ...
> > platform 10060000.gpio: deferred probe pending: platform: supplier
> 10000000.clock-controller not ready
> > platform 10010000.serial: deferred probe pending: platform: supplier
> 10000000.clock-controller not ready
> > platform 10011000.serial: deferred probe pending: platform: supplier
> 10000000.clock-controller not ready
> > platform 10040000.spi: deferred probe pending: platform: supplier
> 10000000.clock-controller not ready
> > platform 10050000.spi: deferred probe pending: platform: supplier
> 10000000.clock-controller not ready
> > platform 10090000.ethernet: deferred probe pending: platform: supplier
> 10000000.clock-controller not ready
> >
> > when trying to boot sifive_u in qemu.
> >
> > Apparently, "10000000.clock-controller" is too long. Any suggestion on
> > how to solve the problem ? I guess using dev_name(dev) as dev_id parameter
> > for clk_hw_register_clkdev() is not or no longer a good idea.
> > What else should be used instead ?
>
> This issue causes a complete boot failure on real hardware (SiFive
> Unmatched). The boot only gets as far as "Starting kernel ..." with no other
> indication of what's going on.
>
> Guenter's suggested patch solves the issue.
>
> diff --git a/drivers/clk/sifive/sifive-prci.c
> b/drivers/clk/sifive/sifive-prci.c
> index 25b8e1a80ddc..20cc8f42d9eb 100644
> --- a/drivers/clk/sifive/sifive-prci.c
> +++ b/drivers/clk/sifive/sifive-prci.c
> @@ -537,7 +537,7 @@ static int __prci_register_clocks(struct device *dev,
> struct __prci_data *pd,
> return r;
> }
>
> - r = clk_hw_register_clkdev(&pic->hw, pic->name,
> dev_name(dev));
> + r = clk_hw_register_clkdev(&pic->hw, pic->name, "prci");
How about just changing this to:
r = clk_hw_register(dev, &pic->hw);
?
Since, if the device name is over-sized and thus truncated in the clk
lookup array that clkdev maintains, *nothing* will be able to match
the entry. Hence, I suspect all those clkdev registrations are
completely redundant for this driver (and do nothing other than
waste memory!)
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2024-05-27 13:18 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-27 10:45 [PATCH] clkdev: report over-sized strings when creating clkdev Ron Economos
2024-05-27 10:45 ` Ron Economos
2024-05-27 11:16 ` Linux regression tracking (Thorsten Leemhuis)
2024-05-27 11:16 ` Linux regression tracking (Thorsten Leemhuis)
2024-05-27 12:57 ` Russell King (Oracle)
2024-05-27 12:57 ` Russell King (Oracle)
2024-05-27 13:18 ` Russell King (Oracle) [this message]
2024-05-27 13:18 ` Russell King (Oracle)
2024-05-27 13:24 ` Russell King (Oracle)
2024-05-27 13:24 ` Russell King (Oracle)
2024-05-27 13:30 ` Russell King (Oracle)
2024-05-27 13:30 ` Russell King (Oracle)
2024-05-28 8:15 ` [PATCH] clk: clkdev: don't fail clkdev_alloc() if over-sized Russell King (Oracle)
2024-05-28 8:15 ` Russell King (Oracle)
2024-05-28 8:15 ` Russell King (Oracle)
2024-05-28 11:21 ` Ron Economos
2024-05-28 11:21 ` Ron Economos
2024-05-28 11:21 ` Ron Economos
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=ZlSIH1/etwPQe+bQ@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=linux@roeck-us.net \
--cc=re@w6rz.net \
--cc=regressions@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.