* Re: procps 2.x vs. procps 3.x
From: Brandon Low @ 2002-12-13 2:09 UTC (permalink / raw)
To: Dan Kegel; +Cc: linux-kernel
In-Reply-To: <3DF93D89.3000704@ixiacom.com>
Well at Gentoo, we are kinda using both right now. We've noticed
some querkiness with the 3.x series where TOP will miss certain
characters in output, but the 3.x series is much prettier and
feature rich than the 2.x series. On the other hand, 2.x is
consistently more up to date with kernel changes since RML and Riel
maintain it and are intimately familiar with current kernel
development.
For the moment, we are on 2.x in stable and 3.x in unstable,
awaiting fixage for the minor querks of 3.x before switching up
to 3.x for the stable.
Hope that helps,
Brandon Low
Gentoo Linux Kernel Release Manager
On Thu, 12/12/02 at 17:53:13 -0800, Dan Kegel wrote:
> Albert Cahalan wrote in message "[ANNOUNCE] procps 3.1.3":
> > This release includes user selection in top, the sysctl -e
> > option needed to support the Red Hat 8.0 boot scripts, and
> > the use of /proc/*/wchan on recent 2.5.xx kernels.
> >
> > For those of you still upgrading from procps 2.0.xx releases,
> > you can expect:
> > ...
> > There's a procps-feedback@lists.sf.net mailing list you can
> > use for feature requests, bug reports, and so on. Use it!
>
> and
>
> Robert Love wrote in message "[announce] procps 2.0.11":
> > Rik and I are pleased to announce version 2.0.11 of procps, the package
> > that contains ps, top, free, vmstat, etc.
> >
> > Newer versions of procps are required for 2.5 kernels.
> > ...
> >
> > Procps discussion, bugs, and patches are welcome at:
> > procps-list@redhat.com
>
> Which one should distributions use?
> Or is that a matter of taste?
>
> - Dan
>
>
>
>
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply
* Re: [PATCH][2.5][RFC] Using xAPIC apic address space on !Summit
From: James Cleverdon @ 2002-12-13 2:09 UTC (permalink / raw)
To: Zwane Mwaikambo, Martin Bligh; +Cc: John Stultz, Linux Kernel
In-Reply-To: <Pine.LNX.4.50.0212112105490.14901-100000@montezuma.mastecende.com>
On Thursday 12 December 2002 05:44 pm, Zwane Mwaikambo wrote:
> Hi,
> I've got an 32x SMP system which has an xAPIC but utilises flat
> addressing. This patch is to rename what was formerly x86_summit to
> x86_xapic (just to avoid confusion) and then select mask depending on
> that.
>
> Untested/uncompiled patch
Hi Zwane,
How can you have a 32-way SMP system with flat addressing? There are only 8
bits in the destination address field. Even if you work around that by
assigning a set of CPUs to each dest addr bit, there can only be 15 physical
APIC IDs in flat mode. To get to 32 you must switch into clustered mode.
Please tell me more. I'm intrigued how this can be done.
> Index: linux-2.5.51/include/asm-i386/apic.h
> ===================================================================
> RCS file: /build/cvsroot/linux-2.5.51/include/asm-i386/apic.h,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 apic.h
> --- linux-2.5.51/include/asm-i386/apic.h 10 Dec 2002 12:47:44 -0000 1.1.1.1
> +++ linux-2.5.51/include/asm-i386/apic.h 12 Dec 2002 17:10:51 -0000
> @@ -90,6 +90,7 @@
> extern int check_nmi_watchdog (void);
> extern void enable_NMI_through_LVT0 (void * dummy);
>
> +extern int x86_xapic;
> extern unsigned int nmi_watchdog;
> #define NMI_NONE 0
> #define NMI_IO_APIC 1
> Index: linux-2.5.51/include/asm-i386/apicdef.h
> ===================================================================
> RCS file: /build/cvsroot/linux-2.5.51/include/asm-i386/apicdef.h,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 apicdef.h
> --- linux-2.5.51/include/asm-i386/apicdef.h 10 Dec 2002 12:47:44
> -0000 1.1.1.1 +++ linux-2.5.51/include/asm-i386/apicdef.h 12 Dec 2002
> 03:22:59 -0000 @@ -9,10 +9,11 @@
> */
>
> #define APIC_DEFAULT_PHYS_BASE 0xfee00000
> -
> +extern int x86_xapic;
> +#define APIC_BROADCAST_ID (x86_xapic ? 0xFF : 0x0F)
> #define APIC_ID 0x20
> -#define APIC_ID_MASK (0x0F<<24)
> -#define GET_APIC_ID(x) (((x)>>24)&0x0F)
> +#define APIC_ID_MASK (APIC_BROADCAST_ID<<24)
> +#define GET_APIC_ID(x) (((x)>>24)&APIC_BROADCAST_ID)
> #define APIC_LVR 0x30
> #define APIC_LVR_MASK 0xFF00FF
> #define GET_APIC_VERSION(x) ((x)&0xFF)
> Index: linux-2.5.51/arch/i386/kernel/apic.c
> ===================================================================
> RCS file: /build/cvsroot/linux-2.5.51/arch/i386/kernel/apic.c,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 apic.c
> --- linux-2.5.51/arch/i386/kernel/apic.c 10 Dec 2002 12:46:46 -0000 1.1.1.1
> +++ linux-2.5.51/arch/i386/kernel/apic.c 12 Dec 2002 17:08:26 -0000
> @@ -33,6 +33,8 @@
> #include <asm/arch_hooks.h>
> #include "mach_apic.h"
>
> +int x86_xapic;
> +
> void __init apic_intr_init(void)
> {
> #ifdef CONFIG_SMP
> Index: linux-2.5.51/arch/i386/kernel/io_apic.c
> ===================================================================
> RCS file: /build/cvsroot/linux-2.5.51/arch/i386/kernel/io_apic.c,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 io_apic.c
> --- linux-2.5.51/arch/i386/kernel/io_apic.c 10 Dec 2002 12:46:46
> -0000 1.1.1.1 +++ linux-2.5.51/arch/i386/kernel/io_apic.c 12 Dec 2002
> 16:08:04 -0000 @@ -1147,7 +1147,7 @@
>
> if (clustered_apic_mode)
> /* We don't have a good way to do this yet - hack */
> - phys_id_present_map = (u_long) 0xf;
> + phys_id_present_map = (u_long) APIC_BROADCAST_ID;
> /*
> * Set the IOAPIC ID to the value stored in the MPC table.
> */
> @@ -1177,10 +1177,10 @@
> mp_ioapics[apic].mpc_apicid)) {
> printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n",
> apic, mp_ioapics[apic].mpc_apicid);
> - for (i = 0; i < 0xf; i++)
> + for (i = 0; i < APIC_BROADCAST_ID; i++)
> if (!(phys_id_present_map & (1 << i)))
> break;
> - if (i >= 0xf)
> + if (i >= APIC_BROADCAST_ID)
> panic("Max APIC ID exceeded!\n");
> printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
> i);
> Index: linux-2.5.51/arch/i386/kernel/mpparse.c
> ===================================================================
> RCS file: /build/cvsroot/linux-2.5.51/arch/i386/kernel/mpparse.c,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 mpparse.c
> --- linux-2.5.51/arch/i386/kernel/mpparse.c 10 Dec 2002 12:46:46
> -0000 1.1.1.1 +++ linux-2.5.51/arch/i386/kernel/mpparse.c 12 Dec 2002
> 17:07:39 -0000 @@ -67,10 +67,9 @@
> /* Internal processor count */
> static unsigned int __initdata num_processors;
>
> -/* Bitmask of physically existing CPUs */
> +/* Bitmask of physically present CPUs and IOAPICs */
> unsigned long phys_cpu_present_map;
>
> -int summit_x86 = 0;
> u8 raw_phys_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID };
>
> /*
> @@ -394,7 +393,7 @@
> str[12]=0;
> printk("Product ID: %s ",str);
>
> - summit_check(oem, str);
> + smp_hardware_check(oem, str);
>
> printk("APIC at: 0x%lX\n",mpc->mpc_lapic);
>
> Index: linux-2.5.51/arch/i386/mach-generic/mach_apic.h
> ===================================================================
> RCS file: /build/cvsroot/linux-2.5.51/arch/i386/mach-generic/mach_apic.h,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 mach_apic.h
> --- linux-2.5.51/arch/i386/mach-generic/mach_apic.h 10 Dec 2002 12:46:46
> -0000 1.1.1.1 +++ linux-2.5.51/arch/i386/mach-generic/mach_apic.h 12 Dec
> 2002 03:49:07 -0000 @@ -17,11 +17,15 @@
> #define TARGET_CPUS 0x01
> #endif
>
> -#define APIC_BROADCAST_ID 0x0F
> #define check_apicid_used(bitmap, apicid) (bitmap & (1 << apicid))
>
> -static inline void summit_check(char *oem, char *productid)
> +static inline void smp_hardware_check(char *oem, char *productid)
> {
> + unsigned long ver, reg = apic_read(APIC_LVR);
> +
> + ver = GET_APIC_VERSION(reg);
> + if (ver == 0x14)
> + x86_xapic = 1;
> }
>
> static inline void clustered_apic_check(void)
> Index: linux-2.5.51/arch/i386/mach-summit/mach_apic.h
> ===================================================================
> RCS file: /build/cvsroot/linux-2.5.51/arch/i386/mach-summit/mach_apic.h,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 mach_apic.h
> --- linux-2.5.51/arch/i386/mach-summit/mach_apic.h 10 Dec 2002 12:46:46
> -0000 1.1.1.1 +++ linux-2.5.51/arch/i386/mach-summit/mach_apic.h 12 Dec
> 2002 03:49:20 -0000 @@ -1,8 +1,6 @@
> #ifndef __ASM_MACH_APIC_H
> #define __ASM_MACH_APIC_H
>
> -extern int x86_summit;
> -
> #define XAPIC_DEST_CPUS_MASK 0x0Fu
> #define XAPIC_DEST_CLUSTER_MASK 0xF0u
>
> @@ -13,34 +11,33 @@
> {
> unsigned long id;
>
> - if (x86_summit)
> + if (x86_xapic)
> id = xapic_phys_to_log_apicid(hard_smp_processor_id());
> else
> id = 1UL << smp_processor_id();
> return ((old & ~APIC_LDR_MASK) | SET_APIC_LOGICAL_ID(id));
> }
>
> -#define APIC_DFR_VALUE (x86_summit ? APIC_DFR_CLUSTER : APIC_DFR_FLAT)
> -#define TARGET_CPUS (x86_summit ? XAPIC_DEST_CPUS_MASK : cpu_online_map)
> +#define APIC_DFR_VALUE (x86_xapic ? APIC_DFR_CLUSTER : APIC_DFR_FLAT)
> +#define TARGET_CPUS (x86_xapic ? XAPIC_DEST_CPUS_MASK : cpu_online_map)
>
> -#define APIC_BROADCAST_ID (x86_summit ? 0xFF : 0x0F)
> #define check_apicid_used(bitmap, apicid) (0)
>
> -static inline void summit_check(char *oem, char *productid)
> +static inline void smp_hardware_check(char *oem, char *productid)
> {
> if (!strncmp(oem, "IBM ENSW", 8) && !strncmp(str, "VIGIL SMP", 9))
> - x86_summit = 1;
> + x86_xapic = 1;
> }
>
> static inline void clustered_apic_check(void)
> {
> printk("Enabling APIC mode: %s. Using %d I/O APICs\n",
> - (x86_summit ? "Summit" : "Flat"), nr_ioapics);
> + (x86_xapic ? "Summit" : "Flat"), nr_ioapics);
> }
>
> static inline int cpu_present_to_apicid(int mps_cpu)
> {
> - if (x86_summit)
> + if (x86_xapic)
> return (int) raw_phys_apicid[mps_cpu];
> else
> return mps_cpu;
> @@ -48,7 +45,7 @@
>
> static inline unsigned long apicid_to_phys_cpu_present(int apicid)
> {
> - if (x86_summit)
> + if (x86_xapic)
> return (1ul << (((apicid >> 4) << 2) | (apicid & 0x3)));
> else
> return (1ul << apicid);
> -
--
James Cleverdon
IBM xSeries Linux Solutions
{jamesclv(Unix, preferred), cleverdj(Notes)} at us dot ibm dot com
^ permalink raw reply
* Re: rmap15a swappy?
From: Rik van Riel @ 2002-12-13 2:08 UTC (permalink / raw)
To: Sean Neakums; +Cc: linux-mm
In-Reply-To: <6uisxzrl00.fsf@zork.zork.net>
On Thu, 12 Dec 2002, Sean Neakums wrote:
> > On Thu, 12 Dec 2002, Sean Neakums wrote:
> >
> > Indeed, the older rmaps swapped later. However, swapping
> > a little bit earlier turns out to be faster for almost all
> > workloads.
>
> Oh right, because if you get sudden memory pressure you have a bunch
> of pages that you can just throw away without writeout?
Exactly.
> Anyway, that's nifty. I just wanted to make sure it wasn't a
> regression.
I know there are a few regressions in "strange" corner cases,
stuff I can easily reproduce with special test programs but
haven't seen in real life. I'm still ironing out those.
regards,
Rik
--
Bravely reimplemented by the knights who say "NIH".
http://www.surriel.com/ http://guru.conectiva.com/
Current spamtrap: <a href=mailto:"october@surriel.com">october@surriel.com</a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/
^ permalink raw reply
* Re: [PATCH][2.5][RFC] Using xAPIC apic address space on !Summit
From: Zwane Mwaikambo @ 2002-12-13 2:21 UTC (permalink / raw)
To: James Cleverdon; +Cc: Martin Bligh, John Stultz, Linux Kernel
In-Reply-To: <200212121809.43698.jamesclv@us.ibm.com>
On Thu, 12 Dec 2002, James Cleverdon wrote:
> On Thursday 12 December 2002 05:44 pm, Zwane Mwaikambo wrote:
> > Hi,
> > I've got an 32x SMP system which has an xAPIC but utilises flat
> > addressing. This patch is to rename what was formerly x86_summit to
> > x86_xapic (just to avoid confusion) and then select mask depending on
> > that.
> >
> > Untested/uncompiled patch
>
> Hi Zwane,
>
> How can you have a 32-way SMP system with flat addressing? There are only 8
> bits in the destination address field. Even if you work around that by
> assigning a set of CPUs to each dest addr bit, there can only be 15 physical
> APIC IDs in flat mode. To get to 32 you must switch into clustered mode.
>
> Please tell me more. I'm intrigued how this can be done.
Hi James,
with the xAPIC we can use the 8bit address space everywhere in
physical destination mode. For example the ICR now has an 8bit space for
destination.
"Specifies the target processor or processors. This field is only used
when the destination shorthand field is set to 00B. If the destination
mode is set to physical, then bits 56 through 59 contain the APIC ID of
the target processor for Pentium and P6 family processors and bits 56
through 63 contain the APIC ID of the target processor the for Pentium 4
and Intel Xeon processors. If the destination mode is set to logical, the
interpretation of the 8-bit destination field depends on the settings of
the DFR and LDR registers of the local APICs in all the processors in the
system (see Section 8.6.2., Determining IPI Destination )."
- System Developer's Manual vol3 p291
Regards,
Zwane
--
function.linuxpower.ca
^ permalink raw reply
* Re: R: Kernel bug handling TCP_RTO_MAX?
From: Nivedita Singhvi @ 2002-12-13 2:26 UTC (permalink / raw)
To: Alan Cox
Cc: Andreani Stefano, David S. Miller, Linux Kernel Mailing List,
linux-net
In-Reply-To: <1039727809.22174.38.camel@irongate.swansea.linux.org.uk>
Alan Cox wrote:
>
> On Thu, 2002-12-12 at 20:18, Andreani Stefano wrote:
> > Never say never ;-)
> > I need to change it now as a temporary workaround for a
> > problem in the UMTS core network of my company. But I think
> > there could be thousands of situations where a fine tuning
> > of this TCP parameter could be useful.
> >
> The default is too short ?
Short?? :). On the contrary...
[I apologize for the length of this note, it became a river ]
here's what it would roughly look like:
assuming HZ = 100 (2.4)
tcp_retries2 = 15 (default) /* The # of retransmits */
TCP_RTO_MAX = 120*HZ = 120 seconds = 120000ms
TCP_RTO_MAX2 = 6*HZ = 6 seconds = 6000 ms /* modified value */
TCP_RTO_MIN = HZ/5 = 200ms
Assuming you are on a local lan, your round trip
times are going to be much less than 200 ms, and
so using the TCP_RTO_MIN of 200ms ("The algorithm
ensures that the rto cant go below that").
At each retransmit, TCP backs off exponentially:
Retransmission # Default rto (ms) With TCP_RTO_MAX(2) (ms)
1 200 200
2 400 400
3 800 800
4 1600 1600
5 3200 3200
6 6400 6000
7 12800 6000
8 25600 6000
9 51200 6000
10 102400 6000
11 120000 6000
12 120000 6000
13 120000 6000
14 120000 6000
15 120000 6000
Total time = 804.6 seconds 66.2 seconds
13.4 minutes
So the minimum total time to time out a tcp connection
(barring application close) would be ~13 minutes in the
default case and 66 seconds with a modified TCP_RTO_MAX
of 6*HZ.
I can see the argument for lowering both, the TCP_RTO_MAX
and the TCP_RTO_MIN default values.
I just did a bunch of testing over satellite, and round trip
times were of the order of 850ms ~ 4000ms.
The max retransmission timeout of 120 seconds is two orders of
magnitude larger than really the slowest round trip times
probably experienced on this planet..(Are we trying to make this
work to the moon and back? Surely NASA has its own code??)
Particularly since we also retransmit 15 times, cant we conclude
"Its dead, Jim" earlier??
200ms is for the minimum retransmission timeout is roughly a
thousand times, if not more, the round trip time on a
fast lan. Since the algorithm is adaptive (a function of the
measured round trip times), what would be the negative
repercussions of lowering this?
It may not be a good idea to make either tunable, but what about
the default init rto value, TCP_TIMEOUT_INIT, since that would allow a
starting point of something close to a suitable value?
The problem with all of the above is that the TCP engine is
global and undifferentiated, and tuning for at least these parameters
is the same regardless of the interface or route or environment..
Yes, we should and want to meet the standards for the internet, and
behave in a network friendly fashion. But all networks != internet.
I'm thinking for eg of a dedicated fast gigabit or better connection
between a tier 2 webserver and a backend database, for example, that
has every need of performance and few of standards compliance..
It would be wonderful if we could tune TCP on a per-interface or a
per-route basis (everything public, for a start, considered the
internet, and non-routable networks (10, etc), could be configured
suitably for its environment. (TCP over private LAN - rfc?). Trusting
users would be a big issue..
Any thoughts? How stupid is this? Old hat??
thanks,
Nivedita
^ permalink raw reply
* Re: [PATCH][2.5][RFC] Using xAPIC apic address space on !Summit
From: James Cleverdon @ 2002-12-13 2:41 UTC (permalink / raw)
To: Zwane Mwaikambo; +Cc: Martin Bligh, John Stultz, Linux Kernel
In-Reply-To: <Pine.LNX.4.50.0212122116260.6931-100000@montezuma.mastecende.com>
On Thursday 12 December 2002 06:21 pm, Zwane Mwaikambo wrote:
> On Thu, 12 Dec 2002, James Cleverdon wrote:
> > On Thursday 12 December 2002 05:44 pm, Zwane Mwaikambo wrote:
> > > Hi,
> > > I've got an 32x SMP system which has an xAPIC but utilises flat
> > > addressing. This patch is to rename what was formerly x86_summit to
> > > x86_xapic (just to avoid confusion) and then select mask depending on
> > > that.
> > >
> > > Untested/uncompiled patch
> >
> > Hi Zwane,
> >
> > How can you have a 32-way SMP system with flat addressing? There are
> > only 8 bits in the destination address field. Even if you work around
> > that by assigning a set of CPUs to each dest addr bit, there can only be
> > 15 physical APIC IDs in flat mode. To get to 32 you must switch into
> > clustered mode.
> >
> > Please tell me more. I'm intrigued how this can be done.
>
> Hi James,
> with the xAPIC we can use the 8bit address space everywhere in
> physical destination mode. For example the ICR now has an 8bit space for
> destination.
>
> "Specifies the target processor or processors. This field is only used
> when the destination shorthand field is set to 00B. If the destination
> mode is set to physical, then bits 56 through 59 contain the APIC ID of
> the target processor for Pentium and P6 family processors and bits 56
> through 63 contain the APIC ID of the target processor the for Pentium 4
> and Intel Xeon processors. If the destination mode is set to logical, the
> interpretation of the 8-bit destination field depends on the settings of
> the DFR and LDR registers of the local APICs in all the processors in the
> system (see Section 8.6.2., Determining IPI Destination )."
> - System Developer's Manual vol3 p291
>
> Regards,
> Zwane
Sure you can physically address them, if you assign IDs using Intel's official
xAPIC numbering scheme (which must be clustered for more than 7 CPUs). But,
you still don't have enough destination address bits to go around. In flat
mode, the kernel assumes you have one bit per CPU and phys IDs will be < 0xF.
Bill tells me that you may be doing this for an emulator. Why not emulate
clusered APIC mode, like the real hardware uses?
I know the name x86_summit doesn't really fit. The summit patch should work
for any xAPIC box that uses the system bus for interrupt delivery and has
multiple APIC clusters. Is that what you're working towards?
--
James Cleverdon
IBM xSeries Linux Solutions
{jamesclv(Unix, preferred), cleverdj(Notes)} at us dot ibm dot com
^ permalink raw reply
* roxio easy cd creator 5 and linux
From: dashielljt @ 2002-12-13 2:42 UTC (permalink / raw)
To: linux-admin
I have one of these cdrw drives and it's an ide connect nd it reads no
problem but doing the cd-writing howto that brand and model isn't listed
in my version of the howto file (need to update my howtos), and the script
to make devices and scan cdrw drives also fails to work. I'm wondering if
roxio has a driver on line that needs downloading. I haven't had a chance
to get sighted assistance reading the manuals for it yet since there's so
much junk mail tossed in my mailbox daily. If someone here has their
drive burning using linux I'd like to know I'm not alone out here. The
box had as one of its hardware requirements slackware 3.5 and I have
slackware 8.0 runnning over here so figured it should be possible to get
fully functional.
Jude <dashielljt(at)gmpexpress-dot-net>
^ permalink raw reply
* RE: [PATCH][2.5][RFC] Using xAPIC apic address space on !Summit
From: Nakajima, Jun @ 2002-12-13 3:05 UTC (permalink / raw)
To: jamesclv, Zwane Mwaikambo; +Cc: Martin Bligh, John Stultz, Linux Kernel
BTW, we are working on a xAPIC patch that supports more than 8 CPUs in a
generic fashion (don't use hardcode OEM checking). We already tested it on
two OEM systems with 16 CPUs.
- It uses clustered mode. We don't want to use physical mode because it does
not support lowest priority delivery mode.
- We also check the version of the local APIC if it's xAPIC or not. It's
possible that some other x86 architecture (other than P4P) uses xAPIC.
Stay tuned.
Jun
> -----Original Message-----
> From: James Cleverdon [mailto:jamesclv@us.ibm.com]
> Sent: Thursday, December 12, 2002 6:42 PM
> To: Zwane Mwaikambo
> Cc: Martin Bligh; John Stultz; Linux Kernel
> Subject: Re: [PATCH][2.5][RFC] Using xAPIC apic address space on !Summit
>
> On Thursday 12 December 2002 06:21 pm, Zwane Mwaikambo wrote:
> > On Thu, 12 Dec 2002, James Cleverdon wrote:
> > > On Thursday 12 December 2002 05:44 pm, Zwane Mwaikambo wrote:
> > > > Hi,
> > > > I've got an 32x SMP system which has an xAPIC but utilises
> flat
> > > > addressing. This patch is to rename what was formerly x86_summit to
> > > > x86_xapic (just to avoid confusion) and then select mask depending
> on
> > > > that.
> > > >
> > > > Untested/uncompiled patch
> > >
> > > Hi Zwane,
> > >
> > > How can you have a 32-way SMP system with flat addressing? There are
> > > only 8 bits in the destination address field. Even if you work around
> > > that by assigning a set of CPUs to each dest addr bit, there can only
> be
> > > 15 physical APIC IDs in flat mode. To get to 32 you must switch into
> > > clustered mode.
> > >
> > > Please tell me more. I'm intrigued how this can be done.
> >
> > Hi James,
> > with the xAPIC we can use the 8bit address space everywhere in
> > physical destination mode. For example the ICR now has an 8bit space for
> > destination.
> >
> > "Specifies the target processor or processors. This field is only used
> > when the destination shorthand field is set to 00B. If the destination
> > mode is set to physical, then bits 56 through 59 contain the APIC ID of
> > the target processor for Pentium and P6 family processors and bits 56
> > through 63 contain the APIC ID of the target processor the for Pentium 4
> > and Intel Xeon processors. If the destination mode is set to logical,
> the
> > interpretation of the 8-bit destination field depends on the settings of
> > the DFR and LDR registers of the local APICs in all the processors in
> the
> > system (see Section 8.6.2., Determining IPI Destination )."
> > - System Developer's Manual vol3 p291
> >
> > Regards,
> > Zwane
>
> Sure you can physically address them, if you assign IDs using Intel's
> official
> xAPIC numbering scheme (which must be clustered for more than 7 CPUs).
> But,
> you still don't have enough destination address bits to go around. In
> flat
> mode, the kernel assumes you have one bit per CPU and phys IDs will be <
> 0xF.
>
> Bill tells me that you may be doing this for an emulator. Why not emulate
> clusered APIC mode, like the real hardware uses?
>
> I know the name x86_summit doesn't really fit. The summit patch should
> work
> for any xAPIC box that uses the system bus for interrupt delivery and has
> multiple APIC clusters. Is that what you're working towards?
>
> --
> James Cleverdon
> IBM xSeries Linux Solutions
> {jamesclv(Unix, preferred), cleverdj(Notes)} at us dot ibm dot com
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply
* [PATCH] Module init reentry fix
From: Rusty Russell @ 2002-12-13 2:44 UTC (permalink / raw)
To: torvalds; +Cc: linux-kernel, Kees Bakker
Linus, please apply.
In some configurations, parport and bttv request a module inside their
module_init function. Drop the lock around mod->init(), change
module->live to module->state so we can detect modules which are in
init.
Survives stress_modules.sh here for a few hours, and according to
Kees, does fix the problem.
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
Name: Module init reentry fix
Author: Rusty Russell
Status: Tested on 2.5.51
D: This changes the code to drop the module_mutex() before calling the
D: module's init function, so module init functions can call
D: request_module(). This was trivial before someone broke the module
D: code to start non-live. Now it requires us to keep info on the
D: exact module state.
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .27854-linux-2.5.51/include/linux/module.h .27854-linux-2.5.51.updated/include/linux/module.h
--- .27854-linux-2.5.51/include/linux/module.h 2002-12-10 15:56:53.000000000 +1100
+++ .27854-linux-2.5.51.updated/include/linux/module.h 2002-12-12 11:31:28.000000000 +1100
@@ -116,10 +116,16 @@ struct module_ref
atomic_t count;
} ____cacheline_aligned;
+enum module_state
+{
+ MODULE_STATE_LIVE,
+ MODULE_STATE_COMING,
+ MODULE_STATE_GOING,
+};
+
struct module
{
- /* Am I live (yet)? */
- int live;
+ enum module_state state;
/* Member of list of modules */
struct list_head list;
@@ -177,6 +183,14 @@ struct module
char args[0];
};
+/* FIXME: It'd be nice to isolate modules during init, too, so they
+ aren't used before they (may) fail. But presently too much code
+ (IDE & SCSI) require entry into the module during init.*/
+static inline int module_is_live(struct module *mod)
+{
+ return mod->state != MODULE_STATE_GOING;
+}
+
#ifdef CONFIG_MODULE_UNLOAD
void __symbol_put(const char *symbol);
@@ -195,7 +209,7 @@ static inline int try_module_get(struct
if (module) {
unsigned int cpu = get_cpu();
- if (likely(module->live))
+ if (likely(module_is_live(module)))
local_inc(&module->ref[cpu].count);
else
ret = 0;
@@ -210,7 +224,7 @@ static inline void module_put(struct mod
unsigned int cpu = get_cpu();
local_dec(&module->ref[cpu].count);
/* Maybe they're waiting for us to drop reference? */
- if (unlikely(!module->live))
+ if (unlikely(!module_is_live(module)))
wake_up_process(module->waiter);
put_cpu();
}
@@ -219,7 +233,7 @@ static inline void module_put(struct mod
#else /*!CONFIG_MODULE_UNLOAD*/
static inline int try_module_get(struct module *module)
{
- return !module || module->live;
+ return !module || module_is_live(module);
}
static inline void module_put(struct module *module)
{
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .27854-linux-2.5.51/kernel/module.c .27854-linux-2.5.51.updated/kernel/module.c
--- .27854-linux-2.5.51/kernel/module.c 2002-12-10 15:56:54.000000000 +1100
+++ .27854-linux-2.5.51.updated/kernel/module.c 2002-12-12 11:31:28.000000000 +1100
@@ -44,6 +44,14 @@
static DECLARE_MUTEX(module_mutex);
LIST_HEAD(modules); /* FIXME: Accessed w/o lock on oops by some archs */
+/* We require a truly strong try_module_get() */
+static inline int strong_try_module_get(struct module *mod)
+{
+ if (mod && mod->state == MODULE_STATE_COMING)
+ return 0;
+ return try_module_get(mod);
+}
+
/* Convenient structure for holding init and core sizes */
struct sizes
{
@@ -378,7 +386,7 @@ sys_delete_module(const char *name_user,
}
/* Already dying? */
- if (!mod->live) {
+ if (mod->state == MODULE_STATE_GOING) {
/* FIXME: if (force), slam module count and wake up
waiter --RR */
DEBUGP("%s already dying\n", mod->name);
@@ -386,6 +394,16 @@ sys_delete_module(const char *name_user,
goto out;
}
+ /* Coming up? Allow force on stuck modules. */
+ if (mod->state == MODULE_STATE_COMING) {
+ forced = try_force(flags);
+ if (!forced) {
+ /* This module can't be removed */
+ ret = -EBUSY;
+ goto out;
+ }
+ }
+
if (!mod->exit || mod->unsafe) {
forced = try_force(flags);
if (!forced) {
@@ -407,7 +425,7 @@ sys_delete_module(const char *name_user,
ret = -EWOULDBLOCK;
} else {
mod->waiter = current;
- mod->live = 0;
+ mod->state = MODULE_STATE_GOING;
}
restart_refcounts();
@@ -507,7 +525,7 @@ static inline void module_unload_free(st
static inline int use_module(struct module *a, struct module *b)
{
- return try_module_get(b);
+ return strong_try_module_get(b);
}
static inline void module_unload_init(struct module *mod)
@@ -578,7 +596,7 @@ void *__symbol_get(const char *symbol)
spin_lock_irqsave(&modlist_lock, flags);
value = __find_symbol(symbol, &ksg);
- if (value && !try_module_get(ksg->owner))
+ if (value && !strong_try_module_get(ksg->owner))
value = 0;
spin_unlock_irqrestore(&modlist_lock, flags);
@@ -935,12 +953,8 @@ static struct module *load_module(void *
goto free_mod;
}
- /* Initialize the lists, since they will be list_del'd if init fails */
- INIT_LIST_HEAD(&mod->extable.list);
- INIT_LIST_HEAD(&mod->list);
- INIT_LIST_HEAD(&mod->symbols.list);
mod->symbols.owner = mod;
- mod->live = 0;
+ mod->state = MODULE_STATE_COMING;
module_unload_init(mod);
/* How much space will we need? (Common area in first) */
@@ -1097,51 +1111,40 @@ sys_init_module(void *umod,
flush_icache_range((unsigned long)mod->module_core,
(unsigned long)mod->module_core + mod->core_size);
- /* Now sew it into exception list (just in case...). */
+ /* Now sew it into the lists. They won't access us, since
+ strong_try_module_get() will fail. */
spin_lock_irq(&modlist_lock);
list_add(&mod->extable.list, &extables);
+ list_add_tail(&mod->symbols.list, &symbols);
spin_unlock_irq(&modlist_lock);
+ list_add(&mod->list, &modules);
+
+ /* Drop lock so they can recurse */
+ up(&module_mutex);
- /* Note, setting the mod->live to 1 here is safe because we haven't
- * linked the module into the system's kernel symbol table yet,
- * which means that the only way any other kernel code can call
- * into this module right now is if this module hands out entry
- * pointers to the other code. We assume that no module hands out
- * entry pointers to the rest of the kernel unless it is ready to
- * have them used.
- */
- mod->live = 1;
/* Start the module */
ret = mod->init ? mod->init() : 0;
if (ret < 0) {
/* Init routine failed: abort. Try to protect us from
buggy refcounters. */
+ mod->state = MODULE_STATE_GOING;
synchronize_kernel();
- if (mod->unsafe) {
+ if (mod->unsafe)
printk(KERN_ERR "%s: module is now stuck!\n",
mod->name);
- /* Mark it "live" so that they can force
- deletion later, and we don't keep getting
- woken on every decrement. */
- } else {
- mod->live = 0;
+ else {
+ down(&module_mutex);
free_module(mod);
+ up(&module_mutex);
}
- up(&module_mutex);
return ret;
}
/* Now it's a first class citizen! */
- spin_lock_irq(&modlist_lock);
- list_add_tail(&mod->symbols.list, &symbols);
- spin_unlock_irq(&modlist_lock);
- list_add(&mod->list, &modules);
-
+ mod->state = MODULE_STATE_LIVE;
module_free(mod, mod->module_init);
mod->module_init = NULL;
- /* All ok! */
- up(&module_mutex);
return 0;
}
^ permalink raw reply
* [PATCH] Revert module directory hierarchy and depmod invocation
From: Rusty Russell @ 2002-12-13 3:04 UTC (permalink / raw)
To: torvalds; +Cc: linux-kernel
Linus, please apply.
While the kernel, depmod et. al. don't care, other tools want the
directory hierarchy under /lib/modules/`uname -r`/. Sure, it's bogus
for them to rely on kernel source layout, but noone has come up with a
better alternative, so revert.
NOTE: You *still* can't have two modules of the same name! (You never
could).
Thanks,
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
Name: Module init reentry fix
Author: Rusty Russell
Status: Tested on 2.5.51
D: This changes the code to drop the module_mutex() before calling the
D: module's init function, so module init functions can call
D: request_module(). This was trivial before someone broke the module
D: code to start non-live. Now it requires us to keep info on the
D: exact module state.
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .27854-linux-2.5.51/include/linux/module.h .27854-linux-2.5.51.updated/include/linux/module.h
--- .27854-linux-2.5.51/include/linux/module.h 2002-12-10 15:56:53.000000000 +1100
+++ .27854-linux-2.5.51.updated/include/linux/module.h 2002-12-12 11:31:28.000000000 +1100
@@ -116,10 +116,16 @@ struct module_ref
atomic_t count;
} ____cacheline_aligned;
+enum module_state
+{
+ MODULE_STATE_LIVE,
+ MODULE_STATE_COMING,
+ MODULE_STATE_GOING,
+};
+
struct module
{
- /* Am I live (yet)? */
- int live;
+ enum module_state state;
/* Member of list of modules */
struct list_head list;
@@ -177,6 +183,14 @@ struct module
char args[0];
};
+/* FIXME: It'd be nice to isolate modules during init, too, so they
+ aren't used before they (may) fail. But presently too much code
+ (IDE & SCSI) require entry into the module during init.*/
+static inline int module_is_live(struct module *mod)
+{
+ return mod->state != MODULE_STATE_GOING;
+}
+
#ifdef CONFIG_MODULE_UNLOAD
void __symbol_put(const char *symbol);
@@ -195,7 +209,7 @@ static inline int try_module_get(struct
if (module) {
unsigned int cpu = get_cpu();
- if (likely(module->live))
+ if (likely(module_is_live(module)))
local_inc(&module->ref[cpu].count);
else
ret = 0;
@@ -210,7 +224,7 @@ static inline void module_put(struct mod
unsigned int cpu = get_cpu();
local_dec(&module->ref[cpu].count);
/* Maybe they're waiting for us to drop reference? */
- if (unlikely(!module->live))
+ if (unlikely(!module_is_live(module)))
wake_up_process(module->waiter);
put_cpu();
}
@@ -219,7 +233,7 @@ static inline void module_put(struct mod
#else /*!CONFIG_MODULE_UNLOAD*/
static inline int try_module_get(struct module *module)
{
- return !module || module->live;
+ return !module || module_is_live(module);
}
static inline void module_put(struct module *module)
{
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .27854-linux-2.5.51/kernel/module.c .27854-linux-2.5.51.updated/kernel/module.c
--- .27854-linux-2.5.51/kernel/module.c 2002-12-10 15:56:54.000000000 +1100
+++ .27854-linux-2.5.51.updated/kernel/module.c 2002-12-12 11:31:28.000000000 +1100
@@ -44,6 +44,14 @@
static DECLARE_MUTEX(module_mutex);
LIST_HEAD(modules); /* FIXME: Accessed w/o lock on oops by some archs */
+/* We require a truly strong try_module_get() */
+static inline int strong_try_module_get(struct module *mod)
+{
+ if (mod && mod->state == MODULE_STATE_COMING)
+ return 0;
+ return try_module_get(mod);
+}
+
/* Convenient structure for holding init and core sizes */
struct sizes
{
@@ -378,7 +386,7 @@ sys_delete_module(const char *name_user,
}
/* Already dying? */
- if (!mod->live) {
+ if (mod->state == MODULE_STATE_GOING) {
/* FIXME: if (force), slam module count and wake up
waiter --RR */
DEBUGP("%s already dying\n", mod->name);
@@ -386,6 +394,16 @@ sys_delete_module(const char *name_user,
goto out;
}
+ /* Coming up? Allow force on stuck modules. */
+ if (mod->state == MODULE_STATE_COMING) {
+ forced = try_force(flags);
+ if (!forced) {
+ /* This module can't be removed */
+ ret = -EBUSY;
+ goto out;
+ }
+ }
+
if (!mod->exit || mod->unsafe) {
forced = try_force(flags);
if (!forced) {
@@ -407,7 +425,7 @@ sys_delete_module(const char *name_user,
ret = -EWOULDBLOCK;
} else {
mod->waiter = current;
- mod->live = 0;
+ mod->state = MODULE_STATE_GOING;
}
restart_refcounts();
@@ -507,7 +525,7 @@ static inline void module_unload_free(st
static inline int use_module(struct module *a, struct module *b)
{
- return try_module_get(b);
+ return strong_try_module_get(b);
}
static inline void module_unload_init(struct module *mod)
@@ -578,7 +596,7 @@ void *__symbol_get(const char *symbol)
spin_lock_irqsave(&modlist_lock, flags);
value = __find_symbol(symbol, &ksg);
- if (value && !try_module_get(ksg->owner))
+ if (value && !strong_try_module_get(ksg->owner))
value = 0;
spin_unlock_irqrestore(&modlist_lock, flags);
@@ -935,12 +953,8 @@ static struct module *load_module(void *
goto free_mod;
}
- /* Initialize the lists, since they will be list_del'd if init fails */
- INIT_LIST_HEAD(&mod->extable.list);
- INIT_LIST_HEAD(&mod->list);
- INIT_LIST_HEAD(&mod->symbols.list);
mod->symbols.owner = mod;
- mod->live = 0;
+ mod->state = MODULE_STATE_COMING;
module_unload_init(mod);
/* How much space will we need? (Common area in first) */
@@ -1097,51 +1111,40 @@ sys_init_module(void *umod,
flush_icache_range((unsigned long)mod->module_core,
(unsigned long)mod->module_core + mod->core_size);
- /* Now sew it into exception list (just in case...). */
+ /* Now sew it into the lists. They won't access us, since
+ strong_try_module_get() will fail. */
spin_lock_irq(&modlist_lock);
list_add(&mod->extable.list, &extables);
+ list_add_tail(&mod->symbols.list, &symbols);
spin_unlock_irq(&modlist_lock);
+ list_add(&mod->list, &modules);
+
+ /* Drop lock so they can recurse */
+ up(&module_mutex);
- /* Note, setting the mod->live to 1 here is safe because we haven't
- * linked the module into the system's kernel symbol table yet,
- * which means that the only way any other kernel code can call
- * into this module right now is if this module hands out entry
- * pointers to the other code. We assume that no module hands out
- * entry pointers to the rest of the kernel unless it is ready to
- * have them used.
- */
- mod->live = 1;
/* Start the module */
ret = mod->init ? mod->init() : 0;
if (ret < 0) {
/* Init routine failed: abort. Try to protect us from
buggy refcounters. */
+ mod->state = MODULE_STATE_GOING;
synchronize_kernel();
- if (mod->unsafe) {
+ if (mod->unsafe)
printk(KERN_ERR "%s: module is now stuck!\n",
mod->name);
- /* Mark it "live" so that they can force
- deletion later, and we don't keep getting
- woken on every decrement. */
- } else {
- mod->live = 0;
+ else {
+ down(&module_mutex);
free_module(mod);
+ up(&module_mutex);
}
- up(&module_mutex);
return ret;
}
/* Now it's a first class citizen! */
- spin_lock_irq(&modlist_lock);
- list_add_tail(&mod->symbols.list, &symbols);
- spin_unlock_irq(&modlist_lock);
- list_add(&mod->list, &modules);
-
+ mod->state = MODULE_STATE_LIVE;
module_free(mod, mod->module_init);
mod->module_init = NULL;
- /* All ok! */
- up(&module_mutex);
return 0;
}
^ permalink raw reply
* Re: [PATCH][2.5][RFC] Using xAPIC apic address space on !Summit
From: Zwane Mwaikambo @ 2002-12-13 3:11 UTC (permalink / raw)
To: James Cleverdon; +Cc: Martin Bligh, John Stultz, Linux Kernel
In-Reply-To: <200212121841.32381.jamesclv@us.ibm.com>
On Thu, 12 Dec 2002, James Cleverdon wrote:
> Sure you can physically address them, if you assign IDs using Intel's official
> xAPIC numbering scheme (which must be clustered for more than 7 CPUs). But,
> you still don't have enough destination address bits to go around. In flat
> mode, the kernel assumes you have one bit per CPU and phys IDs will be < 0xF.
>
> Bill tells me that you may be doing this for an emulator. Why not emulate
> clusered APIC mode, like the real hardware uses?
>
> I know the name x86_summit doesn't really fit. The summit patch should work
> for any xAPIC box that uses the system bus for interrupt delivery and has
> multiple APIC clusters. Is that what you're working towards?
Hmm although i could then skip the logical destination mode and stick to
physical destination mode. This would greatly simplify my code paths since
i could almost use the same code for both normal SMP and this larger sim.
Debugging would then be somewhat simpler. My target doesn't have multiple
APIC clusters and all are addressable via a 0xff broadcast.
Thanks,
Zwane
--
function.linuxpower.ca
^ permalink raw reply
* [Linux-ia64] Problem with pci_read_config_word_nodev in 2.4.20
From: Matthew Wilcox @ 2002-12-13 3:05 UTC (permalink / raw)
To: linux-ia64
I'm trying to get the acpiphp driver going on an HP system.
Unfortunately, it crashes the machine on zx1 systems due to uninitialised
sysdata. I'm using the 2.4.20 patch from Bjorn, plus the 0.4 acpiphp
driver that was submitted for 2.4.21.
Here's the problem:
acpiphp_enable_slot()
|-> enable_device()
|-> acpiphp_configure_slot()
|-> pci_read_config_byte_nodev()
|-> build_dev()
|-> pci_read_config_byte(dev)
|-> dev->bus->ops->read_byte()
And the zx1 read_byte operation attempts to dereference a struct which
sysdata points to. But build_dev() doesn't fill in sysdata, and it has
no easy way to get it.
I really don't know the best way to fix this. Part of me says to fix
the _nodev() API to take a struct pci_bus *. Part of me says that's too
big for 2.4 and not necessary for 2.5. So maybe we should stash the sysdata
in the acpiphp_bridge.
--
"It's not Hollywood. War is real, war is primarily not about defeat or
victory, it is about death. I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk
^ permalink raw reply
* Re: Success! TWO questions remain
From: Jack Zielke @ 2002-12-13 3:12 UTC (permalink / raw)
To: linux-hams
In-Reply-To: <20021212214530.GB12823@silly.cloud.net.au>
I believe that OPIE is really what you are looking for. I know this was
mentioned before but seriously look at it. One Time Passwords. I have this
enabled for login (console), ftp, telnet and ssh. I am using S/Key myself but
you can find opie where the previous poster mentioned for their distro and you
can find it in the folder 'extra/ham/login' in mine. =]
http://distro.ibiblio.org/pub/Linux/distributions/slackware/slackware-8.1/extra/ham/login/
Setup opie, make a login that *must* use it, and open up telnet over the air.
No encryption goes over the airwaves. Anyone that watches you log in will not
be able to follow in your footsteps.
Jack
^ permalink raw reply
* RE: [PATCH][2.5][RFC] Using xAPIC apic address space on !Summit
From: Nakajima, Jun @ 2002-12-13 3:20 UTC (permalink / raw)
To: Zwane Mwaikambo, James Cleverdon; +Cc: Martin Bligh, John Stultz, Linux Kernel
The clustering mode we are talking about is part of xAPIC functionality, not
a NUMA (or Multi-Quad) thing. Even a non-NUMA system, it's available if it
has xAPICs.
Jun
> -----Original Message-----
> From: Zwane Mwaikambo [mailto:zwane@holomorphy.com]
> Sent: Thursday, December 12, 2002 7:11 PM
> To: James Cleverdon
> Cc: Martin Bligh; John Stultz; Linux Kernel
> Subject: Re: [PATCH][2.5][RFC] Using xAPIC apic address space on !Summit
>
> On Thu, 12 Dec 2002, James Cleverdon wrote:
>
> > Sure you can physically address them, if you assign IDs using Intel's
> official
> > xAPIC numbering scheme (which must be clustered for more than 7 CPUs).
> But,
> > you still don't have enough destination address bits to go around. In
> flat
> > mode, the kernel assumes you have one bit per CPU and phys IDs will be <
> 0xF.
> >
> > Bill tells me that you may be doing this for an emulator. Why not
> emulate
> > clusered APIC mode, like the real hardware uses?
> >
> > I know the name x86_summit doesn't really fit. The summit patch should
> work
> > for any xAPIC box that uses the system bus for interrupt delivery and
> has
> > multiple APIC clusters. Is that what you're working towards?
>
> Hmm although i could then skip the logical destination mode and stick to
> physical destination mode. This would greatly simplify my code paths since
> i could almost use the same code for both normal SMP and this larger sim.
> Debugging would then be somewhat simpler. My target doesn't have multiple
> APIC clusters and all are addressable via a 0xff broadcast.
>
> Thanks,
> Zwane
> --
> function.linuxpower.ca
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply
* Re: [PATCH][2.5][RFC] Using xAPIC apic address space on !Summit
From: James Cleverdon @ 2002-12-13 3:21 UTC (permalink / raw)
To: Nakajima, Jun, Zwane Mwaikambo; +Cc: Martin Bligh, John Stultz, Linux Kernel
In-Reply-To: <F2DBA543B89AD51184B600508B68D40010F1CE54@fmsmsx103.fm.intel.com>
On Thursday 12 December 2002 07:05 pm, Nakajima, Jun wrote:
> BTW, we are working on a xAPIC patch that supports more than 8 CPUs in a
> generic fashion (don't use hardcode OEM checking). We already tested it on
> two OEM systems with 16 CPUs.
> - It uses clustered mode. We don't want to use physical mode because it
> does not support lowest priority delivery mode.
> - We also check the version of the local APIC if it's xAPIC or not. It's
> possible that some other x86 architecture (other than P4P) uses xAPIC.
>
> Stay tuned.
>
> Jun
See my 2.5 summit patch for one that uses logical mode and lowest priority
delivery. I haven't submitted that for 2.4 because the physical patch has
the most run time on it, both in Alan's tree and SuSE 8.0+.
The hardcoded OEM checking was necessary because the Summit I/O APICs were
still using the older version number. (The HW folks claim that Intel didn't
specify the new number soon enough for them.)
I'm hesitant to key xAPIC vs. flat off the local APIC version number because
it's possible to build a flat system out of P4 CPUs. I/O APIC version
numbers combined with the parallel vs. serial bit would be safer (except for
the Summit problem above). I've also tried checking all the CPU's physical
APIC IDs to see if they use multiple APIC clusters.
> > -----Original Message-----
> > From: James Cleverdon [mailto:jamesclv@us.ibm.com]
> > Sent: Thursday, December 12, 2002 6:42 PM
> > To: Zwane Mwaikambo
> > Cc: Martin Bligh; John Stultz; Linux Kernel
> > Subject: Re: [PATCH][2.5][RFC] Using xAPIC apic address space on !Summit
> >
> > On Thursday 12 December 2002 06:21 pm, Zwane Mwaikambo wrote:
> > > On Thu, 12 Dec 2002, James Cleverdon wrote:
> > > > On Thursday 12 December 2002 05:44 pm, Zwane Mwaikambo wrote:
> > > > > Hi,
> > > > > I've got an 32x SMP system which has an xAPIC but utilises
> >
> > flat
> >
> > > > > addressing. This patch is to rename what was formerly x86_summit to
> > > > > x86_xapic (just to avoid confusion) and then select mask depending
> >
> > on
> >
> > > > > that.
> > > > >
> > > > > Untested/uncompiled patch
> > > >
> > > > Hi Zwane,
> > > >
> > > > How can you have a 32-way SMP system with flat addressing? There are
> > > > only 8 bits in the destination address field. Even if you work
> > > > around that by assigning a set of CPUs to each dest addr bit, there
> > > > can only
> >
> > be
> >
> > > > 15 physical APIC IDs in flat mode. To get to 32 you must switch into
> > > > clustered mode.
> > > >
> > > > Please tell me more. I'm intrigued how this can be done.
> > >
> > > Hi James,
> > > with the xAPIC we can use the 8bit address space everywhere in
> > > physical destination mode. For example the ICR now has an 8bit space
> > > for destination.
> > >
> > > "Specifies the target processor or processors. This field is only used
> > > when the destination shorthand field is set to 00B. If the destination
> > > mode is set to physical, then bits 56 through 59 contain the APIC ID of
> > > the target processor for Pentium and P6 family processors and bits 56
> > > through 63 contain the APIC ID of the target processor the for Pentium
> > > 4 and Intel Xeon processors. If the destination mode is set to logical,
> >
> > the
> >
> > > interpretation of the 8-bit destination field depends on the settings
> > > of the DFR and LDR registers of the local APICs in all the processors
> > > in
> >
> > the
> >
> > > system (see Section 8.6.2., Determining IPI Destination )."
> > > - System Developer's Manual vol3 p291
> > >
> > > Regards,
> > > Zwane
> >
> > Sure you can physically address them, if you assign IDs using Intel's
> > official
> > xAPIC numbering scheme (which must be clustered for more than 7 CPUs).
> > But,
> > you still don't have enough destination address bits to go around. In
> > flat
> > mode, the kernel assumes you have one bit per CPU and phys IDs will be <
> > 0xF.
> >
> > Bill tells me that you may be doing this for an emulator. Why not
> > emulate clusered APIC mode, like the real hardware uses?
> >
> > I know the name x86_summit doesn't really fit. The summit patch should
> > work
> > for any xAPIC box that uses the system bus for interrupt delivery and has
> > multiple APIC clusters. Is that what you're working towards?
> >
> > --
> > James Cleverdon
> > IBM xSeries Linux Solutions
> > {jamesclv(Unix, preferred), cleverdj(Notes)} at us dot ibm dot com
--
James Cleverdon
IBM xSeries Linux Solutions
{jamesclv(Unix, preferred), cleverdj(Notes)} at us dot ibm dot com
^ permalink raw reply
* RE: [PATCH][2.5][RFC] Using xAPIC apic address space on !Summit
From: Zwane Mwaikambo @ 2002-12-13 3:26 UTC (permalink / raw)
To: Nakajima, Jun; +Cc: jamesclv, Martin Bligh, John Stultz, Linux Kernel
In-Reply-To: <F2DBA543B89AD51184B600508B68D40010F1CE54@fmsmsx103.fm.intel.com>
On Thu, 12 Dec 2002, Nakajima, Jun wrote:
> BTW, we are working on a xAPIC patch that supports more than 8 CPUs in a
> generic fashion (don't use hardcode OEM checking). We already tested it on
> two OEM systems with 16 CPUs.
> - It uses clustered mode. We don't want to use physical mode because it does
> not support lowest priority delivery mode.
Wouldn't that only be for all including self? Or is the documentation
incorrect?
Thanks,
Zwane
--
function.linuxpower.ca
^ permalink raw reply
* Re: Setting standard arguments
From: dashielljt @ 2002-12-13 3:21 UTC (permalink / raw)
To: axel; +Cc: linux-newbie
In-Reply-To: <20021213015515.GA12456@neon.pearbough.net>
It looks as if the preinstall.pkg file is where you want to store what
parameters this package will allow.
Jude <dashielljt(at)gmpexpress-dot-net>
On Fri, 13 Dec 2002 axel@pearbough.net wrote:
Hi dashielljt!
On Thu, 12 Dec 2002, dashielljt wrote:
> Never heard of that package and I have slackware 8.0 going on his machine.
> It's not in the man pages, is it even part of traditional slackware full
> install? If not, you do best to check its documentation and faq file if
> one exists.
Well it's not about checkinstall. Checkinstall is not part of Slackware, it
just creates slackware packages from source builds to help keep you system
in order. Please take a look at it, in case you build software from source
packages. It's very useful. (http://asic-linux.com.mx/~izto/checkinstall/).
No, my question was targeted at doing such thing in general. Calling a
program which is called with a set of standard arguments given to it.
Because quite often you use the same options when calling some program.
Best regards,
Axel
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply
* Re: [PATCH][2.5][RFC] Using xAPIC apic address space on !Summit
From: James Cleverdon @ 2002-12-13 3:32 UTC (permalink / raw)
To: Zwane Mwaikambo, Nakajima, Jun; +Cc: Martin Bligh, John Stultz, Linux Kernel
In-Reply-To: <Pine.LNX.4.50.0212122221450.6931-100000@montezuma.mastecende.com>
On Thursday 12 December 2002 07:26 pm, Zwane Mwaikambo wrote:
> On Thu, 12 Dec 2002, Nakajima, Jun wrote:
> > BTW, we are working on a xAPIC patch that supports more than 8 CPUs in a
> > generic fashion (don't use hardcode OEM checking). We already tested it
> > on two OEM systems with 16 CPUs.
> > - It uses clustered mode. We don't want to use physical mode because it
> > does not support lowest priority delivery mode.
>
> Wouldn't that only be for all including self? Or is the documentation
> incorrect?
>
> Thanks,
> Zwane
I'm not sure I understand your question. Lowest Priority delivery mode only
works with logical interrupts. (I've tried it with physical intrs. It fails
miserably.) The "all including self" and "all excluding self" destination
shorthands don't do lowest priority arbitration. They always deliver the
interrupt to the CPUs mentioned in the shortand.
Lowest priority delivery mode isn't _too_ useful in Linux yet. It would be
nice to preferentially target idle CPUs with interrupts in real time. That
means changing each CPU's Task Priority Register (TPR) to represent how busy
it is. I've got some patches to do that, but haven't posted them as anything
more than a RFC.
--
James Cleverdon
IBM xSeries Linux Solutions
{jamesclv(Unix, preferred), cleverdj(Notes)} at us dot ibm dot com
^ permalink raw reply
* Re: problems with ALSA
From: dashielljt @ 2002-12-13 3:26 UTC (permalink / raw)
To: r4mz3z; +Cc: linux-newbie
In-Reply-To: <200212120019.25355.r4mz3z@yahoo.es>
Is that alsa rc6 or something earlier? If earlier, suggest you download
and try installing and compiling rc6.
Jude <dashielljt(at)gmpexpress-dot-net>
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
^ permalink raw reply
* Re: R: Kernel bug handling TCP_RTO_MAX?
From: Matti Aarnio @ 2002-12-13 3:39 UTC (permalink / raw)
To: Nivedita Singhvi
Cc: Alan Cox, Andreani Stefano, David S. Miller,
Linux Kernel Mailing List, linux-net
In-Reply-To: <3DF94565.2C582DE2@us.ibm.com>
On Thu, Dec 12, 2002 at 06:26:45PM -0800, Nivedita Singhvi wrote:
> Alan Cox wrote:
> > The default is too short ?
>
> Short?? :). On the contrary...
>
> here's what it would roughly look like:
>
> assuming HZ = 100 (2.4)
>
> tcp_retries2 = 15 (default) /* The # of retransmits */
>
> TCP_RTO_MAX = 120*HZ = 120 seconds = 120000ms
> TCP_RTO_MAX2 = 6*HZ = 6 seconds = 6000 ms /* modified value */
>
> TCP_RTO_MIN = HZ/5 = 200ms
>
> Assuming you are on a local lan, your round trip
> times are going to be much less than 200 ms, and
> so using the TCP_RTO_MIN of 200ms ("The algorithm
> ensures that the rto cant go below that").
The RTO steps in only when there is a need to RETRANSMIT.
For that reason, it makes no sense to place its start
any shorter.
> At each retransmit, TCP backs off exponentially:
>
> Retransmission # Default rto (ms) With TCP_RTO_MAX(2) (ms)
> 1 200 200
...
> 14 120000 6000
> 15 120000 6000
>
> Total time = 804.6 seconds 66.2 seconds
> 13.4 minutes
>
> So the minimum total time to time out a tcp connection
> (barring application close) would be ~13 minutes in the
> default case and 66 seconds with a modified TCP_RTO_MAX
> of 6*HZ.
You can have this by doing carefull non-blocking socket
coding, and protocol traffic monitoring along with
protocol level keepalive ping-pong packets to have
something flying around (like NJE ping-pong, not
that every IBM person knows what that is/was..)
> I can see the argument for lowering both, the TCP_RTO_MAX
> and the TCP_RTO_MIN default values.
I don't.
> I just did a bunch of testing over satellite, and round trip
> times were of the order of 850ms ~ 4000ms.
>
> The max retransmission timeout of 120 seconds is two orders of
> magnitude larger than really the slowest round trip times
> probably experienced on this planet..(Are we trying to make this
> work to the moon and back? Surely NASA has its own code??)
We try not to kill overloaded network routers while they
are trying to compensate some line breakage and doing
large-scale network topology re-routing.
> Particularly since we also retransmit 15 times, cant we conclude
> "Its dead, Jim" earlier??
No. I have had LAN spanning-tree flaps taking 60 seconds
(actually a bit over 30 seconds), and years ago Linux's
TCP code timed out in that. It was most annoying to
use some remote system thru such a network...
> 200ms is for the minimum retransmission timeout is roughly a
> thousand times, if not more, the round trip time on a
> fast lan. Since the algorithm is adaptive (a function of the
> measured round trip times), what would be the negative
> repercussions of lowering this?
When things _fail_ in the lan, what would be sensible value ?
How long will such abnormality last ?
In overload, resending quickly won't help a bit, just raise
the backoff (and prolong overload.)
Loosing a packet sometimes, and that way needing to retransmit
is the gray area I can't define quickly. If it is rare, it
really does not matter. If it happens often, there could be
so serious trouble that having quicker retransmit will only
aggreviate the trouble more.
> It may not be a good idea to make either tunable, but what about
> the default init rto value, TCP_TIMEOUT_INIT, since that would allow a
> starting point of something close to a suitable value?
>
> The problem with all of the above is that the TCP engine is
> global and undifferentiated, and tuning for at least these parameters
> is the same regardless of the interface or route or environment..
You are looking for "STP" perhaps ?
It has a feature of waking all streams retransmits, in between
particular machines, when at least one STP frame travels in between
the hosts.
I can't find it now from my RFC collection. Odd at that..
Neither as a draft. has it been abandoned ?
> Yes, we should and want to meet the standards for the internet, and
> behave in a network friendly fashion. But all networks != internet.
>
> I'm thinking for eg of a dedicated fast gigabit or better connection
> between a tier 2 webserver and a backend database, for example, that
> has every need of performance and few of standards compliance..
>
> It would be wonderful if we could tune TCP on a per-interface or a
> per-route basis (everything public, for a start, considered the
> internet, and non-routable networks (10, etc), could be configured
> suitably for its environment. (TCP over private LAN - rfc?). Trusting
> users would be a big issue..
>
> Any thoughts? How stupid is this? Old hat??
More and more of STP ..
> thanks,
> Nivedita
/Matti Aarnio
^ permalink raw reply
* RE: (no subject)
From: Antonino Daplas @ 2002-12-13 6:33 UTC (permalink / raw)
To: vivens; +Cc: 'James Simmons', Linux Fbdev development list
In-Reply-To: <001301c2a08f$f49d9250$3c01a8c0@berflo.lan>
On Wed, 2002-12-11 at 02:05, vivens wrote:
> Well, I mend it like this:
> I'm trying to build a framebuffer for an embedded ARM platform (which
> doesn't use any kind of a Lunix distr).
> I want to use a framebuffer, because some apps need it. For example the
> ZEN browser I want to implement on this platform.
You can check the linux-2.5.51 for insights. But if you just want to
implement the API without necessarily conforming to linux's framebuffer
support (don't want to use linux), then:
First you need hardware with linear video memory.
If you want compatibility with standard fb_apps , then you need the
following;
1. accessing the driver as a file (/dev/fbx) - the name is pretty much
hardwired.
2. support standard file operations (open, close, read, write). The
read/write operation accesses the video memory.
3. This is the biggie: support for most fb_specific ioctls (check
drivers/video/fbmem.c).
Required ioctl support:
a. Setting the struct fb_var_screeninfo. This is basically the
structure used to communicate between user apps and the driver, and
contains information that can modify the video/framebuffer state
depending on the capabilities of the hardware. As for the video
/framebuffer state, it encompasses the dimensions of the display, the
pixelformat, the color information, etc, as described in the file
linux/include/linux/fb.h.
You don't have to follow everything in the request. In fact, you don't
even have to do anything at all, but you must return an
fb_var_screeninfo structure that is valid for the driver. It's like the
app saying "this is what I want" and the driver returning with "this is
what you get, take it or leave it".
b. Getting the struct fb_var_screeninfo. This is simple enough, it
returns the structure containing information describing the current
state.
c. Getting struct fb_fix_screeninfo. This structure contains
information that cannot be altered by outside requests, that's why get
is only supported. It does partly depend on fb_var_screeninfo, but is
more or less hardware specific information. This is a one way ioctl,
driver to user.
As for the rest of the ioctls, you can just return success or fail.
4. have video memory mappable to user space (check fb_mmap in fbmem.c).
Although optional, practically all apps use/need this.
5. You may wish to skip console support because that entails a lot of
work. (and you probably don't need this)
> So my question is:
> What basic functions does a framebuffer normally have, what is need to
> initialize for these functions?
At a bare minimum, the driver must set the hardware into a state as
imposed by itself during initialization, or by requests through
fb_var_screeninfo..
For most apps, mmap support must be included.
The simplest driver then would support #1, #2, #4, and set the video
mode at initialization. As for #3, just return success/fail, making
sure the driver channels back the correct information to the userland
app, without actually doing anything at all.
> Can I see the framebuffer as the API between the video hardware and any
> application what uses the video hardware?
>
Yes, that's the goal of the framebuffer, to abstract the underlying
hardware into a well-defined interface. But to keep it as simple and as
cross-platform as possible, the API is at the barest minimum (set the
hardware, set the mode, and offer access to the graphics memory either
through file reads/writes or mmap). The rest are icing on the cake.
If I missed anything, feel free.
Tony
-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/
^ permalink raw reply
* [2.5.51] Failure to mount ext3 root when ext2 compiled in
From: Rusty Russell @ 2002-12-13 3:48 UTC (permalink / raw)
To: akpm, viro; +Cc: linux-kernel
Just noticed this (usually ext2 is compiled as a module, but was
testing a patch with CONFIG_MODULES=n). Reverted to plain 2.5.51, and
it's still there:
VFS: Cannot open root device "301" or 03:01
Please append a correct "root=" boot option
Kernel panic: VFS: Unable to mount root fs on 03:01
Now, I have an ext3 root, but when CONFIG_EXT3_FS=y and
CONFIG_EXT2_FS=y, I get this failure. Turning off CONFIG_EXT2_FS
"fixes" it.
Hope this helps,
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
^ permalink raw reply
* [PATCH] module_param() primitive (1/3)
From: Rusty Russell @ 2002-12-13 3:51 UTC (permalink / raw)
To: torvalds; +Cc: linux-kernel
Linus, please apply.
This version uses __param for the section name: ld generates
__start___param and __stop___param automatically this way (unless the
sections don't exist, so the declarations have to be in ld scripts
anyway for now).
Thanks,
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
Name: Parameter Core Patch
Author: Rusty Russell
Status: Tested on 2.5.51
D: This patch is a rewrite of the insmod and boot parameter handling,
D: to unify them.
D:
D: The new format is fairly simple: built on top of __module_param_call there
D: are several helpers, eg "module_param(foo, int, 000)". The final argument
D: is the permissions bits, for exposing parameters in sysfs (if
D: non-zero) at a later stage.
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .645-linux-2.5-bk/arch/i386/vmlinux.lds.S .645-linux-2.5-bk.updated/arch/i386/vmlinux.lds.S
--- .645-linux-2.5-bk/arch/i386/vmlinux.lds.S 2002-11-19 09:58:38.000000000 +1100
+++ .645-linux-2.5-bk.updated/arch/i386/vmlinux.lds.S 2002-12-03 12:03:16.000000000 +1100
@@ -67,6 +67,9 @@ SECTIONS
__setup_start = .;
.init.setup : { *(.init.setup) }
__setup_end = .;
+ __start___param = .;
+ __param : { *(__param) }
+ __stop___param = .;
__initcall_start = .;
.initcall.init : {
*(.initcall1.init)
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .645-linux-2.5-bk/arch/ia64/vmlinux.lds.S .645-linux-2.5-bk.updated/arch/ia64/vmlinux.lds.S
--- .645-linux-2.5-bk/arch/ia64/vmlinux.lds.S 2002-11-05 10:54:24.000000000 +1100
+++ .645-linux-2.5-bk.updated/arch/ia64/vmlinux.lds.S 2002-12-03 12:03:16.000000000 +1100
@@ -102,6 +102,10 @@ SECTIONS
.init.setup : AT(ADDR(.init.setup) - PAGE_OFFSET)
{ *(.init.setup) }
__setup_end = .;
+ __start___param = .;
+ __param : AT(ADDR(__param) - PAGE_OFFSET)
+ { *(__param) }
+ __stop___param = .;
__initcall_start = .;
.initcall.init : AT(ADDR(.initcall.init) - PAGE_OFFSET)
{
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .645-linux-2.5-bk/arch/ppc/vmlinux.lds.S .645-linux-2.5-bk.updated/arch/ppc/vmlinux.lds.S
--- .645-linux-2.5-bk/arch/ppc/vmlinux.lds.S 2002-11-11 20:00:54.000000000 +1100
+++ .645-linux-2.5-bk.updated/arch/ppc/vmlinux.lds.S 2002-12-03 12:03:16.000000000 +1100
@@ -103,6 +103,9 @@ SECTIONS
__setup_start = .;
.init.setup : { *(.init.setup) }
__setup_end = .;
+ __start___param = .;
+ __param : { *(__param) }
+ __stop___param = .;
__initcall_start = .;
.initcall.init : {
*(.initcall1.init)
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .645-linux-2.5-bk/arch/ppc64/vmlinux.lds.S .645-linux-2.5-bk.updated/arch/ppc64/vmlinux.lds.S
--- .645-linux-2.5-bk/arch/ppc64/vmlinux.lds.S 2002-11-11 20:00:55.000000000 +1100
+++ .645-linux-2.5-bk.updated/arch/ppc64/vmlinux.lds.S 2002-12-03 12:03:16.000000000 +1100
@@ -91,6 +91,9 @@ SECTIONS
__setup_start = .;
.init.setup : { *(.init.setup) }
__setup_end = .;
+ __start___param = .;
+ __param : { *(__param) }
+ __stop___param = .;
__initcall_start = .;
.initcall.init : {
*(.initcall1.init)
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .645-linux-2.5-bk/arch/sparc64/vmlinux.lds.S .645-linux-2.5-bk.updated/arch/sparc64/vmlinux.lds.S
--- .645-linux-2.5-bk/arch/sparc64/vmlinux.lds.S 2002-11-25 08:43:49.000000000 +1100
+++ .645-linux-2.5-bk.updated/arch/sparc64/vmlinux.lds.S 2002-12-03 12:03:16.000000000 +1100
@@ -51,6 +51,9 @@ SECTIONS
__setup_start = .;
.init.setup : { *(.init.setup) }
__setup_end = .;
+ __start___param = .;
+ __param : { *(__param) }
+ __stop___param = .;
__initcall_start = .;
.initcall.init : {
*(.initcall1.init)
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .645-linux-2.5-bk/include/linux/init.h .645-linux-2.5-bk.updated/include/linux/init.h
--- .645-linux-2.5-bk/include/linux/init.h 2002-12-03 09:27:22.000000000 +1100
+++ .645-linux-2.5-bk.updated/include/linux/init.h 2002-12-03 12:03:16.000000000 +1100
@@ -86,19 +86,15 @@ typedef void (*exitcall_t)(void);
#define __exitcall(fn) \
static exitcall_t __exitcall_##fn __exit_call = fn
-/*
- * Used for kernel command line parameter setup
- */
-struct kernel_param {
+struct obs_kernel_param {
const char *str;
int (*setup_func)(char *);
};
-extern struct kernel_param __setup_start, __setup_end;
-
+/* OBSOLETE: see moduleparam.h for the right way. */
#define __setup(str, fn) \
static char __setup_str_##fn[] __initdata = str; \
- static struct kernel_param __setup_##fn \
+ static struct obs_kernel_param __setup_##fn \
__attribute__((unused,__section__ (".init.setup"))) \
= { __setup_str_##fn, fn }
@@ -161,6 +157,16 @@ extern struct kernel_param __setup_start
/* Data marked not to be saved by software_suspend() */
#define __nosavedata __attribute__ ((__section__ (".data.nosave")))
+/* This means "can be init if no module support, otherwise module load
+ may call it." */
+#ifdef CONFIG_MODULES
+#define __init_or_module
+#define __initdata_or_module
+#else
+#define __init_or_module __init
+#define __initdata_or_module __initdata
+#endif /*CONFIG_MODULES*/
+
#ifdef CONFIG_HOTPLUG
#define __devinit
#define __devinitdata
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .645-linux-2.5-bk/include/linux/kernel.h .645-linux-2.5-bk.updated/include/linux/kernel.h
--- .645-linux-2.5-bk/include/linux/kernel.h 2002-11-28 10:20:09.000000000 +1100
+++ .645-linux-2.5-bk.updated/include/linux/kernel.h 2002-12-03 12:03:16.000000000 +1100
@@ -71,7 +71,7 @@ extern int sscanf(const char *, const ch
extern int vsscanf(const char *, const char *, va_list);
extern int get_option(char **str, int *pint);
-extern char *get_options(char *str, int nints, int *ints);
+extern char *get_options(const char *str, int nints, int *ints);
extern unsigned long long memparse(char *ptr, char **retptr);
extern void dev_probe_lock(void);
extern void dev_probe_unlock(void);
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .645-linux-2.5-bk/include/linux/moduleparam.h .645-linux-2.5-bk.updated/include/linux/moduleparam.h
--- .645-linux-2.5-bk/include/linux/moduleparam.h 1970-01-01 10:00:00.000000000 +1000
+++ .645-linux-2.5-bk.updated/include/linux/moduleparam.h 2002-12-03 12:03:16.000000000 +1100
@@ -0,0 +1,127 @@
+#ifndef _LINUX_MODULE_PARAMS_H
+#define _LINUX_MODULE_PARAMS_H
+/* (C) Copyright 2001, 2002 Rusty Russell IBM Corporation */
+#include <linux/init.h>
+#include <linux/stringify.h>
+
+/* You can override this manually, but generally this should match the
+ module name. */
+#ifdef MODULE
+#define MODULE_PARAM_PREFIX /* empty */
+#else
+#define MODULE_PARAM_PREFIX __stringify(KBUILD_MODNAME) "."
+#endif
+
+struct kernel_param;
+
+/* Returns 0, or -errno. arg is in kp->arg. */
+typedef int (*param_set_fn)(const char *val, struct kernel_param *kp);
+/* Returns length written or -errno. Buffer is 4k (ie. be short!) */
+typedef int (*param_get_fn)(char *buffer, struct kernel_param *kp);
+
+struct kernel_param {
+ const char *name;
+ unsigned int perm;
+ param_set_fn set;
+ param_get_fn get;
+ void *arg;
+};
+
+/* Special one for strings we want to copy into */
+struct kparam_string {
+ unsigned int maxlen;
+ char *string;
+};
+
+/* This is the fundamental function for registering boot/module
+ parameters. perm sets the visibility in driverfs: 000 means it's
+ not there, read bits mean it's readable, write bits mean it's
+ writable. */
+#define __module_param_call(prefix, name, set, get, arg, perm) \
+ static char __param_str_##name[] __initdata = prefix #name; \
+ static struct kernel_param __param_##name \
+ __attribute__ ((unused,__section__ ("__param"))) \
+ = { __param_str_##name, perm, set, get, arg }
+
+#define module_param_call(name, set, get, arg, perm) \
+ __module_param_call(MODULE_PARAM_PREFIX, name, set, get, arg, perm)
+
+/* Helper functions: type is byte, short, ushort, int, uint, long,
+ ulong, charp, bool or invbool, or XXX if you define param_get_XXX,
+ param_set_XXX and param_check_XXX. */
+#define module_param_named(name, value, type, perm) \
+ param_check_##type(name, &(value)); \
+ module_param_call(name, param_set_##type, param_get_##type, &value, perm)
+
+#define module_param(name, type, perm) \
+ module_param_named(name, name, type, perm)
+
+/* Actually copy string: maxlen param is usually sizeof(string). */
+#define module_param_string(name, string, len, perm) \
+ static struct kparam_string __param_string_##name __initdata \
+ = { len, string }; \
+ module_param_call(name, param_set_copystring, param_get_charp, \
+ &__param_string_##name, perm)
+
+/* Called on module insert or kernel boot */
+extern int parse_args(const char *name,
+ char *args,
+ struct kernel_param *params,
+ unsigned num,
+ int (*unknown)(char *param, char *val));
+
+/* All the helper functions */
+/* The macros to do compile-time type checking stolen from Jakub
+ Jelinek, who IIRC came up with this idea for the 2.4 module init code. */
+#define __param_check(name, p, type) \
+ static inline type *__check_##name(void) { return(p); }
+
+extern int param_set_short(const char *val, struct kernel_param *kp);
+extern int param_get_short(char *buffer, struct kernel_param *kp);
+#define param_check_short(name, p) __param_check(name, p, short)
+
+extern int param_set_ushort(const char *val, struct kernel_param *kp);
+extern int param_get_ushort(char *buffer, struct kernel_param *kp);
+#define param_check_ushort(name, p) __param_check(name, p, unsigned short)
+
+extern int param_set_int(const char *val, struct kernel_param *kp);
+extern int param_get_int(char *buffer, struct kernel_param *kp);
+#define param_check_int(name, p) __param_check(name, p, int)
+
+extern int param_set_uint(const char *val, struct kernel_param *kp);
+extern int param_get_uint(char *buffer, struct kernel_param *kp);
+#define param_check_uint(name, p) __param_check(name, p, unsigned int)
+
+extern int param_set_long(const char *val, struct kernel_param *kp);
+extern int param_get_long(char *buffer, struct kernel_param *kp);
+#define param_check_long(name, p) __param_check(name, p, long)
+
+extern int param_set_ulong(const char *val, struct kernel_param *kp);
+extern int param_get_ulong(char *buffer, struct kernel_param *kp);
+#define param_check_ulong(name, p) __param_check(name, p, unsigned long)
+
+extern int param_set_charp(const char *val, struct kernel_param *kp);
+extern int param_get_charp(char *buffer, struct kernel_param *kp);
+#define param_check_charp(name, p) __param_check(name, p, char *)
+
+extern int param_set_bool(const char *val, struct kernel_param *kp);
+extern int param_get_bool(char *buffer, struct kernel_param *kp);
+#define param_check_bool(name, p) __param_check(name, p, int)
+
+extern int param_set_invbool(const char *val, struct kernel_param *kp);
+extern int param_get_invbool(char *buffer, struct kernel_param *kp);
+#define param_check_invbool(name, p) __param_check(name, p, int)
+
+/* First two elements are the max and min array length (which don't change) */
+extern int param_set_intarray(const char *val, struct kernel_param *kp);
+extern int param_get_intarray(char *buffer, struct kernel_param *kp);
+#define param_check_intarray(name, p) __param_check(name, p, int *)
+
+extern int param_set_copystring(const char *val, struct kernel_param *kp);
+
+int param_array(const char *name,
+ const char *val,
+ unsigned int min, unsigned int max,
+ void *elem, int elemsize,
+ int (*set)(const char *, struct kernel_param *kp));
+#endif /* _LINUX_MODULE_PARAM_TYPES_H */
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .645-linux-2.5-bk/init/main.c .645-linux-2.5-bk.updated/init/main.c
--- .645-linux-2.5-bk/init/main.c 2002-11-19 09:58:52.000000000 +1100
+++ .645-linux-2.5-bk.updated/init/main.c 2002-12-03 12:03:16.000000000 +1100
@@ -33,6 +33,7 @@
#include <linux/workqueue.h>
#include <linux/profile.h>
#include <linux/rcupdate.h>
+#include <linux/moduleparam.h>
#include <asm/io.h>
#include <asm/bugs.h>
@@ -136,9 +137,10 @@ char * envp_init[MAX_INIT_ENVS+2] = { "H
__setup("profile=", profile_setup);
-static int __init checksetup(char *line)
+static int __init obsolete_checksetup(char *line)
{
- struct kernel_param *p;
+ struct obs_kernel_param *p;
+ extern struct obs_kernel_param __setup_start, __setup_end;
p = &__setup_start;
do {
@@ -221,74 +223,45 @@ static int __init quiet_kernel(char *str
__setup("debug", debug_kernel);
__setup("quiet", quiet_kernel);
-/*
- * This is a simple kernel command line parsing function: it parses
- * the command line, and fills in the arguments/environment to init
- * as appropriate. Any cmd-line option is taken to be an environment
- * variable if it contains the character '='.
- *
- * This routine also checks for options meant for the kernel.
- * These options are not given to init - they are for internal kernel use only.
- */
-static void __init parse_options(char *line)
+/* Unknown boot options get handed to init, unless they look like
+ failed parameters */
+static int __init unknown_bootoption(char *param, char *val)
{
- char *next,*quote;
- int args, envs;
+ /* Change NUL term back to "=", to make "param" the whole string. */
+ if (val)
+ val[-1] = '=';
- if (!*line)
- return;
- args = 0;
- envs = 1; /* TERM is set to 'linux' by default */
- next = line;
- while ((line = next) != NULL) {
- quote = strchr(line,'"');
- next = strchr(line, ' ');
- while (next != NULL && quote != NULL && quote < next) {
- /* we found a left quote before the next blank
- * now we have to find the matching right quote
- */
- next = strchr(quote+1, '"');
- if (next != NULL) {
- quote = strchr(next+1, '"');
- next = strchr(next+1, ' ');
- }
- }
- if (next != NULL)
- *next++ = 0;
- if (!strncmp(line,"init=",5)) {
- line += 5;
- execute_command = line;
- /* In case LILO is going to boot us with default command line,
- * it prepends "auto" before the whole cmdline which makes
- * the shell think it should execute a script with such name.
- * So we ignore all arguments entered _before_ init=... [MJ]
- */
- args = 0;
- continue;
+ /* Handle obsolete-style parameters */
+ if (obsolete_checksetup(param))
+ return 0;
+
+ /* Preemptive maintenance for "why didn't my mispelled command
+ line work?" */
+ if (strchr(param, '.') && (!val || strchr(param, '.') < val)) {
+ printk(KERN_ERR "Unknown boot option `%s': ignoring\n", param);
+ return 0;
+ }
+
+ if (val) {
+ /* Environment option */
+ unsigned int i;
+ for (i = 0; envp_init[i]; i++) {
+ if (i == MAX_INIT_ENVS)
+ panic("Too many boot env vars at `%s'", param);
}
- if (checksetup(line))
- continue;
-
- /*
- * Then check if it's an environment variable or
- * an option.
- */
- if (strchr(line,'=')) {
- if (envs >= MAX_INIT_ENVS)
- break;
- envp_init[++envs] = line;
- } else {
- if (args >= MAX_INIT_ARGS)
- break;
- if (*line)
- argv_init[++args] = line;
+ envp_init[i] = param;
+ } else {
+ /* Command line option */
+ unsigned int i;
+ for (i = 0; argv_init[i]; i++) {
+ if (i == MAX_INIT_ARGS)
+ panic("Too many boot init vars at `%s'",param);
}
+ argv_init[i] = param;
}
- argv_init[args+1] = NULL;
- envp_init[envs+1] = NULL;
+ return 0;
}
-
extern void setup_arch(char **);
extern void cpu_idle(void);
@@ -382,6 +355,7 @@ asmlinkage void __init start_kernel(void
{
char * command_line;
extern char saved_command_line[];
+ extern struct kernel_param __start___param, __stop___param;
/*
* Interrupts are still disabled. Do necessary setups, then
* enable them
@@ -393,7 +367,9 @@ asmlinkage void __init start_kernel(void
build_all_zonelists();
page_alloc_init();
printk("Kernel command line: %s\n", saved_command_line);
- parse_options(command_line);
+ parse_args("Booting kernel", command_line, &__start___param,
+ &__stop___param - &__start___param,
+ &unknown_bootoption);
trap_init();
extable_init();
rcu_init();
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .645-linux-2.5-bk/kernel/Makefile .645-linux-2.5-bk.updated/kernel/Makefile
--- .645-linux-2.5-bk/kernel/Makefile 2002-11-25 08:44:18.000000000 +1100
+++ .645-linux-2.5-bk.updated/kernel/Makefile 2002-12-03 12:03:16.000000000 +1100
@@ -4,13 +4,13 @@
export-objs = signal.o sys.o kmod.o workqueue.o ksyms.o pm.o exec_domain.o \
printk.o platform.o suspend.o dma.o module.o cpufreq.o \
- profile.o rcupdate.o intermodule.o
+ profile.o rcupdate.o intermodule.o params.o
obj-y = sched.o fork.o exec_domain.o panic.o printk.o profile.o \
exit.o itimer.o time.o softirq.o resource.o \
sysctl.o capability.o ptrace.o timer.o user.o \
signal.o sys.o kmod.o workqueue.o futex.o platform.o pid.o \
- rcupdate.o intermodule.o extable.o
+ rcupdate.o intermodule.o extable.o params.o
obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
obj-$(CONFIG_SMP) += cpu.o
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .645-linux-2.5-bk/kernel/params.c .645-linux-2.5-bk.updated/kernel/params.c
--- .645-linux-2.5-bk/kernel/params.c 1970-01-01 10:00:00.000000000 +1000
+++ .645-linux-2.5-bk.updated/kernel/params.c 2002-12-03 12:03:16.000000000 +1100
@@ -0,0 +1,338 @@
+/* Helpers for initial module or kernel cmdline parsing
+ Copyright (C) 2001 Rusty Russell.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+#include <linux/moduleparam.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/errno.h>
+#include <linux/module.h>
+
+#if 0
+#define DEBUGP printk
+#else
+#define DEBUGP(fmt , ...)
+#endif
+
+static int parse_one(char *param,
+ char *val,
+ struct kernel_param *params,
+ unsigned num_params,
+ int (*handle_unknown)(char *param, char *val))
+{
+ unsigned int i;
+
+ /* Find parameter */
+ for (i = 0; i < num_params; i++) {
+ if (strcmp(param, params[i].name) == 0) {
+ DEBUGP("They are equal! Calling %p\n",
+ params[i].set);
+ return params[i].set(val, ¶ms[i]);
+ }
+ }
+
+ if (handle_unknown) {
+ DEBUGP("Unknown argument: calling %p\n", handle_unknown);
+ return handle_unknown(param, val);
+ }
+
+ DEBUGP("Unknown argument `%s'\n", param);
+ return -ENOENT;
+}
+
+/* You can use " around spaces, but can't escape ". */
+/* Hyphens and underscores equivalent in parameter names. */
+static char *next_arg(char *args, char **param, char **val)
+{
+ unsigned int i, equals = 0;
+ int in_quote = 0;
+
+ /* Chew any extra spaces */
+ while (*args == ' ') args++;
+
+ for (i = 0; args[i]; i++) {
+ if (args[i] == ' ' && !in_quote)
+ break;
+ if (equals == 0) {
+ if (args[i] == '=')
+ equals = i;
+ else if (args[i] == '-')
+ args[i] = '_';
+ }
+ if (args[i] == '"')
+ in_quote = !in_quote;
+ }
+
+ *param = args;
+ if (!equals)
+ *val = NULL;
+ else {
+ args[equals] = '\0';
+ *val = args + equals + 1;
+ }
+
+ if (args[i]) {
+ args[i] = '\0';
+ return args + i + 1;
+ } else
+ return args + i;
+}
+
+/* Args looks like "foo=bar,bar2 baz=fuz wiz". */
+int parse_args(const char *name,
+ char *args,
+ struct kernel_param *params,
+ unsigned num,
+ int (*unknown)(char *param, char *val))
+{
+ char *param, *val;
+
+ DEBUGP("Parsing ARGS: %s\n", args);
+
+ while (*args) {
+ int ret;
+
+ args = next_arg(args, ¶m, &val);
+ ret = parse_one(param, val, params, num, unknown);
+ switch (ret) {
+ case -ENOENT:
+ printk(KERN_ERR "%s: Unknown parameter `%s'\n",
+ name, param);
+ return ret;
+ case -ENOSPC:
+ printk(KERN_ERR
+ "%s: `%s' too large for parameter `%s'\n",
+ name, val ?: "", param);
+ return ret;
+ case 0:
+ break;
+ default:
+ printk(KERN_ERR
+ "%s: `%s' invalid for parameter `%s'\n",
+ name, val ?: "", param);
+ return ret;
+ }
+ }
+
+ /* All parsed OK. */
+ return 0;
+}
+
+/* Lazy bastard, eh? */
+#define STANDARD_PARAM_DEF(name, type, format, tmptype, strtolfn) \
+ int param_set_##name(const char *val, struct kernel_param *kp) \
+ { \
+ char *endp; \
+ tmptype l; \
+ \
+ if (!val) return -EINVAL; \
+ l = strtolfn(val, &endp, 0); \
+ if (endp == val || *endp || ((type)l != l)) \
+ return -EINVAL; \
+ *((type *)kp->arg) = l; \
+ return 0; \
+ } \
+ int param_get_##name(char *buffer, struct kernel_param *kp) \
+ { \
+ return sprintf(buffer, format, *((type *)kp->arg)); \
+ }
+
+STANDARD_PARAM_DEF(short, short, "%hi", long, simple_strtol);
+STANDARD_PARAM_DEF(ushort, unsigned short, "%hu", long, simple_strtol);
+STANDARD_PARAM_DEF(int, int, "%i", long, simple_strtol);
+STANDARD_PARAM_DEF(uint, unsigned int, "%u", long, simple_strtol);
+STANDARD_PARAM_DEF(long, long, "%li", long, simple_strtol);
+STANDARD_PARAM_DEF(ulong, unsigned long, "%lu", unsigned long, simple_strtoul);
+
+int param_set_charp(const char *val, struct kernel_param *kp)
+{
+ if (!val) {
+ printk(KERN_ERR "%s: string parameter expected\n",
+ kp->name);
+ return -EINVAL;
+ }
+
+ if (strlen(val) > 1024) {
+ printk(KERN_ERR "%s: string parameter too long\n",
+ kp->name);
+ return -ENOSPC;
+ }
+
+ *(char **)kp->arg = (char *)val;
+ return 0;
+}
+
+int param_get_charp(char *buffer, struct kernel_param *kp)
+{
+ return sprintf(buffer, "%s", *((char **)kp->arg));
+}
+
+int param_set_bool(const char *val, struct kernel_param *kp)
+{
+ /* No equals means "set"... */
+ if (!val) val = "1";
+
+ /* One of =[yYnN01] */
+ switch (val[0]) {
+ case 'y': case 'Y': case '1':
+ *(int *)kp->arg = 1;
+ return 0;
+ case 'n': case 'N': case '0':
+ *(int *)kp->arg = 0;
+ return 0;
+ }
+ return -EINVAL;
+}
+
+int param_get_bool(char *buffer, struct kernel_param *kp)
+{
+ /* Y and N chosen as being relatively non-coder friendly */
+ return sprintf(buffer, "%c", (*(int *)kp->arg) ? 'Y' : 'N');
+}
+
+int param_set_invbool(const char *val, struct kernel_param *kp)
+{
+ int boolval, ret;
+ struct kernel_param dummy = { .arg = &boolval };
+
+ ret = param_set_bool(val, &dummy);
+ if (ret == 0)
+ *(int *)kp->arg = !boolval;
+ return ret;
+}
+
+int param_get_invbool(char *buffer, struct kernel_param *kp)
+{
+ int val;
+ struct kernel_param dummy = { .arg = &val };
+
+ val = !*(int *)kp->arg;
+ return param_get_bool(buffer, &dummy);
+}
+
+/* We cheat here and temporarily mangle the string. */
+int param_array(const char *name,
+ const char *val,
+ unsigned int min, unsigned int max,
+ void *elem, int elemsize,
+ int (*set)(const char *, struct kernel_param *kp))
+{
+ int ret;
+ unsigned int count = 0;
+ struct kernel_param kp;
+
+ /* Get the name right for errors. */
+ kp.name = name;
+ kp.arg = elem;
+
+ /* No equals sign? */
+ if (!val) {
+ printk(KERN_ERR "%s: expects arguments\n", name);
+ return -EINVAL;
+ }
+
+ /* We expect a comma-separated list of values. */
+ do {
+ int len;
+ char save;
+
+ if (count > max) {
+ printk(KERN_ERR "%s: can only take %i arguments\n",
+ name, max);
+ return -EINVAL;
+ }
+ len = strcspn(val, ",");
+
+ /* Temporarily nul-terminate and parse */
+ save = val[len];
+ ((char *)val)[len] = '\0';
+ ret = set(val, &kp);
+ ((char *)val)[len] = save;
+
+ if (ret != 0)
+ return ret;
+ kp.arg += elemsize;
+ val += len+1;
+ count++;
+ } while (val[-1] == ',');
+
+ if (count < min) {
+ printk(KERN_ERR "%s: needs at least %i arguments\n",
+ name, min);
+ return -EINVAL;
+ }
+ return 0;
+}
+
+/* First two elements are the max and min array length (which don't change) */
+int param_set_intarray(const char *val, struct kernel_param *kp)
+{
+ int *array;
+
+ /* Grab min and max as first two elements */
+ array = kp->arg;
+ return param_array(kp->name, val, array[0], array[1], &array[2],
+ sizeof(int), param_set_int);
+}
+
+int param_get_intarray(char *buffer, struct kernel_param *kp)
+{
+ int max;
+ int *array;
+ unsigned int i;
+
+ array = kp->arg;
+ max = array[1];
+
+ for (i = 2; i < max + 2; i++)
+ sprintf(buffer, "%s%i", i > 2 ? "," : "", array[i]);
+ return strlen(buffer);
+}
+
+int param_set_copystring(const char *val, struct kernel_param *kp)
+{
+ struct kparam_string *kps = kp->arg;
+
+ if (strlen(val)+1 > kps->maxlen) {
+ printk(KERN_ERR "%s: string doesn't fit in %u chars.\n",
+ kp->name, kps->maxlen-1);
+ return -ENOSPC;
+ }
+ strcpy(kps->string, val);
+ return 0;
+}
+
+EXPORT_SYMBOL(param_set_short);
+EXPORT_SYMBOL(param_get_short);
+EXPORT_SYMBOL(param_set_ushort);
+EXPORT_SYMBOL(param_get_ushort);
+EXPORT_SYMBOL(param_set_int);
+EXPORT_SYMBOL(param_get_int);
+EXPORT_SYMBOL(param_set_uint);
+EXPORT_SYMBOL(param_get_uint);
+EXPORT_SYMBOL(param_set_long);
+EXPORT_SYMBOL(param_get_long);
+EXPORT_SYMBOL(param_set_ulong);
+EXPORT_SYMBOL(param_get_ulong);
+EXPORT_SYMBOL(param_set_charp);
+EXPORT_SYMBOL(param_get_charp);
+EXPORT_SYMBOL(param_set_bool);
+EXPORT_SYMBOL(param_get_bool);
+EXPORT_SYMBOL(param_set_invbool);
+EXPORT_SYMBOL(param_get_invbool);
+EXPORT_SYMBOL(param_set_intarray);
+EXPORT_SYMBOL(param_get_intarray);
+EXPORT_SYMBOL(param_set_copystring);
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .645-linux-2.5-bk/lib/cmdline.c .645-linux-2.5-bk.updated/lib/cmdline.c
--- .645-linux-2.5-bk/lib/cmdline.c 2001-04-13 05:25:53.000000000 +1000
+++ .645-linux-2.5-bk.updated/lib/cmdline.c 2002-12-03 12:03:16.000000000 +1100
@@ -64,12 +64,12 @@ int get_option (char **str, int *pint)
* completely parseable).
*/
-char *get_options (char *str, int nints, int *ints)
+char *get_options(const char *str, int nints, int *ints)
{
int res, i = 1;
while (i < nints) {
- res = get_option (&str, ints + i);
+ res = get_option ((char **)&str, ints + i);
if (res == 0)
break;
i++;
@@ -77,7 +77,7 @@ char *get_options (char *str, int nints,
break;
}
ints[0] = i - 1;
- return (str);
+ return (char *)str;
}
/**
^ permalink raw reply
* [PATCH] module_param() primitive (2/3)
From: Rusty Russell @ 2002-12-13 3:53 UTC (permalink / raw)
To: torvalds; +Cc: linux-kernel
Linus, please apply.
This implements it in the module code, corrects the section name and
clarifies a comment.
Name: Parameter Implementation for modules
Author: Rusty Russell
Status: Tested on 2.5.50
Depends: Module/param.patch.gz
D: This activates parameter parsing for module_param() declarations in modules.
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .31807-linux-2.5.43/kernel/module.c .31807-linux-2.5.43.updated/kernel/module.c
--- .31807-linux-2.5.43/kernel/module.c 2002-10-18 17:17:25.000000000 +1000
+++ .31807-linux-2.5.43.updated/kernel/module.c 2002-10-18 17:17:57.000000000 +1000
@@ -25,6 +25,7 @@
#include <linux/fcntl.h>
#include <linux/rcupdate.h>
#include <linux/cpu.h>
+#include <linux/moduleparam.h>
#include <asm/uaccess.h>
#include <asm/semaphore.h>
#include <asm/pgalloc.h>
@@ -882,7 +882,7 @@ static struct module *load_module(void *
/* Strings */
DEBUGP("String table found in section %u\n", i);
strindex = i;
- } else if (strcmp(secstrings+sechdrs[i].sh_name, ".setup.init")
+ } else if (strcmp(secstrings+sechdrs[i].sh_name, "__param")
== 0) {
/* Setup parameter info */
DEBUGP("Setup table found in section %u\n", i);
@@ -951,8 +952,7 @@ static struct module *load_module(void *
if (err < 0)
goto cleanup;
-#if 0 /* Needs param support */
- /* Size of section 0 is 0, so this works well */
+ /* Size of section 0 is 0, so this works well if no params */
err = parse_args(mod->args,
(struct kernel_param *)
sechdrs[setupindex].sh_offset,
@@ -961,7 +961,6 @@ static struct module *load_module(void *
NULL);
if (err < 0)
goto cleanup;
-#endif
/* Get rid of temporary copy */
vfree(hdr);
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
^ permalink raw reply
* [PATCH] module_param() primitive (3/3)
From: Rusty Russell @ 2002-12-13 3:56 UTC (permalink / raw)
To: torvalds; +Cc: linux-kernel
Linus, please apply.
This is the backwards compat wedge for MODULE_PARM() declarations.
It's complicated by the fact that many modules place MODULE_PARM()
before the declaration (some do MODULE_PARM() for non-existant
variables, too). To avoid breaking them, we have to do the name
lookups at load time, rather than just storing a pointer 8(
CONFIG_OBSOLETE_MODPARM is set to y without prompting: it's a useful
marker for deprecating in 2.7.
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
Name: MODULE_PARM support for older modules
Author: Rusty Russell
Status: Tested on 2.5.50
Depends: Module/param-modules.patch.gz
D: This is the backwards compatibility code for MODULE_PARM, and moves
D: __MODULE_STRING() down to the graveyard at the bottom of module.h.
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .3259-linux-2.5-bk/include/linux/module.h .3259-linux-2.5-bk.updated/include/linux/module.h
--- .3259-linux-2.5-bk/include/linux/module.h 2002-12-02 17:35:54.000000000 +1100
+++ .3259-linux-2.5-bk.updated/include/linux/module.h 2002-12-02 17:44:43.000000000 +1100
@@ -20,10 +21,6 @@
#include <asm/module.h>
#include <asm/uaccess.h> /* For struct exception_table_entry */
-/* Indirect stringification */
-#define __MODULE_STRING_1(x) #x
-#define __MODULE_STRING(x) __MODULE_STRING_1(x)
-
/* Not Yet Implemented */
#define MODULE_LICENSE(name)
#define MODULE_AUTHOR(name)
@@ -291,6 +288,21 @@ extern spinlock_t modlist_lock;
#define __MOD_DEC_USE_COUNT(mod) module_put(mod)
#define SET_MODULE_OWNER(dev) ((dev)->owner = THIS_MODULE)
+struct obsolete_modparm {
+ char name[64];
+ char type[64-sizeof(void *)];
+ void *addr;
+};
+#ifdef MODULE
+/* DEPRECATED: Do not use. */
+#define MODULE_PARM(var,type) \
+struct obsolete_modparm __parm_##var __attribute__((section("__obsparm"))) = \
+{ __stringify(var), type };
+
+#else
+#define MODULE_PARM(var,type)
+#endif
+
/* People do this inside their init routines, when the module isn't
"live" yet. They should no longer be doing that, but
meanwhile... */
@@ -303,11 +315,11 @@ extern spinlock_t modlist_lock;
#endif
#define MOD_DEC_USE_COUNT module_put(THIS_MODULE)
#define try_inc_mod_count(mod) try_module_get(mod)
-#define MODULE_PARM(parm,string)
#define EXPORT_NO_SYMBOLS
extern int module_dummy_usage;
#define GET_USE_COUNT(module) (module_dummy_usage)
#define MOD_IN_USE 0
+#define __MODULE_STRING(x) __stringify(x)
#define __mod_between(a_start, a_len, b_start, b_len) \
(((a_start) >= (b_start) && (a_start) <= (b_start)+(b_len)) \
|| ((a_start)+(a_len) >= (b_start) \
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .3259-linux-2.5-bk/init/Kconfig .3259-linux-2.5-bk.updated/init/Kconfig
--- .3259-linux-2.5-bk/init/Kconfig 2002-11-19 09:58:52.000000000 +1100
+++ .3259-linux-2.5-bk.updated/init/Kconfig 2002-12-02 17:44:11.000000000 +1100
@@ -135,6 +135,15 @@ config MODULE_FORCE_UNLOAD
rmmod). This is mainly for kernel developers and desparate users.
If unsure, say N.
+config OBSOLETE_MODPARM
+ bool
+ default y
+ depends on MODULES
+ help
+ You need this option to use module parameters on modules which
+ have not been converted to the new module parameter system yet.
+ If unsure, say Y.
+
config KMOD
bool "Kernel module loader"
depends on MODULES
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .3259-linux-2.5-bk/kernel/module.c .3259-linux-2.5-bk.updated/kernel/module.c
--- .3259-linux-2.5-bk/kernel/module.c 2002-12-02 17:43:47.000000000 +1100
+++ .3259-linux-2.5-bk.updated/kernel/module.c 2002-12-02 17:44:11.000000000 +1100
@@ -523,6 +523,134 @@ sys_delete_module(const char *name_user,
#endif /* CONFIG_MODULE_UNLOAD */
+#ifdef CONFIG_OBSOLETE_MODPARM
+static int param_set_byte(const char *val, struct kernel_param *kp)
+{
+ char *endp;
+ long l;
+
+ if (!val) return -EINVAL;
+ l = simple_strtol(val, &endp, 0);
+ if (endp == val || *endp || ((char)l != l))
+ return -EINVAL;
+ *((char *)kp->arg) = l;
+ return 0;
+}
+
+static int param_string(const char *name, const char *val,
+ unsigned int min, unsigned int max,
+ char *dest)
+{
+ if (strlen(val) < min || strlen(val) > max) {
+ printk(KERN_ERR
+ "Parameter %s length must be %u-%u characters\n",
+ name, min, max);
+ return -EINVAL;
+ }
+ strcpy(dest, val);
+ return 0;
+}
+
+extern int set_obsolete(const char *val, struct kernel_param *kp)
+{
+ unsigned int min, max;
+ char *p, *endp;
+ struct obsolete_modparm *obsparm = kp->arg;
+
+ if (!val) {
+ printk(KERN_ERR "Parameter %s needs an argument\n", kp->name);
+ return -EINVAL;
+ }
+
+ /* type is: [min[-max]]{b,h,i,l,s} */
+ p = obsparm->type;
+ min = simple_strtol(p, &endp, 10);
+ if (endp == obsparm->type)
+ min = max = 1;
+ else if (*endp == '-') {
+ p = endp+1;
+ max = simple_strtol(p, &endp, 10);
+ } else
+ max = min;
+ switch (*endp) {
+ case 'b':
+ return param_array(kp->name, val, min, max, obsparm->addr,
+ 1, param_set_byte);
+ case 'h':
+ return param_array(kp->name, val, min, max, obsparm->addr,
+ sizeof(short), param_set_short);
+ case 'i':
+ return param_array(kp->name, val, min, max, obsparm->addr,
+ sizeof(int), param_set_int);
+ case 'l':
+ return param_array(kp->name, val, min, max, obsparm->addr,
+ sizeof(long), param_set_long);
+ case 's':
+ return param_string(kp->name, val, min, max, obsparm->addr);
+ }
+ printk(KERN_ERR "Unknown obsolete parameter type %s\n", obsparm->type);
+ return -EINVAL;
+}
+
+static int obsolete_params(const char *name,
+ char *args,
+ struct obsolete_modparm obsparm[],
+ unsigned int num,
+ Elf_Shdr *sechdrs,
+ unsigned int symindex,
+ const char *strtab)
+{
+ struct kernel_param *kp;
+ unsigned int i;
+ int ret;
+
+ kp = kmalloc(sizeof(kp[0]) * num, GFP_KERNEL);
+ if (!kp)
+ return -ENOMEM;
+
+ DEBUGP("Module %s has %u obsolete params\n", name, num);
+ for (i = 0; i < num; i++)
+ DEBUGP("Param %i: %s type %s\n",
+ num, obsparm[i].name, obsparm[i].type);
+
+ for (i = 0; i < num; i++) {
+ kp[i].name = obsparm[i].name;
+ kp[i].perm = 000;
+ kp[i].set = set_obsolete;
+ kp[i].get = NULL;
+ obsparm[i].addr
+ = (void *)find_local_symbol(sechdrs, symindex, strtab,
+ obsparm[i].name);
+ if (!obsparm[i].addr) {
+ printk("%s: falsely claims to have parameter %s\n",
+ name, obsparm[i].name);
+ ret = -EINVAL;
+ goto out;
+ }
+ kp[i].arg = &obsparm[i];
+ }
+
+ ret = parse_args(name, args, kp, num, NULL);
+ out:
+ kfree(kp);
+ return ret;
+}
+#else
+static int obsolete_params(const char *name,
+ char *args,
+ struct obsolete_modparm obsparm[],
+ unsigned int num,
+ Elf_Shdr *sechdrs,
+ unsigned int symindex,
+ const char *strtab)
+{
+ if (num != 0)
+ printk(KERN_WARNING "%s: Ignoring obsolete parameters\n",
+ name);
+ return 0;
+}
+#endif /* CONFIG_OBSOLETE_MODPARM */
+
/* Find an symbol for this module (ie. resolve internals first).
It we find one, record usage. Must be holding module_mutex. */
unsigned long find_symbol_internal(Elf_Shdr *sechdrs,
@@ -819,7 +947,7 @@ static struct module *load_module(void *
Elf_Shdr *sechdrs;
char *secstrings;
unsigned int i, symindex, exportindex, strindex, setupindex, exindex,
- modnameindex;
+ modnameindex, obsparmindex;
long arglen;
unsigned long common_length;
struct sizes sizes, used;
@@ -857,7 +985,7 @@ static struct module *load_module(void *
/* May not export symbols, or have setup params, so these may
not exist */
- exportindex = setupindex = 0;
+ exportindex = setupindex = obsparmindex = 0;
/* And these should exist, but gcc whinges if we don't init them */
symindex = strindex = exindex = modnameindex = 0;
@@ -893,6 +1021,11 @@ static struct module *load_module(void *
/* Exception table */
DEBUGP("Exception table found in section %u\n", i);
exindex = i;
+ } else if (strcmp(secstrings+sechdrs[i].sh_name, "__obsparm")
+ == 0) {
+ /* Obsolete MODULE_PARM() table */
+ DEBUGP("Obsolete param found in section %u\n", i);
+ obsparmindex = i;
}
#ifdef CONFIG_KALLSYMS
/* symbol and string tables for decoding later. */
@@ -1035,13 +1168,23 @@ static struct module *load_module(void *
if (err < 0)
goto cleanup;
- /* Size of section 0 is 0, so this works well if no params */
- err = parse_args(mod->args,
- (struct kernel_param *)
- sechdrs[setupindex].sh_offset,
- sechdrs[setupindex].sh_size
- / sizeof(struct kernel_param),
- NULL);
+ if (obsparmindex) {
+ err = obsolete_params(mod->name, mod->args,
+ (struct obsolete_modparm *)
+ sechdrs[obsparmindex].sh_offset,
+ sechdrs[obsparmindex].sh_size
+ / sizeof(struct obsolete_modparm),
+ sechdrs, symindex,
+ (char *)sechdrs[strindex].sh_offset);
+ } else {
+ /* Size of section 0 is 0, so this works well if no params */
+ err = parse_args(mod->name, mod->args,
+ (struct kernel_param *)
+ sechdrs[setupindex].sh_offset,
+ sechdrs[setupindex].sh_size
+ / sizeof(struct kernel_param),
+ NULL);
+ }
if (err < 0)
goto cleanup;
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
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.