Commit 6cfcdad7 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'x86-cache-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 cache resource control update from Ingo Molnar:
 "Two cleanup patches"

* 'x86-cache-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/resctrl: Cleanup cbm_ensure_valid()
  x86/resctrl: Use _ASM_BX to avoid ifdeffery
parents c83b5d32 2ef085bd
...@@ -431,11 +431,7 @@ static int pseudo_lock_fn(void *_rdtgrp) ...@@ -431,11 +431,7 @@ static int pseudo_lock_fn(void *_rdtgrp)
#else #else
register unsigned int line_size asm("esi"); register unsigned int line_size asm("esi");
register unsigned int size asm("edi"); register unsigned int size asm("edi");
#ifdef CONFIG_X86_64 register void *mem_r asm(_ASM_BX);
register void *mem_r asm("rbx");
#else
register void *mem_r asm("ebx");
#endif /* CONFIG_X86_64 */
#endif /* CONFIG_KASAN */ #endif /* CONFIG_KASAN */
/* /*
......
...@@ -2488,21 +2488,21 @@ static int mkdir_mondata_all(struct kernfs_node *parent_kn, ...@@ -2488,21 +2488,21 @@ static int mkdir_mondata_all(struct kernfs_node *parent_kn,
* modification to the CBM if the default does not satisfy the * modification to the CBM if the default does not satisfy the
* requirements. * requirements.
*/ */
static void cbm_ensure_valid(u32 *_val, struct rdt_resource *r) static u32 cbm_ensure_valid(u32 _val, struct rdt_resource *r)
{ {
unsigned long val = *_val;
unsigned int cbm_len = r->cache.cbm_len; unsigned int cbm_len = r->cache.cbm_len;
unsigned long first_bit, zero_bit; unsigned long first_bit, zero_bit;
unsigned long val = _val;
if (val == 0) if (!val)
return; return 0;
first_bit = find_first_bit(&val, cbm_len); first_bit = find_first_bit(&val, cbm_len);
zero_bit = find_next_zero_bit(&val, cbm_len, first_bit); zero_bit = find_next_zero_bit(&val, cbm_len, first_bit);
/* Clear any remaining bits to ensure contiguous region */ /* Clear any remaining bits to ensure contiguous region */
bitmap_clear(&val, zero_bit, cbm_len - zero_bit); bitmap_clear(&val, zero_bit, cbm_len - zero_bit);
*_val = (u32)val; return (u32)val;
} }
/* /*
...@@ -2560,7 +2560,7 @@ static int __init_one_rdt_domain(struct rdt_domain *d, struct rdt_resource *r, ...@@ -2560,7 +2560,7 @@ static int __init_one_rdt_domain(struct rdt_domain *d, struct rdt_resource *r,
* Force the initial CBM to be valid, user can * Force the initial CBM to be valid, user can
* modify the CBM based on system availability. * modify the CBM based on system availability.
*/ */
cbm_ensure_valid(&d->new_ctrl, r); d->new_ctrl = cbm_ensure_valid(d->new_ctrl, r);
/* /*
* Assign the u32 CBM to an unsigned long to ensure that * Assign the u32 CBM to an unsigned long to ensure that
* bitmap_weight() does not access out-of-bound memory. * bitmap_weight() does not access out-of-bound memory.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment