-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimized kernel config for better general kernel support and saner defaults #245
Optimized kernel config for better general kernel support and saner defaults #245
Conversation
Enabled a number of scenarios some of which are addressed in smaller PRs. This should make it easier to troubleshoot the Hyper-V side for bringing support to some features. USBIP has been enabled as this is a known working scenario with use of extra software installed on both Windows and WSL2. Adds ExFAT, NTFS, and IPv6 support (still needs work on the VM side). Improves performance and security features of the kernel. Use bcc to test perf improvements (enabled as part of PR).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick thoughts on things that might be an issue or could be improved. (all in my opinion as a third-party watcher)
CONFIG_KVM_INTEL=y | ||
CONFIG_KVM_AMD=y |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this disable nested virtualisation on AMD platforms? Was this an intentional change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I dropped all AMD support though it could be added back if needed. Most users have Intel processors including me (at least in corporate environment) so decided it should be disabled by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AMD currently has around a 20% market share. I suggest that is a large enough market share to leave AMD enabled by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I dropped all AMD support though it could be added back if needed. Most users have Intel processors including me (at least in corporate environment) so decided it should be disabled by default.
What does this mean for WSL users who have AMD processors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A controlled corporate environment with a limited set of hardware configuration is not a good representation of the systems out there. There is a massive amount of AMD systems in active use (including the one I'm writing this from).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a person who primarily relies on WSL2 to do some heavy compute on my Ryzen box, this is apocalyptically dumb. Please reconsider.
# CONFIG_FB is not set | ||
CONFIG_FB_CMDLINE=y | ||
CONFIG_FB_NOTIFY=y | ||
CONFIG_FB=y | ||
CONFIG_FIRMWARE_EDID=y | ||
CONFIG_FB_CFB_FILLRECT=y | ||
CONFIG_FB_CFB_COPYAREA=y | ||
CONFIG_FB_CFB_IMAGEBLIT=y | ||
# CONFIG_FB_FOREIGN_ENDIAN is not set | ||
CONFIG_FB_DEFERRED_IO=y | ||
CONFIG_FB_MODE_HELPERS=y | ||
CONFIG_FB_TILEBLITTING=y | ||
|
||
# | ||
# Frame buffer hardware drivers | ||
# | ||
# CONFIG_FB_CIRRUS is not set | ||
# CONFIG_FB_PM2 is not set | ||
# CONFIG_FB_CYBER2000 is not set | ||
# CONFIG_FB_ARC is not set | ||
# CONFIG_FB_ASILIANT is not set | ||
# CONFIG_FB_IMSTT is not set | ||
# CONFIG_FB_VGA16 is not set | ||
# CONFIG_FB_UVESA is not set | ||
# CONFIG_FB_VESA is not set | ||
# CONFIG_FB_EFI is not set | ||
# CONFIG_FB_N411 is not set | ||
# CONFIG_FB_HGA is not set | ||
# CONFIG_FB_OPENCORES is not set | ||
# CONFIG_FB_S1D13XXX is not set | ||
# CONFIG_FB_NVIDIA is not set | ||
# CONFIG_FB_RIVA is not set | ||
# CONFIG_FB_I740 is not set | ||
# CONFIG_FB_LE80578 is not set | ||
# CONFIG_FB_MATROX is not set | ||
# CONFIG_FB_RADEON is not set | ||
# CONFIG_FB_ATY128 is not set | ||
# CONFIG_FB_ATY is not set | ||
# CONFIG_FB_S3 is not set | ||
# CONFIG_FB_SAVAGE is not set | ||
# CONFIG_FB_SIS is not set | ||
# CONFIG_FB_NEOMAGIC is not set | ||
# CONFIG_FB_KYRO is not set | ||
# CONFIG_FB_3DFX is not set | ||
# CONFIG_FB_VOODOO1 is not set | ||
# CONFIG_FB_VT8623 is not set | ||
# CONFIG_FB_TRIDENT is not set | ||
# CONFIG_FB_ARK is not set | ||
# CONFIG_FB_PM3 is not set | ||
# CONFIG_FB_CARMINE is not set | ||
# CONFIG_FB_SMSCUFX is not set | ||
# CONFIG_FB_UDL is not set | ||
# CONFIG_FB_IBM_GXT4500 is not set | ||
# CONFIG_FB_VIRTUAL is not set | ||
# CONFIG_FB_METRONOME is not set | ||
# CONFIG_FB_MB862XX is not set | ||
CONFIG_FB_HYPERV=y | ||
# CONFIG_FB_SIMPLE is not set | ||
# CONFIG_FB_SM712 is not set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the FrameBuffer considering it cannot be accessed by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This helps boosts the perf as compared to without and is using the hyper-v backend so its likely enabled for WSL2 but maybe its experimental or leftover from code used for Hyper-v. Either way it works for me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need some benchmarks and complete documentation of testing methodology to back up your claim. You cannot claim perf boost without it.
@@ -2211,29 +2378,239 @@ CONFIG_BCMA_POSSIBLE=y | |||
# | |||
# Console display driver support | |||
# | |||
# CONFIG_VGA_CONSOLE is not set | |||
CONFIG_VGA_CONSOLE=y |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly not but with GUI support coming, having VGA support would be helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unnecessary since the display is a remote Wayland server anyways. This is superficial.
# CONFIG_HID is not set | ||
CONFIG_HID=y | ||
# CONFIG_HID_BATTERY_STRENGTH is not set | ||
CONFIG_HIDRAW=y | ||
# CONFIG_UHID is not set | ||
CONFIG_HID_GENERIC=y | ||
|
||
# | ||
# Special HID drivers | ||
# | ||
# CONFIG_HID_A4TECH is not set | ||
# CONFIG_HID_ACCUTOUCH is not set | ||
# CONFIG_HID_ACRUX is not set | ||
# CONFIG_HID_APPLE is not set | ||
# CONFIG_HID_APPLEIR is not set | ||
# CONFIG_HID_AUREAL is not set | ||
# CONFIG_HID_BELKIN is not set | ||
# CONFIG_HID_BETOP_FF is not set | ||
# CONFIG_HID_CHERRY is not set | ||
# CONFIG_HID_CHICONY is not set | ||
# CONFIG_HID_COUGAR is not set | ||
# CONFIG_HID_MACALLY is not set | ||
# CONFIG_HID_CMEDIA is not set | ||
# CONFIG_HID_CREATIVE_SB0540 is not set | ||
# CONFIG_HID_CYPRESS is not set | ||
# CONFIG_HID_DRAGONRISE is not set | ||
# CONFIG_HID_EMS_FF is not set | ||
# CONFIG_HID_ELECOM is not set | ||
# CONFIG_HID_ELO is not set | ||
# CONFIG_HID_EZKEY is not set | ||
# CONFIG_HID_GEMBIRD is not set | ||
# CONFIG_HID_GFRM is not set | ||
# CONFIG_HID_GLORIOUS is not set | ||
# CONFIG_HID_HOLTEK is not set | ||
# CONFIG_HID_VIVALDI is not set | ||
# CONFIG_HID_KEYTOUCH is not set | ||
# CONFIG_HID_KYE is not set | ||
# CONFIG_HID_UCLOGIC is not set | ||
# CONFIG_HID_WALTOP is not set | ||
# CONFIG_HID_VIEWSONIC is not set | ||
# CONFIG_HID_GYRATION is not set | ||
# CONFIG_HID_ICADE is not set | ||
# CONFIG_HID_ITE is not set | ||
# CONFIG_HID_JABRA is not set | ||
# CONFIG_HID_TWINHAN is not set | ||
# CONFIG_HID_KENSINGTON is not set | ||
# CONFIG_HID_LCPOWER is not set | ||
# CONFIG_HID_LENOVO is not set | ||
# CONFIG_HID_MAGICMOUSE is not set | ||
# CONFIG_HID_MALTRON is not set | ||
# CONFIG_HID_MAYFLASH is not set | ||
# CONFIG_HID_REDRAGON is not set | ||
CONFIG_HID_MICROSOFT=y | ||
# CONFIG_HID_MONTEREY is not set | ||
# CONFIG_HID_MULTITOUCH is not set | ||
# CONFIG_HID_NTI is not set | ||
# CONFIG_HID_NTRIG is not set | ||
# CONFIG_HID_ORTEK is not set | ||
# CONFIG_HID_PANTHERLORD is not set | ||
# CONFIG_HID_PENMOUNT is not set | ||
# CONFIG_HID_PETALYNX is not set | ||
# CONFIG_HID_PICOLCD is not set | ||
# CONFIG_HID_PLANTRONICS is not set | ||
# CONFIG_HID_PRIMAX is not set | ||
# CONFIG_HID_RETRODE is not set | ||
# CONFIG_HID_ROCCAT is not set | ||
# CONFIG_HID_SAITEK is not set | ||
# CONFIG_HID_SAMSUNG is not set | ||
# CONFIG_HID_SPEEDLINK is not set | ||
# CONFIG_HID_STEAM is not set | ||
# CONFIG_HID_STEELSERIES is not set | ||
# CONFIG_HID_SUNPLUS is not set | ||
# CONFIG_HID_RMI is not set | ||
# CONFIG_HID_GREENASIA is not set | ||
CONFIG_HID_HYPERV_MOUSE=y | ||
# CONFIG_HID_SMARTJOYPLUS is not set | ||
# CONFIG_HID_TIVO is not set | ||
# CONFIG_HID_TOPSEED is not set | ||
# CONFIG_HID_THRUSTMASTER is not set | ||
# CONFIG_HID_UDRAW_PS3 is not set | ||
# CONFIG_HID_WACOM is not set | ||
# CONFIG_HID_XINMO is not set | ||
# CONFIG_HID_ZEROPLUS is not set | ||
# CONFIG_HID_ZYDACRON is not set | ||
# CONFIG_HID_SENSOR_HUB is not set | ||
# CONFIG_HID_ALPS is not set | ||
# end of Special HID drivers | ||
|
||
# | ||
# USB HID support | ||
# | ||
CONFIG_USB_HID=y | ||
CONFIG_HID_PID=y | ||
CONFIG_USB_HIDDEV=y | ||
# end of USB HID support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need HID support when there is no display/station/console access to the VM? If we do desire HID support we at least likely do not need CONFIG_HID_HYPERV_MOUSE
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is access to this VM if you enable Hyper-v. I assume the CONFIG_HID_HYPERV_MOUSE would be needed at minimum. I am unsure about CONFIG_HID_MICROSOFT=y as it could simply mean certain devices. This was enabled with thinking of "rather safe than sorry". I'd love to have an expert on HID and Hyper-v provide details on this
@@ -3206,13 +3640,13 @@ CONFIG_SBITMAP=y | |||
# | |||
CONFIG_PRINTK_TIME=y | |||
# CONFIG_PRINTK_CALLER is not set | |||
CONFIG_CONSOLE_LOGLEVEL_DEFAULT=2 | |||
CONFIG_CONSOLE_LOGLEVEL_DEFAULT=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly not a desirable change - the console is only accessible in read-only view via the wsl2.debugconsole
configuration in .wslconfig
so having the extra information is not a detriment and can be helpful for debugging the VM when it is failing to let you in to access the kernel ringbuffer via dmesg
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe I got this originally from Clear Linux. If we want extra debugging, I'd happy to change it back.
# CONFIG_KERNEL_BZIP2 is not set | ||
# CONFIG_KERNEL_LZMA is not set | ||
# CONFIG_KERNEL_XZ is not set | ||
CONFIG_KERNEL_XZ=y |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is potentially slower than the original gzip
or an alternative like lzma
or zstd
. Size vs speed might be the wrong thing to focus on. Faster startup would be most desirable IMO, so using zstd
would be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately I found I needed smaller rather than faster here and this compression algorithm is supposed to be fast in decompression as well. I thought about zstd instead but looking to make the kernel size as small as possible.
@@ -347,7 +356,7 @@ CONFIG_IA32_FEAT_CTL=y | |||
CONFIG_X86_VMX_FEATURE_NAMES=y | |||
CONFIG_PROCESSOR_SELECT=y | |||
CONFIG_CPU_SUP_INTEL=y | |||
CONFIG_CPU_SUP_AMD=y | |||
# CONFIG_CPU_SUP_AMD is not set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to drop AMD support here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really a indicative of good change. Your use case should not represent everyone's use case. Bring back AMD support or you're going to end up breaking 20% of workstations with AMD.
Hi, Will it be possible to include VRF support as a part of this work? It will need enabling:
The context is that we are trying to adopt WSL2 as our dev environment and having VRF support is essential for our dev work. |
Can you file an issue on WSL repo and explain the use case of VRF? I'm trying to allow common scenarios to be enabled while improving the performance and security too. |
Thanks! I have raised microsoft/WSL#6850. |
Co-authored-by: Daniel Llewellyn <[email protected]>
Thank you for your contribution. We currently don't see enough data for this change to be warranted and are closing out this pull request. |
FWIW, if, like I did, you ended up at this bug while searching for how to enable USBIP, I have updated instructions and a build script at https://github.com/supersat/usbip-wsl2-instructions. It can build USBIP as a set of kernel modules, so you don't need to replace your kernel. (There is a unfortunate patch that needs to be applied to build genalloc as a module, since 1) it is a dependency of USBIP, 2) isn't included in the WSL kernel, and 3) doesn't natively support being built as a module.) |
I plan on adding the AMD support back when I get to it and was hopeful it would be provided a bit more consideration at that time. Are you suggesting that the "data" reflects that the enablement of several scenarios doesn't seem to really be there? I would ask where this data is coming from. Telemetry? I bet it's been disabled for most users to max degree it can be for Windows and wouldn't be the accurate data point to base from. If it's based on GH issues, that also would be a poor place to look. Everything here has been requested by a number of developers or heavily in use in other smaller kernel changes. All I've done is consolidate everything and do my best to increase the performance and security of the kernel. I would suggest instead merging this PR once I add the AMD support back in and test it out in Insiders. It can be reverted before the next stable if needed but I'd expect you to hear alot more positive feedback from users once this PR has been merged. |
The WSL team has discussed and decided that the WSL 2 Linux kernel GitHub repo is not taking pull requests. Removal of AMD support is not the plan of record, so we do not have any intention to remove AMD on WSL. The WSL 2 Linux kernel repo was always intended to provide the additional infrastructure necessary to build and release the kernel component of WSL 2. It was never designed to replace the current existing community and feedback channels for WSL, especially through https://github.com/microsoft/WSL. This is why we are not accepting issues or pull requests through this repository. We understand that this should have been better communicated and implemented from the beginning. While we understand that it is frustrating to have a PR closed, it is never our intention to ignore feedback or stifle community discussions. We are taking this opportunity to increase transparency on how we work with the WSL community and ensure all members are routed to the appropriate resources. If you would like contribute to, discuss, or report an issue relating to WSL, or the WSL 2 Linux kernel configuration, please do so at the WSL GitHub. The team is actively monitoring and responding to user feedback there: https://github.com/microsoft/WSL. The WSL 2 Linux kernel is based on the Linux version from https://www.kernel.org/. If you would like to contribute to or report an issue on the Linux kernel in general, please do so on the upstream Linux GitHub: https://www.kernel.org/doc/html/latest/process/submitting-patches.html. |
Enables a number of scenarios some of which are addressed in smaller PRs. USBIP has been enabled as this is a known working scenario with use of extra software installed on both Windows and WSL2. Adds ExFAT, NTFS, and IPv6 support. This should make it easier to troubleshoot the Hyper-V side for bringing support to some features. Improves the security posture and boosts performance of the kernel. Use bcc to compare the difference (Required kernel options are enabled in this PR). @craigloewen-msft and @sashalevin.