mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 01:53:29 +02:00
linux_kselftest-next-6.20-rc1
resctrl test: - fixes a devision by zero error on Hygon - fixes non-contiguous CBM check for Hygon - defines CPU vendor IDs as bits to match usage - adds CPU vendor detection for Hygon - coredeump test: changes to use __builtin_trap() instead of a null pointer - anon_inode: replaces null pointers with empty arrays - kublk: includes message in _Static_assert for C11 compatibility - run_kselftest.sh: adds `--skip` argument option - pidfd: fixes typo in comment -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEPZKym/RZuOCGeA/kCwJExA0NQxwFAml/QHkACgkQCwJExA0N QxxB4A/+IQNvqlgD2vT/oZonMUZ6hLNueJFi4DMONUAiLZkloUwf8Diq2ZW1SOTF RkmkNDcSrW9KG++q5wwSThExlYbmfahhfT2Q7F3KeDZuL85KiK2uFJzPjnpSW43p iKUIiF5QSPk1UnBV/WsfzLP87dGuc8LD2kD0J2GaMCeQc4miq9WxCFQr6JjeAOJL lTCq7XcskDHUEVhFSgMkEvBoL0FqRbd14SxE3TeaATzjDOK0nvz4OjqaE4chr2tW c+OIe6djqv+nc91Gm4WPjlP6SPLbb6QCfJP5ETV4IHvjvcQheTHyyqlnsyQMTEXT yGyzKrroCSUAjPtpzqKbu+3cF3mji4Cu8MNRzWT/R2MOJO+hkReOmoluQWT84Oxy 5OG6SD3fLnu/Kj8sJP3l7SMAkurjkBGPJyR4ZA+nRw101IjqeMbdZK9/CXm051aG rOtKZTVX0FSp/DbARjfIoSqhcMiL1wef8Yfnt11frDwdIf7O1iG3kPNYfddMwy5Y on5KgcWhnw9+zYF2i0dJdKKwWucNPrSs5NxmNcanCtfGqTB5TEIsdDTX+2TxT+V8 8HOJhuk0g8xA+EO310xFpauqOX1/RM95la7NLghLukauiNfbep60ohn1nMCkNWGJ 3P3WFKw/kue0r7tmfzwrKcjWHJ55jai7dvyJ/VtoMd5NgFfElJM= =1cku -----END PGP SIGNATURE----- Merge tag 'linux_kselftest-next-6.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest Pull kselftest updates from Shuah Khan: "resctrl test: - fix division by zero error on Hygon - fix non-contiguous CBM check for Hygon - define CPU vendor IDs as bits to match usage - add CPU vendor detection for Hygon misc: - coredeump test: use __builtin_trap() instead of a null pointer - anon_inode: replace null pointers with empty arrays - kublk: include message in _Static_assert for C11 compatibility - run_kselftest.sh: add `--skip` argument option - pidfd: fix typo in comment" * tag 'linux_kselftest-next-6.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: selftests/pidfd: fix typo in comment selftests/run_kselftest.sh: Add `--skip` argument option selftests/resctrl: Fix non-contiguous CBM check for Hygon selftests/resctrl: Add CPU vendor detection for Hygon selftests/resctrl: Define CPU vendor IDs as bits to match usage selftests/resctrl: Fix a division by zero error on Hygon kselftest/kublk: include message in _Static_assert for C11 compatibility kselftest/anon_inode: replace null pointers with empty arrays kselftest/coredump: use __builtin_trap() instead of null pointer
This commit is contained in:
commit
5c40222af1
|
|
@ -56,7 +56,7 @@ void crashing_child(void)
|
|||
pthread_create(&thread, NULL, do_nothing, NULL);
|
||||
|
||||
/* crash on purpose */
|
||||
i = *(int *)NULL;
|
||||
__builtin_trap();
|
||||
}
|
||||
|
||||
int create_detached_tmpfs(void)
|
||||
|
|
|
|||
|
|
@ -42,7 +42,10 @@ TEST(anon_inode_no_exec)
|
|||
fd_context = sys_fsopen("tmpfs", 0);
|
||||
ASSERT_GE(fd_context, 0);
|
||||
|
||||
ASSERT_LT(execveat(fd_context, "", NULL, NULL, AT_EMPTY_PATH), 0);
|
||||
char *const empty_argv[] = {NULL};
|
||||
char *const empty_envp[] = {NULL};
|
||||
|
||||
ASSERT_LT(execveat(fd_context, "", empty_argv, empty_envp, AT_EMPTY_PATH), 0);
|
||||
ASSERT_EQ(errno, EACCES);
|
||||
|
||||
EXPECT_EQ(close(fd_context), 0);
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ static void *pidfd_info_pause_thread(void *arg)
|
|||
|
||||
close(ipc_socket);
|
||||
|
||||
/* Sleep untill we're killed. */
|
||||
/* Sleep until we're killed. */
|
||||
pause();
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -290,8 +290,10 @@ static int cat_run_test(const struct resctrl_test *test, const struct user_param
|
|||
|
||||
static bool arch_supports_noncont_cat(const struct resctrl_test *test)
|
||||
{
|
||||
/* AMD always supports non-contiguous CBM. */
|
||||
if (get_vendor() == ARCH_AMD)
|
||||
unsigned int vendor_id = get_vendor();
|
||||
|
||||
/* AMD and Hygon always support non-contiguous CBM. */
|
||||
if (vendor_id == ARCH_AMD || vendor_id == ARCH_HYGON)
|
||||
return true;
|
||||
|
||||
#if defined(__i386__) || defined(__x86_64__) /* arch */
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include <asm/unistd.h>
|
||||
#include <linux/perf_event.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/bits.h>
|
||||
#include "kselftest.h"
|
||||
|
||||
#define MB (1024 * 1024)
|
||||
|
|
@ -36,8 +37,9 @@
|
|||
* Define as bits because they're used for vendor_specific bitmask in
|
||||
* the struct resctrl_test.
|
||||
*/
|
||||
#define ARCH_INTEL 1
|
||||
#define ARCH_AMD 2
|
||||
#define ARCH_INTEL BIT(0)
|
||||
#define ARCH_AMD BIT(1)
|
||||
#define ARCH_HYGON BIT(2)
|
||||
|
||||
#define END_OF_TESTS 1
|
||||
|
||||
|
|
@ -163,7 +165,7 @@ extern int snc_unreliable;
|
|||
extern char llc_occup_path[1024];
|
||||
|
||||
int snc_nodes_per_l3_cache(void);
|
||||
int get_vendor(void);
|
||||
unsigned int get_vendor(void);
|
||||
bool check_resctrlfs_support(void);
|
||||
int filter_dmesg(void);
|
||||
int get_domain_id(const char *resource, int cpu_no, int *domain_id);
|
||||
|
|
|
|||
|
|
@ -23,16 +23,24 @@ static struct resctrl_test *resctrl_tests[] = {
|
|||
&l2_noncont_cat_test,
|
||||
};
|
||||
|
||||
static int detect_vendor(void)
|
||||
static unsigned int detect_vendor(void)
|
||||
{
|
||||
FILE *inf = fopen("/proc/cpuinfo", "r");
|
||||
int vendor_id = 0;
|
||||
static unsigned int vendor_id;
|
||||
static bool initialized;
|
||||
char *s = NULL;
|
||||
FILE *inf;
|
||||
char *res;
|
||||
|
||||
if (!inf)
|
||||
if (initialized)
|
||||
return vendor_id;
|
||||
|
||||
inf = fopen("/proc/cpuinfo", "r");
|
||||
if (!inf) {
|
||||
vendor_id = 0;
|
||||
initialized = true;
|
||||
return vendor_id;
|
||||
}
|
||||
|
||||
res = fgrep(inf, "vendor_id");
|
||||
|
||||
if (res)
|
||||
|
|
@ -42,18 +50,22 @@ static int detect_vendor(void)
|
|||
vendor_id = ARCH_INTEL;
|
||||
else if (s && !strcmp(s, ": AuthenticAMD\n"))
|
||||
vendor_id = ARCH_AMD;
|
||||
else if (s && !strcmp(s, ": HygonGenuine\n"))
|
||||
vendor_id = ARCH_HYGON;
|
||||
|
||||
fclose(inf);
|
||||
free(res);
|
||||
|
||||
initialized = true;
|
||||
return vendor_id;
|
||||
}
|
||||
|
||||
int get_vendor(void)
|
||||
unsigned int get_vendor(void)
|
||||
{
|
||||
static int vendor = -1;
|
||||
unsigned int vendor;
|
||||
|
||||
vendor = detect_vendor();
|
||||
|
||||
if (vendor == -1)
|
||||
vendor = detect_vendor();
|
||||
if (vendor == 0)
|
||||
ksft_print_msg("Can not get vendor info...\n");
|
||||
|
||||
|
|
|
|||
|
|
@ -243,6 +243,16 @@ int snc_nodes_per_l3_cache(void)
|
|||
}
|
||||
snc_mode = cache_cpus / node_cpus;
|
||||
|
||||
/*
|
||||
* On some platforms (e.g. Hygon),
|
||||
* cache_cpus < node_cpus, the calculated snc_mode is 0.
|
||||
*
|
||||
* Set snc_mode = 1 to indicate that SNC mode is not
|
||||
* supported on the platform.
|
||||
*/
|
||||
if (!snc_mode)
|
||||
snc_mode = 1;
|
||||
|
||||
if (snc_mode > 1)
|
||||
ksft_print_msg("SNC-%d mode discovered.\n", snc_mode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ Usage: $0 [OPTIONS]
|
|||
-s | --summary Print summary with detailed log in output.log (conflict with -p)
|
||||
-p | --per-test-log Print test log in /tmp with each test name (conflict with -s)
|
||||
-t | --test COLLECTION:TEST Run TEST from COLLECTION
|
||||
-S | --skip COLLECTION:TEST Skip TEST from COLLECTION
|
||||
-c | --collection COLLECTION Run all tests from COLLECTION
|
||||
-l | --list List the available collection:test entries
|
||||
-d | --dry-run Don't actually run any tests
|
||||
|
|
@ -43,6 +44,7 @@ EOF
|
|||
|
||||
COLLECTIONS=""
|
||||
TESTS=""
|
||||
SKIP=""
|
||||
dryrun=""
|
||||
kselftest_override_timeout=""
|
||||
ERROR_ON_FAIL=true
|
||||
|
|
@ -58,6 +60,9 @@ while true; do
|
|||
-t | --test)
|
||||
TESTS="$TESTS $2"
|
||||
shift 2 ;;
|
||||
-S | --skip)
|
||||
SKIP="$SKIP $2"
|
||||
shift 2 ;;
|
||||
-c | --collection)
|
||||
COLLECTIONS="$COLLECTIONS $2"
|
||||
shift 2 ;;
|
||||
|
|
@ -109,6 +114,12 @@ if [ -n "$TESTS" ]; then
|
|||
done
|
||||
available="$(echo "$valid" | sed -e 's/ /\n/g')"
|
||||
fi
|
||||
# Remove tests to be skipped from available list
|
||||
if [ -n "$SKIP" ]; then
|
||||
for skipped in $SKIP ; do
|
||||
available="$(echo "$available" | grep -v "^${skipped}$")"
|
||||
done
|
||||
fi
|
||||
|
||||
kselftest_failures_file="$(mktemp --tmpdir kselftest-failures-XXXXXX)"
|
||||
export kselftest_failures_file
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ static inline __u64 build_user_data(unsigned tag, unsigned op,
|
|||
unsigned tgt_data, unsigned q_id, unsigned is_target_io)
|
||||
{
|
||||
/* we only have 7 bits to encode q_id */
|
||||
_Static_assert(UBLK_MAX_QUEUES_SHIFT <= 7);
|
||||
_Static_assert(UBLK_MAX_QUEUES_SHIFT <= 7, "UBLK_MAX_QUEUES_SHIFT must be <= 7");
|
||||
assert(!(tag >> 16) && !(op >> 8) && !(tgt_data >> 16) && !(q_id >> 7));
|
||||
|
||||
return tag | (op << 16) | (tgt_data << 24) |
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user