Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
a5736426eb |
@@ -163,6 +163,24 @@ _acs_override="false"
|
|||||||
# This can be buggy and isn't recommended on a production machine, also enabling this option will not allow you to enable MGLRU.
|
# This can be buggy and isn't recommended on a production machine, also enabling this option will not allow you to enable MGLRU.
|
||||||
_bcachefs="false"
|
_bcachefs="false"
|
||||||
|
|
||||||
|
# Set to "true" to add multi-generational LRU framework support on kernel 5.18+ - Improves memory pressure handling - https://lore.kernel.org/lkml/20220706220022.968789-1-yuzhao@google.com/
|
||||||
|
# Older kernel versions might have a patch available in the community-patches repo
|
||||||
|
# ! This option will be disabled when bcachefs is enabled for now !
|
||||||
|
_mglru="true"
|
||||||
|
|
||||||
|
# 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"
|
||||||
|
|
||||||
|
# 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
|
||||||
|
# https://gitlab.collabora.com/tonyk/linux/-/tree/futex2-dev
|
||||||
|
_futex2="true"
|
||||||
|
|
||||||
|
# Set to "true" to enable backported patches to add support for the futex_waitv() syscall, a new interface for fsync. It will appear in mainline at Linux 5.16 release and requires a wine/proton with builtin support for it. It's expected to be available in Valve Proton 6.3 stable soon - https://github.com/ValveSoftware/wine/pull/128
|
||||||
|
# !! Disables futex2 interfaces support !!
|
||||||
|
# https://github.com/andrealmeid/futex_waitv_patches
|
||||||
|
_futex_waitv="false"
|
||||||
|
|
||||||
# Set to "true" to enable support for winesync, an experimental replacement for esync - requires patched wine - https://repo.or.cz/linux/zf.git/shortlog/refs/heads/winesync4
|
# Set to "true" to enable support for winesync, an experimental replacement for esync - requires patched wine - https://repo.or.cz/linux/zf.git/shortlog/refs/heads/winesync4
|
||||||
# ! Can't be used on multiple kernels installed side-by-side, which will require https://aur.archlinux.org/packages/winesync-dkms/ instead of this option !
|
# ! Can't be used on multiple kernels installed side-by-side, which will require https://aur.archlinux.org/packages/winesync-dkms/ instead of this option !
|
||||||
_winesync="false"
|
_winesync="false"
|
||||||
@@ -190,6 +208,9 @@ _compileroptlevel="2"
|
|||||||
# - "generic_v4" (depends on GCC11 - to share the package between machines with different CPU µarch supporting at least x86-64-v4
|
# - "generic_v4" (depends on GCC11 - to share the package between machines with different CPU µarch supporting at least x86-64-v4
|
||||||
_processor_opt="skylake"
|
_processor_opt="skylake"
|
||||||
|
|
||||||
|
# MuQSS only - Make IRQ threading compulsory (FORCE_IRQ_THREADING) - Default is "false"
|
||||||
|
_irq_threading="false"
|
||||||
|
|
||||||
# CacULE only - Enable Response Driven Balancer, an experimental load balancer for CacULE
|
# CacULE only - Enable Response Driven Balancer, an experimental load balancer for CacULE
|
||||||
_cacule_rdb="false"
|
_cacule_rdb="false"
|
||||||
|
|
||||||
@@ -206,6 +227,10 @@ _smt_nice="true"
|
|||||||
# Trust the CPU manufacturer to initialize Linux's CRNG (RANDOM_TRUST_CPU) - Kernel default is "false"
|
# Trust the CPU manufacturer to initialize Linux's CRNG (RANDOM_TRUST_CPU) - Kernel default is "false"
|
||||||
_random_trust_cpu="true"
|
_random_trust_cpu="true"
|
||||||
|
|
||||||
|
# MuQSS only - CPU scheduler runqueue sharing - No sharing (RQ_NONE), SMT (hyperthread) siblings (RQ_SMT), Multicore siblings (RQ_MC), Symmetric Multi-Processing (RQ_SMP), NUMA (RQ_ALL)
|
||||||
|
# Valid values are "none", "smt", "mc", "mc-llc"(for zen), "smp", "all" - Kernel default is "smt"
|
||||||
|
_runqueue_sharing=""
|
||||||
|
|
||||||
# Timer frequency - "100" "250" "300" "500" "750" "1000" ("2000" is available for cacule cpusched only) - More options available in kernel config prompt when left empty depending on selected cpusched with the default option pointed with a ">" (2000 for cacule, 100 for muqss and 1000 for other cpu schedulers)
|
# Timer frequency - "100" "250" "300" "500" "750" "1000" ("2000" is available for cacule cpusched only) - More options available in kernel config prompt when left empty depending on selected cpusched with the default option pointed with a ">" (2000 for cacule, 100 for muqss and 1000 for other cpu schedulers)
|
||||||
_timer_freq="500"
|
_timer_freq="500"
|
||||||
|
|
||||||
@@ -239,41 +264,14 @@ _custom_pkgbase=""
|
|||||||
# If left empty, it will use "-tkg-${_cpusched}${_compiler}" where "${_cpusched}" will be replaced by the user chosen scheduler, ${_compiler} will be replaced by "-llvm" if clang is used (nothing for GCC).
|
# If left empty, it will use "-tkg-${_cpusched}${_compiler}" where "${_cpusched}" will be replaced by the user chosen scheduler, ${_compiler} will be replaced by "-llvm" if clang is used (nothing for GCC).
|
||||||
_kernel_localversion=""
|
_kernel_localversion=""
|
||||||
|
|
||||||
|
# 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"
|
||||||
|
|
||||||
# Set to your maximum number of CPUs (physical + logical cores) - Lower means less overhead - You can set it to "$(nproc)" to use the current host's CPU(s) core count, or leave empty to use default
|
# Set to your maximum number of CPUs (physical + logical cores) - Lower means less overhead - You can set it to "$(nproc)" to use the current host's CPU(s) core count, or leave empty to use default
|
||||||
# If you set this to a lower value than you have cores, some cores will be disabled
|
# If you set this to a lower value than you have cores, some cores will be disabled
|
||||||
# Default Arch kernel value is 320
|
# Default Arch kernel value is 320
|
||||||
_NR_CPUS_value=""
|
_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"
|
|
||||||
|
|
||||||
# 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"
|
|
||||||
|
|
||||||
# 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
|
|
||||||
# https://gitlab.collabora.com/tonyk/linux/-/tree/futex2-dev
|
|
||||||
_futex2="true"
|
|
||||||
|
|
||||||
# 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"
|
|
||||||
|
|
||||||
# MuQSS only - CPU scheduler runqueue sharing - No sharing (RQ_NONE), SMT (hyperthread) siblings (RQ_SMT), Multicore siblings (RQ_MC), Symmetric Multi-Processing (RQ_SMP), NUMA (RQ_ALL)
|
|
||||||
# Valid values are "none", "smt", "mc", "mc-llc"(for zen), "smp", "all" - Kernel default is "smt"
|
|
||||||
_runqueue_sharing=""
|
|
||||||
|
|
||||||
# MuQSS only - Make IRQ threading compulsory (FORCE_IRQ_THREADING) - Default is "false"
|
|
||||||
_irq_threading="false"
|
|
||||||
|
|
||||||
# Set to "true" to add multi-generational LRU framework support on kernel 5.18+ - Improves memory pressure handling - https://lore.kernel.org/lkml/20220706220022.968789-1-yuzhao@google.com/
|
|
||||||
# Older kernel versions might have a patch available in the community-patches repo
|
|
||||||
# Upstream as of 6.1
|
|
||||||
# ! This option will be disabled when bcachefs is enabled !
|
|
||||||
_mglru="true"
|
|
||||||
|
|
||||||
#### USER PATCHES ####
|
#### USER PATCHES ####
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Automatically generated file; DO NOT EDIT.
|
# Automatically generated file; DO NOT EDIT.
|
||||||
# Linux/x86 6.2.0-rc4 Kernel Configuration
|
# Linux/x86 6.2.0-rc1 Kernel Configuration
|
||||||
#
|
#
|
||||||
CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.2.0"
|
CONFIG_CC_VERSION_TEXT="gcc (GCC) 12.2.0"
|
||||||
CONFIG_CC_IS_GCC=y
|
CONFIG_CC_IS_GCC=y
|
||||||
@@ -206,7 +206,6 @@ CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y
|
|||||||
CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH=y
|
CONFIG_ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH=y
|
||||||
CONFIG_CC_HAS_INT128=y
|
CONFIG_CC_HAS_INT128=y
|
||||||
CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5"
|
CONFIG_CC_IMPLICIT_FALLTHROUGH="-Wimplicit-fallthrough=5"
|
||||||
CONFIG_GCC11_NO_ARRAY_BOUNDS=y
|
|
||||||
CONFIG_GCC12_NO_ARRAY_BOUNDS=y
|
CONFIG_GCC12_NO_ARRAY_BOUNDS=y
|
||||||
CONFIG_CC_NO_ARRAY_BOUNDS=y
|
CONFIG_CC_NO_ARRAY_BOUNDS=y
|
||||||
CONFIG_ARCH_SUPPORTS_INT128=y
|
CONFIG_ARCH_SUPPORTS_INT128=y
|
||||||
@@ -242,7 +241,6 @@ CONFIG_UTS_NS=y
|
|||||||
CONFIG_TIME_NS=y
|
CONFIG_TIME_NS=y
|
||||||
CONFIG_IPC_NS=y
|
CONFIG_IPC_NS=y
|
||||||
CONFIG_USER_NS=y
|
CONFIG_USER_NS=y
|
||||||
CONFIG_USER_NS_UNPRIVILEGED=y
|
|
||||||
CONFIG_PID_NS=y
|
CONFIG_PID_NS=y
|
||||||
CONFIG_NET_NS=y
|
CONFIG_NET_NS=y
|
||||||
CONFIG_CHECKPOINT_RESTORE=y
|
CONFIG_CHECKPOINT_RESTORE=y
|
||||||
@@ -2548,7 +2546,6 @@ CONFIG_BLK_DEV_NBD=m
|
|||||||
CONFIG_BLK_DEV_RAM=m
|
CONFIG_BLK_DEV_RAM=m
|
||||||
CONFIG_BLK_DEV_RAM_COUNT=16
|
CONFIG_BLK_DEV_RAM_COUNT=16
|
||||||
CONFIG_BLK_DEV_RAM_SIZE=16384
|
CONFIG_BLK_DEV_RAM_SIZE=16384
|
||||||
# CONFIG_CDROM_PKTCDVD is not set
|
|
||||||
CONFIG_ATA_OVER_ETH=m
|
CONFIG_ATA_OVER_ETH=m
|
||||||
CONFIG_XEN_BLKDEV_FRONTEND=m
|
CONFIG_XEN_BLKDEV_FRONTEND=m
|
||||||
CONFIG_XEN_BLKDEV_BACKEND=m
|
CONFIG_XEN_BLKDEV_BACKEND=m
|
||||||
|
@@ -284,8 +284,7 @@ _set_cpu_scheduler() {
|
|||||||
elif [ "$_kver" = "601" ]; then
|
elif [ "$_kver" = "601" ]; then
|
||||||
_avail_cpu_scheds=("cfs" "pds" "bmq" "tt" "bore")
|
_avail_cpu_scheds=("cfs" "pds" "bmq" "tt" "bore")
|
||||||
elif [ "$_kver" = "602" ]; then
|
elif [ "$_kver" = "602" ]; then
|
||||||
_avail_cpu_scheds=("cfs" "pds" "bmq" "tt" "bore")
|
_avail_cpu_scheds=("cfs" "tt" "bore")
|
||||||
_projectc_unoff=1
|
|
||||||
else
|
else
|
||||||
_avail_cpu_scheds=("cfs")
|
_avail_cpu_scheds=("cfs")
|
||||||
fi
|
fi
|
||||||
@@ -1573,13 +1572,9 @@ CONFIG_DEBUG_INFO_BTF_MODULES=y\r
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# NR_CPUS
|
# NR_CPUS
|
||||||
if [ "$_basever" != "601" ]; then
|
if [ -n "$_NR_CPUS_value" ]; then
|
||||||
if [ -n "$_NR_CPUS_value" ]; then
|
scripts/config --set-val "NR_CPUS" "$_NR_CPUS_value"
|
||||||
scripts/config --set-val "NR_CPUS" "$_NR_CPUS_value"
|
_enable "FORCE_NR_CPUS"
|
||||||
_enable "FORCE_NR_CPUS"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
warning "NR_CPUS is bugged on 6.1.y, so your setting was ignored"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,90 +0,0 @@
|
|||||||
From f7f49141a5dbe9c99d78196b58c44307fb2e6be3 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Tk-Glitch <ti3nou@gmail.com>
|
|
||||||
Date: Wed, 4 Jul 2018 04:30:08 +0200
|
|
||||||
Subject: glitched - PDS
|
|
||||||
|
|
||||||
diff --git a/kernel/Kconfig.hz b/kernel/Kconfig.hz
|
|
||||||
index 2a202a846757..1d9c7ed79b11 100644
|
|
||||||
--- a/kernel/Kconfig.hz
|
|
||||||
+++ b/kernel/Kconfig.hz
|
|
||||||
@@ -4,7 +4,7 @@
|
|
||||||
|
|
||||||
choice
|
|
||||||
prompt "Timer frequency"
|
|
||||||
- default HZ_250
|
|
||||||
+ default HZ_500
|
|
||||||
help
|
|
||||||
Allows the configuration of the timer frequency. It is customary
|
|
||||||
to have the timer interrupt run at 1000 Hz but 100 Hz may be more
|
|
||||||
@@ -39,6 +39,13 @@ choice
|
|
||||||
on SMP and NUMA systems and exactly dividing by both PAL and
|
|
||||||
NTSC frame rates for video and multimedia work.
|
|
||||||
|
|
||||||
+ config HZ_500
|
|
||||||
+ bool "500 HZ"
|
|
||||||
+ help
|
|
||||||
+ 500 Hz is a balanced timer frequency. Provides fast interactivity
|
|
||||||
+ on desktops with great smoothness without increasing CPU power
|
|
||||||
+ consumption and sacrificing the battery life on laptops.
|
|
||||||
+
|
|
||||||
config HZ_1000
|
|
||||||
bool "1000 HZ"
|
|
||||||
help
|
|
||||||
@@ -52,6 +59,7 @@ config HZ
|
|
||||||
default 100 if HZ_100
|
|
||||||
default 250 if HZ_250
|
|
||||||
default 300 if HZ_300
|
|
||||||
+ default 500 if HZ_500
|
|
||||||
default 1000 if HZ_1000
|
|
||||||
|
|
||||||
config SCHED_HRTICK
|
|
||||||
|
|
||||||
diff --git a/kernel/Kconfig.hz b/kernel/Kconfig.hz
|
|
||||||
index 2a202a846757..1d9c7ed79b11 100644
|
|
||||||
--- a/kernel/Kconfig.hz
|
|
||||||
+++ b/kernel/Kconfig.hz
|
|
||||||
@@ -4,7 +4,7 @@
|
|
||||||
|
|
||||||
choice
|
|
||||||
prompt "Timer frequency"
|
|
||||||
- default HZ_500
|
|
||||||
+ default HZ_750
|
|
||||||
help
|
|
||||||
Allows the configuration of the timer frequency. It is customary
|
|
||||||
to have the timer interrupt run at 1000 Hz but 100 Hz may be more
|
|
||||||
@@ -46,6 +46,13 @@ choice
|
|
||||||
on desktops with great smoothness without increasing CPU power
|
|
||||||
consumption and sacrificing the battery life on laptops.
|
|
||||||
|
|
||||||
+ config HZ_750
|
|
||||||
+ bool "750 HZ"
|
|
||||||
+ help
|
|
||||||
+ 750 Hz is a good timer frequency for desktops. Provides fast
|
|
||||||
+ interactivity with great smoothness without sacrificing too
|
|
||||||
+ much throughput.
|
|
||||||
+
|
|
||||||
config HZ_1000
|
|
||||||
bool "1000 HZ"
|
|
||||||
help
|
|
||||||
@@ -60,6 +67,7 @@ config HZ
|
|
||||||
default 250 if HZ_250
|
|
||||||
default 300 if HZ_300
|
|
||||||
default 500 if HZ_500
|
|
||||||
+ default 750 if HZ_750
|
|
||||||
default 1000 if HZ_1000
|
|
||||||
|
|
||||||
config SCHED_HRTICK
|
|
||||||
|
|
||||||
diff --git a/mm/vmscan.c b/mm/vmscan.c
|
|
||||||
index 9270a4370d54..30d01e647417 100644
|
|
||||||
--- a/mm/vmscan.c
|
|
||||||
+++ b/mm/vmscan.c
|
|
||||||
@@ -169,7 +169,7 @@
|
|
||||||
/*
|
|
||||||
* From 0 .. 200. Higher means more swappy.
|
|
||||||
*/
|
|
||||||
-int vm_swappiness = 60;
|
|
||||||
+int vm_swappiness = 20;
|
|
||||||
|
|
||||||
static void set_task_reclaim_state(struct task_struct *task,
|
|
||||||
struct reclaim_state *rs)
|
|
File diff suppressed because it is too large
Load Diff
@@ -64,3 +64,253 @@ index 2c7171e0b0010..85de313ddec29 100644
|
|||||||
select CPU_FREQ_GOV_PERFORMANCE
|
select CPU_FREQ_GOV_PERFORMANCE
|
||||||
help
|
help
|
||||||
|
|
||||||
|
From 0c079d3f88df5f8286cd5c91b54bdac7c819be85 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Matthew Auld <matthew.auld@intel.com>
|
||||||
|
Date: Tue, 6 Dec 2022 16:11:41 +0000
|
||||||
|
Subject: [PATCH] drm/i915: improve the catch-all evict to handle lock
|
||||||
|
contention
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
The catch-all evict can fail due to object lock contention, since it
|
||||||
|
only goes as far as trylocking the object, due to us already holding the
|
||||||
|
vm->mutex. Doing a full object lock here can deadlock, since the
|
||||||
|
vm->mutex is always our inner lock. Add another execbuf pass which drops
|
||||||
|
the vm->mutex and then tries to grab the object will the full lock,
|
||||||
|
before then retrying the eviction. This should be good enough for now to
|
||||||
|
fix the immediate regression with userspace seeing -ENOSPC from execbuf
|
||||||
|
due to contended object locks during GTT eviction.
|
||||||
|
|
||||||
|
Testcase: igt@gem_ppgtt@shrink-vs-evict-*
|
||||||
|
Fixes: 7e00897be8bf ("drm/i915: Add object locking to i915_gem_evict_for_node and i915_gem_evict_something, v2.")
|
||||||
|
References: https://gitlab.freedesktop.org/drm/intel/-/issues/7627
|
||||||
|
References: https://gitlab.freedesktop.org/drm/intel/-/issues/7570
|
||||||
|
References: https://bugzilla.mozilla.org/show_bug.cgi?id=1779558
|
||||||
|
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
|
||||||
|
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
|
||||||
|
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
|
||||||
|
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
|
||||||
|
Cc: Andrzej Hajda <andrzej.hajda@intel.com>
|
||||||
|
Cc: Mani Milani <mani@chromium.org>
|
||||||
|
Cc: <stable@vger.kernel.org> # v5.18+
|
||||||
|
|
||||||
|
Revision 1 of https://patchwork.freedesktop.org/series/111686/
|
||||||
|
---
|
||||||
|
.../gpu/drm/i915/gem/i915_gem_execbuffer.c | 25 +++++++++++--
|
||||||
|
drivers/gpu/drm/i915/gem/i915_gem_mman.c | 2 +-
|
||||||
|
drivers/gpu/drm/i915/i915_gem_evict.c | 37 ++++++++++++++-----
|
||||||
|
drivers/gpu/drm/i915/i915_gem_evict.h | 4 +-
|
||||||
|
drivers/gpu/drm/i915/i915_vma.c | 2 +-
|
||||||
|
.../gpu/drm/i915/selftests/i915_gem_evict.c | 4 +-
|
||||||
|
6 files changed, 56 insertions(+), 18 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
|
||||||
|
index 845023c14eb36f..094e92ed28db4f 100644
|
||||||
|
--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
|
||||||
|
+++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
|
||||||
|
@@ -741,25 +741,44 @@ static int eb_reserve(struct i915_execbuffer *eb)
|
||||||
|
*
|
||||||
|
* Defragmenting is skipped if all objects are pinned at a fixed location.
|
||||||
|
*/
|
||||||
|
- for (pass = 0; pass <= 2; pass++) {
|
||||||
|
+ for (pass = 0; pass <= 3; pass++) {
|
||||||
|
int pin_flags = PIN_USER | PIN_VALIDATE;
|
||||||
|
|
||||||
|
if (pass == 0)
|
||||||
|
pin_flags |= PIN_NONBLOCK;
|
||||||
|
|
||||||
|
if (pass >= 1)
|
||||||
|
- unpinned = eb_unbind(eb, pass == 2);
|
||||||
|
+ unpinned = eb_unbind(eb, pass >= 2);
|
||||||
|
|
||||||
|
if (pass == 2) {
|
||||||
|
err = mutex_lock_interruptible(&eb->context->vm->mutex);
|
||||||
|
if (!err) {
|
||||||
|
- err = i915_gem_evict_vm(eb->context->vm, &eb->ww);
|
||||||
|
+ err = i915_gem_evict_vm(eb->context->vm, &eb->ww, NULL);
|
||||||
|
mutex_unlock(&eb->context->vm->mutex);
|
||||||
|
}
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (pass == 3) {
|
||||||
|
+retry:
|
||||||
|
+ err = mutex_lock_interruptible(&eb->context->vm->mutex);
|
||||||
|
+ if (!err) {
|
||||||
|
+ struct drm_i915_gem_object *busy_bo = NULL;
|
||||||
|
+
|
||||||
|
+ err = i915_gem_evict_vm(eb->context->vm, &eb->ww, &busy_bo);
|
||||||
|
+ mutex_unlock(&eb->context->vm->mutex);
|
||||||
|
+ if (err && busy_bo) {
|
||||||
|
+ err = i915_gem_object_lock(busy_bo, &eb->ww);
|
||||||
|
+ i915_gem_object_put(busy_bo);
|
||||||
|
+ if (!err)
|
||||||
|
+ goto retry;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
list_for_each_entry(ev, &eb->unbound, bind_link) {
|
||||||
|
err = eb_reserve_vma(eb, ev, pin_flags);
|
||||||
|
if (err)
|
||||||
|
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
|
||||||
|
index 73d9eda1d6b7a6..c83d98e1dc5da0 100644
|
||||||
|
--- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c
|
||||||
|
+++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
|
||||||
|
@@ -369,7 +369,7 @@ static vm_fault_t vm_fault_gtt(struct vm_fault *vmf)
|
||||||
|
if (vma == ERR_PTR(-ENOSPC)) {
|
||||||
|
ret = mutex_lock_interruptible(&ggtt->vm.mutex);
|
||||||
|
if (!ret) {
|
||||||
|
- ret = i915_gem_evict_vm(&ggtt->vm, &ww);
|
||||||
|
+ ret = i915_gem_evict_vm(&ggtt->vm, &ww, NULL);
|
||||||
|
mutex_unlock(&ggtt->vm.mutex);
|
||||||
|
}
|
||||||
|
if (ret)
|
||||||
|
diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c
|
||||||
|
index f025ee4fa52618..a4b4d9b7d26c7a 100644
|
||||||
|
--- a/drivers/gpu/drm/i915/i915_gem_evict.c
|
||||||
|
+++ b/drivers/gpu/drm/i915/i915_gem_evict.c
|
||||||
|
@@ -416,6 +416,11 @@ int i915_gem_evict_for_node(struct i915_address_space *vm,
|
||||||
|
* @vm: Address space to cleanse
|
||||||
|
* @ww: An optional struct i915_gem_ww_ctx. If not NULL, i915_gem_evict_vm
|
||||||
|
* will be able to evict vma's locked by the ww as well.
|
||||||
|
+ * @busy_bo: Optional pointer to struct drm_i915_gem_object. If not NULL, then
|
||||||
|
+ * in the event i915_gem_evict_vm() is unable to trylock an object for eviction,
|
||||||
|
+ * then @busy_bo will point to it. -EBUSY is also returned. The caller must drop
|
||||||
|
+ * the vm->mutex, before trying again to acquire the contended lock. The caller
|
||||||
|
+ * also owns a reference to the object.
|
||||||
|
*
|
||||||
|
* This function evicts all vmas from a vm.
|
||||||
|
*
|
||||||
|
@@ -425,7 +430,8 @@ int i915_gem_evict_for_node(struct i915_address_space *vm,
|
||||||
|
* To clarify: This is for freeing up virtual address space, not for freeing
|
||||||
|
* memory in e.g. the shrinker.
|
||||||
|
*/
|
||||||
|
-int i915_gem_evict_vm(struct i915_address_space *vm, struct i915_gem_ww_ctx *ww)
|
||||||
|
+int i915_gem_evict_vm(struct i915_address_space *vm, struct i915_gem_ww_ctx *ww,
|
||||||
|
+ struct drm_i915_gem_object **busy_bo)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
@@ -457,15 +463,22 @@ int i915_gem_evict_vm(struct i915_address_space *vm, struct i915_gem_ww_ctx *ww)
|
||||||
|
* the resv is shared among multiple objects, we still
|
||||||
|
* need the object ref.
|
||||||
|
*/
|
||||||
|
- if (dying_vma(vma) ||
|
||||||
|
+ if (!i915_gem_object_get_rcu(vma->obj) ||
|
||||||
|
(ww && (dma_resv_locking_ctx(vma->obj->base.resv) == &ww->ctx))) {
|
||||||
|
__i915_vma_pin(vma);
|
||||||
|
list_add(&vma->evict_link, &locked_eviction_list);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (!i915_gem_object_trylock(vma->obj, ww))
|
||||||
|
+ if (!i915_gem_object_trylock(vma->obj, ww)) {
|
||||||
|
+ if (busy_bo) {
|
||||||
|
+ *busy_bo = vma->obj; /* holds ref */
|
||||||
|
+ ret = -EBUSY;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ i915_gem_object_put(vma->obj);
|
||||||
|
continue;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
__i915_vma_pin(vma);
|
||||||
|
list_add(&vma->evict_link, &eviction_list);
|
||||||
|
@@ -473,25 +486,29 @@ int i915_gem_evict_vm(struct i915_address_space *vm, struct i915_gem_ww_ctx *ww)
|
||||||
|
if (list_empty(&eviction_list) && list_empty(&locked_eviction_list))
|
||||||
|
break;
|
||||||
|
|
||||||
|
- ret = 0;
|
||||||
|
/* Unbind locked objects first, before unlocking the eviction_list */
|
||||||
|
list_for_each_entry_safe(vma, vn, &locked_eviction_list, evict_link) {
|
||||||
|
__i915_vma_unpin(vma);
|
||||||
|
|
||||||
|
- if (ret == 0)
|
||||||
|
+ if (ret == 0) {
|
||||||
|
ret = __i915_vma_unbind(vma);
|
||||||
|
- if (ret != -EINTR) /* "Get me out of here!" */
|
||||||
|
- ret = 0;
|
||||||
|
+ if (ret != -EINTR) /* "Get me out of here!" */
|
||||||
|
+ ret = 0;
|
||||||
|
+ }
|
||||||
|
+ if (!dying_vma(vma))
|
||||||
|
+ i915_gem_object_put(vma->obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
list_for_each_entry_safe(vma, vn, &eviction_list, evict_link) {
|
||||||
|
__i915_vma_unpin(vma);
|
||||||
|
- if (ret == 0)
|
||||||
|
+ if (ret == 0) {
|
||||||
|
ret = __i915_vma_unbind(vma);
|
||||||
|
- if (ret != -EINTR) /* "Get me out of here!" */
|
||||||
|
- ret = 0;
|
||||||
|
+ if (ret != -EINTR) /* "Get me out of here!" */
|
||||||
|
+ ret = 0;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
i915_gem_object_unlock(vma->obj);
|
||||||
|
+ i915_gem_object_put(vma->obj);
|
||||||
|
}
|
||||||
|
} while (ret == 0);
|
||||||
|
|
||||||
|
diff --git a/drivers/gpu/drm/i915/i915_gem_evict.h b/drivers/gpu/drm/i915/i915_gem_evict.h
|
||||||
|
index e593c530f9bd7a..bf0ee0e4fe6088 100644
|
||||||
|
--- a/drivers/gpu/drm/i915/i915_gem_evict.h
|
||||||
|
+++ b/drivers/gpu/drm/i915/i915_gem_evict.h
|
||||||
|
@@ -11,6 +11,7 @@
|
||||||
|
struct drm_mm_node;
|
||||||
|
struct i915_address_space;
|
||||||
|
struct i915_gem_ww_ctx;
|
||||||
|
+struct drm_i915_gem_object;
|
||||||
|
|
||||||
|
int __must_check i915_gem_evict_something(struct i915_address_space *vm,
|
||||||
|
struct i915_gem_ww_ctx *ww,
|
||||||
|
@@ -23,6 +24,7 @@ int __must_check i915_gem_evict_for_node(struct i915_address_space *vm,
|
||||||
|
struct drm_mm_node *node,
|
||||||
|
unsigned int flags);
|
||||||
|
int i915_gem_evict_vm(struct i915_address_space *vm,
|
||||||
|
- struct i915_gem_ww_ctx *ww);
|
||||||
|
+ struct i915_gem_ww_ctx *ww,
|
||||||
|
+ struct drm_i915_gem_object **busy_bo);
|
||||||
|
|
||||||
|
#endif /* __I915_GEM_EVICT_H__ */
|
||||||
|
diff --git a/drivers/gpu/drm/i915/i915_vma.c b/drivers/gpu/drm/i915/i915_vma.c
|
||||||
|
index f17c09ead7d778..4d06875de14a14 100644
|
||||||
|
--- a/drivers/gpu/drm/i915/i915_vma.c
|
||||||
|
+++ b/drivers/gpu/drm/i915/i915_vma.c
|
||||||
|
@@ -1569,7 +1569,7 @@ static int __i915_ggtt_pin(struct i915_vma *vma, struct i915_gem_ww_ctx *ww,
|
||||||
|
* locked objects when called from execbuf when pinning
|
||||||
|
* is removed. This would probably regress badly.
|
||||||
|
*/
|
||||||
|
- i915_gem_evict_vm(vm, NULL);
|
||||||
|
+ i915_gem_evict_vm(vm, NULL, NULL);
|
||||||
|
mutex_unlock(&vm->mutex);
|
||||||
|
}
|
||||||
|
} while (1);
|
||||||
|
diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c b/drivers/gpu/drm/i915/selftests/i915_gem_evict.c
|
||||||
|
index 8c6517d29b8e0c..37068542aafe7f 100644
|
||||||
|
--- a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c
|
||||||
|
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_evict.c
|
||||||
|
@@ -344,7 +344,7 @@ static int igt_evict_vm(void *arg)
|
||||||
|
|
||||||
|
/* Everything is pinned, nothing should happen */
|
||||||
|
mutex_lock(&ggtt->vm.mutex);
|
||||||
|
- err = i915_gem_evict_vm(&ggtt->vm, NULL);
|
||||||
|
+ err = i915_gem_evict_vm(&ggtt->vm, NULL, NULL);
|
||||||
|
mutex_unlock(&ggtt->vm.mutex);
|
||||||
|
if (err) {
|
||||||
|
pr_err("i915_gem_evict_vm on a full GGTT returned err=%d]\n",
|
||||||
|
@@ -356,7 +356,7 @@ static int igt_evict_vm(void *arg)
|
||||||
|
|
||||||
|
for_i915_gem_ww(&ww, err, false) {
|
||||||
|
mutex_lock(&ggtt->vm.mutex);
|
||||||
|
- err = i915_gem_evict_vm(&ggtt->vm, &ww);
|
||||||
|
+ err = i915_gem_evict_vm(&ggtt->vm, &ww, NULL);
|
||||||
|
mutex_unlock(&ggtt->vm.mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user