public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: Valdis.Kletnieks@vt.edu
Cc: Arnaud Lacombe <lacombar@gmail.com>,
	Michal Marek <mmarek@suse.cz>,
	linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org,
	x86@kernel.org, Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCH v2] kconfig: autogenerated config_is_xxx macro
Date: Wed, 18 May 2011 07:27:47 +0200	[thread overview]
Message-ID: <20110518052747.GC15292@game.jcrosoft.org> (raw)
In-Reply-To: <14777.1305659606@localhost>

On 15:13 Tue 17 May     , Valdis.Kletnieks@vt.edu wrote:
> On Tue, 17 May 2011 03:03:29 +0200, Jean-Christophe PLAGNIOL-VILLARD said:
> > On 15:38 Mon 16 May     , Arnaud Lacombe wrote:
> > > On Mon, May 16, 2011 at 3:03 PM,  <Valdis.Kletnieks@vt.edu> wrote:
> > > > #if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP)
> > > >        if (!pinned && get_sysctl_timer_migration() && idle_cpu(cpu))
> > > >                cpu = get_nohz_timer_target();
> > > > #endif
> > > >        new_base = per_cpu(tvec_bases, cpu);
> 
> > > I already exposed this case, but let's prove it:
> > >
> > > % grep CONFIG_SMP .config
> > > # CONFIG_SMP is not set
> > >
> > > % git diff
> > > diff --git a/kernel/timer.c b/kernel/timer.c
> > > index fd61986..ea4a5ba 100644
> > > --- a/kernel/timer.c
> > > +++ b/kernel/timer.c
> > > @@ -681,10 +681,8 @@ __mod_timer(struct timer_list *timer, unsigned
> > > long expires,
> > >
> > >         cpu = smp_processor_id();
> > >
> > > -#if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP)
> > > -       if (!pinned && get_sysctl_timer_migration() && idle_cpu(cpu))
> > > +       if (0 && 0 && !pinned && get_sysctl_timer_migration() && idle_cpu(cpu))
> > >                 cpu = get_nohz_timer_target();
> > > -#endif
> > >         new_base = per_cpu(tvec_bases, cpu);
> > >
> > > % gmake kernel/timer.o
> > >   CHK     include/linux/version.h
> > >   CHK     include/generated/utsrelease.h
> > >   CALL    scripts/checksyscalls.sh
> > >   CC      kernel/timer.o
> > > kernel/timer.c: In function '__mod_timer':
> > > kernel/timer.c:685:3: error: implicit declaration of function
> > > 'get_nohz_timer_target'
> > > gmake[1]: *** [kernel/timer.o] Error 1
> > > gmake: *** [kernel/timer.o] Error 2
> 
> > because we do not define the inline function if the CONFIG_ is not define
> > as we are supposed to do if we want to compile without ifdef everywhere
> 
> Right - the point is that since many/most cases of #ifdef CONFIG_FOO in open
> code won't compile cleanly if converted to config_is_foo(), it limits the
> usefulness of the feature.
yeah because the code is not design today to be able to compile if not def

But it's not the case everywhere in the kernel
as example on ARM it's common to if machine_is_xxx in the code and this is
handle the same way

And this is a good practice

I'll not said that to be able to use this config_is in most of the place will
be trivial but this will allow to simplify the maintenance a lot. This will
considerably reduce the number of config to test to be sure we brake nothing

> 
> Which raises another question - does this create a maintenance headache, where
> people who used to just 'grep -r CONFIG_FOO' to find code they needed to fix up
> now have to remember to do a *second* grep to find all callsites?
> 
you can do it in one grep also
grep -r -E "CONFIG_|config_is" *

Best Regards,
J.

  reply	other threads:[~2011-05-18  5:39 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-06  5:03 [PATCH v2] kconfig: autogenerated config_is_xxx macro Jean-Christophe PLAGNIOL-VILLARD
2011-05-06 16:19 ` Arnaud Lacombe
2011-05-07  1:50   ` Jean-Christophe PLAGNIOL-VILLARD
2011-05-09  8:52     ` Michal Marek
2011-05-13  8:09       ` Jean-Christophe PLAGNIOL-VILLARD
2011-05-13  8:30         ` Ingo Molnar
2011-05-13  8:36           ` Jean-Christophe PLAGNIOL-VILLARD
2011-05-13 10:01             ` Ingo Molnar
2011-05-13 10:21               ` Alexey Dobriyan
2011-05-13 10:38                 ` Michal Marek
2011-05-13 12:21                 ` Ingo Molnar
2011-05-14 10:02                   ` Jean-Christophe PLAGNIOL-VILLARD
2011-05-13 15:19         ` Arnaud Lacombe
2011-05-16 19:03         ` Valdis.Kletnieks
2011-05-16 19:38           ` Arnaud Lacombe
2011-05-16 20:05             ` Michal Marek
2011-05-16 20:24               ` Arnaud Lacombe
2011-05-16 20:33                 ` Michal Marek
2011-05-17  1:08                   ` Jean-Christophe PLAGNIOL-VILLARD
2011-05-17  1:03             ` Jean-Christophe PLAGNIOL-VILLARD
2011-05-17 19:13               ` Valdis.Kletnieks
2011-05-18  5:27                 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2011-05-13 16:26 ` Andi Kleen
2011-05-13 18:18 ` Arnaud Lacombe
2011-05-17 14:45 ` Michal Marek
2011-05-17 18:19   ` Jean-Christophe PLAGNIOL-VILLARD

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=20110518052747.GC15292@game.jcrosoft.org \
    --to=plagnioj@jcrosoft.com \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=lacombar@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mmarek@suse.cz \
    --cc=x86@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