All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: Marek Vasut <marex@denx.de>
Cc: u-boot@lists.denx.de, Simon Glass <sjg@chromium.org>,
	Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Subject: Re: [PATCH 02/14] lmb: Use CONFIG_LMB_*_REGIONS only if they are defined
Date: Sun, 29 Aug 2021 19:11:45 -0400	[thread overview]
Message-ID: <20210829231145.GN858@bill-the-cat> (raw)
In-Reply-To: <a788b638-eba6-550b-6dc5-0a09a26d0eec@denx.de>

[-- Attachment #1: Type: text/plain, Size: 6220 bytes --]

On Mon, Aug 30, 2021 at 01:00:02AM +0200, Marek Vasut wrote:
> On 8/30/21 12:51 AM, Tom Rini wrote:
> > On Mon, Aug 30, 2021 at 12:40:07AM +0200, Marek Vasut wrote:
> > > On 8/30/21 12:23 AM, Tom Rini wrote:
> > > > On Mon, Aug 30, 2021 at 12:19:59AM +0200, Marek Vasut wrote:
> > > > > On 8/30/21 12:10 AM, Tom Rini wrote:
> > > > > > On Sun, Aug 29, 2021 at 11:47:58PM +0200, Marek Vasut wrote:
> > > > > > > On 8/29/21 9:32 PM, Tom Rini wrote:
> > > > > > > > On Sun, Aug 29, 2021 at 09:24:46PM +0200, Marek Vasut wrote:
> > > > > > > > > On 8/29/21 8:02 PM, Tom Rini wrote:
> > > > > > > > > > On Sun, Aug 29, 2021 at 06:26:23PM +0200, Marek Vasut wrote:
> > > > > > > > > > > On 8/15/21 9:47 PM, Tom Rini wrote:
> > > > > > > > > > > > On Sun, Aug 15, 2021 at 08:13:02PM +0200, Marek Vasut wrote:
> > > > > > > > > > > > 
> > > > > > > > > > > > > The CONFIG_LMB_*_REGIONS are defined only if CONFIG_LMB is enabled,
> > > > > > > > > > > > > protect access to those two config options to avoid undefined macro
> > > > > > > > > > > > > errors.
> > > > > > > > > > > > > 
> > > > > > > > > > > > > Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> > > > > > > > > > > > > Cc: Simon Glass <sjg@chromium.org>
> > > > > > > > > > > > > Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> > > > > > > > > > > > > Cc: Tom Rini <trini@konsulko.com>
> > > > > > > > > > > > > ---
> > > > > > > > > > > > >        include/lmb.h | 4 ++--
> > > > > > > > > > > > >        1 file changed, 2 insertions(+), 2 deletions(-)
> > > > > > > > > > > > > 
> > > > > > > > > > > > > diff --git a/include/lmb.h b/include/lmb.h
> > > > > > > > > > > > > index 3c4afdf9f0..fa1474a360 100644
> > > > > > > > > > > > > --- a/include/lmb.h
> > > > > > > > > > > > > +++ b/include/lmb.h
> > > > > > > > > > > > > @@ -44,7 +44,7 @@ struct lmb_property {
> > > > > > > > > > > > >        struct lmb_region {
> > > > > > > > > > > > >        	unsigned long cnt;
> > > > > > > > > > > > >        	unsigned long max;
> > > > > > > > > > > > > -#if IS_ENABLED(CONFIG_LMB_USE_MAX_REGIONS)
> > > > > > > > > > > > > +#if IS_ENABLED(CONFIG_LMB) && IS_ENABLED(CONFIG_LMB_USE_MAX_REGIONS)
> > > > > > > > > > 
> > > > > > > > > > This doesn't make sense to me, still.  You cannot enable
> > > > > > > > > > CONFIG_LMB_USE_MAX_REGIONS without CONFIG_LMB as the former depends on
> > > > > > > > > > the latter in Kconfig.
> > > > > > > > > > 
> > > > > > > > > > > > >        	struct lmb_property region[CONFIG_LMB_MAX_REGIONS];
> > > > > > > > > > > > >        #else
> > > > > > > > > > > > >        	struct lmb_property *region;
> > > > > > > > > > > > > @@ -67,7 +67,7 @@ struct lmb_region {
> > > > > > > > > > > > >        struct lmb {
> > > > > > > > > > > > >        	struct lmb_region memory;
> > > > > > > > > > > > >        	struct lmb_region reserved;
> > > > > > > > > > > > > -#if !IS_ENABLED(CONFIG_LMB_USE_MAX_REGIONS)
> > > > > > > > > > > > > +#if IS_ENABLED(CONFIG_LMB) && !IS_ENABLED(CONFIG_LMB_USE_MAX_REGIONS)
> > > > > > > > > > > > >        	struct lmb_property memory_regions[CONFIG_LMB_MEMORY_REGIONS];
> > > > > > > > > > > > >        	struct lmb_property reserved_regions[CONFIG_LMB_RESERVED_REGIONS];
> > > > > > > > > > > > >        #endif
> > > > > > > > > > > > 
> > > > > > > > > > > > We shouldn't need this at all.  LMB and LMB_USE_MAX_REGIONS are both in
> > > > > > > > > > > > Kconfig and have the dependencies expressed that way.
> > > > > > > > > > > 
> > > > > > > > > > > However, CONFIG_LMB_MEMORY_REGIONS and CONFIG_LMB_RESERVED_REGIONS may be
> > > > > > > > > > > undefined if CONFIG_LMB and !CONFIG_LMB_USE_MAX_REGIONS . They are four
> > > > > > > > > > > different symbols.
> > > > > > > > > > 
> > > > > > > > > > I'm still not seeing it, sorry.  Is there some case where we're trying
> > > > > > > > > > to access a struct lmb without CONFIG_LMB enabled?
> > > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > See build failure
> > > > > > > > > https://source.denx.de/u-boot/custodians/u-boot-sh/-/jobs/315331
> > > > > > > > 
> > > > > > > > Ah, progress.  Drop <lmb.h> from <image.h> since we already have a
> > > > > > > > forward declaration of struct lmb?  But it's not failing without this
> > > > > > > > series too, so what's changing?
> > > > > > > 
> > > > > > > See 01/14 in this series.
> > > > > > 
> > > > > > Ah, so drop 1/14 then.
> > > > > 
> > > > > Why ? That patch is correct.
> > > > 
> > > > It's not quite right, 1/14 and then 2/14 are papering over the fact that
> > > > lmb.h, and it's including headers / files, need to be cleaned up so that
> > > > we don't need to have redundant tests in the header.
> > > 
> > > 1/14 disables LMB and CMD_BDI for tools build, we do not need those, so 1/14
> > > is correct.
> > 
> > We don't need to build u-boot at all for tools-only, only the tools-only
> > build target.  It's just annoying to exclude the tools-only_defconfig from
> > "sandbox" in CI.
> 
> So, what exactly is the problem with that 01/14 ? Please elaborate, I
> believe the patch is correct.

You disable LMB in a target that's only building "all" in CI because
wasn't ever worth adding ",sandbox" to the all other arches job until
perhaps now.

Disabling LMB in tools-only_defconfig then exposes that <lmb.h> can only
be included safely when CONFIG_LMB is set.

Adding / extending an #if test in code for something that's already
checked for in Kconfig is bad.  We spent so much time already removing
and shrinking #if tests in the code.

> > > What kind of cleanup of lmb.h do you have in mind ?
> > 
> > Remove it from include/image.h and fix any fall-out from that of files
> > that got <lmb.h> indirectly when they needed it directly instead.
> 
> Uh ... that is likely for a separate series, and a big one.

Honestly, checking again, I'm not sure LMB=n is valid, ever.  That's how
we keep our running U-Boot from being trivially overwritten and a huge
number of security issues from being re-opened. 

At this point, I think you should rework things to stop making
CONFIG_LMB be optional, it should be a def_bool y.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

  reply	other threads:[~2021-08-29 23:11 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-15 18:13 [PATCH 01/14] configs: Disable LMB and BDI for tools-only Marek Vasut
2021-08-15 18:13 ` [PATCH 02/14] lmb: Use CONFIG_LMB_*_REGIONS only if they are defined Marek Vasut
2021-08-15 19:47   ` Tom Rini
2021-08-29 16:26     ` Marek Vasut
2021-08-29 18:02       ` Tom Rini
2021-08-29 19:24         ` Marek Vasut
2021-08-29 19:32           ` Tom Rini
2021-08-29 21:47             ` Marek Vasut
2021-08-29 22:10               ` Tom Rini
2021-08-29 22:19                 ` Marek Vasut
2021-08-29 22:23                   ` Tom Rini
2021-08-29 22:40                     ` Marek Vasut
2021-08-29 22:51                       ` Tom Rini
2021-08-29 23:00                         ` Marek Vasut
2021-08-29 23:11                           ` Tom Rini [this message]
2021-08-30  9:45                             ` Marek Vasut
2021-08-30 12:01                               ` Tom Rini
2021-09-04 14:03                                 ` Marek Vasut
2021-09-04 14:10                                   ` Tom Rini
2021-09-04 15:15                                     ` Marek Vasut
2021-09-04 15:17                                       ` Tom Rini
2021-09-04 16:05                                         ` Marek Vasut
2021-09-04 16:09                                           ` Tom Rini
2021-09-04 16:49                                             ` Marek Vasut
2021-09-04 17:01                                               ` Tom Rini
2021-09-04 19:37                                                 ` Marek Vasut
2021-09-04 19:56                                                   ` Tom Rini
2021-08-15 18:13 ` [PATCH 03/14] lmb: Always compile arch_lmb_reserve() into U-Boot on arm Marek Vasut
2021-08-15 19:47   ` Tom Rini
2021-08-15 18:13 ` [PATCH 04/14] lmb: Always compile arch_lmb_reserve() into U-Boot on arc Marek Vasut
2021-08-15 18:13 ` [PATCH 05/14] lmb: Add generic arch_lmb_reserve_generic() Marek Vasut
2021-08-15 19:49   ` Tom Rini
2021-08-15 18:13 ` [PATCH 06/14] lmb: Switch to " Marek Vasut
2021-08-15 19:48   ` Tom Rini
2021-08-15 18:13 ` [PATCH 07/14] lmb: nios2: Add arch_lmb_reserve() Marek Vasut
2021-08-15 18:13 ` [PATCH 08/14] lmb: nds32: " Marek Vasut
     [not found]   ` <HK0PR03MB2994783DDC460B69CDE74093C1CE9@HK0PR03MB2994.apcprd03.prod.outlook.com>
2021-09-02  1:53     ` Rick Chen
2021-08-15 18:13 ` [PATCH 09/14] lmb: riscv: " Marek Vasut
     [not found]   ` <HK0PR03MB2994629C8CC69189EDF64C00C1CE9@HK0PR03MB2994.apcprd03.prod.outlook.com>
2021-09-02  1:54     ` Rick Chen
2021-08-15 18:13 ` [PATCH 10/14] lmb: sh: " Marek Vasut
2021-08-15 18:13 ` [PATCH 11/14] lmb: xtensa: " Marek Vasut
2021-08-15 18:13 ` [PATCH 12/14] lmb: x86: " Marek Vasut
2021-08-15 18:13 ` [PATCH 13/14] lmb: Mark arch_lmb_reserve() as weak symbol Marek Vasut
2021-08-15 19:50   ` Tom Rini
2021-08-29 16:46     ` Marek Vasut
2021-08-29 18:01       ` Tom Rini
2021-08-15 18:13 ` [PATCH 14/14] lmb: Switch imx board_lmb_reserve() to arch_lmb_reserve() Marek Vasut
2021-08-15 19:47   ` Tom Rini

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=20210829231145.GN858@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=marex@denx.de \
    --cc=simon.k.r.goldschmidt@gmail.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /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.