2.5.39 s390 (2/26): include.
PATCH 1/1 2.5.39 s390 (2/26): include.
s390 include file changes for 2.5.39.
include/asm-s390/hardirq.h +65 -56
@@ -14,15 +14,13 @@#include <linux/config.h> #include <linux/threads.h> -#include <asm/lowcore.h> #include <linux/sched.h> #include <linux/cache.h> +#include <asm/lowcore.h> /* entry.S is sensitive to the offsets of these fields */ typedef struct {unsigned int __softirq_pending; -unsigned int __local_irq_count; -unsigned int __local_bh_count;unsigned int __syscall_count;struct task_struct * __ksoftirqd_task;/* waitqueue is too large */ }____cacheline_aligned irq_cpustat_t ;
@@ -30,64 +28,75 @@#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ /* -* Are we in an interrupt context? Either doing bottom half -* or hardware interrupt processing? +* We put the hardirq and softirq counter into the preemption +* counter. The bitmask has the following meaning: +* +* - bits 0-7 are the preemption count (max preemption depth: 256) +* - bits 8-15 are the softirq count (max # of softirqs: 256) +* - bits 16-23 are the hardirq count (max # of hardirqs: 256) +* +* - ( bit 26 is the PREEMPT_ACTIVE flag. ) +* +* PREEMPT_MASK: 0x000000ff +* SOFTIRQ_MASK: 0x0000ff00 +* HARDIRQ_MASK: 0x00010000 */ -#define in_interrupt () ({ int __cpu = smp_processor_id(); \ - (local_irq_count(__cpu) + local_bh_count(__cpu) != 0); }) -#define in_irq () (local_irq_count(smp_processor_id()) != 0) - -#ifndef CONFIG_SMP +#define PREEMPT_BITS 8 +#define SOFTIRQ_BITS 8 +#define HARDIRQ_BITS 1 + +#define PREEMPT_SHIFT 0 +#define SOFTIRQ_SHIFT (PREEMPT_SHIFT + PREEMPT_BITS) +#define HARDIRQ_SHIFT (SOFTIRQ_SHIFT + SOFTIRQ_BITS) + +#define __MASK (x) ((1UL << (x))-1) + +#define PREEMPT_MASK (__MASK(PREEMPT_BITS) << PREEMPT_SHIFT) +#define SOFTIRQ_MASK (__MASK(SOFTIRQ_BITS) << SOFTIRQ_SHIFT) +#define HARDIRQ_MASK (__MASK(HARDIRQ_BITS) << HARDIRQ_SHIFT) + +#define hardirq_count () (preempt_count() & HARDIRQ_MASK) +#define softirq_count () (preempt_count() & SOFTIRQ_MASK) +#define irq_count () (preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK)) + +#define PREEMPT_OFFSET (1UL << PREEMPT_SHIFT) +#define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT) +#define HARDIRQ_OFFSET (1UL << HARDIRQ_SHIFT) + +/* +* Are we doing bottom half or hardware interrupt processing? +* Are we in a softirq context? Interrupt context? +*/ +#define in_irq () (hardirq_count()) +#define in_softirq () (softirq_count()) +#define in_interrupt () (irq_count()) -#define hardirq_trylock (cpu) (local_irq_count(cpu) == 0) -#define hardirq_endlock (cpu) do { } while (0) - -#define hardirq_enter (cpu) (local_irq_count(cpu)++) -#define hardirq_exit (cpu) (local_irq_count(cpu)--) - -#define synchronize_irq () do { } while (0) - -#else /* CONFIG_SMP */ - -#include <asm/atomic.h> -#include <asm/smp.h> - -extern atomic_t global_irq_holder; -extern atomic_t global_irq_lock; -extern atomic_t global_irq_count; - -static inline void release_irqlock (int cpu) -{ -/* if we didn't own the irq lock, just ignore.. */ -if (atomic_read (&global_irq_holder) == cpu) { -atomic_set (&global_irq_holder,NO_PROC_ID ); -atomic_set (&global_irq_lock,0 ); - } -} - -static inline void hardirq_enter (int cpu) -{ - ++local_irq_count (cpu); -atomic_inc (&global_irq_count); -} - -static inline void hardirq_exit (int cpu) -{ -atomic_dec (&global_irq_count); - --local_irq_count (cpu); -} - -static inline int hardirq_trylock (int cpu) -{ -return !atomic_read (&global_irq_count) && - !atomic_read (&global_irq_lock); -} -#define hardirq_endlock (cpu) do { } while (0) +#define hardirq_trylock () (!in_interrupt()) +#define hardirq_endlock () do { } while (0) -extern void synchronize_irq (void ); +#define irq_enter () (preempt_count() += HARDIRQ_OFFSET) + +extern void do_call_softirq (void ); + +#define in_atomic () (preempt_count() != 0) +#define IRQ_EXIT_OFFSET HARDIRQ_OFFSET + +#define irq_exit () \ +do { \ + preempt_count() -= HARDIRQ_OFFSET; \ + if (!in_interrupt() && softirq_pending(smp_processor_id())) \ +/* Use the async. stack for softirq */ \ +do_call_softirq (); \ +} while (0) + +#ifndef CONFIG_SMP +# define synchronize_irq (irq) barrier() +#else +extern void synchronize_irq (unsigned int irq); +#endif /* CONFIG_SMP */ -#endif /* CONFIG_SMP */ +extern void show_stack (unsigned long * esp);#endif /* __ASM_HARDIRQ_H */
include/asm-s390/irq.h +0 -61
67 lines not on this page · raw message
include/asm-s390/kmap_types.h +21 -0
@@ -0,0 +1,21 @@ +#ifdef __KERNEL__ +#ifndef _ASM_KMAP_TYPES_H +#define _ASM_KMAP_TYPES_H + +enum km_type { +KM_BOUNCE_READ , +KM_SKB_SUNRPC_DATA , +KM_SKB_DATA_SOFTIRQ , +KM_USER0 , +KM_USER1 , +KM_BIO_SRC_IRQ , +KM_BIO_DST_IRQ , +KM_PTE0 , +KM_PTE1 , +KM_IRQ0 , +KM_IRQ1 , +KM_TYPE_NR +}; + +#endif +#endif /* __KERNEL__ */
include/asm-s390/param.h +6 -4
@@ -9,6 +9,12 @@#ifndef _ASMS390_PARAM_H#define _ASMS390_PARAM_H +#ifdef __KERNEL__ +# define HZ 100/* Internal kernel timer frequency */ +# define USER_HZ 100/* .. some user interfaces are in "ticks" */ +# define CLOCKS_PER_SEC (USER_HZ)/* like times() */ +#endif +#ifndef HZ #define HZ 100#endif
@@ -25,8 +31,4 @@#define MAXHOSTNAMELEN 64/* max length of hostname */ -#ifdef __KERNEL__ -# define CLOCKS_PER_SEC HZ/* frequency at which times() counts */ -#endif -#endif
include/asm-s390/pgalloc.h +2 -0
@@ -16,6 +16,8 @@#include <linux/config.h> #include <asm/processor.h> #include <linux/threads.h> +#include <linux/gfp.h> +#include <linux/mm.h> #define check_pgt_cache () do {} while (0)
include/asm-s390/pgtable.h +2 -0
@@ -176,6 +176,8 @@#define _SEGMENT_TABLE (_USER_SEG_TABLE_LEN|0x80000000|0x100)#define _KERNSEG_TABLE (_KERNEL_SEG_TABLE_LEN) +#define USER_STD_MASK 0x00000080UL +/* * No mapping available */
include/asm-s390/rwsem.h +66 -2
93 lines not on this page · raw message
include/asm-s390/smp.h +11 -5
@@ -11,7 +11,6 @@#include <linux/config.h> #include <linux/threads.h> -#include <linux/ptrace.h> #if defined(__KERNEL__) && defined(CONFIG_SMP ) && !defined(__ASSEMBLY__)
@@ -29,6 +28,7 @@ } sigp_info;extern volatile unsigned long cpu_online_map; +extern unsigned long cpu_possible_map;#define NO_PROC_ID 0xFF/* No processor magic marker */
@@ -46,14 +46,20 @@#define smp_processor_id () (current_thread_info()->cpu) -extern __inline__int cpu_logical_map (int cpu) +#define cpu_online (cpu) (cpu_online_map & (1<<(cpu))) +#define cpu_possible (cpu) (cpu_possible_map & (1<<(cpu))) + +extern inline unsigned int num_online_cpus (void ) { -return cpu; +return hweight32 (cpu_online_map); } -extern __inline__int cpu_number_map (int cpu) +extern inline int any_online_cpu (unsigned int mask) { -return cpu; +if (mask & cpu_online_map) +return __ffs (mask & cpu_online_map); + +return -1 ; }extern __inline____u16 hard_smp_processor_id (void )
include/asm-s390/softirq.h +10 -19
@@ -9,34 +9,25 @@#ifndef __ASM_SOFTIRQ_H#define __ASM_SOFTIRQ_H -#ifndef __LINUX_SMP_H#include <linux/smp.h> -#endif #include <asm/atomic.h> #include <asm/hardirq.h> #include <asm/lowcore.h> -#define __cpu_bh_enable (cpu) \ - do { barrier(); local_bh_count(cpu)--; } while (0) -#define cpu_bh_disable (cpu) \ - do { local_bh_count(cpu)++; barrier(); } while (0) - -#define local_bh_disable () cpu_bh_disable(smp_processor_id()) -#define __local_bh_enable () __cpu_bh_enable(smp_processor_id()) - -#define in_softirq () (local_bh_count(smp_processor_id()) != 0) +#define local_bh_disable () \ + do { preempt_count() += SOFTIRQ_OFFSET; barrier(); } while (0) +#define __local_bh_enable () \ + do { barrier(); preempt_count() -= SOFTIRQ_OFFSET; } while (0)extern void do_call_softirq (void ); -#define local_bh_enable () \ -do { \ - unsigned int *ptr = &local_bh_count(smp_processor_id()); \ - barrier(); \ - if (!--*ptr) \ - if (softirq_pending(smp_processor_id())) \ -/* Use the async. stack for softirq */ \ -do_call_softirq (); \ +#define local_bh_enable () \ +do { \ + __local_bh_enable(); \ + if (!in_interrupt() && softirq_pending(smp_processor_id())) \ +/* Use the async. stack for softirq */ \ +do_call_softirq (); \ } while (0)#endif /* __ASM_SOFTIRQ_H */
include/asm-s390/spinlock.h +2 -0
@@ -76,6 +76,8 @@#define rwlock_init (x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) +#define rwlock_is_locked (x) ((x)->lock != 0) +#define _raw_read_lock (rw) \ asm volatile(" l 2,0(%1)\n" \ " j 1f\n" \
include/asm-s390/system.h +78 -16
121 lines not on this page · raw message
include/asm-s390/tlbflush.h +1 -2
@@ -91,8 +91,7 @@static inline void __flush_tlb_mm (struct mm_struct * mm) { -if ((smp_num_cpus >1 ) && - ((atomic_read (&mm->mm_count) !=1 ) || +if (((atomic_read (&mm->mm_count) !=1 ) || (mm->cpu_vm_mask != (1UL <<smp_processor_id ())))) { mm->cpu_vm_mask = (1UL <<smp_processor_id ());global_flush_tlb ();
include/asm-s390x/bitops.h +8 -1
@@ -811,7 +811,14 @@* hweightN: returns the hamming weight (i.e. the number * of bits set) of a N-bit word */ - +#define hweight64 (x) \ +({ \ + unsigned long __x = (x); \ + unsigned int __w; \ + __w = generic_hweight32((unsigned int) __x); \ + __w += generic_hweight32((unsigned int) (__x>>32)); \ + __w; \ +})#define hweight32 (x) generic_hweight32(x)#define hweight16 (x) generic_hweight16(x)#define hweight8 (x) generic_hweight8(x)
include/asm-s390x/hardirq.h +60 -50
132 lines not on this page · raw message
include/asm-s390x/irq.h +0 -61
67 lines not on this page · raw message
include/asm-s390x/kmap_types.h +21 -0
@@ -0,0 +1,21 @@ +#ifdef __KERNEL__ +#ifndef _ASM_KMAP_TYPES_H +#define _ASM_KMAP_TYPES_H + +enum km_type { +KM_BOUNCE_READ , +KM_SKB_SUNRPC_DATA , +KM_SKB_DATA_SOFTIRQ , +KM_USER0 , +KM_USER1 , +KM_BIO_SRC_IRQ , +KM_BIO_DST_IRQ , +KM_PTE0 , +KM_PTE1 , +KM_IRQ0 , +KM_IRQ1 , +KM_TYPE_NR +}; + +#endif +#endif /* __KERNEL__ */
include/asm-s390x/param.h +6 -7
@@ -9,11 +9,14 @@#ifndef _ASMS390_PARAM_H#define _ASMS390_PARAM_H -#ifndef HZ -#define HZ 100#ifdef __KERNEL__ -#define hz_to_std (a) (a) +# define HZ 100/* Internal kernel timer frequency */ +# define USER_HZ 100/* .. some user interfaces are in "ticks" */ +# define CLOCKS_PER_SEC (USER_HZ)/* like times() */ #endif + +#ifndef HZ +#define HZ 100#endif #define EXEC_PAGESIZE 4096
@@ -28,8 +31,4 @@#define MAXHOSTNAMELEN 64/* max length of hostname */ -#ifdef __KERNEL__ -# define CLOCKS_PER_SEC HZ/* frequency at which times() counts */ -#endif -#endif
include/asm-s390x/pgalloc.h +2 -0
@@ -16,6 +16,8 @@#include <linux/config.h> #include <asm/processor.h> #include <linux/threads.h> +#include <linux/gfp.h> +#include <linux/mm.h> #define check_pgt_cache () do { } while (0)
include/asm-s390x/pgtable.h +2 -0
@@ -168,6 +168,8 @@#define _REGION_TABLE (_REGION_THIRD|_REGION_THIRD_LEN|0x40|0x100)#define _KERN_REGION_TABLE (_REGION_THIRD|_REGION_THIRD_LEN) +#define USER_STD_MASK 0x0000000000000080UL +/* Bits in the storage key */ #define _PAGE_CHANGED 0x02/* HW changed bit */ #define _PAGE_REFERENCED 0x04/* HW referenced bit */
include/asm-s390x/rwsem.h +66 -2
93 lines not on this page · raw message
include/asm-s390x/smp.h +11 -5
@@ -11,7 +11,6 @@#include <linux/config.h> #include <linux/threads.h> -#include <linux/ptrace.h> #if defined(__KERNEL__) && defined(CONFIG_SMP ) && !defined(__ASSEMBLY__)
@@ -29,6 +28,7 @@ } sigp_info;extern volatile unsigned long cpu_online_map; +extern volatile unsigned long cpu_possible_map;#define NO_PROC_ID 0xFF/* No processor magic marker */
@@ -46,14 +46,20 @@#define smp_processor_id () (current_thread_info()->cpu) -extern __inline__int cpu_logical_map (int cpu) +#define cpu_online (cpu) (cpu_online_map & (1<<(cpu))) +#define cpu_possible (cpu) (cpu_possible_map & (1<<(cpu))) + +extern inline unsigned int num_online_cpus (void ) { -return cpu; +return hweight64 (cpu_online_map); } -extern __inline__int cpu_number_map (int cpu) +extern inline int any_online_cpu (unsigned int mask) { -return cpu; +if (mask & cpu_online_map) +return __ffs (mask & cpu_online_map); + +return -1 ; }extern __inline____u16 hard_smp_processor_id (void )
include/asm-s390x/softirq.h +12 -19
@@ -9,34 +9,27 @@#ifndef __ASM_SOFTIRQ_H#define __ASM_SOFTIRQ_H -#ifndef __LINUX_SMP_H#include <linux/smp.h> -#endif +#include <linux/preempt.h> #include <asm/atomic.h> #include <asm/hardirq.h> #include <asm/lowcore.h> -#define __cpu_bh_enable (cpu) \ - do { barrier(); local_bh_count(cpu)--; } while (0) -#define cpu_bh_disable (cpu) \ - do { local_bh_count(cpu)++; barrier(); } while (0) - -#define local_bh_disable () cpu_bh_disable(smp_processor_id()) -#define __local_bh_enable () __cpu_bh_enable(smp_processor_id()) - -#define in_softirq () (local_bh_count(smp_processor_id()) != 0) +#define local_bh_disable () \ + do { preempt_count() += SOFTIRQ_OFFSET; barrier(); } while (0) +#define __local_bh_enable () \ + do { barrier(); preempt_count() -= SOFTIRQ_OFFSET; } while (0)extern void do_call_softirq (void ); -#define local_bh_enable () \ -do { \ - unsigned int *ptr = &local_bh_count(smp_processor_id()); \ - barrier(); \ - if (!--*ptr) \ - if (softirq_pending(smp_processor_id())) \ -/* Use the async. stack for softirq */ \ -do_call_softirq (); \ +#define local_bh_enable () \ +do { \ + __local_bh_enable(); \ + if (!in_interrupt() && softirq_pending(smp_processor_id())) \ +/* Use the async. stack for softirq */ \ +do_call_softirq (); \ +preempt_check_resched (); \ } while (0)#endif /* __ASM_SOFTIRQ_H */
include/asm-s390x/spinlock.h +9 -0
@@ -12,6 +12,13 @@#define __ASM_SPINLOCK_H/* +* Grmph, take care of %&#! user space programs that include +* asm/spinlock.h. The diagnose is only available in kernel +* context. +*/ +#include <asm/lowcore.h> + +/* * Simple spin lock operations. There are two variants, one clears IRQ's * on the local processor, one does not. *
@@ -76,6 +83,8 @@#define rwlock_init (x) do { *(x) = RW_LOCK_UNLOCKED; } while(0) +#define rwlock_is_locked (x) ((x)->lock != 0) +#define _raw_read_lock (rw) \ asm volatile(" lg 2,0(%1)\n" \ " j 1f\n" \
include/asm-s390x/system.h +85 -17
135 lines not on this page · raw message
include/asm-s390x/tlbflush.h +1 -2
@@ -88,8 +88,7 @@static inline void __flush_tlb_mm (struct mm_struct * mm) { -if ((smp_num_cpus >1 ) && - ((atomic_read (&mm->mm_count) !=1 ) || +if (((atomic_read (&mm->mm_count) !=1 ) || (mm->cpu_vm_mask != (1UL <<smp_processor_id ())))) { mm->cpu_vm_mask = (1UL <<smp_processor_id ());global_flush_tlb ();