mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
KVM: selftests: Add a KVM syscall wrapper for sched_setaffinity()
Add and use a KVM wrapper for sched_setaffinity() so that selftests don't need to manually assert that the syscall succeeded. No functional change intended. Link: https://patch.msgid.link/20260731195612.2697986-2-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
parent
2f0c30d0d1
commit
f766bf3d0a
|
|
@ -95,6 +95,7 @@ __KVM_SYSCALL_DEFINE(fallocate, 4, int, fd, int, mode, loff_t, offset, loff_t, l
|
|||
__KVM_SYSCALL_DEFINE(ftruncate, 2, unsigned int, fd, off_t, length);
|
||||
__KVM_SYSCALL_DEFINE(madvise, 3, void *, addr, size_t, length, int, advice);
|
||||
__KVM_SYSCALL_DEFINE(sched_getaffinity, 3, pid_t, pid, size_t, cpusetsize, cpu_set_t *, mask);
|
||||
__KVM_SYSCALL_DEFINE(sched_setaffinity, 3, pid_t, pid, size_t, cpusetsize, cpu_set_t *, mask);
|
||||
|
||||
#define kvm_free_fd(fd) \
|
||||
do { \
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ static void *migration_worker(void *__rseq_tid)
|
|||
{
|
||||
pid_t rseq_tid = (pid_t)(unsigned long)__rseq_tid;
|
||||
cpu_set_t allowed_mask;
|
||||
int r, i, cpu;
|
||||
int i, cpu;
|
||||
|
||||
CPU_ZERO(&allowed_mask);
|
||||
|
||||
|
|
@ -96,9 +96,7 @@ static void *migration_worker(void *__rseq_tid)
|
|||
* stable, i.e. while changing affinity is in-progress.
|
||||
*/
|
||||
smp_wmb();
|
||||
r = sched_setaffinity(rseq_tid, sizeof(allowed_mask), &allowed_mask);
|
||||
TEST_ASSERT(!r, "sched_setaffinity failed, errno = %d (%s)",
|
||||
errno, strerror(errno));
|
||||
kvm_sched_setaffinity(rseq_tid, sizeof(allowed_mask), &allowed_mask);
|
||||
smp_wmb();
|
||||
atomic_inc(&seq_cnt);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user