linux-kselftest-fixes-5.15-rc3
This Kselftest fixes update for Linux 5.15-rc3 consists of: - fix to Kselftest common framework header install to run before other targets for it work correctly in parallel build case. - fixes to kvm test to not ignore fscanf() returns which could result in inconsistent test behavior and failures. -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEPZKym/RZuOCGeA/kCwJExA0NQxwFAmFOL14ACgkQCwJExA0N Qxyz9hAA6LKcNpv7BGXWpTNB2z/p9KcbSWdA3eejvb+3kiovd2AyFPvf1U1fT5kA VlJWk4d3cbhPkCrXmkpsI2vBuSb+u5HcwoEy0WH4T4q2aDjoEOnyn3xr2ktnBdXl oeWqPusSRKTJn7gCCZN+H6s5JaUbGZxTWsL2n0v5Pzb6sW4hikc8nXpd+1IeoTKq 0xg7FM6NcaWRzKb6D97wFpQEo6mnC9Zifv6TalxQn71d//n9MXGW2600ZSDDfBRG XfolWqVUHGI2Lyy0mIT788fmntA7xOka3Tajzk4WrfmcgczABJFRJr8ZG6iZ+J0j dT+KaTqEZHcL1L9Pusf2VehJZTUwKMenc2NmOZ+n6pK+PUL/KZNobcXoFW01I9jI z4UYeH9DUnTiaTP8b7OJ1RB7H5XU3CncuO2gELkera212XckdmiTldpox0ywwyh9 x+X6mk4lzbDSFMPrSPJrVTasvLMEZv6A05I8Td8Gw7mgeYIxupyk0/k5jgjMlZGN 6CHyQu4iGre3oM72snuthomtzqwArF3bhWAm7ooZYG4qLQ6z6naDdvcpWYmszIV0 RuC74FZCHZWGXXojVJWPquf47C79QPFQyQcwXxfAaSMY3XezVsI7c/QaXLoT1VeA BZbsUoAPvLa8mLRiFU2jZmLbx57rxej5zM+UvKJjI1JdCL9+cUA= =Q9zx -----END PGP SIGNATURE----- Merge tag 'linux-kselftest-fixes-5.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest Pull Kselftest fixes from Shuah Khan: - fix to Kselftest common framework header install to run before other targets for it work correctly in parallel build case. - fixes to kvm test to not ignore fscanf() returns which could result in inconsistent test behavior and failures. * tag 'linux-kselftest-fixes-5.15-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: selftests: kvm: fix get_run_delay() ignoring fscanf() return warn selftests: kvm: move get_run_delay() into lib/test_util selftests:kvm: fix get_trans_hugepagesz() ignoring fscanf() return warn selftests:kvm: fix get_warnings_count() ignoring fscanf() return warn selftests: be sure to make khdr before other targets
This commit is contained in:
commit
90316e6ea0
|
@ -95,6 +95,8 @@ struct vm_mem_backing_src_alias {
|
|||
uint32_t flag;
|
||||
};
|
||||
|
||||
#define MIN_RUN_DELAY_NS 200000UL
|
||||
|
||||
bool thp_configured(void);
|
||||
size_t get_trans_hugepagesz(void);
|
||||
size_t get_def_hugetlb_pagesz(void);
|
||||
|
@ -102,6 +104,7 @@ const struct vm_mem_backing_src_alias *vm_mem_backing_src_alias(uint32_t i);
|
|||
size_t get_backing_src_pagesz(uint32_t i);
|
||||
void backing_src_help(void);
|
||||
enum vm_mem_backing_src_type parse_backing_src_type(const char *type_name);
|
||||
long get_run_delay(void);
|
||||
|
||||
/*
|
||||
* Whether or not the given source type is shared memory (as opposed to
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <linux/mman.h>
|
||||
#include "linux/kernel.h"
|
||||
|
||||
|
@ -129,13 +130,16 @@ size_t get_trans_hugepagesz(void)
|
|||
{
|
||||
size_t size;
|
||||
FILE *f;
|
||||
int ret;
|
||||
|
||||
TEST_ASSERT(thp_configured(), "THP is not configured in host kernel");
|
||||
|
||||
f = fopen("/sys/kernel/mm/transparent_hugepage/hpage_pmd_size", "r");
|
||||
TEST_ASSERT(f != NULL, "Error in opening transparent_hugepage/hpage_pmd_size");
|
||||
|
||||
fscanf(f, "%ld", &size);
|
||||
ret = fscanf(f, "%ld", &size);
|
||||
ret = fscanf(f, "%ld", &size);
|
||||
TEST_ASSERT(ret < 1, "Error reading transparent_hugepage/hpage_pmd_size");
|
||||
fclose(f);
|
||||
|
||||
return size;
|
||||
|
@ -300,3 +304,19 @@ enum vm_mem_backing_src_type parse_backing_src_type(const char *type_name)
|
|||
TEST_FAIL("Unknown backing src type: %s", type_name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
long get_run_delay(void)
|
||||
{
|
||||
char path[64];
|
||||
long val[2];
|
||||
FILE *fp;
|
||||
|
||||
sprintf(path, "/proc/%ld/schedstat", syscall(SYS_gettid));
|
||||
fp = fopen(path, "r");
|
||||
/* Return MIN_RUN_DELAY_NS upon failure just to be safe */
|
||||
if (fscanf(fp, "%ld %ld ", &val[0], &val[1]) < 2)
|
||||
val[1] = MIN_RUN_DELAY_NS;
|
||||
fclose(fp);
|
||||
|
||||
return val[1];
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#include <sched.h>
|
||||
#include <pthread.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <asm/kvm.h>
|
||||
#include <asm/kvm_para.h>
|
||||
|
||||
|
@ -20,7 +19,6 @@
|
|||
|
||||
#define NR_VCPUS 4
|
||||
#define ST_GPA_BASE (1 << 30)
|
||||
#define MIN_RUN_DELAY_NS 200000UL
|
||||
|
||||
static void *st_gva[NR_VCPUS];
|
||||
static uint64_t guest_stolen_time[NR_VCPUS];
|
||||
|
@ -217,20 +215,6 @@ static void steal_time_dump(struct kvm_vm *vm, uint32_t vcpuid)
|
|||
|
||||
#endif
|
||||
|
||||
static long get_run_delay(void)
|
||||
{
|
||||
char path[64];
|
||||
long val[2];
|
||||
FILE *fp;
|
||||
|
||||
sprintf(path, "/proc/%ld/schedstat", syscall(SYS_gettid));
|
||||
fp = fopen(path, "r");
|
||||
fscanf(fp, "%ld %ld ", &val[0], &val[1]);
|
||||
fclose(fp);
|
||||
|
||||
return val[1];
|
||||
}
|
||||
|
||||
static void *do_steal_time(void *arg)
|
||||
{
|
||||
struct timespec ts, stop;
|
||||
|
|
|
@ -82,7 +82,8 @@ int get_warnings_count(void)
|
|||
FILE *f;
|
||||
|
||||
f = popen("dmesg | grep \"WARNING:\" | wc -l", "r");
|
||||
fscanf(f, "%d", &warnings);
|
||||
if (fscanf(f, "%d", &warnings) < 1)
|
||||
warnings = 0;
|
||||
fclose(f);
|
||||
|
||||
return warnings;
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
#include <sched.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#define VCPU_ID 5
|
||||
|
||||
|
@ -98,20 +97,6 @@ static void guest_code(void)
|
|||
GUEST_DONE();
|
||||
}
|
||||
|
||||
static long get_run_delay(void)
|
||||
{
|
||||
char path[64];
|
||||
long val[2];
|
||||
FILE *fp;
|
||||
|
||||
sprintf(path, "/proc/%ld/schedstat", syscall(SYS_gettid));
|
||||
fp = fopen(path, "r");
|
||||
fscanf(fp, "%ld %ld ", &val[0], &val[1]);
|
||||
fclose(fp);
|
||||
|
||||
return val[1];
|
||||
}
|
||||
|
||||
static int cmp_timespec(struct timespec *a, struct timespec *b)
|
||||
{
|
||||
if (a->tv_sec > b->tv_sec)
|
||||
|
|
|
@ -48,6 +48,7 @@ ARCH ?= $(SUBARCH)
|
|||
# When local build is done, headers are installed in the default
|
||||
# INSTALL_HDR_PATH usr/include.
|
||||
.PHONY: khdr
|
||||
.NOTPARALLEL:
|
||||
khdr:
|
||||
ifndef KSFT_KHDR_INSTALL_DONE
|
||||
ifeq (1,$(DEFAULT_INSTALL_HDR_PATH))
|
||||
|
|
Loading…
Reference in New Issue