From patchwork Mon May 16 19:38:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnaud Lacombe X-Patchwork-Id: 789362 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4GJcYbf024740 for ; Mon, 16 May 2011 19:38:35 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754276Ab1EPTiT (ORCPT ); Mon, 16 May 2011 15:38:19 -0400 Received: from mail-iy0-f174.google.com ([209.85.210.174]:54930 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752860Ab1EPTiS convert rfc822-to-8bit (ORCPT ); Mon, 16 May 2011 15:38:18 -0400 Received: by iyb14 with SMTP id 14so4014627iyb.19 for ; Mon, 16 May 2011 12:38:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=rpNMK8mGCDCOTA6BUqNzG1vTbH4TFnHD9ZBRpLYi/SI=; b=pwg+5ZQSn5X6EVxNf1ho6W1zsTy8haJEvQm4fa0gySRA5RpNMbxGDG28H3ixTXRC6N HgiFtypEHvojNXBcaasFwP5Wj+3BRnElVVnxvOI4BpjxoL0nz6HqWRKZOnH+RpawH+BR r69vDNUmc50qc6G2Ob46TFrMHfgA7LXbgPPCw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=fYlO32BnvtoGFfdyO6NzpB+p+5X3qm8C+YvmafqlE3rcR9926WtHDQu8IDyd6rcrdb /IPr2yhOCAmWuH8ZBLlAlF+bxWa0gDCu+e2wzBenVhcm/49nKWf3EU+B2dFCtsW/SDkZ wNAXCHMA8A1B0hWQ5CMhebvxYt+WhUgDZ+o64= MIME-Version: 1.0 Received: by 10.42.134.67 with SMTP id k3mr1997841ict.478.1305574697385; Mon, 16 May 2011 12:38:17 -0700 (PDT) Received: by 10.42.177.10 with HTTP; Mon, 16 May 2011 12:38:17 -0700 (PDT) In-Reply-To: <32557.1305572616@localhost> References: <1304658229-30820-1-git-send-email-plagnioj@jcrosoft.com> <20110507015041.GA21017@game.jcrosoft.org> <4DC7AB57.9050002@suse.cz> <20110513080909.GO18952@game.jcrosoft.org> <32557.1305572616@localhost> Date: Mon, 16 May 2011 15:38:17 -0400 Message-ID: Subject: Re: [PATCH v2] kconfig: autogenerated config_is_xxx macro From: Arnaud Lacombe To: Valdis.Kletnieks@vt.edu Cc: Jean-Christophe PLAGNIOL-VILLARD , Michal Marek , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, x86@kernel.org, Ingo Molnar Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Mon, 16 May 2011 19:38:35 +0000 (UTC) Hi, On Mon, May 16, 2011 at 3:03 PM, wrote: > On Fri, 13 May 2011 10:09:09 +0200, Jean-Christophe PLAGNIOL-VILLARD said: >> On 10:52 Mon 09 May     , Michal Marek wrote: >> > Do you have proof of concept patches that make use of the >> > config_is_xxx macros? Acked by the respective subsystem maintainers? >> > It would be a good idea to send them along to show that this feature >> > is going to be actually used. >> I've seen thousands of place in the kernel we can use >> so I'll just take one example on x86 >> >> the patch attached is just an example > > Out of curiosity, will this Do The Right Thing for cases where things simply won't > build for some configs?  For example, consider this code snippet from kernel/timer.c, > in __mod_timer() (near line 682): > >        debug_activate(timer, expires); > >        cpu = smp_processor_id(); > > #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); > > If you convert this to an if statement, will it still compile?  Which will > happen first, dead code elimination, or the warning that get_nohz_timer_target() > is an implicit declaration because the definition in the .h file is also > guarded by #ifdef CONFIG_NO_HZ? > I already exposed this case, but let's prove it: % grep CONFIG_SMP .config # CONFIG_SMP is not set % git diff % 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 - Arnaud --- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);