Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
8d8d1f8f18 | ||
|
24f561c816 | ||
|
f033dc9a50 | ||
|
e64616ef3c | ||
|
d638829538 |
@@ -246,18 +246,18 @@ _NR_CPUS_value=""
|
||||
|
||||
#### LEGACY OPTIONS ####
|
||||
|
||||
# Set to "true" to enable support for fsync, an experimental replacement for esync found in Valve Proton 4.11+ - https://steamcommunity.com/games/221410/announcements/detail/2957094910196249305
|
||||
# Can be enabled alongside _futex_waitv on 5.13+ to use it as a fallback for older Proton builds
|
||||
_fsync="true"
|
||||
# Upstreamed version of Fsync from Linux 5.16 for previous kernel versions - https://github.com/andrealmeid/futex_waitv_patches
|
||||
# ! Only affect 5.13, 5.14 and 5.15 kernel branches. Safely ignored for 5.16 or newer !
|
||||
_fsync_backport="true"
|
||||
|
||||
# Set to "true" to enable backported patches to add support for the futex_waitv() syscall, a new interface for fsync. Upstream as of 5.16 and requires a wine/proton with builtin support for it - https://github.com/ValveSoftware/wine/pull/128
|
||||
# !! Disables futex2 interfaces support !!
|
||||
# https://github.com/andrealmeid/futex_waitv_patches
|
||||
_futex_waitv="true"
|
||||
# Fsync legacy, known as FUTEX_WAIT_MULTIPLE (opcode 31) - previous version of fsync required for Valve Proton 4.11, 5.0 and 5.13 - https://steamcommunity.com/games/221410/announcements/detail/2957094910196249305
|
||||
_fsync_legacy="true"
|
||||
|
||||
# Set to "true" to enable support for futex2, an experimental interface that can be used by proton-tkg and proton 5.13 experimental through Fsync - Can be enabled alongside fsync to use it as a fallback
|
||||
# Set to "true" to enable support for futex2, a DEPRECATED interface that can be used by proton-tkg and proton 5.13 experimental through Fsync - Can be enabled alongside fsync legacy to use it as a fallback
|
||||
# https://gitlab.collabora.com/tonyk/linux/-/tree/futex2-dev
|
||||
_futex2="true"
|
||||
# ! Only affect 5.10-5.14 kernel branches. Safely ignored for 5.15 or newer !
|
||||
# ! required _fsync_backport="false" !
|
||||
_fsync_futex2="false"
|
||||
|
||||
# Set to "true" to add back missing symbol for AES-NI/AVX support on ZFS - This is a legacy option that can be ignored on 5.10+ kernels - https://github.com/NixOS/nixpkgs/blob/master/pkgs/os-specific/linux/kernel/export_kernel_fpu_functions.patch
|
||||
_zfsfix="true"
|
||||
|
@@ -1,15 +1,15 @@
|
||||
#
|
||||
# Automatically generated file; DO NOT EDIT.
|
||||
# Linux/x86 5.15.61 Kernel Configuration
|
||||
# Linux/x86 5.15.106 Kernel Configuration
|
||||
#
|
||||
CONFIG_CC_VERSION_TEXT="gcc (TkG-mostlyportable) 12.1.1 20220515"
|
||||
CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.2.1 20230201"
|
||||
CONFIG_CC_IS_GCC=y
|
||||
CONFIG_GCC_VERSION=120101
|
||||
CONFIG_GCC_VERSION=120201
|
||||
CONFIG_CLANG_VERSION=0
|
||||
CONFIG_AS_IS_GNU=y
|
||||
CONFIG_AS_VERSION=20244315
|
||||
CONFIG_AS_VERSION=24000
|
||||
CONFIG_LD_IS_BFD=y
|
||||
CONFIG_LD_VERSION=20244315
|
||||
CONFIG_LD_VERSION=24000
|
||||
CONFIG_LLD_VERSION=0
|
||||
CONFIG_CC_CAN_LINK=y
|
||||
CONFIG_CC_CAN_LINK_STATIC=y
|
||||
@@ -18,6 +18,7 @@ CONFIG_CC_HAS_ASM_GOTO_OUTPUT=y
|
||||
CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT=y
|
||||
CONFIG_CC_HAS_ASM_INLINE=y
|
||||
CONFIG_CC_HAS_NO_PROFILE_FN_ATTR=y
|
||||
CONFIG_PAHOLE_VERSION=124
|
||||
CONFIG_IRQ_WORK=y
|
||||
CONFIG_BUILDTIME_TABLE_SORT=y
|
||||
CONFIG_THREAD_INFO_IN_TASK=y
|
||||
@@ -437,7 +438,7 @@ CONFIG_I8K=m
|
||||
CONFIG_MICROCODE=y
|
||||
CONFIG_MICROCODE_INTEL=y
|
||||
CONFIG_MICROCODE_AMD=y
|
||||
# CONFIG_MICROCODE_OLD_INTERFACE is not set
|
||||
# CONFIG_MICROCODE_LATE_LOADING is not set
|
||||
CONFIG_X86_MSR=y
|
||||
CONFIG_X86_CPUID=y
|
||||
CONFIG_X86_5LEVEL=y
|
||||
@@ -1142,6 +1143,7 @@ CONFIG_INET_ESP=m
|
||||
CONFIG_INET_ESP_OFFLOAD=m
|
||||
CONFIG_INET_ESPINTCP=y
|
||||
CONFIG_INET_IPCOMP=m
|
||||
CONFIG_INET_TABLE_PERTURB_ORDER=16
|
||||
CONFIG_INET_XFRM_TUNNEL=m
|
||||
CONFIG_INET_TUNNEL=m
|
||||
CONFIG_INET_DIAG=m
|
||||
@@ -1707,7 +1709,6 @@ CONFIG_DEFAULT_NET_SCH="fq_codel"
|
||||
#
|
||||
CONFIG_NET_CLS=y
|
||||
CONFIG_NET_CLS_BASIC=m
|
||||
CONFIG_NET_CLS_TCINDEX=m
|
||||
CONFIG_NET_CLS_ROUTE4=m
|
||||
CONFIG_NET_CLS_FW=m
|
||||
CONFIG_NET_CLS_U32=m
|
||||
@@ -9898,6 +9899,7 @@ CONFIG_GCC_PLUGIN_STRUCTLEAK=y
|
||||
# Memory initialization
|
||||
#
|
||||
CONFIG_CC_HAS_AUTO_VAR_INIT_PATTERN=y
|
||||
CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO_BARE=y
|
||||
CONFIG_CC_HAS_AUTO_VAR_INIT_ZERO=y
|
||||
# CONFIG_INIT_STACK_NONE is not set
|
||||
# CONFIG_GCC_PLUGIN_STRUCTLEAK_USER is not set
|
||||
@@ -10351,6 +10353,8 @@ CONFIG_SYMBOLIC_ERRNAME=y
|
||||
CONFIG_DEBUG_BUGVERBOSE=y
|
||||
# end of printk and dmesg options
|
||||
|
||||
CONFIG_AS_HAS_NON_CONST_LEB128=y
|
||||
|
||||
#
|
||||
# Compile-time checks and compiler options
|
||||
#
|
||||
@@ -10360,6 +10364,7 @@ CONFIG_DEBUG_INFO=y
|
||||
# CONFIG_DEBUG_INFO_SPLIT is not set
|
||||
# CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT is not set
|
||||
CONFIG_DEBUG_INFO_DWARF4=y
|
||||
# CONFIG_DEBUG_INFO_DWARF5 is not set
|
||||
CONFIG_DEBUG_INFO_BTF=y
|
||||
CONFIG_PAHOLE_HAS_SPLIT_BTF=y
|
||||
CONFIG_DEBUG_INFO_BTF_MODULES=y
|
||||
|
@@ -1,15 +1,15 @@
|
||||
#
|
||||
# Automatically generated file; DO NOT EDIT.
|
||||
# Linux/x86 6.1.0-arch1 Kernel Configuration
|
||||
# Linux/x86 6.1.23 Kernel Configuration
|
||||
#
|
||||
CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.2.0"
|
||||
CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.2.1 20230201"
|
||||
CONFIG_CC_IS_GCC=y
|
||||
CONFIG_GCC_VERSION=120200
|
||||
CONFIG_GCC_VERSION=120201
|
||||
CONFIG_CLANG_VERSION=0
|
||||
CONFIG_AS_IS_GNU=y
|
||||
CONFIG_AS_VERSION=23900
|
||||
CONFIG_AS_VERSION=24000
|
||||
CONFIG_LD_IS_BFD=y
|
||||
CONFIG_LD_VERSION=23900
|
||||
CONFIG_LD_VERSION=24000
|
||||
CONFIG_LLD_VERSION=0
|
||||
CONFIG_CC_CAN_LINK=y
|
||||
CONFIG_CC_CAN_LINK_STATIC=y
|
||||
@@ -206,6 +206,7 @@ CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y
|
||||
CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH=y
|
||||
CONFIG_CC_HAS_INT128=y
|
||||
CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5"
|
||||
CONFIG_GCC11_NO_ARRAY_BOUNDS=y
|
||||
CONFIG_GCC12_NO_ARRAY_BOUNDS=y
|
||||
CONFIG_CC_NO_ARRAY_BOUNDS=y
|
||||
CONFIG_ARCH_SUPPORTS_INT128=y
|
||||
@@ -1784,7 +1785,6 @@ CONFIG_DEFAULT_NET_SCH="fq_codel"
|
||||
#
|
||||
CONFIG_NET_CLS=y
|
||||
CONFIG_NET_CLS_BASIC=m
|
||||
CONFIG_NET_CLS_TCINDEX=m
|
||||
CONFIG_NET_CLS_ROUTE4=m
|
||||
CONFIG_NET_CLS_FW=m
|
||||
CONFIG_NET_CLS_U32=m
|
||||
@@ -4456,7 +4456,6 @@ CONFIG_SERIAL_ARC_NR_PORTS=1
|
||||
CONFIG_SERIAL_RP2=m
|
||||
CONFIG_SERIAL_RP2_NR_UARTS=32
|
||||
CONFIG_SERIAL_FSL_LPUART=m
|
||||
CONFIG_SERIAL_FSL_LPUART_CONSOLE=y
|
||||
CONFIG_SERIAL_FSL_LINFLEXUART=m
|
||||
CONFIG_SERIAL_MEN_Z135=m
|
||||
CONFIG_SERIAL_SPRD=m
|
||||
@@ -6527,7 +6526,6 @@ CONFIG_DRM=y
|
||||
CONFIG_DRM_MIPI_DBI=m
|
||||
CONFIG_DRM_MIPI_DSI=y
|
||||
# CONFIG_DRM_DEBUG_MM is not set
|
||||
CONFIG_DRM_USE_DYNAMIC_DEBUG=y
|
||||
CONFIG_DRM_KMS_HELPER=y
|
||||
CONFIG_DRM_FBDEV_EMULATION=y
|
||||
CONFIG_DRM_FBDEV_OVERALLOC=100
|
||||
@@ -6598,7 +6596,6 @@ CONFIG_DRM_I915_FORCE_PROBE="*"
|
||||
CONFIG_DRM_I915_CAPTURE_ERROR=y
|
||||
CONFIG_DRM_I915_COMPRESS_ERROR=y
|
||||
CONFIG_DRM_I915_USERPTR=y
|
||||
CONFIG_DRM_I915_GVT=y
|
||||
CONFIG_DRM_I915_GVT_KVMGT=m
|
||||
CONFIG_DRM_I915_PXP=y
|
||||
CONFIG_DRM_I915_REQUEST_TIMEOUT=20000
|
||||
@@ -6609,6 +6606,7 @@ CONFIG_DRM_I915_PREEMPT_TIMEOUT=640
|
||||
CONFIG_DRM_I915_MAX_REQUEST_BUSYWAIT=8000
|
||||
CONFIG_DRM_I915_STOP_TIMEOUT=100
|
||||
CONFIG_DRM_I915_TIMESLICE_DURATION=1
|
||||
CONFIG_DRM_I915_GVT=y
|
||||
CONFIG_DRM_VGEM=m
|
||||
CONFIG_DRM_VKMS=m
|
||||
CONFIG_DRM_VMWGFX=m
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# Automatically generated file; DO NOT EDIT.
|
||||
# Linux/x86 6.2.5-arch1 Kernel Configuration
|
||||
# Linux/x86 6.2.10 Kernel Configuration
|
||||
#
|
||||
CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.2.1 20230201"
|
||||
CONFIG_CC_IS_GCC=y
|
||||
@@ -4494,7 +4494,6 @@ CONFIG_SERIAL_ARC_NR_PORTS=1
|
||||
CONFIG_SERIAL_RP2=m
|
||||
CONFIG_SERIAL_RP2_NR_UARTS=32
|
||||
CONFIG_SERIAL_FSL_LPUART=m
|
||||
CONFIG_SERIAL_FSL_LPUART_CONSOLE=y
|
||||
CONFIG_SERIAL_FSL_LINFLEXUART=m
|
||||
CONFIG_SERIAL_MEN_Z135=m
|
||||
CONFIG_SERIAL_SPRD=m
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# Automatically generated file; DO NOT EDIT.
|
||||
# Linux/x86 6.3.0-rc1 Kernel Configuration
|
||||
# Linux/x86 6.3.0-rc6 Kernel Configuration
|
||||
#
|
||||
CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.2.1 20230201"
|
||||
CONFIG_CC_IS_GCC=y
|
||||
@@ -993,7 +993,6 @@ CONFIG_EFI_PARTITION=y
|
||||
# CONFIG_CMDLINE_PARTITION is not set
|
||||
# end of Partition Types
|
||||
|
||||
CONFIG_BLOCK_COMPAT=y
|
||||
CONFIG_BLK_MQ_PCI=y
|
||||
CONFIG_BLK_MQ_VIRTIO=y
|
||||
CONFIG_BLK_MQ_RDMA=y
|
||||
@@ -3333,6 +3332,7 @@ CONFIG_MICROSOFT_MANA=m
|
||||
CONFIG_NET_VENDOR_MYRI=y
|
||||
CONFIG_MYRI10GE=m
|
||||
CONFIG_MYRI10GE_DCA=y
|
||||
CONFIG_FEALNX=m
|
||||
CONFIG_NET_VENDOR_NI=y
|
||||
CONFIG_NI_XGE_MANAGEMENT_ENET=m
|
||||
CONFIG_NET_VENDOR_NATSEMI=y
|
||||
@@ -4499,7 +4499,6 @@ CONFIG_SERIAL_ARC_NR_PORTS=1
|
||||
CONFIG_SERIAL_RP2=m
|
||||
CONFIG_SERIAL_RP2_NR_UARTS=32
|
||||
CONFIG_SERIAL_FSL_LPUART=m
|
||||
CONFIG_SERIAL_FSL_LPUART_CONSOLE=y
|
||||
CONFIG_SERIAL_FSL_LINFLEXUART=m
|
||||
CONFIG_SERIAL_MEN_Z135=m
|
||||
CONFIG_SERIAL_SPRD=m
|
||||
@@ -8756,7 +8755,6 @@ CONFIG_RTLLIB_CRYPTO_WEP=m
|
||||
CONFIG_RTL8192E=m
|
||||
CONFIG_RTL8723BS=m
|
||||
CONFIG_R8712U=m
|
||||
CONFIG_R8188EU=m
|
||||
CONFIG_RTS5208=m
|
||||
CONFIG_VT6655=m
|
||||
CONFIG_VT6656=m
|
||||
|
@@ -252,7 +252,7 @@ _set_cpu_scheduler() {
|
||||
["bore"]="BORE (Burst-Oriented Response Enhancer) CPU Scheduler"
|
||||
)
|
||||
|
||||
# CPU SCHED selector
|
||||
# CPU SCHED selector - _projectc_unoff=1 sets unofficial Project C revision flag for a given version
|
||||
if [ "$_kver" = "504" ]; then
|
||||
_avail_cpu_scheds=("pds" "bmq" "muqss" "cacule" "cfs")
|
||||
elif [ "$_kver" = "507" ]; then
|
||||
@@ -285,7 +285,6 @@ _set_cpu_scheduler() {
|
||||
_avail_cpu_scheds=("cfs" "pds" "bmq" "tt" "bore")
|
||||
elif [ "$_kver" = "602" ]; then
|
||||
_avail_cpu_scheds=("cfs" "pds" "bmq" "tt" "bore")
|
||||
_projectc_unoff=1
|
||||
else
|
||||
_avail_cpu_scheds=("cfs")
|
||||
fi
|
||||
@@ -726,6 +725,8 @@ _tkg_srcprep() {
|
||||
rev=2
|
||||
elif [ "$_kver" = "601" ]; then
|
||||
rev=1
|
||||
elif [ "$_kver" = "602" ]; then
|
||||
rev=2
|
||||
else
|
||||
rev=0
|
||||
fi
|
||||
@@ -1391,10 +1392,10 @@ _tkg_srcprep() {
|
||||
fi
|
||||
fi
|
||||
|
||||
# futex_waitv support
|
||||
# fsync (futex_waitv) support
|
||||
tkgpatch="$srcdir/0007-v${_basekernel}-futex_waitv.patch"
|
||||
if [ -e "$tkgpatch" ]; then
|
||||
if [ -z "$_futex_waitv" ]; then
|
||||
if [ -z "$_fsync_backport" ]; then
|
||||
plain ""
|
||||
plain "Enable support for futex_waitv, backported patches for fsync from 5.16 Kernel"
|
||||
plain "! Will disable futex2 patchset !"
|
||||
@@ -1402,33 +1403,33 @@ _tkg_srcprep() {
|
||||
plain "https://github.com/ValveSoftware/wine/pull/128"
|
||||
read -rp "`echo $' > N/y : '`" CONDITION9;
|
||||
fi
|
||||
if [[ "$CONDITION9" =~ [yY] ]] || [ "$_futex_waitv" = "true" ]; then
|
||||
_msg="Patching futex_waitv support"
|
||||
if [[ "$CONDITION9" =~ [yY] ]] || [ "$_fsync_backport" = "true" ]; then
|
||||
_msg="Patching fsync support"
|
||||
_tkg_patcher
|
||||
_futex2="false"
|
||||
_fsync_futex2="false"
|
||||
fi
|
||||
else
|
||||
_futex_waitv="false"
|
||||
_fsync_backport="false"
|
||||
fi
|
||||
|
||||
# fsync support
|
||||
if [[ $_kver > 515 ]] || [[ "$CONDITION9" =~ [yY] ]] || [ "$_futex_waitv" = "true" ]; then
|
||||
tkgpatch="$srcdir/0007-v${_basekernel}-fsync1_via_futex_waitv.patch"
|
||||
# fsync legacy support
|
||||
if [[ $_kver > 515 ]] || [[ "$CONDITION9" =~ [yY] ]] || [ "$_fsync_backport" = "true" ]; then
|
||||
tkgpatch="$srcdir/0007-v${_basekernel}-fsync_legacy_via_futex_waitv.patch"
|
||||
else
|
||||
tkgpatch="$srcdir/0007-v${_basekernel}-fsync.patch"
|
||||
tkgpatch="$srcdir/0007-v${_basekernel}-fsync_legacy.patch"
|
||||
fi
|
||||
if [ -e "$tkgpatch" ]; then
|
||||
if [ -z "$_fsync" ]; then
|
||||
if [ -z "$_fsync_legacy" ]; then
|
||||
plain ""
|
||||
plain "Enable support for fsync, an experimental replacement for esync in Valve Proton 4.11+"
|
||||
plain "Enable support for FUTEX_WAIT_MULTIPLE (opcode 31) - fsync legacy used in Valve Proton 4.11, 5.0 and 5.13"
|
||||
plain "https://steamcommunity.com/games/221410/announcements/detail/2957094910196249305"
|
||||
if [[ "$CONDITION9" =~ [yY] ]] || [ "$_futex_waitv" = "true" ]; then
|
||||
if [[ "$CONDITION9" =~ [yY] ]] || [ "$_fsync_backport" = "true" ]; then
|
||||
plain "Will be used as a fallback to futex_waitv on older Proton builds if enabled"
|
||||
fi
|
||||
read -rp "`echo $' > N/y : '`" CONDITION10;
|
||||
fi
|
||||
if [[ "$CONDITION10" =~ [yY] ]] || [ "$_fsync" = "true" ]; then
|
||||
_msg="Patching Fsync support"
|
||||
if [[ "$CONDITION10" =~ [yY] ]] || [ "$_fsync_legacy" = "true" ]; then
|
||||
_msg="Patching fsync legacy support"
|
||||
_tkg_patcher
|
||||
fi
|
||||
fi
|
||||
@@ -1436,15 +1437,15 @@ _tkg_srcprep() {
|
||||
# futex2 support
|
||||
tkgpatch="$srcdir/0007-v${_basekernel}-futex2_interface.patch"
|
||||
if [ -e "$tkgpatch" ]; then
|
||||
if [ -z "$_futex2" ]; then
|
||||
if [ -z "$_fsync_futex2" ]; then
|
||||
plain ""
|
||||
plain "Enable support for futex2, an experimental replacement for esync and fsync in Valve Proton 5.13 experimental"
|
||||
plain "Can be enabled alongside regular fsync patchset to have a fallback option"
|
||||
plain "Enable support for futex2, a DEPRECATED replacement for esync and fsync in Valve Proton 5.13 experimental"
|
||||
plain "Can be enabled alongside fsync legacy patchset to have a fallback option"
|
||||
plain "https://gitlab.collabora.com/tonyk/linux/-/tree/futex2-dev"
|
||||
plain "https://github.com/ValveSoftware/Proton/issues/4568"
|
||||
read -rp "`echo $' > N/y : '`" CONDITION11;
|
||||
fi
|
||||
if [[ "$CONDITION11" =~ [yY] ]] || [ "$_futex2" = "true" ]; then
|
||||
if [[ "$CONDITION11" =~ [yY] ]] || [ "$_fsync_futex2" = "true" ]; then
|
||||
_msg="Patching futex2 support"
|
||||
_tkg_patcher
|
||||
_enable "FUTEX2"
|
||||
|
@@ -1,165 +0,0 @@
|
||||
From b70e738f08403950aa3053c36b98c6b0eeb0eb90 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Andr=C3=A9=20Almeida?= <andrealmeid@collabora.com>
|
||||
Date: Mon, 25 Oct 2021 09:49:42 -0300
|
||||
Subject: [PATCH] futex: Add entry point for FUTEX_WAIT_MULTIPLE (opcode 31)
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Add an option to wait on multiple futexes using the old interface, that
|
||||
uses opcode 31 through futex() syscall. Do that by just translation the
|
||||
old interface to use the new code. This allows old and stable versions
|
||||
of Proton to still use fsync in new kernel releases.
|
||||
|
||||
Signed-off-by: André Almeida <andrealmeid@collabora.com>
|
||||
---
|
||||
include/uapi/linux/futex.h | 12 ++++++
|
||||
kernel/futex/core.c | 75 +++++++++++++++++++++++++++++++++++++-
|
||||
2 files changed, 86 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/include/uapi/linux/futex.h b/include/uapi/linux/futex.h
|
||||
index 2a06b99f9803..417c5d89b745 100644
|
||||
--- a/include/uapi/linux/futex.h
|
||||
+++ b/include/uapi/linux/futex.h
|
||||
@@ -22,6 +22,7 @@
|
||||
#define FUTEX_WAIT_REQUEUE_PI 11
|
||||
#define FUTEX_CMP_REQUEUE_PI 12
|
||||
#define FUTEX_LOCK_PI2 13
|
||||
+#define FUTEX_WAIT_MULTIPLE 31
|
||||
|
||||
#define FUTEX_PRIVATE_FLAG 128
|
||||
#define FUTEX_CLOCK_REALTIME 256
|
||||
@@ -68,6 +69,17 @@ struct futex_waitv {
|
||||
__u32 __reserved;
|
||||
};
|
||||
|
||||
+/**
|
||||
+ * struct futex_wait_block - Block of futexes to be waited for
|
||||
+ * @uaddr: User address of the futex
|
||||
+ * @val: Futex value expected by userspace
|
||||
+ * @bitset: Bitset for the optional bitmasked wakeup
|
||||
+ */
|
||||
+struct futex_wait_block {
|
||||
+ __u32 __user *uaddr;
|
||||
+ __u32 val;
|
||||
+ __u32 bitset;
|
||||
+};
|
||||
|
||||
/*
|
||||
* Support for robust futexes: the kernel cleans up held futexes at
|
||||
diff --git a/kernel/futex/core.c b/kernel/futex/core.c
|
||||
index 4a9e7ce3714a..c3f2e65afab8 100644
|
||||
--- a/kernel/futex/core.c
|
||||
+++ b/kernel/futex/core.c
|
||||
@@ -4012,6 +4012,7 @@ static __always_inline bool futex_cmd_has_timeout(u32 cmd)
|
||||
case FUTEX_LOCK_PI2:
|
||||
case FUTEX_WAIT_BITSET:
|
||||
case FUTEX_WAIT_REQUEUE_PI:
|
||||
+ case FUTEX_WAIT_MULTIPLE:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -4024,13 +4025,79 @@ futex_init_timeout(u32 cmd, u32 op, struct timespec64 *ts, ktime_t *t)
|
||||
return -EINVAL;
|
||||
|
||||
*t = timespec64_to_ktime(*ts);
|
||||
- if (cmd == FUTEX_WAIT)
|
||||
+ if (cmd == FUTEX_WAIT || cmd == FUTEX_WAIT_MULTIPLE)
|
||||
*t = ktime_add_safe(ktime_get(), *t);
|
||||
else if (cmd != FUTEX_LOCK_PI && !(op & FUTEX_CLOCK_REALTIME))
|
||||
*t = timens_ktime_to_host(CLOCK_MONOTONIC, *t);
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * futex_read_wait_block - Read an array of futex_wait_block from userspace
|
||||
+ * @uaddr: Userspace address of the block
|
||||
+ * @count: Number of blocks to be read
|
||||
+ *
|
||||
+ * This function creates and allocate an array of futex_q (we zero it to
|
||||
+ * initialize the fields) and then, for each futex_wait_block element from
|
||||
+ * userspace, fill a futex_q element with proper values.
|
||||
+ */
|
||||
+inline struct futex_vector *futex_read_wait_block(u32 __user *uaddr, u32 count)
|
||||
+{
|
||||
+ unsigned int i;
|
||||
+ struct futex_vector *futexv;
|
||||
+ struct futex_wait_block fwb;
|
||||
+ struct futex_wait_block __user *entry =
|
||||
+ (struct futex_wait_block __user *)uaddr;
|
||||
+
|
||||
+ if (!count || count > FUTEX_WAITV_MAX)
|
||||
+ return ERR_PTR(-EINVAL);
|
||||
+
|
||||
+ futexv = kcalloc(count, sizeof(*futexv), GFP_KERNEL);
|
||||
+ if (!futexv)
|
||||
+ return ERR_PTR(-ENOMEM);
|
||||
+
|
||||
+ for (i = 0; i < count; i++) {
|
||||
+ if (copy_from_user(&fwb, &entry[i], sizeof(fwb))) {
|
||||
+ kfree(futexv);
|
||||
+ return ERR_PTR(-EFAULT);
|
||||
+ }
|
||||
+
|
||||
+ futexv[i].w.flags = FUTEX_32;
|
||||
+ futexv[i].w.val = fwb.val;
|
||||
+ futexv[i].w.uaddr = (uintptr_t) (fwb.uaddr);
|
||||
+ futexv[i].q = futex_q_init;
|
||||
+ }
|
||||
+
|
||||
+ return futexv;
|
||||
+}
|
||||
+
|
||||
+int futex_wait_multiple(struct futex_vector *vs, unsigned int count,
|
||||
+ struct hrtimer_sleeper *to);
|
||||
+
|
||||
+int futex_opcode_31(ktime_t *abs_time, u32 __user *uaddr, int count)
|
||||
+{
|
||||
+ int ret;
|
||||
+ struct futex_vector *vs;
|
||||
+ struct hrtimer_sleeper *to = NULL, timeout;
|
||||
+
|
||||
+ to = futex_setup_timer(abs_time, &timeout, 0, 0);
|
||||
+
|
||||
+ vs = futex_read_wait_block(uaddr, count);
|
||||
+
|
||||
+ if (IS_ERR(vs))
|
||||
+ return PTR_ERR(vs);
|
||||
+
|
||||
+ ret = futex_wait_multiple(vs, count, abs_time ? to : NULL);
|
||||
+ kfree(vs);
|
||||
+
|
||||
+ if (to) {
|
||||
+ hrtimer_cancel(&to->timer);
|
||||
+ destroy_hrtimer_on_stack(&to->timer);
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
|
||||
const struct __kernel_timespec __user *, utime,
|
||||
u32 __user *, uaddr2, u32, val3)
|
||||
@@ -4050,6 +4117,9 @@ SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
|
||||
tp = &t;
|
||||
}
|
||||
|
||||
+ if (cmd == FUTEX_WAIT_MULTIPLE)
|
||||
+ return futex_opcode_31(tp, uaddr, val);
|
||||
+
|
||||
return do_futex(uaddr, op, val, tp, uaddr2, (unsigned long)utime, val3);
|
||||
}
|
||||
|
||||
@@ -4551,6 +4621,9 @@ SYSCALL_DEFINE6(futex_time32, u32 __user *, uaddr, int, op, u32, val,
|
||||
tp = &t;
|
||||
}
|
||||
|
||||
+ if (cmd == FUTEX_WAIT_MULTIPLE)
|
||||
+ return futex_opcode_31(tp, uaddr, val);
|
||||
+
|
||||
return do_futex(uaddr, op, val, tp, uaddr2, (unsigned long)utime, val3);
|
||||
}
|
||||
#endif /* CONFIG_COMPAT_32BIT_TIME */
|
||||
--
|
||||
2.33.1
|
||||
|
@@ -1,165 +0,0 @@
|
||||
From b70e738f08403950aa3053c36b98c6b0eeb0eb90 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Andr=C3=A9=20Almeida?= <andrealmeid@collabora.com>
|
||||
Date: Mon, 25 Oct 2021 09:49:42 -0300
|
||||
Subject: [PATCH] futex: Add entry point for FUTEX_WAIT_MULTIPLE (opcode 31)
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Add an option to wait on multiple futexes using the old interface, that
|
||||
uses opcode 31 through futex() syscall. Do that by just translation the
|
||||
old interface to use the new code. This allows old and stable versions
|
||||
of Proton to still use fsync in new kernel releases.
|
||||
|
||||
Signed-off-by: André Almeida <andrealmeid@collabora.com>
|
||||
---
|
||||
include/uapi/linux/futex.h | 12 ++++++
|
||||
kernel/futex/core.c | 75 +++++++++++++++++++++++++++++++++++++-
|
||||
2 files changed, 86 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/include/uapi/linux/futex.h b/include/uapi/linux/futex.h
|
||||
index 2a06b99f9803..417c5d89b745 100644
|
||||
--- a/include/uapi/linux/futex.h
|
||||
+++ b/include/uapi/linux/futex.h
|
||||
@@ -22,6 +22,7 @@
|
||||
#define FUTEX_WAIT_REQUEUE_PI 11
|
||||
#define FUTEX_CMP_REQUEUE_PI 12
|
||||
#define FUTEX_LOCK_PI2 13
|
||||
+#define FUTEX_WAIT_MULTIPLE 31
|
||||
|
||||
#define FUTEX_PRIVATE_FLAG 128
|
||||
#define FUTEX_CLOCK_REALTIME 256
|
||||
@@ -68,6 +69,17 @@ struct futex_waitv {
|
||||
__u32 __reserved;
|
||||
};
|
||||
|
||||
+/**
|
||||
+ * struct futex_wait_block - Block of futexes to be waited for
|
||||
+ * @uaddr: User address of the futex
|
||||
+ * @val: Futex value expected by userspace
|
||||
+ * @bitset: Bitset for the optional bitmasked wakeup
|
||||
+ */
|
||||
+struct futex_wait_block {
|
||||
+ __u32 __user *uaddr;
|
||||
+ __u32 val;
|
||||
+ __u32 bitset;
|
||||
+};
|
||||
|
||||
/*
|
||||
* Support for robust futexes: the kernel cleans up held futexes at
|
||||
diff --git a/kernel/futex/core.c b/kernel/futex/core.c
|
||||
index 4a9e7ce3714a..c3f2e65afab8 100644
|
||||
--- a/kernel/futex/core.c
|
||||
+++ b/kernel/futex/core.c
|
||||
@@ -4012,6 +4012,7 @@ static __always_inline bool futex_cmd_has_timeout(u32 cmd)
|
||||
case FUTEX_LOCK_PI2:
|
||||
case FUTEX_WAIT_BITSET:
|
||||
case FUTEX_WAIT_REQUEUE_PI:
|
||||
+ case FUTEX_WAIT_MULTIPLE:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -4024,13 +4025,79 @@ futex_init_timeout(u32 cmd, u32 op, struct timespec64 *ts, ktime_t *t)
|
||||
return -EINVAL;
|
||||
|
||||
*t = timespec64_to_ktime(*ts);
|
||||
- if (cmd == FUTEX_WAIT)
|
||||
+ if (cmd == FUTEX_WAIT || cmd == FUTEX_WAIT_MULTIPLE)
|
||||
*t = ktime_add_safe(ktime_get(), *t);
|
||||
else if (cmd != FUTEX_LOCK_PI && !(op & FUTEX_CLOCK_REALTIME))
|
||||
*t = timens_ktime_to_host(CLOCK_MONOTONIC, *t);
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * futex_read_wait_block - Read an array of futex_wait_block from userspace
|
||||
+ * @uaddr: Userspace address of the block
|
||||
+ * @count: Number of blocks to be read
|
||||
+ *
|
||||
+ * This function creates and allocate an array of futex_q (we zero it to
|
||||
+ * initialize the fields) and then, for each futex_wait_block element from
|
||||
+ * userspace, fill a futex_q element with proper values.
|
||||
+ */
|
||||
+inline struct futex_vector *futex_read_wait_block(u32 __user *uaddr, u32 count)
|
||||
+{
|
||||
+ unsigned int i;
|
||||
+ struct futex_vector *futexv;
|
||||
+ struct futex_wait_block fwb;
|
||||
+ struct futex_wait_block __user *entry =
|
||||
+ (struct futex_wait_block __user *)uaddr;
|
||||
+
|
||||
+ if (!count || count > FUTEX_WAITV_MAX)
|
||||
+ return ERR_PTR(-EINVAL);
|
||||
+
|
||||
+ futexv = kcalloc(count, sizeof(*futexv), GFP_KERNEL);
|
||||
+ if (!futexv)
|
||||
+ return ERR_PTR(-ENOMEM);
|
||||
+
|
||||
+ for (i = 0; i < count; i++) {
|
||||
+ if (copy_from_user(&fwb, &entry[i], sizeof(fwb))) {
|
||||
+ kfree(futexv);
|
||||
+ return ERR_PTR(-EFAULT);
|
||||
+ }
|
||||
+
|
||||
+ futexv[i].w.flags = FUTEX_32;
|
||||
+ futexv[i].w.val = fwb.val;
|
||||
+ futexv[i].w.uaddr = (uintptr_t) (fwb.uaddr);
|
||||
+ futexv[i].q = futex_q_init;
|
||||
+ }
|
||||
+
|
||||
+ return futexv;
|
||||
+}
|
||||
+
|
||||
+int futex_wait_multiple(struct futex_vector *vs, unsigned int count,
|
||||
+ struct hrtimer_sleeper *to);
|
||||
+
|
||||
+int futex_opcode_31(ktime_t *abs_time, u32 __user *uaddr, int count)
|
||||
+{
|
||||
+ int ret;
|
||||
+ struct futex_vector *vs;
|
||||
+ struct hrtimer_sleeper *to = NULL, timeout;
|
||||
+
|
||||
+ to = futex_setup_timer(abs_time, &timeout, 0, 0);
|
||||
+
|
||||
+ vs = futex_read_wait_block(uaddr, count);
|
||||
+
|
||||
+ if (IS_ERR(vs))
|
||||
+ return PTR_ERR(vs);
|
||||
+
|
||||
+ ret = futex_wait_multiple(vs, count, abs_time ? to : NULL);
|
||||
+ kfree(vs);
|
||||
+
|
||||
+ if (to) {
|
||||
+ hrtimer_cancel(&to->timer);
|
||||
+ destroy_hrtimer_on_stack(&to->timer);
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
|
||||
const struct __kernel_timespec __user *, utime,
|
||||
u32 __user *, uaddr2, u32, val3)
|
||||
@@ -4050,6 +4117,9 @@ SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
|
||||
tp = &t;
|
||||
}
|
||||
|
||||
+ if (cmd == FUTEX_WAIT_MULTIPLE)
|
||||
+ return futex_opcode_31(tp, uaddr, val);
|
||||
+
|
||||
return do_futex(uaddr, op, val, tp, uaddr2, (unsigned long)utime, val3);
|
||||
}
|
||||
|
||||
@@ -4551,6 +4621,9 @@ SYSCALL_DEFINE6(futex_time32, u32 __user *, uaddr, int, op, u32, val,
|
||||
tp = &t;
|
||||
}
|
||||
|
||||
+ if (cmd == FUTEX_WAIT_MULTIPLE)
|
||||
+ return futex_opcode_31(tp, uaddr, val);
|
||||
+
|
||||
return do_futex(uaddr, op, val, tp, uaddr2, (unsigned long)utime, val3);
|
||||
}
|
||||
#endif /* CONFIG_COMPAT_32BIT_TIME */
|
||||
--
|
||||
2.33.1
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -182,11 +182,11 @@ index 4700d24e5d55..8f7a3d7fd9c1 100644
|
||||
/*
|
||||
* Some Atheros AR9xxx and QCA988x chips do not behave after a bus reset.
|
||||
* The device will throw a Link Down error on AER-capable systems and
|
||||
@@ -4513,6 +4613,7 @@ static const struct pci_dev_acs_enabled {
|
||||
{ PCI_VENDOR_ID_ZHAOXIN, 0x9083, pci_quirk_mf_endpoint_acs },
|
||||
/* Zhaoxin Root/Downstream Ports */
|
||||
@@ -5102,6 +5102,7 @@
|
||||
{ PCI_VENDOR_ID_ZHAOXIN, PCI_ANY_ID, pci_quirk_zhaoxin_pcie_ports_acs },
|
||||
+ { PCI_ANY_ID, PCI_ANY_ID, pcie_acs_overrides },
|
||||
/* Wangxun nics */
|
||||
{ PCI_VENDOR_ID_WANGXUN, PCI_ANY_ID, pci_quirk_wangxun_nic_acs },
|
||||
+ { PCI_ANY_ID, PCI_ANY_ID, pcie_acs_overrides },
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user