Skip to content

Commit 6cfcdad

Browse files
committed
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
2 parents c83b5d3 + 2ef085b commit 6cfcdad

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

arch/x86/kernel/cpu/resctrl/pseudo_lock.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -431,11 +431,7 @@ static int pseudo_lock_fn(void *_rdtgrp)
431431
#else
432432
register unsigned int line_size asm("esi");
433433
register unsigned int size asm("edi");
434-
#ifdef CONFIG_X86_64
435-
register void *mem_r asm("rbx");
436-
#else
437-
register void *mem_r asm("ebx");
438-
#endif /* CONFIG_X86_64 */
434+
register void *mem_r asm(_ASM_BX);
439435
#endif /* CONFIG_KASAN */
440436

441437
/*

arch/x86/kernel/cpu/resctrl/rdtgroup.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2488,21 +2488,21 @@ static int mkdir_mondata_all(struct kernfs_node *parent_kn,
24882488
* modification to the CBM if the default does not satisfy the
24892489
* requirements.
24902490
*/
2491-
static void cbm_ensure_valid(u32 *_val, struct rdt_resource *r)
2491+
static u32 cbm_ensure_valid(u32 _val, struct rdt_resource *r)
24922492
{
2493-
unsigned long val = *_val;
24942493
unsigned int cbm_len = r->cache.cbm_len;
24952494
unsigned long first_bit, zero_bit;
2495+
unsigned long val = _val;
24962496

2497-
if (val == 0)
2498-
return;
2497+
if (!val)
2498+
return 0;
24992499

25002500
first_bit = find_first_bit(&val, cbm_len);
25012501
zero_bit = find_next_zero_bit(&val, cbm_len, first_bit);
25022502

25032503
/* Clear any remaining bits to ensure contiguous region */
25042504
bitmap_clear(&val, zero_bit, cbm_len - zero_bit);
2505-
*_val = (u32)val;
2505+
return (u32)val;
25062506
}
25072507

25082508
/*
@@ -2560,7 +2560,7 @@ static int __init_one_rdt_domain(struct rdt_domain *d, struct rdt_resource *r,
25602560
* Force the initial CBM to be valid, user can
25612561
* modify the CBM based on system availability.
25622562
*/
2563-
cbm_ensure_valid(&d->new_ctrl, r);
2563+
d->new_ctrl = cbm_ensure_valid(d->new_ctrl, r);
25642564
/*
25652565
* Assign the u32 CBM to an unsigned long to ensure that
25662566
* bitmap_weight() does not access out-of-bound memory.

0 commit comments

Comments
 (0)