From 34708b4893e409cb1559679c2a99e25d1bc41982 Mon Sep 17 00:00:00 2001 From: Thomas Pedersen Date: Fri, 27 Mar 2020 15:51:45 -0700 Subject: [PATCH] tests: Include UML defconfig Include a defconfig for building kernel as UML. Also update the README with a few notes related to UML. Signed-off-by: Thomas Pedersen --- tests/hwsim/vm/README | 24 ++++-- tests/hwsim/vm/kernel-config.uml | 131 +++++++++++++++++++++++++++++++ 2 files changed, 150 insertions(+), 5 deletions(-) create mode 100644 tests/hwsim/vm/kernel-config.uml diff --git a/tests/hwsim/vm/README b/tests/hwsim/vm/README index 4cea85b98..224d65a26 100644 --- a/tests/hwsim/vm/README +++ b/tests/hwsim/vm/README @@ -1,9 +1,23 @@ -These scripts allow you to run the hwsim tests inside a KVM virtual machine. +These scripts allow you to run the hwsim tests inside a KVM virtual machine or +as a UML (User Mode Linux) program. -To set it up, first compile a kernel with the kernel-config file as the -.config. You can adjust it as needed, the configuration is for a 64-bit -x86 system and should be close to minimal. The architecture must be the -same as your host since the host's filesystem is used. +To set it up, first compile a kernel with the kernel-config[.uml] file as the +.config. You can adjust it as needed, the configuration is for a 64-bit x86 +system and should be close to minimal. The architecture must be the same as +your host since the host's filesystem is used. + +To build the regular x86_64 kernel, simply issue + +yes "" | make -j + +or to build UML: + +yes "" | ARCH=um make -j + +Running a UML kernel is recommended as it can optimize out any sleep()s or +kernel timers by taking advantage of UML time travel mode, greatly increasing +test efficiency (~3200 tests can be run in under 5 minutes using parallel-vm.py +on a 24 core CPU). Install the required tools: at least 'kvm', if you want tracing trace-cmd, valgrind if you want, etc. diff --git a/tests/hwsim/vm/kernel-config.uml b/tests/hwsim/vm/kernel-config.uml new file mode 100644 index 000000000..b0f2f65ac --- /dev/null +++ b/tests/hwsim/vm/kernel-config.uml @@ -0,0 +1,131 @@ +CONFIG_SYSVIPC=y +CONFIG_POSIX_MQUEUE=y +CONFIG_NO_HZ=y +CONFIG_HIGH_RES_TIMERS=y +CONFIG_BSD_PROCESS_ACCT=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_LOG_BUF_SHIFT=14 +CONFIG_CGROUPS=y +CONFIG_BLK_CGROUP=y +CONFIG_CGROUP_SCHED=y +CONFIG_CGROUP_FREEZER=y +CONFIG_CGROUP_DEVICE=y +CONFIG_CGROUP_CPUACCT=y +# CONFIG_PID_NS is not set +CONFIG_SYSFS_DEPRECATED=y +CONFIG_CC_OPTIMIZE_FOR_SIZE=y +CONFIG_SLAB=y +CONFIG_HOSTFS=y +CONFIG_MAGIC_SYSRQ=y +CONFIG_MMAPPER=y +# CONFIG_SECCOMP is not set +CONFIG_UML_TIME_TRAVEL_SUPPORT=y +CONFIG_SSL=y +CONFIG_NULL_CHAN=y +CONFIG_PORT_CHAN=y +CONFIG_PTY_CHAN=y +CONFIG_TTY_CHAN=y +CONFIG_XTERM_CHAN=y +CONFIG_CON_CHAN="pts" +CONFIG_SSL_CHAN="pts" +CONFIG_UML_NET=y +CONFIG_UML_NET_TUNTAP=y +CONFIG_UML_NET_VECTOR=y +# CONFIG_BLK_DEV_BSG is not set +# CONFIG_MQ_IOSCHED_DEADLINE is not set +# CONFIG_MQ_IOSCHED_KYBER is not set +CONFIG_BINFMT_MISC=y +# CONFIG_COMPACTION is not set +CONFIG_NET=y +CONFIG_PACKET=y +CONFIG_UNIX=y +CONFIG_INET=y +CONFIG_IP_MULTICAST=y +CONFIG_IP_ADVANCED_ROUTER=y +CONFIG_IP_MULTIPLE_TABLES=y +CONFIG_NETFILTER=y +CONFIG_BRIDGE_NETFILTER=y +CONFIG_NF_TABLES=y +CONFIG_NETFILTER_XTABLES=y +CONFIG_NETFILTER_XT_MATCH_PKTTYPE=y +CONFIG_NF_TABLES_BRIDGE=y +CONFIG_BRIDGE_NF_EBTABLES=y +CONFIG_BRIDGE_EBT_T_FILTER=y +CONFIG_BRIDGE_EBT_ARP=y +CONFIG_BRIDGE_EBT_IP=y +CONFIG_BRIDGE_EBT_IP6=y +CONFIG_BRIDGE_EBT_PKTTYPE=y +CONFIG_BRIDGE_EBT_ARPREPLY=y +CONFIG_BRIDGE=y +CONFIG_BRIDGE_VLAN_FILTERING=y +CONFIG_VLAN_8021Q=y +CONFIG_CFG80211=y +CONFIG_CFG80211_DEBUGFS=y +CONFIG_CFG80211_WEXT=y +CONFIG_MAC80211=y +CONFIG_MAC80211_MESH=y +CONFIG_MAC80211_DEBUGFS=y +CONFIG_MAC80211_MESSAGE_TRACING=y +CONFIG_MAC80211_DEBUG_MENU=y +CONFIG_MAC80211_VERBOSE_DEBUG=y +CONFIG_MAC80211_MLME_DEBUG=y +CONFIG_MAC80211_STA_DEBUG=y +CONFIG_MAC80211_HT_DEBUG=y +CONFIG_MAC80211_OCB_DEBUG=y +CONFIG_MAC80211_IBSS_DEBUG=y +CONFIG_MAC80211_PS_DEBUG=y +CONFIG_MAC80211_TDLS_DEBUG=y +CONFIG_MAC80211_DEBUG_COUNTERS=y +CONFIG_RFKILL=y +CONFIG_UEVENT_HELPER=y +CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" +CONFIG_DEVTMPFS=y +CONFIG_DEVTMPFS_MOUNT=y +CONFIG_BLK_DEV_UBD=y +CONFIG_BLK_DEV_LOOP=y +CONFIG_DUMMY=y +CONFIG_MACSEC=y +CONFIG_VETH=y +# CONFIG_ETHERNET is not set +# CONFIG_WLAN_VENDOR_ADMTEK is not set +# CONFIG_WLAN_VENDOR_ATH is not set +# CONFIG_WLAN_VENDOR_ATMEL is not set +# CONFIG_WLAN_VENDOR_BROADCOM is not set +# CONFIG_WLAN_VENDOR_CISCO is not set +# CONFIG_WLAN_VENDOR_INTEL is not set +# CONFIG_WLAN_VENDOR_INTERSIL is not set +# CONFIG_WLAN_VENDOR_MARVELL is not set +# CONFIG_WLAN_VENDOR_MEDIATEK is not set +# CONFIG_WLAN_VENDOR_RALINK is not set +# CONFIG_WLAN_VENDOR_REALTEK is not set +# CONFIG_WLAN_VENDOR_RSI is not set +# CONFIG_WLAN_VENDOR_ST is not set +# CONFIG_WLAN_VENDOR_TI is not set +# CONFIG_WLAN_VENDOR_ZYDAS is not set +# CONFIG_WLAN_VENDOR_QUANTENNA is not set +CONFIG_MAC80211_HWSIM=y +CONFIG_LEGACY_PTY_COUNT=32 +# CONFIG_HW_RANDOM is not set +CONFIG_UML_RANDOM=y +# CONFIG_IOMMU_SUPPORT is not set +# CONFIG_DNOTIFY is not set +# CONFIG_INOTIFY_USER is not set +CONFIG_PROC_KCORE=y +CONFIG_TMPFS=y +# CONFIG_MISC_FILESYSTEMS is not set +# CONFIG_NETWORK_FILESYSTEMS is not set +CONFIG_NLS=y +CONFIG_LSM="yama,loadpin,safesetid,integrity" +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_ARC4=y +CONFIG_CRC16=y +CONFIG_PRINTK_TIME=y +CONFIG_DEBUG_INFO=y +CONFIG_FRAME_WARN=1024 +CONFIG_DEBUG_FS=y +CONFIG_DEBUG_KERNEL=y +CONFIG_PANIC_ON_OOPS=y +CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y +CONFIG_PREEMPTIRQ_EVENTS=y +# CONFIG_RUNTIME_TESTING_MENU is not set