2007-09-24 09:21:27

by Jonathan Campbell

[permalink] [raw]
Subject: [PATCH] Patches for tiny 386 kernels, again. Linux kernel 2.6.22.7

diff -u -r linux-2.6.22.7-old/arch/i386/Kconfig linux-2.6.22.7/arch/i386/Kconfig
--- linux-2.6.22.7-old/arch/i386/Kconfig 2007-09-23 20:44:10.000000000 +0000
+++ linux-2.6.22.7/arch/i386/Kconfig 2007-09-23 22:15:57.000000000 +0000
@@ -362,6 +362,18 @@
to disable it. MCE support simply ignores non-MCE processors like
the 386 and 486, so nearly everyone can say Y here.

+config X86_TSC
+ bool "Use TSC as time source" if EMBEDDED
+ depends on X86
+ default y
+ help
+ Uses the TSC (time stamp counter) in Pentium and newer systems as a
+ high resolution timer. If you are compiling a kernel for older 386
+ and 486 systems that do not have this counter, you can say N here
+ to help reduce the size of your kernel.
+
+ If unsure, say Y.
+
config X86_MCE_NONFATAL
tristate "Check for non-fatal errors on AMD Athlon/Duron / Intel Pentium 4"
depends on X86_MCE
diff -u -r linux-2.6.22.7-old/arch/i386/kernel/Makefile linux-2.6.22.7/arch/i386/kernel/Makefile
--- linux-2.6.22.7-old/arch/i386/kernel/Makefile 2007-09-21 22:38:23.000000000 +0000
+++ linux-2.6.22.7/arch/i386/kernel/Makefile 2007-09-23 22:17:36.000000000 +0000
@@ -7,8 +7,9 @@
obj-y := process.o signal.o entry.o traps.o irq.o \
ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_i386.o \
pci-dma.o i386_ksyms.o i387.o bootflag.o e820.o\
- quirks.o i8237.o topology.o alternative.o i8253.o tsc.o
+ quirks.o i8237.o topology.o alternative.o i8253.o

+obj-$(CONFIG_X86_TSC) += tsc.o
obj-$(CONFIG_STACKTRACE) += stacktrace.o
obj-y += cpu/
obj-y += acpi/
diff -u -r linux-2.6.22.7-old/arch/i386/kernel/cpu/amd.c linux-2.6.22.7/arch/i386/kernel/cpu/amd.c
--- linux-2.6.22.7-old/arch/i386/kernel/cpu/amd.c 2007-09-21 22:38:23.000000000 +0000
+++ linux-2.6.22.7/arch/i386/kernel/cpu/amd.c 2007-09-23 23:39:11.000000000 +0000
@@ -117,6 +117,7 @@
break;
}

+#ifdef CONFIG_X86_TSC /* this test requires the presence of the TSC */
if ( c->x86_model == 6 && c->x86_mask == 1 ) {
const int K6_BUG_LOOP = 1000000;
int n;
@@ -144,6 +145,7 @@
printk("probably OK (after B9730xxxx).\n");
printk(KERN_INFO "Please see http://membres.lycos.fr/poulot/k6bug.html\n");
}
+#endif

/* K6 with old style WHCR */
if (c->x86_model < 8 ||
diff -u -r linux-2.6.22.7-old/arch/i386/lib/delay.c linux-2.6.22.7/arch/i386/lib/delay.c
--- linux-2.6.22.7-old/arch/i386/lib/delay.c 2007-09-21 22:38:23.000000000 +0000
+++ linux-2.6.22.7/arch/i386/lib/delay.c 2007-09-23 23:15:42.000000000 +0000
@@ -37,6 +37,7 @@
:"0" (loops));
}

+#ifdef CONFIG_X86_TSC
/* TSC based delay: */
static void delay_tsc(unsigned long loops)
{
@@ -48,6 +49,7 @@
rdtscl(now);
} while ((now-bclock) < loops);
}
+#endif

/*
* Since we calibrate only once at boot, this
@@ -55,6 +57,7 @@
*/
static void (*delay_fn)(unsigned long) = delay_loop;

+#ifdef CONFIG_X86_TSC
void use_tsc_delay(void)
{
delay_fn = delay_tsc;
@@ -68,6 +71,7 @@
}
return -1;
}
+#endif

void __delay(unsigned long loops)
{
diff -u -r linux-2.6.22.7-old/include/asm-i386/cpufeature.h linux-2.6.22.7/include/asm-i386/cpufeature.h
--- linux-2.6.22.7-old/include/asm-i386/cpufeature.h 2007-09-21 22:38:23.000000000 +0000
+++ linux-2.6.22.7/include/asm-i386/cpufeature.h 2007-09-23 23:32:13.000000000 +0000
@@ -119,7 +119,11 @@
#define cpu_has_vme boot_cpu_has(X86_FEATURE_VME)
#define cpu_has_de boot_cpu_has(X86_FEATURE_DE)
#define cpu_has_pse boot_cpu_has(X86_FEATURE_PSE)
+#ifdef CONFIG_X86_TSC
#define cpu_has_tsc boot_cpu_has(X86_FEATURE_TSC)
+#else
+#define cpu_has_tsc 0
+#endif
#define cpu_has_pae boot_cpu_has(X86_FEATURE_PAE)
#define cpu_has_pge boot_cpu_has(X86_FEATURE_PGE)
#define cpu_has_apic boot_cpu_has(X86_FEATURE_APIC)
diff -u -r linux-2.6.22.7-old/include/asm-i386/delay.h linux-2.6.22.7/include/asm-i386/delay.h
--- linux-2.6.22.7-old/include/asm-i386/delay.h 2007-09-21 22:38:23.000000000 +0000
+++ linux-2.6.22.7/include/asm-i386/delay.h 2007-09-23 23:16:25.000000000 +0000
@@ -26,6 +26,10 @@
((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \
__ndelay(n))

+#ifdef CONFIG_X86_TSC
void use_tsc_delay(void);
+#else
+static inline void use_tsc_delay(void) { }
+#endif

#endif /* defined(_I386_DELAY_H) */
diff -u -r linux-2.6.22.7-old/include/asm-i386/msr.h linux-2.6.22.7/include/asm-i386/msr.h
--- linux-2.6.22.7-old/include/asm-i386/msr.h 2007-09-21 22:38:23.000000000 +0000
+++ linux-2.6.22.7/include/asm-i386/msr.h 2007-09-23 23:41:08.000000000 +0000
@@ -60,12 +60,14 @@
return err;
}

+#ifdef CONFIG_X86_TSC
static inline unsigned long long native_read_tsc(void)
{
unsigned long long val;
asm volatile("rdtsc" : "=A" (val));
return val;
}
+#endif

static inline unsigned long long native_read_pmc(void)
{
@@ -117,6 +119,8 @@
__err; \
})

+#ifdef CONFIG_X86_TSC
+
#define rdtscl(low) \
((low) = (u32)native_read_tsc())

@@ -125,6 +129,16 @@

#define write_tsc(val1,val2) wrmsr(0x10, val1, val2)

+#else /* CONFIG_X86_TSC */
+
+#define rdtscl(low) ((low) = 0)
+
+#define rdtscll(val) ((val) = 0)
+
+#define write_tsc(val1,val2)
+
+#endif /* CONFIG_X86_TSC */
+
#define rdpmc(counter,low,high) \
do { \
u64 _l = native_read_pmc(); \
diff -u -r linux-2.6.22.7-old/include/asm-i386/processor.h linux-2.6.22.7/include/asm-i386/processor.h
--- linux-2.6.22.7-old/include/asm-i386/processor.h 2007-09-21 22:38:23.000000000 +0000
+++ linux-2.6.22.7/include/asm-i386/processor.h 2007-09-23 22:58:59.000000000 +0000
@@ -24,7 +24,11 @@
#include <asm/processor-flags.h>

/* flag for disabling the tsc */
+#ifdef CONFIG_X86_TSC
extern int tsc_disable;
+#else
+# define tsc_disable 1
+#endif

struct desc_struct {
unsigned long a,b;
diff -u -r linux-2.6.22.7-old/include/asm-i386/timer.h linux-2.6.22.7/include/asm-i386/timer.h
--- linux-2.6.22.7-old/include/asm-i386/timer.h 2007-09-21 22:38:23.000000000 +0000
+++ linux-2.6.22.7/include/asm-i386/timer.h 2007-09-23 23:12:35.000000000 +0000
@@ -12,7 +12,12 @@
extern int timer_ack;
extern int no_timer_check;
extern int no_sync_cmos_clock;
+
+#ifdef CONFIG_X86_TSC
extern int recalibrate_cpu_khz(void);
+#else
+static inline int recalibrate_cpu_khz(void) { return -ENODEV; }
+#endif

#ifndef CONFIG_PARAVIRT
#define get_scheduled_cycles(val) rdtscll(val)
diff -u -r linux-2.6.22.7-old/include/asm-i386/timex.h linux-2.6.22.7/include/asm-i386/timex.h
--- linux-2.6.22.7-old/include/asm-i386/timex.h 2007-09-21 22:38:23.000000000 +0000
+++ linux-2.6.22.7/include/asm-i386/timex.h 2007-09-23 23:20:42.000000000 +0000
@@ -15,8 +15,12 @@
# define CLOCK_TICK_RATE 1193182 /* Underlying HZ */
#endif

-
+#ifdef CONFIG_X86_TSC
extern int read_current_timer(unsigned long *timer_value);
+#else
+static inline int read_current_timer(unsigned long *timer_value) { return -1; }
+#endif
+
#define ARCH_HAS_READ_CURRENT_TIMER 1

#endif
diff -u -r linux-2.6.22.7-old/include/asm-i386/tsc.h linux-2.6.22.7/include/asm-i386/tsc.h
--- linux-2.6.22.7-old/include/asm-i386/tsc.h 2007-09-21 22:38:23.000000000 +0000
+++ linux-2.6.22.7/include/asm-i386/tsc.h 2007-09-23 23:36:29.000000000 +0000
@@ -25,7 +25,7 @@
return 0;
#endif

-#if defined(CONFIG_X86_GENERIC) || defined(CONFIG_X86_TSC)
+#if defined(CONFIG_X86_GENERIC) && defined(CONFIG_X86_TSC)
rdtscll(ret);
#endif
return ret;
@@ -34,6 +34,7 @@
/* Like get_cycles, but make sure the CPU is synchronized. */
static __always_inline cycles_t get_cycles_sync(void)
{
+#ifdef CONFIG_X86_TSC
unsigned long long ret;
unsigned eax, edx;

@@ -57,8 +58,12 @@
rdtscll(ret);

return ret;
+#else
+ return 0;
+#endif
}

+#ifdef CONFIG_X86_TSC
extern void tsc_init(void);
extern void mark_tsc_unstable(char *reason);
extern int unsynchronized_tsc(void);
@@ -70,5 +75,15 @@
*/
extern void check_tsc_sync_source(int cpu);
extern void check_tsc_sync_target(void);
+#else /* CONFIG_X86_TSC */
+/* effectively disable all calls to TSC functions.
+ * GCC should optimize these inline functions down to nothing. */
+static inline void tsc_init(void) { }
+static inline void mark_tsc_unstable(char *reason) { }
+static inline int unsynchronized_tsc(void) { return 1; }
+static inline void init_tsc_clocksource(void) { }
+static inline void check_tsc_sync_source(int cpu) { }
+static inline void check_tsc_sync_target(void) { }
+#endif /* CONFIG_X86_TSC */

#endif


Attachments:
linux-2.6.22.7-embedded-dmi-disable-option.patch (4.24 kB)
linux-2.6.22.7-embedded-disable-rdtsc.patch (8.19 kB)
Download all attachments

2007-09-24 17:49:58

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH] Patches for tiny 386 kernels, again. Linux kernel 2.6.22.7

On Mon, 24 Sep 2007 01:51:17 -0700 Jonathan Campbell wrote:

> Sorry for the long delay, been very busy since I last posted the 386
> kernel patches back in July.
> Now that I have more free time I remade the patches in a cleaner manner,
> broken down into
> smaller patches, with fewer #ifdefs all over the place. most #ifdefs are
> in the include/asm-i386 headers
> now.

Regarding only the DMI-disable patch:

> linux-2.6.22.7-embedded-dmi-disable-option.patch:
> * Allows you to remove DMI (Desktop Management Interface) parsing.
> Older computers do
> not have DMI structures in the BIOS, on these computers the DMI
> code is a waste of space.
> In my tests with applying this patch and disabling DMI removes
> 6KB from
> arch/i386/boot/bzImage after compile. Apparently there is already
> a CONFIG_DMI out there,
> and #ifdef's in some parts to check this, so all this patch does
> is make CONFIG_DMI visible
> from "make menuconfig" while patching up other parts (like ACPI)
> that simply assume DMI
> functions are there. Depends on CONFIG_EMBEDDED.


This seems reasonable, so I tried to use it. Here are the results
and comments and meta-comments.


1. Please forcibly wrap text lines in mail body at around column 70-72.

2. Put patches inline in the mail body, not as attachments.

3. Make patches against current mainline (e.g., 2.6.23-rc7), not
against the stable tree. Mainline is where someone would end
up applying them.

4. The DMI patch does not build against current mainline. It needs
the additional patch below (at end of mail).

5. The Kconfig part of the DMI patch contains a trailing space.
No brownie today.

6. The Kconfig entry for "config DMI" should not be listed under
"Processor types and features". It should just go into the
main EMBEDDED menu:

menuconfig EMBEDDED
bool "Configure standard kernel features (for small systems)"


After all of these fixes, I can ack the patch.

---

From: Randy Dunlap <[email protected]>
Signed-off-by: Randy Dunlap <[email protected]>
---
drivers/acpi/thermal.c | 2 ++
1 file changed, 2 insertions(+)

--- linux-2.6.23-rc7.orig/drivers/acpi/thermal.c
+++ linux-2.6.23-rc7/drivers/acpi/thermal.c
@@ -1440,7 +1440,9 @@ static int __init acpi_thermal_init(void
{
int result = 0;

+#ifdef CONFIG_DMI
dmi_check_system(thermal_dmi_table);
+#endif /* CONFIG_DMI */

if (off) {
printk(KERN_NOTICE "ACPI: thermal control disabled\n");

2007-09-24 19:09:38

by Dave Jones

[permalink] [raw]
Subject: Re: [PATCH] Patches for tiny 386 kernels, again. Linux kernel 2.6.22.7

On Mon, Sep 24, 2007 at 01:51:17AM -0700, Jonathan Campbell wrote:


> +#if defined(__i386__) && defined(CONFIG_DMI)
> dmi_check_system(acpi_dmi_table);
> #endif
>
> +#ifdef CONFIG_DMI
> dmi_scan_machine();
> +#endif
>
> +#ifdef CONFIG_DMI
> /* Check and install the TSC clocksource */
> dmi_check_system(bad_tsc_dmi_table);
> +#endif
>
> +#ifdef CONFIG_DMI
> dmi_check_system(acpi_osl_dmi_table);
> +#endif

Instead of adding all these ifdefs, we could just define
add something along the lines of..

#ifndef CONFIG_DMI
#define dmi_check_system do {} while (0)
#endif

in some header, which hides the uglies away from the code
whilst having the same net effect.

Dave

--
http://www.codemonkey.org.uk

2007-09-25 04:46:05

by Andrey Panin

[permalink] [raw]
Subject: Re: [PATCH] Patches for tiny 386 kernels, again. Linux kernel 2.6.22.7

On 267, 09 24, 2007 at 03:09:17PM -0400, Dave Jones wrote:
> On Mon, Sep 24, 2007 at 01:51:17AM -0700, Jonathan Campbell wrote:
>
>
> > +#if defined(__i386__) && defined(CONFIG_DMI)
> > dmi_check_system(acpi_dmi_table);
> > #endif
> >
> > +#ifdef CONFIG_DMI
> > dmi_scan_machine();
> > +#endif
> >
> > +#ifdef CONFIG_DMI
> > /* Check and install the TSC clocksource */
> > dmi_check_system(bad_tsc_dmi_table);
> > +#endif
> >
> > +#ifdef CONFIG_DMI
> > dmi_check_system(acpi_osl_dmi_table);
> > +#endif
>
> Instead of adding all these ifdefs, we could just define
> add something along the lines of..
>
> #ifndef CONFIG_DMI
> #define dmi_check_system do {} while (0)
> #endif
>
> in some header, which hides the uglies away from the code
> whilst having the same net effect.

Let take a look at linux/dmi.h:

#ifdef CONFIG_DMI

extern int dmi_check_system(struct dmi_system_id *list);
extern char * dmi_get_system_info(int field);
extern struct dmi_device * dmi_find_device(int type, const char *name,
struct dmi_device *from);
extern void dmi_scan_machine(void);
extern int dmi_get_year(int field);
extern int dmi_name_in_vendors(char *str);

#else

static inline int dmi_check_system(struct dmi_system_id *list) { return 0; }
static inline char * dmi_get_system_info(int field) { return NULL; }
static inline struct dmi_device * dmi_find_device(int type, const char *name,
struct dmi_device *from) { return NULL; }
static inline int dmi_get_year(int year) { return 0; }
static inline int dmi_name_in_vendors(char *s) { return 0; }

#endif

--
Andrey Panin | Linux and UNIX system administrator
[email protected] | PGP key: wwwkeys.pgp.net


Attachments:
(No filename) (1.64 kB)
signature.asc (189.00 B)
Digital signature
Download all attachments

2007-09-25 07:28:16

by Jan Engelhardt

[permalink] [raw]
Subject: Re: [PATCH] Patches for tiny 386 kernels, again. Linux kernel 2.6.22.7


On Sep 24 2007 15:09, Dave Jones wrote:
>
> > +#if defined(__i386__) && defined(CONFIG_DMI)
> > dmi_check_system(acpi_dmi_table);
> > #endif
> >
> > +#ifdef CONFIG_DMI
> > dmi_scan_machine();
> > +#endif
> >
> > +#ifdef CONFIG_DMI
> > /* Check and install the TSC clocksource */
> > dmi_check_system(bad_tsc_dmi_table);
> > +#endif
> >
> > +#ifdef CONFIG_DMI
> > dmi_check_system(acpi_osl_dmi_table);
> > +#endif
>
>Instead of adding all these ifdefs, we could just define
>add something along the lines of..
>
>#ifndef CONFIG_DMI
>#define dmi_check_system do {} while (0)
>#endif
>
>in some header, which hides the uglies away from the code
>whilst having the same net effect.

Need #define dmi_check_system(x) otherwise you get

/* Check and install the TSC clocksource */
do {} while (0) (bad_tsc_dmi_table);

2007-09-26 18:42:27

by Jonathan Campbell

[permalink] [raw]
Subject: Re: [PATCH] Patches for tiny 386 kernels, again. Linux kernel 2.6.22.7

Here is the DMI patch again, written against linux-2.6.23-rc8,
with some of the #ifdef CONFIG_DMI's removed and moved
to include/linux/dmi.h. Putting them there in the way I've done
ensures that you don't have to put #ifdef CONFIG_DMI
around each dmi_check_machine() and that you don't
have to apply little patches to so many device drivers.

diff -u -r linux-2.6.23-rc8-old/arch/i386/Kconfig
linux-2.6.23-rc8/arch/i386/Kconfig
--- linux-2.6.23-rc8-old/arch/i386/Kconfig 2007-09-21
22:38:23.000000000 +0000
+++ linux-2.6.23-rc8/arch/i386/Kconfig 2007-09-26 00:01:48.000000000
+0000
@@ -83,10 +83,6 @@
bool
default y

-config DMI
- bool
- default y
-
source "init/Kconfig"

menu "Processor type and features"
diff -u -r linux-2.6.23-rc8-old/arch/i386/kernel/acpi/boot.c
linux-2.6.23-rc8/arch/i386/kernel/acpi/boot.c
--- linux-2.6.23-rc8-old/arch/i386/kernel/acpi/boot.c 2007-09-21
22:38:23.000000000 +0000
+++ linux-2.6.23-rc8/arch/i386/kernel/acpi/boot.c 2007-09-26
00:40:42.000000000 +0000
@@ -869,7 +869,7 @@
return;
}

-#ifdef __i386__
+#if defined(__i386__) && defined(CONFIG_DMI)

static int __init disable_acpi_irq(struct dmi_system_id *d)
{
@@ -1097,8 +1097,7 @@
},
{}
};
-
-#endif /* __i386__ */
+#endif /* CONFIG_DMI && __i386__ */

/*
* acpi_boot_table_init() and acpi_boot_init()
diff -u -r linux-2.6.23-rc8-old/arch/i386/kernel/acpi/sleep.c
linux-2.6.23-rc8/arch/i386/kernel/acpi/sleep.c
--- linux-2.6.23-rc8-old/arch/i386/kernel/acpi/sleep.c 2007-09-21
22:38:23.000000000 +0000
+++ linux-2.6.23-rc8/arch/i386/kernel/acpi/sleep.c 2007-09-25
23:59:14.000000000 +0000
@@ -86,6 +86,7 @@
return 0;
}

+#ifdef CONFIG_DMI
static __initdata struct dmi_system_id acpisleep_dmi_table[] = {
{ /* Reset video mode after returning from ACPI S3 sleep */
.callback = reset_videomode_after_s3,
@@ -104,3 +105,5 @@
}

core_initcall(acpisleep_dmi_init);
+#endif
+
diff -u -r
linux-2.6.23-rc8-old/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
linux-2.6.23-rc8/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
--- linux-2.6.23-rc8-old/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
2007-09-21 22:38:23.000000000 +0000
+++ linux-2.6.23-rc8/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
2007-09-26 00:59:26.000000000 +0000
@@ -535,7 +535,7 @@
return 0;
}

-#ifdef CONFIG_SMP
+#if defined(CONFIG_SMP) && defined(CONFIG_DMI)
/*
* Some BIOSes do SW_ANY coordination internally, either set it up in hw
* or do it in BIOS firmware and won't inform about it to OS. If not
@@ -562,7 +562,9 @@
},
{ }
};
-#endif
+#else
+# define bios_with_sw_any_bug 0
+#endif /* CONFIG_SMP && CONFIG_DMI */

static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
{
diff -u -r linux-2.6.23-rc8-old/arch/i386/kernel/reboot.c
linux-2.6.23-rc8/arch/i386/kernel/reboot.c
--- linux-2.6.23-rc8-old/arch/i386/kernel/reboot.c 2007-09-21
22:38:23.000000000 +0000
+++ linux-2.6.23-rc8/arch/i386/kernel/reboot.c 2007-09-26
01:00:08.000000000 +0000
@@ -71,6 +71,7 @@

__setup("reboot=", reboot_setup);

+#ifdef CONFIG_DMI
/*
* Reboot options and system auto-detection code provided by
* Dell Inc. so their systems "just work". :-)
@@ -131,6 +132,7 @@
},
{ }
};
+#endif /* CONFIG_DMI */

static int __init reboot_init(void)
{
diff -u -r linux-2.6.23-rc8-old/arch/i386/kernel/tsc.c
linux-2.6.23-rc8/arch/i386/kernel/tsc.c
--- linux-2.6.23-rc8-old/arch/i386/kernel/tsc.c 2007-09-21
22:38:23.000000000 +0000
+++ linux-2.6.23-rc8/arch/i386/kernel/tsc.c 2007-09-26
00:39:52.000000000 +0000
@@ -290,6 +290,7 @@
}
EXPORT_SYMBOL_GPL(mark_tsc_unstable);

+#ifdef CONFIG_DMI
static int __init dmi_mark_tsc_unstable(struct dmi_system_id *d)
{
printk(KERN_NOTICE "%s detected: marking TSC unstable.\n",
@@ -310,6 +311,7 @@
},
{}
};
+#endif

/*
* Make an educated guess if the TSC is trustworthy and synchronized
diff -u -r linux-2.6.23-rc8-old/arch/i386/mach-generic/bigsmp.c
linux-2.6.23-rc8/arch/i386/mach-generic/bigsmp.c
--- linux-2.6.23-rc8-old/arch/i386/mach-generic/bigsmp.c 2007-09-21
22:38:23.000000000 +0000
+++ linux-2.6.23-rc8/arch/i386/mach-generic/bigsmp.c 2007-09-26
00:57:13.000000000 +0000
@@ -21,6 +21,7 @@

static int dmi_bigsmp; /* can be set by dmi scanners */

+#ifdef CONFIG_DMI
static int hp_ht_bigsmp(struct dmi_system_id *d)
{
#ifdef CONFIG_X86_GENERICARCH
@@ -30,7 +31,6 @@
return 0;
}

-
static struct dmi_system_id bigsmp_dmi_table[] = {
{ hp_ht_bigsmp, "HP ProLiant DL760 G2", {
DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
@@ -43,7 +43,7 @@
}},
{ }
};
-
+#endif /* CONFIG_DMI */

static int probe_bigsmp(void)
{
diff -u -r linux-2.6.23-rc8-old/arch/i386/pci/fixup.c
linux-2.6.23-rc8/arch/i386/pci/fixup.c
--- linux-2.6.23-rc8-old/arch/i386/pci/fixup.c 2007-09-21
22:38:23.000000000 +0000
+++ linux-2.6.23-rc8/arch/i386/pci/fixup.c 2007-09-26
01:17:23.000000000 +0000
@@ -367,6 +367,7 @@
*/
static u16 toshiba_line_size;

+#ifdef CONFIG_DMI
static struct dmi_system_id __devinitdata toshiba_ohci1394_dmi_table[] = {
{
.ident = "Toshiba PS5 based laptop",
@@ -391,6 +392,7 @@
},
{ }
};
+#endif

static void __devinit pci_pre_fixup_toshiba_ohci1394(struct pci_dev *dev)
{
diff -u -r linux-2.6.23-rc8-old/drivers/acpi/Kconfig
linux-2.6.23-rc8/drivers/acpi/Kconfig
--- linux-2.6.23-rc8-old/drivers/acpi/Kconfig 2007-09-21
22:38:23.000000000 +0000
+++ linux-2.6.23-rc8/drivers/acpi/Kconfig 2007-09-25
23:59:14.000000000 +0000
@@ -263,6 +263,7 @@

config ACPI_BLACKLIST_YEAR
int "Disable ACPI for systems before Jan 1st this year" if X86_32
+ depends on DMI
default 0
help
enter a 4-digit year, eg. 2001 to disable ACPI by default
diff -u -r linux-2.6.23-rc8-old/drivers/acpi/blacklist.c
linux-2.6.23-rc8/drivers/acpi/blacklist.c
--- linux-2.6.23-rc8-old/drivers/acpi/blacklist.c 2007-09-21
22:38:23.000000000 +0000
+++ linux-2.6.23-rc8/drivers/acpi/blacklist.c 2007-09-26
01:06:59.000000000 +0000
@@ -73,7 +73,7 @@
{""}
};

-#if CONFIG_ACPI_BLACKLIST_YEAR
+#if defined(CONFIG_ACPI_BLACKLIST_YEAR) && CONFIG_ACPI_BLACKLIST_YEAR > 0

static int __init blacklist_by_year(void)
{
diff -u -r linux-2.6.23-rc8-old/drivers/acpi/processor_idle.c
linux-2.6.23-rc8/drivers/acpi/processor_idle.c
--- linux-2.6.23-rc8-old/drivers/acpi/processor_idle.c 2007-09-21
22:38:23.000000000 +0000
+++ linux-2.6.23-rc8/drivers/acpi/processor_idle.c 2007-09-26
01:08:00.000000000 +0000
@@ -85,6 +85,7 @@
Power Management

--------------------------------------------------------------------------
*/

+#ifdef CONFIG_DMI
/*
* IBM ThinkPad R40e crashes mysteriously when going into C2 or C3.
* For now disable this. Probably a bug somewhere else.
@@ -165,6 +166,7 @@
(void *)2},
{},
};
+#endif // CONFIG_DMI

static inline u32 ticks_elapsed(u32 t1, u32 t2)
{
diff -u -r linux-2.6.23-rc8-old/drivers/input/mouse/Kconfig
linux-2.6.23-rc8/drivers/input/mouse/Kconfig
--- linux-2.6.23-rc8-old/drivers/input/mouse/Kconfig 2007-09-21
22:38:23.000000000 +0000
+++ linux-2.6.23-rc8/drivers/input/mouse/Kconfig 2007-09-26
01:12:13.000000000 +0000
@@ -60,7 +60,7 @@
config MOUSE_PS2_SYNAPTICS
bool "Synaptics PS/2 mouse protocol extension" if EMBEDDED
default y
- depends on MOUSE_PS2
+ depends on MOUSE_PS2 && DMI
help
Say Y here if you have a Synaptics PS/2 TouchPad connected to
your system.
@@ -70,7 +70,7 @@
config MOUSE_PS2_LIFEBOOK
bool "Fujitsu Lifebook PS/2 mouse protocol extension" if EMBEDDED
default y
- depends on MOUSE_PS2
+ depends on MOUSE_PS2 && DMI
help
Say Y here if you have a Fujitsu B-series Lifebook PS/2
TouchScreen connected to your system.
diff -u -r linux-2.6.23-rc8-old/drivers/input/serio/i8042-x86ia64io.h
linux-2.6.23-rc8/drivers/input/serio/i8042-x86ia64io.h
--- linux-2.6.23-rc8-old/drivers/input/serio/i8042-x86ia64io.h
2007-09-21 22:38:23.000000000 +0000
+++ linux-2.6.23-rc8/drivers/input/serio/i8042-x86ia64io.h 2007-09-26
01:19:54.000000000 +0000
@@ -63,7 +63,7 @@
outb(val, I8042_COMMAND_REG);
}

-#if defined(__i386__)
+#if defined(__i386__) && defined(CONFIG_DMI)

#include <linux/dmi.h>

@@ -472,7 +472,7 @@
i8042_reset = 1;
#endif

-#if defined(__i386__)
+#if defined(__i386__) && defined(CONFIG_DMI)
if (dmi_check_system(i8042_dmi_noloop_table))
i8042_noloop = 1;

diff -u -r linux-2.6.23-rc8-old/include/linux/dmi.h
linux-2.6.23-rc8/include/linux/dmi.h
--- linux-2.6.23-rc8-old/include/linux/dmi.h 2007-09-21
22:38:23.000000000 +0000
+++ linux-2.6.23-rc8/include/linux/dmi.h 2007-09-26
01:34:13.000000000 +0000
@@ -73,12 +73,24 @@

#else

-static inline int dmi_check_system(struct dmi_system_id *list) { return
0; }
+/* use the C preprocessor to toss out the DMI id list, and redirect
+ * to an inline function that reduces down to 0 (failure). this
+ * satisfies code using this in if () ... else ... statements that
+ * do not use brackets where #define dmi_check_list(list) 0 would
+ * give many "statement reduces to nothing" errors. { } is a
+ * possibility except that many parts of the kernel do in fact
+ * check the return value, { } would result in a syntax error.
+ * we toss out the param because the list is included only if
+ * #ifdef CONFIG_DMI. without DMI the id list is not used, and
+ * a waste of memory, so it is #ifdef'd out. */
+#define dmi_check_system(list) dmi_check_system_NOTHING()
+static inline int dmi_check_system_NOTHING(void) { return 0; }
+
static inline char * dmi_get_system_info(int field) { return NULL; }
-static inline struct dmi_device * dmi_find_device(int type, const char
*name,
- struct dmi_device *from) { return NULL; }
-static inline int dmi_get_year(int year) { return 0; }
-static inline int dmi_name_in_vendors(char *s) { return 0; }
+#define dmi_find_device(type,name,from) NULL
+#define dmi_scan_machine() { }
+static inline int dmi_get_year(int field) { return 0; }
+static inline int dmi_name_in_vendors(char *str) { return 0; }

#endif

diff -u -r linux-2.6.23-rc8-old/init/Kconfig linux-2.6.23-rc8/init/Kconfig
--- linux-2.6.23-rc8-old/init/Kconfig 2007-09-21 22:38:23.000000000 +0000
+++ linux-2.6.23-rc8/init/Kconfig 2007-09-26 00:03:05.000000000 +0000
@@ -542,6 +542,18 @@
on EMBEDDED systems. /proc/vmstat will only show page counts
if VM event counters are disabled.

+config DMI
+ default y
+ bool "Enable DMI support" if EMBEDDED
+ depends on X86
+ help
+ This enables support for processing the Desktop Management
+ Interface structures present in most modern BIOSes. If you are
+ building a kernel for an older Pentium, 486, or 386 system and
+ memory is tight, you can disable this to help reduce the size
+ of your kernel by about 6K.
+ If unsure, say Y.
+
config SLUB_DEBUG
default y
bool "Enable SLUB debugging support" if EMBEDDED

2007-09-26 22:07:47

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH] Patches for tiny 386 kernels, again. Linux kernel 2.6.22.7

On Wed, 26 Sep 2007 11:42:16 -0700 Jonathan Campbell wrote:

> Here is the DMI patch again, written against linux-2.6.23-rc8,
> with some of the #ifdef CONFIG_DMI's removed and moved
> to include/linux/dmi.h. Putting them there in the way I've done
> ensures that you don't have to put #ifdef CONFIG_DMI
> around each dmi_check_machine() and that you don't
> have to apply little patches to so many device drivers.

This patch is horribly whitespace-damaged and does not apply to
2.6.23-rc8 as is:

Reversed (or previously applied) patch detected! Assume -R? [n] n
Apply anyway? [n]
1 out of 1 hunk ignored -- saving rejects to file arch/i386/Kconfig.rej
1 out of 2 hunks FAILED -- saving rejects to file arch/i386/kernel/acpi/boot.c.rej
1 out of 1 hunk FAILED -- saving rejects to file drivers/acpi/Kconfig.rej
1 out of 1 hunk FAILED -- saving rejects to file drivers/acpi/blacklist.c.rej
patch: **** malformed patch at line 233: */



Please send it to yourself and make sure that you can apply it
before sending it to the mailing list.

---
~Randy
Phaedrus says that Quality is about caring.

2007-09-26 23:22:54

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH] Patches for tiny 386 kernels, again. Linux kernel 2.6.22.7

On Wed, 26 Sep 2007 11:42:16 -0700 Jonathan Campbell wrote:

> Here is the DMI patch again, written against linux-2.6.23-rc8,
> with some of the #ifdef CONFIG_DMI's removed and moved
> to include/linux/dmi.h. Putting them there in the way I've done
> ensures that you don't have to put #ifdef CONFIG_DMI
> around each dmi_check_machine() and that you don't
> have to apply little patches to so many device drivers.

Damaged as the patch is, I was able to apply it by using
'patch -l' (ignore whitespace) + some fuzz. Not something that
Linus or Andrew would or should do.

I built and booted the kernel, it's running fine (x86_32 notebook).



> diff -u -r linux-2.6.23-rc8-old/init/Kconfig linux-2.6.23-rc8/init/Kconfig
> --- linux-2.6.23-rc8-old/init/Kconfig 2007-09-21 22:38:23.000000000 +0000
> +++ linux-2.6.23-rc8/init/Kconfig 2007-09-26 00:03:05.000000000 +0000
> @@ -542,6 +542,18 @@
> on EMBEDDED systems. /proc/vmstat will only show page counts
> if VM event counters are disabled.
>
> +config DMI
> + default y
> + bool "Enable DMI support" if EMBEDDED
> + depends on X86
> + help
> + This enables support for processing the Desktop Management
> + Interface structures present in most modern BIOSes. If you are
> + building a kernel for an older Pentium, 486, or 386 system and
> + memory is tight, you can disable this to help reduce the size
> + of your kernel by about 6K.
> + If unsure, say Y.
> +

This is in the General setup menu. How about putting it into the
EMBEDDED menu instead? [Configure standard kernel features (for
small systems)]

> config SLUB_DEBUG
> default y
> bool "Enable SLUB debugging support" if EMBEDDED


There are still several build warnings that need attention:

drivers/acpi/sleep/main.c:223: warning: 'acpisleep_dmi_table' defined but not used
drivers/pnp/pnpbios/core.c:509: warning: 'pnpbios_dmi_table' defined but not used
arch/i386/pci/irq.c:1035: warning: 'pciirq_dmi_table' defined but not used
arch/i386/pci/common.c:148: warning: 'pciprobe_dmi_table' defined but not used


+#endif // CONFIG_DMI

Use /* ... */ style comments instead of // comments.

---
~Randy
Phaedrus says that Quality is about caring.

2007-09-26 23:44:48

by Jonathan Campbell

[permalink] [raw]
Subject: Re: [PATCH] Patches for tiny 386 kernels, again. Linux kernel 2.6.22.7

Sorry about that. That's the reason I send them as attachments.
Any suggestions for someone like myself using Mozilla Thunderbird?
> Damaged as the patch is, I was able to apply it by using
> 'patch -l' (ignore whitespace) + some fuzz. Not something that
> Linus or Andrew would or should do.
>
> I built and booted the kernel, it's running fine (x86_32 notebook).
>

2007-09-26 23:47:19

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH] Patches for tiny 386 kernels, again. Linux kernel 2.6.22.7

Jonathan Campbell wrote:
> Sorry about that. That's why I always send as attachments.
> Do you have similar problems when using Mozilla Thunderbird?

tbird works when following the instructions at
http://mbligh.org/linuxdocs/Email/Clients/Thunderbird
or (simpler) use an External Editor plugin.


> And have you checked System.map to verify the DMI functions aren't there?

Nope. I expect(ed) you to do that, i.e., make sure that the patch
does that the description says that it does.


>> On Wed, 26 Sep 2007 11:42:16 -0700 Jonathan Campbell wrote:
>>
>>
>>> Here is the DMI patch again, written against linux-2.6.23-rc8,
>>> with some of the #ifdef CONFIG_DMI's removed and moved
>>> to include/linux/dmi.h. Putting them there in the way I've done
>>> ensures that you don't have to put #ifdef CONFIG_DMI
>>> around each dmi_check_machine() and that you don't
>>> have to apply little patches to so many device drivers.
>>>
>>
>> Damaged as the patch is, I was able to apply it by using
>> 'patch -l' (ignore whitespace) + some fuzz. Not something that
>> Linus or Andrew would or should do.
>>
>> I built and booted the kernel, it's running fine (x86_32 notebook).

--
~Randy
Phaedrus says that Quality is about caring.

2007-09-26 23:50:01

by Jonathan Campbell

[permalink] [raw]
Subject: Re: [PATCH] Patches for tiny 386 kernels, again. Linux kernel 2.6.22.7

Heh, well of course I vigoursly checked System.map. On my x86 and amd64
systems it removes them all. What a stupid question :-p
> Nope. I expect(ed) you to do that, i.e., make sure that the patch
> does that the description says that it does.

2007-09-28 21:19:16

by Bill Davidsen

[permalink] [raw]
Subject: Re: [PATCH] Patches for tiny 386 kernels, again. Linux kernel 2.6.22.7

Randy Dunlap wrote:

> This seems reasonable, so I tried to use it. Here are the results
> and comments and meta-comments.
>
>
> 1. Please forcibly wrap text lines in mail body at around column 70-72.
>
> 2. Put patches inline in the mail body, not as attachments.
>
I'll offer this suggestion, knowing it may piss you off, given the
difficulty of preserving whitespace on *many* mailers without using
attachments, and given that attachments can be saved easily without
prying them out of the message, why don't you (one person) switch to a
capable mail agent, if only for patches, instead of trying to teach many
people to jump through hoops to avoid whitespace issues?

Not criticizing, just seems easier for everybody for you to avoid
teaching people things they don't find useful elsewhere, or getting
discouraged and not bothering.

--
Bill Davidsen <[email protected]>
"We have more to fear from the bungling of the incompetent than from
the machinations of the wicked." - from Slashdot

2007-09-28 21:57:53

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH] Patches for tiny 386 kernels, again. Linux kernel 2.6.22.7

On Fri, 28 Sep 2007 17:24:20 -0400 Bill Davidsen wrote:

> Randy Dunlap wrote:
>
> > This seems reasonable, so I tried to use it. Here are the results
> > and comments and meta-comments.
> >
> >
> > 1. Please forcibly wrap text lines in mail body at around column 70-72.
> >
> > 2. Put patches inline in the mail body, not as attachments.
> >
> I'll offer this suggestion, knowing it may piss you off, given the
> difficulty of preserving whitespace on *many* mailers without using
> attachments, and given that attachments can be saved easily without
> prying them out of the message, why don't you (one person) switch to a
> capable mail agent, if only for patches, instead of trying to teach many
> people to jump through hoops to avoid whitespace issues?

Is "you" referring to me? You didn't piss me off.
I don't even understand what you are talking about.

BTW, lots of us have capable mail clients.

> Not criticizing, just seems easier for everybody for you to avoid
> teaching people things they don't find useful elsewhere, or getting
> discouraged and not bothering.

(again, if "you" are referring to me:) I generally try to help
people. Another option is just to give them no feedback and drop
their patches. I think that's not useful or helpful at all.


---
~Randy
Phaedrus says that Quality is about caring.

2007-10-01 13:44:17

by Lennart Sorensen

[permalink] [raw]
Subject: Re: [PATCH] Patches for tiny 386 kernels, again. Linux kernel 2.6.22.7

On Fri, Sep 28, 2007 at 05:24:20PM -0400, Bill Davidsen wrote:
> I'll offer this suggestion, knowing it may piss you off, given the
> difficulty of preserving whitespace on *many* mailers without using
> attachments, and given that attachments can be saved easily without
> prying them out of the message, why don't you (one person) switch to a
> capable mail agent, if only for patches, instead of trying to teach many
> people to jump through hoops to avoid whitespace issues?
>
> Not criticizing, just seems easier for everybody for you to avoid
> teaching people things they don't find useful elsewhere, or getting
> discouraged and not bothering.

Ehm, so you want people to save the patch, then when replying they
should load the patch into their (much better) mail client where they
can comment on the patch? That is the reason the patch should be
inline. People need to comment on it just as they would comment on any
other plain text email.

Well that and some people use git to import patches from the email in a
mostly automated way which also expects them to have the info at top
with signed-off and then the patch, which attachments also screw up.

So yes there are good reasons for getting a non broken mail client when
sending patches to lkml.

--
Len Sorensen

2007-10-01 14:23:18

by Bill Davidsen

[permalink] [raw]
Subject: Re: [PATCH] Patches for tiny 386 kernels, again. Linux kernel 2.6.22.7

Lennart Sorensen wrote:
> On Fri, Sep 28, 2007 at 05:24:20PM -0400, Bill Davidsen wrote:
>
>> I'll offer this suggestion, knowing it may piss you off, given the
>> difficulty of preserving whitespace on *many* mailers without using
>> attachments, and given that attachments can be saved easily without
>> prying them out of the message, why don't you (one person) switch to a
>> capable mail agent, if only for patches, instead of trying to teach many
>> people to jump through hoops to avoid whitespace issues?
>>
>> Not criticizing, just seems easier for everybody for you to avoid
>> teaching people things they don't find useful elsewhere, or getting
>> discouraged and not bothering.
>>
>
> Ehm, so you want people to save the patch, then when replying they
> should load the patch into their (much better) mail client where they
> can comment on the patch? That is the reason the patch should be
> inline. People need to comment on it just as they would comment on any
> other plain text email.
>

And in a perfect world everyone would have a mail client which made that
easy, no one would be force by company policy or other circumstances to
use a client which didn't work the way you think it should, no company
or ISP would filter and mangle outgoing mail, and all vendors would
understand that pristine patches are more important that all that stuff
they do to make business communications look reasonable.

In my world people send me attachments so they don't get mangled, and if
I need to quote them I know how to do so.
> Well that and some people use git to import patches from the email in a
> mostly automated way which also expects them to have the info at top
> with signed-off and then the patch, which attachments also screw up.
>
> So yes there are good reasons for getting a non broken mail client when
> sending patches to lkml.
>

And reading them, many show attached text at the end of the message and
make turning it into inline text simple.

--
Bill Davidsen <[email protected]>
"We have more to fear from the bungling of the incompetent than from
the machinations of the wicked." - from Slashdot

2007-10-02 04:49:33

by Willy Tarreau

[permalink] [raw]
Subject: Re: [PATCH] Patches for tiny 386 kernels, again. Linux kernel 2.6.22.7

On Mon, Oct 01, 2007 at 10:28:30AM -0400, Bill Davidsen wrote:
> Lennart Sorensen wrote:
> >On Fri, Sep 28, 2007 at 05:24:20PM -0400, Bill Davidsen wrote:
> >
> >>I'll offer this suggestion, knowing it may piss you off, given the
> >>difficulty of preserving whitespace on *many* mailers without using
> >>attachments, and given that attachments can be saved easily without
> >>prying them out of the message, why don't you (one person) switch to a
> >>capable mail agent, if only for patches, instead of trying to teach many
> >>people to jump through hoops to avoid whitespace issues?
> >>
> >>Not criticizing, just seems easier for everybody for you to avoid
> >>teaching people things they don't find useful elsewhere, or getting
> >>discouraged and not bothering.
> >>
> >
> >Ehm, so you want people to save the patch, then when replying they
> >should load the patch into their (much better) mail client where they
> >can comment on the patch? That is the reason the patch should be
> >inline. People need to comment on it just as they would comment on any
> >other plain text email.
> >
>
> And in a perfect world everyone would have a mail client which made that
> easy, no one would be force by company policy or other circumstances to
> use a client which didn't work the way you think it should, no company
> or ISP would filter and mangle outgoing mail, and all vendors would
> understand that pristine patches are more important that all that stuff
> they do to make business communications look reasonable.
>
> In my world people send me attachments so they don't get mangled, and if
> I need to quote them I know how to do so.
> >Well that and some people use git to import patches from the email in a
> >mostly automated way which also expects them to have the info at top
> >with signed-off and then the patch, which attachments also screw up.
> >
> >So yes there are good reasons for getting a non broken mail client when
> >sending patches to lkml.
> >
>
> And reading them, many show attached text at the end of the message and
> make turning it into inline text simple.

Hey, if the poster knows his mail client is broken, nothing prevents him
from attaching the patches (so that they don't get mangled) and at the
same time inline them for an easy review. People who review patches won't
bother about spaces or tabs when you indicate to them from the beginning
that the patch may have been mangled.

Willy