Skip to content

Commit 0529ef8

Browse files
committed
Merge tag 'x86-urgent-2025-06-08' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Thomas Gleixner: "A small set of x86 fixes: - Cure IO bitmap inconsistencies A failed fork cleans up all resources of the newly created thread via exit_thread(). exit_thread() invokes io_bitmap_exit() which does the IO bitmap cleanups, which unfortunately assume that the cleanup is related to the current task, which is obviously bogus. Make it work correctly - A lockdep fix in the resctrl code removed the clearing of the command buffer in two places, which keeps stale error messages around. Bring them back. - Remove unused trace events" * tag 'x86-urgent-2025-06-08' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: fs/resctrl: Restore the rdt_last_cmd_clear() calls after acquiring rdtgroup_mutex x86/iopl: Cure TIF_IO_BITMAP inconsistencies x86/fpu: Remove unused trace events
2 parents 4710eac + dd2922d commit 0529ef8

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

arch/x86/include/asm/trace/fpu.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,6 @@ DEFINE_EVENT(x86_fpu, x86_fpu_after_save,
4444
TP_ARGS(fpu)
4545
);
4646

47-
DEFINE_EVENT(x86_fpu, x86_fpu_before_restore,
48-
TP_PROTO(struct fpu *fpu),
49-
TP_ARGS(fpu)
50-
);
51-
52-
DEFINE_EVENT(x86_fpu, x86_fpu_after_restore,
53-
TP_PROTO(struct fpu *fpu),
54-
TP_ARGS(fpu)
55-
);
56-
5747
DEFINE_EVENT(x86_fpu, x86_fpu_regs_activated,
5848
TP_PROTO(struct fpu *fpu),
5949
TP_ARGS(fpu)
@@ -64,11 +54,6 @@ DEFINE_EVENT(x86_fpu, x86_fpu_regs_deactivated,
6454
TP_ARGS(fpu)
6555
);
6656

67-
DEFINE_EVENT(x86_fpu, x86_fpu_init_state,
68-
TP_PROTO(struct fpu *fpu),
69-
TP_ARGS(fpu)
70-
);
71-
7257
DEFINE_EVENT(x86_fpu, x86_fpu_dropped,
7358
TP_PROTO(struct fpu *fpu),
7459
TP_ARGS(fpu)

arch/x86/kernel/ioport.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ void io_bitmap_share(struct task_struct *tsk)
3333
set_tsk_thread_flag(tsk, TIF_IO_BITMAP);
3434
}
3535

36-
static void task_update_io_bitmap(struct task_struct *tsk)
36+
static void task_update_io_bitmap(void)
3737
{
38+
struct task_struct *tsk = current;
3839
struct thread_struct *t = &tsk->thread;
3940

4041
if (t->iopl_emul == 3 || t->io_bitmap) {
@@ -54,7 +55,12 @@ void io_bitmap_exit(struct task_struct *tsk)
5455
struct io_bitmap *iobm = tsk->thread.io_bitmap;
5556

5657
tsk->thread.io_bitmap = NULL;
57-
task_update_io_bitmap(tsk);
58+
/*
59+
* Don't touch the TSS when invoked on a failed fork(). TSS
60+
* reflects the state of @current and not the state of @tsk.
61+
*/
62+
if (tsk == current)
63+
task_update_io_bitmap();
5864
if (iobm && refcount_dec_and_test(&iobm->refcnt))
5965
kfree(iobm);
6066
}
@@ -192,8 +198,7 @@ SYSCALL_DEFINE1(iopl, unsigned int, level)
192198
}
193199

194200
t->iopl_emul = level;
195-
task_update_io_bitmap(current);
196-
201+
task_update_io_bitmap();
197202
return 0;
198203
}
199204

arch/x86/kernel/process.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
176176
frame->ret_addr = (unsigned long) ret_from_fork_asm;
177177
p->thread.sp = (unsigned long) fork_frame;
178178
p->thread.io_bitmap = NULL;
179+
clear_tsk_thread_flag(p, TIF_IO_BITMAP);
179180
p->thread.iopl_warn = 0;
180181
memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps));
181182

@@ -464,6 +465,11 @@ void native_tss_update_io_bitmap(void)
464465
} else {
465466
struct io_bitmap *iobm = t->io_bitmap;
466467

468+
if (WARN_ON_ONCE(!iobm)) {
469+
clear_thread_flag(TIF_IO_BITMAP);
470+
native_tss_invalidate_io_bitmap();
471+
}
472+
467473
/*
468474
* Only copy bitmap data when the sequence number differs. The
469475
* update time is accounted to the incoming task.

fs/resctrl/rdtgroup.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,8 @@ static ssize_t rdtgroup_cpus_write(struct kernfs_open_file *of,
536536
goto unlock;
537537
}
538538

539+
rdt_last_cmd_clear();
540+
539541
if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED ||
540542
rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) {
541543
ret = -EINVAL;
@@ -3472,6 +3474,8 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn,
34723474
goto out_unlock;
34733475
}
34743476

3477+
rdt_last_cmd_clear();
3478+
34753479
/*
34763480
* Check that the parent directory for a monitor group is a "mon_groups"
34773481
* directory.

0 commit comments

Comments
 (0)