Skip to content

Commit

Permalink
Merge branches 'x86-rwsem-for-linus' and 'x86-gcc46-for-linus' of git…
Browse files Browse the repository at this point in the history
…://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
  • Loading branch information
Linus Torvalds committed Aug 6, 2010
3 parents a417fb9 + b4bcb4c + fa10ba6 commit 90c8327
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 18 deletions.
4 changes: 2 additions & 2 deletions arch/x86/include/asm/msr.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ static inline unsigned long long native_read_pmc(int counter)
#define rdmsr(msr, val1, val2) \
do { \
u64 __val = native_read_msr((msr)); \
(val1) = (u32)__val; \
(val2) = (u32)(__val >> 32); \
(void)((val1) = (u32)__val); \
(void)((val2) = (u32)(__val >> 32)); \
} while (0)

static inline void wrmsr(unsigned msr, unsigned low, unsigned high)
Expand Down
21 changes: 9 additions & 12 deletions arch/x86/include/asm/rwsem.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static inline void __down_read(struct rw_semaphore *sem)
{
asm volatile("# beginning down_read\n\t"
LOCK_PREFIX _ASM_INC "(%1)\n\t"
/* adds 0x00000001, returns the old value */
/* adds 0x00000001 */
" jns 1f\n"
" call call_rwsem_down_read_failed\n"
"1:\n\t"
Expand Down Expand Up @@ -156,19 +156,17 @@ static inline int __down_read_trylock(struct rw_semaphore *sem)
static inline void __down_write_nested(struct rw_semaphore *sem, int subclass)
{
rwsem_count_t tmp;

tmp = RWSEM_ACTIVE_WRITE_BIAS;
asm volatile("# beginning down_write\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"
/* was the count 0 before? */
" jz 1f\n"
" call call_rwsem_down_write_failed\n"
"1:\n"
"# ending down_write"
: "+m" (sem->count), "=d" (tmp)
: "a" (sem), "1" (tmp)
: "a" (sem), "1" (RWSEM_ACTIVE_WRITE_BIAS)
: "memory", "cc");
}

Expand All @@ -195,16 +193,16 @@ static inline int __down_write_trylock(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"
LOCK_PREFIX " xadd %1,(%2)\n\t"
/* subtracts 1, returns the old value */
" jns 1f\n\t"
" call call_rwsem_wake\n"
" call call_rwsem_wake\n" /* expects old value in %edx */
"1:\n"
"# ending __up_read\n"
: "+m" (sem->count), "=d" (tmp)
: "a" (sem), "1" (tmp)
: "a" (sem), "1" (-RWSEM_ACTIVE_READ_BIAS)
: "memory", "cc");
}

Expand All @@ -216,10 +214,9 @@ static inline void __up_write(struct rw_semaphore *sem)
rwsem_count_t tmp;
asm volatile("# beginning __up_write\n\t"
LOCK_PREFIX " xadd %1,(%2)\n\t"
/* tries to transition
0xffff0001 -> 0x00000000 */
" jz 1f\n"
" call call_rwsem_wake\n"
/* subtracts 0xffff0001, returns the old value */
" jns 1f\n\t"
" call call_rwsem_wake\n" /* expects old value in %edx */
"1:\n\t"
"# ending __up_write\n"
: "+m" (sem->count), "=d" (tmp)
Expand Down
4 changes: 2 additions & 2 deletions arch/x86/kernel/aperture_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ void __init early_gart_iommu_check(void)
* or BIOS forget to put that in 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;
u32 ctl;
u32 aper_size = 0, aper_order = 0, last_aper_order = 0;
Expand All @@ -291,7 +291,7 @@ void __init early_gart_iommu_check(void)
return;

/* 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;
for (i = 0; i < ARRAY_SIZE(bus_dev_ranges); i++) {
Expand Down
3 changes: 1 addition & 2 deletions arch/x86/kernel/cpu/mtrr/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 tmp, hi;
int cpu;

/*
* get_mtrr doesn't need to update mtrr_state, also it could be called
* from any cpu, so try to print it out directly.
*/
cpu = get_cpu();
get_cpu();

rdmsr(MTRRphysMask_MSR(reg), mask_lo, mask_hi);

Expand Down

0 comments on commit 90c8327

Please sign in to comment.