From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S263722AbTJCMCT (ORCPT ); Fri, 3 Oct 2003 08:02:19 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S263725AbTJCMCS (ORCPT ); Fri, 3 Oct 2003 08:02:18 -0400 Received: from ppp-217-133-42-200.cust-adsl.tiscali.it ([217.133.42.200]:32436 "EHLO velociraptor.random") by vger.kernel.org with ESMTP id S263722AbTJCMCN (ORCPT ); Fri, 3 Oct 2003 08:02:13 -0400 Date: Fri, 3 Oct 2003 14:02:36 +0200 From: Andrea Arcangeli To: Eyal Lebedinsky Cc: linux-kernel@vger.kernel.org Subject: Re: 2.4.23pre6aa1: HZ not constant? Message-ID: <20031003120236.GR13360@velociraptor.random> References: <20031002152648.GB1240@velociraptor.random> <3F7D4C4D.78BB5D0C@eyal.emu.id.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3F7D4C4D.78BB5D0C@eyal.emu.id.au> User-Agent: Mutt/1.4.1i X-GPG-Key: 1024D/68B9CB43 13D9 8355 295F 4823 7C49 C012 DFA1 686E 68B9 CB43 X-PGP-Key: 1024R/CB4660B9 CC A0 71 81 F4 A0 63 AC C0 4B 81 1D 8C 15 C8 E5 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 03, 2003 at 08:15:41PM +1000, Eyal Lebedinsky wrote: > I am getting failures like this: > > tr.c:81: initializer element is not constant > make[3]: *** [tr.o] Error 1 > make[3]: Leaving directory > `/data2/usr/local/src/linux-2.4-pre-aa/net/802' > > > ecc.c:43: initializer element is not constant > ecc.c:1495: warning: function declaration isn't a prototype > make[2]: *** [ecc.o] Error 1 > make[2]: Leaving directory > `/data2/usr/local/src/linux-2.4-pre-aa/drivers/char' > > where the problem is a file level definition like > static var = HZ; > > and it seems that HZ is not anymore valid here (see include/linux/hz.h). HZ isn't known at compile time anymore, you pass it to the kernel as parameter dynamically. the way to fix it is: 1) if the 'static var' variable is somehow visible to userspace then use USER_HZ and the user_to_kenrel_hz/user_to_kernel_hz_overflow (the latter is more efficient, it introduces zero branches , but it gives wrong results for very big inputs, it's ideal for sysctl set to things like 5*USER_HZ or anyways smaller than 2G/HZ ~= 1million). 2) if the static var is not visible to userspace (either via sysctl or module parameter) then we can just initialize it dynamically This is the relevant fix for the above two problems. Please try again and let me know if something else doesn't compile. Thanks! --- x/drivers/char/ecc.c.~1~ 2003-10-02 15:08:07.000000000 +0200 +++ x/drivers/char/ecc.c 2003-10-03 13:52:16.000000000 +0200 @@ -40,7 +40,7 @@ #define max(a,b) ((a)>(b)?(a):(b)) static int ecc_scrub = -1; -static int ecc_ticks = HZ; +static int ecc_ticks = USER_HZ; static spinlock_t ecc_lock = SPIN_LOCK_UNLOCKED; static int proc_ram_valid = 0; @@ -1410,7 +1410,7 @@ static void check_ecc(unsigned long dumm if (cs.clear_err) cs.clear_err(); - ecc_timer.expires = jiffies + ecc_ticks; + ecc_timer.expires = jiffies + user_to_kernel_hz_overflow(ecc_ticks); add_timer(&ecc_timer); spin_unlock (&ecc_lock); @@ -1616,8 +1616,8 @@ static int __init ecc_init(void) spin_lock_bh (&ecc_lock); printk(KERN_INFO "ECC: monitor version %s\n", ECC_VER); - if (ecc_ticks != HZ) - printk(KERN_INFO "ECC: interval=%d ticks\n", ecc_ticks); + if (user_to_kernel_hz_overflow(ecc_ticks) != HZ) + printk(KERN_INFO "ECC: interval=%d ticks\n", user_to_kernel_hz_overflow(ecc_ticks)); for (loop=0;loop I have: > # CONFIG_DEBUG_KERNEL is not set that's ok, it's not related to this. Andrea - If you prefer relying on open source software, check these links: rsync.kernel.org::pub/scm/linux/kernel/bkcvs/linux-2.[45]/ http://www.cobite.com/cvsps/