提交 90c8327c 编写于 作者: L Linus Torvalds

Merge branches 'x86-rwsem-for-linus' and 'x86-gcc46-for-linus' of...

Merge branches 'x86-rwsem-for-linus' and 'x86-gcc46-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'x86-rwsem-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86, rwsem: Minor cleanups
  x86, rwsem: Stay on fast path when count > 0 in __up_write()

* 'x86-gcc46-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86, gcc-4.6: Fix set but not read variables
  x86, gcc-4.6: Avoid unused by set variables in rdmsr
...@@ -148,8 +148,8 @@ static inline unsigned long long native_read_pmc(int counter) ...@@ -148,8 +148,8 @@ static inline unsigned long long native_read_pmc(int counter)
#define rdmsr(msr, val1, val2) \ #define rdmsr(msr, val1, val2) \
do { \ do { \
u64 __val = native_read_msr((msr)); \ u64 __val = native_read_msr((msr)); \
(val1) = (u32)__val; \ (void)((val1) = (u32)__val); \
(val2) = (u32)(__val >> 32); \ (void)((val2) = (u32)(__val >> 32)); \
} while (0) } while (0)
static inline void wrmsr(unsigned msr, unsigned low, unsigned high) static inline void wrmsr(unsigned msr, unsigned low, unsigned high)
......
...@@ -118,7 +118,7 @@ static inline void __down_read(struct rw_semaphore *sem) ...@@ -118,7 +118,7 @@ static inline void __down_read(struct rw_semaphore *sem)
{ {
asm volatile("# beginning down_read\n\t" asm volatile("# beginning down_read\n\t"
LOCK_PREFIX _ASM_INC "(%1)\n\t" LOCK_PREFIX _ASM_INC "(%1)\n\t"
/* adds 0x00000001, returns the old value */ /* adds 0x00000001 */
" jns 1f\n" " jns 1f\n"
" call call_rwsem_down_read_failed\n" " call call_rwsem_down_read_failed\n"
"1:\n\t" "1:\n\t"
...@@ -156,11 +156,9 @@ static inline int __down_read_trylock(struct rw_semaphore *sem) ...@@ -156,11 +156,9 @@ static inline int __down_read_trylock(struct rw_semaphore *sem)
static inline void __down_write_nested(struct rw_semaphore *sem, int subclass) static inline void __down_write_nested(struct rw_semaphore *sem, int subclass)
{ {
rwsem_count_t tmp; rwsem_count_t tmp;
tmp = RWSEM_ACTIVE_WRITE_BIAS;
asm volatile("# beginning down_write\n\t" asm volatile("# beginning down_write\n\t"
LOCK_PREFIX " xadd %1,(%2)\n\t" LOCK_PREFIX " xadd %1,(%2)\n\t"
/* subtract 0x0000ffff, returns the old value */ /* adds 0xffff0001, returns the old value */
" test %1,%1\n\t" " test %1,%1\n\t"
/* was the count 0 before? */ /* was the count 0 before? */
" jz 1f\n" " jz 1f\n"
...@@ -168,7 +166,7 @@ static inline void __down_write_nested(struct rw_semaphore *sem, int subclass) ...@@ -168,7 +166,7 @@ static inline void __down_write_nested(struct rw_semaphore *sem, int subclass)
"1:\n" "1:\n"
"# ending down_write" "# ending down_write"
: "+m" (sem->count), "=d" (tmp) : "+m" (sem->count), "=d" (tmp)
: "a" (sem), "1" (tmp) : "a" (sem), "1" (RWSEM_ACTIVE_WRITE_BIAS)
: "memory", "cc"); : "memory", "cc");
} }
...@@ -195,16 +193,16 @@ static inline int __down_write_trylock(struct rw_semaphore *sem) ...@@ -195,16 +193,16 @@ static inline int __down_write_trylock(struct rw_semaphore *sem)
*/ */
static inline void __up_read(struct rw_semaphore *sem) static inline void __up_read(struct rw_semaphore *sem)
{ {
rwsem_count_t tmp = -RWSEM_ACTIVE_READ_BIAS; rwsem_count_t tmp;
asm volatile("# beginning __up_read\n\t" asm volatile("# beginning __up_read\n\t"
LOCK_PREFIX " xadd %1,(%2)\n\t" LOCK_PREFIX " xadd %1,(%2)\n\t"
/* subtracts 1, returns the old value */ /* subtracts 1, returns the old value */
" jns 1f\n\t" " jns 1f\n\t"
" call call_rwsem_wake\n" " call call_rwsem_wake\n" /* expects old value in %edx */
"1:\n" "1:\n"
"# ending __up_read\n" "# ending __up_read\n"
: "+m" (sem->count), "=d" (tmp) : "+m" (sem->count), "=d" (tmp)
: "a" (sem), "1" (tmp) : "a" (sem), "1" (-RWSEM_ACTIVE_READ_BIAS)
: "memory", "cc"); : "memory", "cc");
} }
...@@ -216,10 +214,9 @@ static inline void __up_write(struct rw_semaphore *sem) ...@@ -216,10 +214,9 @@ static inline void __up_write(struct rw_semaphore *sem)
rwsem_count_t tmp; rwsem_count_t tmp;
asm volatile("# beginning __up_write\n\t" asm volatile("# beginning __up_write\n\t"
LOCK_PREFIX " xadd %1,(%2)\n\t" LOCK_PREFIX " xadd %1,(%2)\n\t"
/* tries to transition /* subtracts 0xffff0001, returns the old value */
0xffff0001 -> 0x00000000 */ " jns 1f\n\t"
" jz 1f\n" " call call_rwsem_wake\n" /* expects old value in %edx */
" call call_rwsem_wake\n"
"1:\n\t" "1:\n\t"
"# ending __up_write\n" "# ending __up_write\n"
: "+m" (sem->count), "=d" (tmp) : "+m" (sem->count), "=d" (tmp)
......
...@@ -280,7 +280,7 @@ void __init early_gart_iommu_check(void) ...@@ -280,7 +280,7 @@ void __init early_gart_iommu_check(void)
* or BIOS forget to put that in reserved. * or BIOS forget to put that in reserved.
* try to update e820 to make that region as reserved. * try to update e820 to make that region as reserved.
*/ */
u32 agp_aper_base = 0, agp_aper_order = 0; u32 agp_aper_order = 0;
int i, fix, slot, valid_agp = 0; int i, fix, slot, valid_agp = 0;
u32 ctl; u32 ctl;
u32 aper_size = 0, aper_order = 0, last_aper_order = 0; u32 aper_size = 0, aper_order = 0, last_aper_order = 0;
...@@ -291,7 +291,7 @@ void __init early_gart_iommu_check(void) ...@@ -291,7 +291,7 @@ void __init early_gart_iommu_check(void)
return; return;
/* This is mostly duplicate of iommu_hole_init */ /* This is mostly duplicate of iommu_hole_init */
agp_aper_base = search_agp_bridge(&agp_aper_order, &valid_agp); search_agp_bridge(&agp_aper_order, &valid_agp);
fix = 0; fix = 0;
for (i = 0; i < ARRAY_SIZE(bus_dev_ranges); i++) { for (i = 0; i < ARRAY_SIZE(bus_dev_ranges); i++) {
......
...@@ -433,13 +433,12 @@ static void generic_get_mtrr(unsigned int reg, unsigned long *base, ...@@ -433,13 +433,12 @@ static void generic_get_mtrr(unsigned int reg, unsigned long *base,
{ {
unsigned int mask_lo, mask_hi, base_lo, base_hi; unsigned int mask_lo, mask_hi, base_lo, base_hi;
unsigned int tmp, hi; unsigned int tmp, hi;
int cpu;
/* /*
* get_mtrr doesn't need to update mtrr_state, also it could be called * get_mtrr doesn't need to update mtrr_state, also it could be called
* from any cpu, so try to print it out directly. * from any cpu, so try to print it out directly.
*/ */
cpu = get_cpu(); get_cpu();
rdmsr(MTRRphysMask_MSR(reg), mask_lo, mask_hi); rdmsr(MTRRphysMask_MSR(reg), mask_lo, mask_hi);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册