From: Marc Fiuczynski Date: Mon, 8 Aug 2005 20:49:16 +0000 (+0000) Subject: vserver 2.0-pre1 X-Git-Tag: vserver-2_6_11_7-vs2_0-pre1~1 X-Git-Url: http://git.onelab.eu/?p=linux-2.6.git;a=commitdiff_plain;h=af20d436230b2df6d73a406b6f1b31ae000775cb vserver 2.0-pre1 --- diff --git a/Makefile b/Makefile index 40e308502..728dadb12 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 11 -EXTRAVERSION = .7 +EXTRAVERSION = .7-vs2.0-pre1 NAME=Woozy Numbat # *DOCUMENTATION* diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig index 72fcbe530..5ed54abff 100644 --- a/arch/i386/Kconfig +++ b/arch/i386/Kconfig @@ -568,14 +568,6 @@ config X86_IO_APIC depends on !SMP && X86_UP_IOAPIC default y -config KERNEL_HZ - int "Timer Frequency (100-20000)" - range 100 20000 - default "1000" - help - This allows you to specify the frequency at which the - kernel timer interrupt will occur. - config X86_TSC bool depends on (MWINCHIP3D || MWINCHIP2 || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2) && !X86_NUMAQ diff --git a/arch/i386/kernel/cpu/proc.c b/arch/i386/kernel/cpu/proc.c index 0fd2a0a52..c8d83fdc2 100644 --- a/arch/i386/kernel/cpu/proc.c +++ b/arch/i386/kernel/cpu/proc.c @@ -124,8 +124,8 @@ static int show_cpuinfo(struct seq_file *m, void *v) seq_printf(m, " %s", x86_cap_flags[i]); seq_printf(m, "\nbogomips\t: %lu.%02lu\n\n", - HZ*(c->loops_per_jiffy >> 3)/62500, - (HZ*(c->loops_per_jiffy >> 3)/625) % 100); + c->loops_per_jiffy/(500000/HZ), + (c->loops_per_jiffy/(5000/HZ)) % 100); return 0; } diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c index d184f0ae5..4b6477b4d 100644 --- a/arch/i386/kernel/io_apic.c +++ b/arch/i386/kernel/io_apic.c @@ -1765,7 +1765,7 @@ static int __init timer_irq_works(void) local_irq_enable(); /* Let ten ticks pass... */ - mdelay((10 * 1000) / HZ + 1); + mdelay((10 * 1000) / HZ); /* * Expect a few ticks at least, to be sure some possible diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index 4b120fcd1..e99992e27 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c @@ -1025,8 +1025,8 @@ static void __init smp_boot_cpus(unsigned int max_cpus) printk(KERN_INFO "Total of %d processors activated (%lu.%02lu BogoMIPS).\n", cpucount+1, - HZ*(bogosum >> 3)/62500, - (HZ*(bogosum >> 3)/625) % 100); + bogosum/(500000/HZ), + (bogosum/(5000/HZ))%100); Dprintk("Before bogocount - setting activated=1.\n"); diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 96772a48b..94a511315 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -938,7 +938,7 @@ acpi_os_wait_semaphore( // TODO: A better timeout algorithm? { int i = 0; - static const int quantum_ms = (HZ>1000)?1:(1000/HZ); + static const int quantum_ms = 1000/HZ; ret = down_trylock(sem); for (i = timeout; (i > 0 && ret < 0); i -= quantum_ms) { diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 0beaf4220..bce3fc0e6 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -358,11 +358,7 @@ static int inr; /* size of reply buffer, when called from interrupt */ #define R_SECTOR (reply_buffer[5]) #define R_SIZECODE (reply_buffer[6]) -#if HZ < 12800 #define SEL_DLY (2*HZ/100) -#else -#define SEL_DLY (255) -#endif /* * this struct defines the different floppy drive types. @@ -4088,7 +4084,7 @@ static void __init daring(int *ints, int param, int param2) FD_SILENT_DCL_CLEAR; } else { default_drive_params[i].params.select_delay = - SEL_DLY; + 2 * HZ / 100; default_drive_params[i].params.flags &= ~FD_SILENT_DCL_CLEAR; } diff --git a/drivers/char/dtlk.c b/drivers/char/dtlk.c index 85d2b4235..903e4c3cc 100644 --- a/drivers/char/dtlk.c +++ b/drivers/char/dtlk.c @@ -198,7 +198,7 @@ static ssize_t dtlk_write(struct file *file, const char __user *buf, up to 250 usec for the RDY bit to go nonzero. */ for (retries = 0; - retries < HZ*(loops_per_jiffy >> 3)/500; + retries < loops_per_jiffy / (4000/HZ); retries++) if (inb_p(dtlk_port_tts) & TTS_WRITABLE) @@ -445,7 +445,7 @@ for (i = 0; i < 10; i++) \ LOOK dtlk_write_bytes("\0012I\r", 4); buffer[b++] = 0; - __delay(50 * (loops_per_jiffy >> 3) * HZ / 125); + __delay(50 * loops_per_jiffy / (1000/HZ)); outb_p(0xff, dtlk_port_lpc); buffer[b++] = 0; LOOK diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index b516e5480..1c8d866a4 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c @@ -561,11 +561,7 @@ static dev_link_t *mgslpc_attach(void) INIT_WORK(&info->task, bh_handler, info); info->max_frame_size = 4096; info->close_delay = 5*HZ/10; - #if HZ < 2185 info->closing_wait = 30*HZ; - #else - info->closing_wait = 65534; - #endif init_waitqueue_head(&info->open_wait); init_waitqueue_head(&info->close_wait); init_waitqueue_head(&info->status_event_wait_q); diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index 48ce9f490..37c8bea8e 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c @@ -4376,11 +4376,7 @@ static struct mgsl_struct* mgsl_allocate_device(void) INIT_WORK(&info->task, mgsl_bh_handler, info); info->max_frame_size = 4096; info->close_delay = 5*HZ/10; - #if HZ < 2185 info->closing_wait = 30*HZ; - #else - info->closing_wait = 65534; - #endif init_waitqueue_head(&info->open_wait); init_waitqueue_head(&info->close_wait); init_waitqueue_head(&info->status_event_wait_q); diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index 5c1eadb8f..dc0af4ea7 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c @@ -3831,11 +3831,7 @@ SLMP_INFO *alloc_dev(int adapter_num, int port_num, struct pci_dev *pdev) INIT_WORK(&info->task, bh_handler, info); info->max_frame_size = 4096; info->close_delay = 5*HZ/10; - #if HZ < 2185 info->closing_wait = 30*HZ; - #else - info->closing_wait = 65534; - #endif init_waitqueue_head(&info->open_wait); init_waitqueue_head(&info->close_wait); init_waitqueue_head(&info->status_event_wait_q); diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index 14c1dd64c..b19442002 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c @@ -1817,13 +1817,8 @@ static int get_serial_info(struct edgeport_port *edge_port, struct serial_struct tmp.flags = ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ; tmp.xmit_fifo_size = edge_port->maxTxCredits; tmp.baud_base = 9600; - #if HZ < 2185 tmp.close_delay = 5*HZ; tmp.closing_wait = 30*HZ; - #else - tmp.close_delay = 2*HZ; - tmp.closing_wait = 65534; - #endif // tmp.custom_divisor = state->custom_divisor; // tmp.hub6 = state->hub6; // tmp.io_type = state->io_type; diff --git a/include/asm-i386/param.h b/include/asm-i386/param.h index f53d78180..b6440526e 100644 --- a/include/asm-i386/param.h +++ b/include/asm-i386/param.h @@ -1,14 +1,8 @@ #ifndef _ASMi386_PARAM_H #define _ASMi386_PARAM_H -#include - #ifdef __KERNEL__ -# ifdef CONFIG_KERNEL_HZ -# define HZ CONFIG_KERNEL_HZ -# else -# define HZ 1000 /* Internal kernel timer frequency */ -# endif +# define HZ 1000 /* Internal kernel timer frequency */ # define USER_HZ 100 /* .. some user interfaces are in "ticks" */ # define CLOCKS_PER_SEC (USER_HZ) /* like times() */ #endif diff --git a/include/linux/cyclades.h b/include/linux/cyclades.h index 337156ca8..46d8254c1 100644 --- a/include/linux/cyclades.h +++ b/include/linux/cyclades.h @@ -624,11 +624,7 @@ struct cyclades_port { #define Cy_EVENT_DELTA_WAKEUP 6 #define Cy_EVENT_Z_RX_FULL 7 -#if HZ < 2185 #define CLOSING_WAIT_DELAY 30*HZ -#else -#define CLOSING_WAIT_DELAY 65534 -#endif #define CY_CLOSING_WAIT_NONE 65535 #define CY_CLOSING_WAIT_INF 0 diff --git a/include/linux/dtlk.h b/include/linux/dtlk.h index 0c26359fc..2896d9011 100644 --- a/include/linux/dtlk.h +++ b/include/linux/dtlk.h @@ -27,7 +27,7 @@ #define DTLK_CLEAR 0x18 /* stops speech */ -#define DTLK_MAX_RETRIES (HZ*(loops_per_jiffy >> 3)/1250) +#define DTLK_MAX_RETRIES (loops_per_jiffy/(10000/HZ)) /* TTS Port Status Flags */ #define TTS_READABLE 0x80 /* mask for bit which is nonzero if a diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h index 08dc59f47..d7a2555a8 100644 --- a/include/linux/jiffies.h +++ b/include/linux/jiffies.h @@ -38,14 +38,6 @@ # define SHIFT_HZ 9 #elif HZ >= 768 && HZ < 1536 # define SHIFT_HZ 10 -#elif HZ >= 1536 && HZ < 3072 -# define SHIFT_HZ 11 -#elif HZ >= 3072 && HZ < 6144 -# define SHIFT_HZ 12 -#elif HZ >= 6144 && HZ < 12288 -# define SHIFT_HZ 13 -#elif HZ >= 12288 && HZ < 24576 -# define SHIFT_HZ 14 #else # error You lose. #endif diff --git a/include/linux/vserver/context.h b/include/linux/vserver/context.h index dda32b43e..eae7ec4b9 100644 --- a/include/linux/vserver/context.h +++ b/include/linux/vserver/context.h @@ -145,7 +145,7 @@ extern int xid_is_hashed(xid_t); extern int vx_migrate_task(struct task_struct *, struct vx_info *); -extern long vs_context_state(unsigned int); +extern long vs_context_state(struct vx_info *, unsigned int); extern void free_vx_info(struct vx_info *); diff --git a/include/net/lapb.h b/include/net/lapb.h index 0a82b4dda..96cb5ddaa 100644 --- a/include/net/lapb.h +++ b/include/net/lapb.h @@ -57,11 +57,7 @@ enum { #define LAPB_DEFAULT_MODE (LAPB_STANDARD | LAPB_SLP | LAPB_DTE) #define LAPB_DEFAULT_WINDOW 7 /* Window=7 */ -#if HZ < 2185 #define LAPB_DEFAULT_T1 (5 * HZ) /* T1=5s */ -#else -#define LAPB_DEFAULT_T1 (65534) /* T1=max */ -#endif #define LAPB_DEFAULT_T2 (1 * HZ) /* T2=1s */ #define LAPB_DEFAULT_N2 20 /* N2=20 */ diff --git a/include/net/tcp.h b/include/net/tcp.h index 161dfebfb..b87b78e0a 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -489,8 +489,8 @@ static __inline__ int tcp_sk_listen_hashfn(struct sock *sk) so that we select tick to get range about 4 seconds. */ -#if HZ <= 16 || HZ > 32768 -# error Unsupported: HZ <= 16 or HZ > 32768 +#if HZ <= 16 || HZ > 4096 +# error Unsupported: HZ <= 16 or HZ > 4096 #elif HZ <= 32 # define TCP_TW_RECYCLE_TICK (5+2-TCP_TW_RECYCLE_SLOTS_LOG) #elif HZ <= 64 @@ -505,14 +505,8 @@ static __inline__ int tcp_sk_listen_hashfn(struct sock *sk) # define TCP_TW_RECYCLE_TICK (10+2-TCP_TW_RECYCLE_SLOTS_LOG) #elif HZ <= 2048 # define TCP_TW_RECYCLE_TICK (11+2-TCP_TW_RECYCLE_SLOTS_LOG) -#elif HZ <= 4096 -# define TCP_TW_RECYCLE_TICK (12+2-TCP_TW_RECYCLE_SLOTS_LOG) -#elif HZ <= 8192 -# define TCP_TW_RECYCLE_TICK (13+2-TCP_TW_RECYCLE_SLOTS_LOG) -#elif HZ <= 16384 -# define TCP_TW_RECYCLE_TICK (14+2-TCP_TW_RECYCLE_SLOTS_LOG) #else -# define TCP_TW_RECYCLE_TICK (15+2-TCP_TW_RECYCLE_SLOTS_LOG) +# define TCP_TW_RECYCLE_TICK (12+2-TCP_TW_RECYCLE_SLOTS_LOG) #endif #define BICTCP_BETA_SCALE 1024 /* Scale factor beta calculation diff --git a/init/calibrate.c b/init/calibrate.c index 4841f3e16..c698e04a3 100644 --- a/init/calibrate.c +++ b/init/calibrate.c @@ -33,8 +33,8 @@ void __devinit calibrate_delay(void) loops_per_jiffy = preset_lpj; printk("Calibrating delay loop (skipped)... " "%lu.%02lu BogoMIPS preset\n", - HZ*(loops_per_jiffy >> 3)/62500, - (HZ*(loops_per_jiffy >> 3)/625) % 100); + loops_per_jiffy/(500000/HZ), + (loops_per_jiffy/(5000/HZ)) % 100); } else { loops_per_jiffy = (1<<12); @@ -71,8 +71,8 @@ void __devinit calibrate_delay(void) /* Round the value and print it */ printk("%lu.%02lu BogoMIPS (lpj=%lu)\n", - HZ*(loops_per_jiffy >> 3)/62500, - (HZ*(loops_per_jiffy >> 3)/625) % 100, + loops_per_jiffy/(500000/HZ), + (loops_per_jiffy/(5000/HZ)) % 100, loops_per_jiffy); } diff --git a/kernel/timer.c b/kernel/timer.c index 9e7985cb2..10af71d99 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -686,11 +686,7 @@ static void second_overflow(void) if (ltemp > (MAXPHASE / MINSEC) << SHIFT_UPDATE) ltemp = (MAXPHASE / MINSEC) << SHIFT_UPDATE; time_offset += ltemp; - #if SHIFT_SCALE - SHIFT_HZ - SHIFT_UPDATE > 0 time_adj = -ltemp << (SHIFT_SCALE - SHIFT_HZ - SHIFT_UPDATE); - #else - time_adj = -ltemp >> (SHIFT_HZ + SHIFT_UPDATE - SHIFT_SCALE); - #endif } else { ltemp = time_offset; if (!(time_status & STA_FLL)) @@ -698,11 +694,7 @@ static void second_overflow(void) if (ltemp > (MAXPHASE / MINSEC) << SHIFT_UPDATE) ltemp = (MAXPHASE / MINSEC) << SHIFT_UPDATE; time_offset -= ltemp; - #if SHIFT_SCALE - SHIFT_HZ - SHIFT_UPDATE > 0 time_adj = ltemp << (SHIFT_SCALE - SHIFT_HZ - SHIFT_UPDATE); - #else - time_adj = ltemp >> (SHIFT_HZ + SHIFT_UPDATE - SHIFT_SCALE); - #endif } /* diff --git a/kernel/vserver/context.c b/kernel/vserver/context.c index edcfebbbd..3d23d7142 100644 --- a/kernel/vserver/context.c +++ b/kernel/vserver/context.c @@ -114,6 +114,8 @@ void __shutdown_vx_info(struct vx_info *vxi) might_sleep(); + vs_context_state(vxi, VS_CONTEXT_DESTROY); + namespace = xchg(&vxi->vx_namespace, NULL); if (namespace) put_namespace(namespace); @@ -666,6 +668,7 @@ int vc_ctx_create(uint32_t xid, void __user *data) if (IS_ERR(new_vxi)) return PTR_ERR(new_vxi); + vs_context_state(new_vxi, VS_CONTEXT_CREATED); ret = new_vxi->vx_id; vx_migrate_task(current, new_vxi); /* if this fails, we might end up with a hashed vx_info */ diff --git a/kernel/vserver/helper.c b/kernel/vserver/helper.c index c5472369a..5963b1812 100644 --- a/kernel/vserver/helper.c +++ b/kernel/vserver/helper.c @@ -23,6 +23,21 @@ char vshelper_path[255] = "/sbin/vshelper"; +int do_vshelper(char *name, char *argv[], char *envp[], int sync) +{ + int ret; + + if ((ret = call_usermodehelper(name, argv, envp, sync))) { + printk( KERN_WARNING + "%s: (%s %s) returned with %d\n", + name, argv[1], argv[2], ret); + } + vxdprintk(VXD_CBIT(switch, 1), + "%s: (%s %s) returned with %d", + name, argv[1], argv[2], ret); + return ret; +} + /* * vshelper path is set via /proc/sys * invoked by vserver sys_reboot(), with @@ -67,31 +82,33 @@ long vs_reboot(unsigned int cmd, void * arg) case LINUX_REBOOT_CMD_SW_SUSPEND: argv[1] = "swsusp"; break; - - default: - argv[1] = "restart2"; - break; } - /* maybe we should wait ? */ - if (call_usermodehelper(*argv, argv, envp, 1)) { - printk( KERN_WARNING - "vs_reboot(): failed to exec (%s %s %s)\n", - vshelper_path, argv[1], argv[2]); + if (do_vshelper(vshelper_path, argv, envp, 1)) return -EPERM; - } return 0; } -long vs_context_state(unsigned int cmd) -{ - char id_buf[8], cmd_buf[32]; - char *argv[] = {vshelper_path, NULL, id_buf, NULL, 0}; +/* + * invoked by vserver sys_reboot(), with + * the following arguments + * + * argv [0] = vshelper_path; + * argv [1] = action: "startup", "shutdown" + * argv [2] = context identifier + * + * envp [*] = type-specific parameters + */ + +long vs_context_state(struct vx_info *vxi, unsigned int cmd) +{ + char id_buf[8], cmd_buf[16]; + char *argv[] = {vshelper_path, NULL, id_buf, 0}; char *envp[] = {"HOME=/", "TERM=linux", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", cmd_buf, 0}; - snprintf(id_buf, sizeof(id_buf)-1, "%d", vx_current_xid()); + snprintf(id_buf, sizeof(id_buf)-1, "%d", vxi->vx_id); snprintf(cmd_buf, sizeof(cmd_buf)-1, "VS_CMD=%08x", cmd); switch (cmd) { @@ -105,12 +122,7 @@ long vs_context_state(unsigned int cmd) return 0; } - if (call_usermodehelper(*argv, argv, envp, 1)) { - printk( KERN_WARNING - "vs_context_state(): failed to exec (%s %s %s %s)\n", - vshelper_path, argv[1], argv[2], argv[3]); - return 0; - } + do_vshelper(vshelper_path, argv, envp, 1); return 0; } diff --git a/net/ipv4/netfilter/ip_conntrack_proto_sctp.c b/net/ipv4/netfilter/ip_conntrack_proto_sctp.c index d68f13779..7d9f8ea14 100644 --- a/net/ipv4/netfilter/ip_conntrack_proto_sctp.c +++ b/net/ipv4/netfilter/ip_conntrack_proto_sctp.c @@ -61,11 +61,7 @@ static const char *sctp_conntrack_names[] = { static unsigned long ip_ct_sctp_timeout_closed = 10 SECS; static unsigned long ip_ct_sctp_timeout_cookie_wait = 3 SECS; static unsigned long ip_ct_sctp_timeout_cookie_echoed = 3 SECS; -#if HZ < 9942 -static unsigned long ip_ct_sctp_timeout_established = 5U DAYS; -#else -static unsigned long ip_ct_sctp_timeout_established = 2U DAYS; -#endif +static unsigned long ip_ct_sctp_timeout_established = 5 DAYS; static unsigned long ip_ct_sctp_timeout_shutdown_sent = 300 SECS / 1000; static unsigned long ip_ct_sctp_timeout_shutdown_recd = 300 SECS / 1000; static unsigned long ip_ct_sctp_timeout_shutdown_ack_sent = 3 SECS; diff --git a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c index 4c20552c8..939931c33 100644 --- a/net/ipv4/netfilter/ip_conntrack_proto_tcp.c +++ b/net/ipv4/netfilter/ip_conntrack_proto_tcp.c @@ -88,11 +88,7 @@ static const char *tcp_conntrack_names[] = { unsigned long ip_ct_tcp_timeout_syn_sent = 2 MINS; unsigned long ip_ct_tcp_timeout_syn_recv = 60 SECS; -#if HZ < 9942 -unsigned long ip_ct_tcp_timeout_established = 5U DAYS; -#else -unsigned long ip_ct_tcp_timeout_established = 2U DAYS; -#endif +unsigned long ip_ct_tcp_timeout_established = 5 DAYS; unsigned long ip_ct_tcp_timeout_fin_wait = 2 MINS; unsigned long ip_ct_tcp_timeout_close_wait = 60 SECS; unsigned long ip_ct_tcp_timeout_last_ack = 30 SECS;