diff options
-rw-r--r-- | .SRCINFO | 20 | ||||
-rw-r--r-- | 0006-ACPI-EC-Rework-flushing-of-pending-work.patch | 135 | ||||
-rw-r--r-- | 0007-ACPI-PM-s2idle-Rework-ACPI-events-synchronization.patch | 78 | ||||
-rw-r--r-- | PKGBUILD | 12 | ||||
-rw-r--r-- | config | 2 |
5 files changed, 234 insertions, 13 deletions
@@ -1,5 +1,5 @@ pkgbase = linux-ck - pkgver = 5.4.2 + pkgver = 5.4.3 pkgrel = 1 url = https://wiki.archlinux.org/index.php/Linux-ck arch = x86_64 @@ -9,8 +9,8 @@ pkgbase = linux-ck makedepends = bc makedepends = libelf options = !strip - source = https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.4.2.tar.xz - source = https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.4.2.tar.sign + source = https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.4.3.tar.xz + source = https://www.kernel.org/pub/linux/kernel/v5.x/linux-5.4.3.tar.sign source = config source = enable_additional_cpu_optimizations-20190822.tar.gz::https://github.com/graysky2/kernel_gcc_patch/archive/20190822.tar.gz source = http://ck.kolivas.org/patches/5.0/5.4/5.4-ck1/patch-5.4-ck1.xz @@ -19,11 +19,13 @@ pkgbase = linux-ck source = 0003-mfd-intel-lpss-Use-devm_ioremap_uc-for-MMIO.patch source = 0004-PCI-pciehp-Do-not-disable-interrupt-twice-on-suspend.patch source = 0005-PCI-pciehp-Prevent-deadlock-on-disconnect.patch + source = 0006-ACPI-EC-Rework-flushing-of-pending-work.patch + source = 0007-ACPI-PM-s2idle-Rework-ACPI-events-synchronization.patch validpgpkeys = ABAF11C65A2970B130ABE3C479BE3E4300411886 validpgpkeys = 647F28654894E3BD457199BE38DBBDC86092693E - sha256sums = 32f98256877ca6b016715ffffcf184f1603df9e17a324787f252cd602e03a557 + sha256sums = 6731682f32e1b1ee53b0e7f66b8dc263d25a0e809e78e2139cb0ed77c378ee51 sha256sums = SKIP - sha256sums = b7f23bbc09b6c571b76f851f0389386a6f3a64f3d7b1b8509c8550228b0f4537 + sha256sums = 5d58a2115892839997ae7dcca226697c34b656de7685cb3eb8696451dc5100a0 sha256sums = 8c11086809864b5cef7d079f930bd40da8d0869c091965fa62e95de9a0fe13b5 sha256sums = f445eea4d0ec2015a25f1ad625c848f4f2252099795966fa4105e0aa29674c5c sha256sums = 8919d8cbab83ccc810d8c7eaf6ebb18be8ae011da90a11d98732c2537af11d11 @@ -31,6 +33,8 @@ pkgbase = linux-ck sha256sums = 88c7e90ac7a1b73b3707feacd23b66feaa4c2cc5bc39ef2807b2301274db3ad2 sha256sums = 786da96d5cc273331bf8a155b0552edcc26d79f194a016c7e4f1c1266aabafc2 sha256sums = 2d51be4ede2c19a3163899fd783a213cf9f837867915b004e0c70c548e0d96c9 + sha256sums = a2f99ed7314efcdd627bef8356a57554caa68d02d404eee28ca2c04fce2d906a + sha256sums = 29e71325f9f3a9e2a6fc47f5309e3e0b03328239093f651eee47c52467e9e5bc pkgname = linux-ck pkgdesc = The Linux-ck kernel and modules with the ck1 patchset featuring MuQSS CPU scheduler @@ -39,11 +43,11 @@ pkgname = linux-ck depends = initramfs optdepends = crda: to set the correct wireless channels of your country optdepends = linux-firmware: firmware images needed for some devices - provides = linux-ck=5.4.2 + provides = linux-ck=5.4.3 pkgname = linux-ck-headers pkgdesc = Headers and scripts for building modules for Linux-ck kernel depends = linux-ck - provides = linux-ck-headers=5.4.2 - provides = linux-headers=5.4.2 + provides = linux-ck-headers=5.4.3 + provides = linux-headers=5.4.3 diff --git a/0006-ACPI-EC-Rework-flushing-of-pending-work.patch b/0006-ACPI-EC-Rework-flushing-of-pending-work.patch new file mode 100644 index 000000000000..017a4fcc4829 --- /dev/null +++ b/0006-ACPI-EC-Rework-flushing-of-pending-work.patch @@ -0,0 +1,135 @@ +From 07b5e7a435b04b599e000eb38f82bc56c634ea4c Mon Sep 17 00:00:00 2001 +From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> +Date: Thu, 28 Nov 2019 23:47:51 +0100 +Subject: [PATCH 6/8] ACPI: EC: Rework flushing of pending work + +There is a race condition in the ACPI EC driver, between +__acpi_ec_flush_event() and acpi_ec_event_handler(), that may +cause systems to stay in suspended-to-idle forever after a wakeup +event coming from the EC. + +Namely, acpi_s2idle_wake() calls acpi_ec_flush_work() to wait until +the delayed work resulting from the handling of the EC GPE in +acpi_ec_dispatch_gpe() is processed, and that function invokes +__acpi_ec_flush_event() which uses wait_event() to wait for +ec->nr_pending_queries to become zero on ec->wait, and that wait +queue may be woken up too early. + +Suppose that acpi_ec_dispatch_gpe() has caused acpi_ec_gpe_handler() +to run, so advance_transaction() has been called and it has invoked +acpi_ec_submit_query() to queue up an event work item, so +ec->nr_pending_queries has been incremented (under ec->lock). The +work function of that work item, acpi_ec_event_handler() runs later +and calls acpi_ec_query() to process the event. That function calls +acpi_ec_transaction() which invokes acpi_ec_transaction_unlocked() +and the latter wakes up ec->wait under ec->lock, but it drops that +lock before returning. + +When acpi_ec_query() returns, acpi_ec_event_handler() acquires +ec->lock and decrements ec->nr_pending_queries, but at that point +__acpi_ec_flush_event() (woken up previously) may already have +acquired ec->lock, checked the value of ec->nr_pending_queries (and +it would not have been zero then) and decided to go back to sleep. +Next, if ec->nr_pending_queries is equal to zero now, the loop +in acpi_ec_event_handler() terminates, ec->lock is released and +acpi_ec_check_event() is called, but it does nothing unless +ec_event_clearing is equal to ACPI_EC_EVT_TIMING_EVENT (which is +not the case by default). In the end, if no more event work items +have been queued up while executing acpi_ec_transaction_unlocked(), +there is nothing to wake up __acpi_ec_flush_event() again and it +sleeps forever, so the suspend-to-idle loop cannot make progress and +the system is permanently suspended. + +To avoid this issue, notice that it actually is not necessary to +wait for ec->nr_pending_queries to become zero in every case in +which __acpi_ec_flush_event() is used. + +First, during platform-based system suspend (not suspend-to-idle), +__acpi_ec_flush_event() is called by acpi_ec_disable_event() after +clearing the EC_FLAGS_QUERY_ENABLED flag, which prevents +acpi_ec_submit_query() from submitting any new event work items, +so calling flush_scheduled_work() and flushing ec_query_wq +subsequently (in order to wait until all of the queries in that +queue have been processed) would be sufficient to flush all of +the pending EC work in that case. + +Second, the purpose of the flushing of pending EC work while +suspended-to-idle described above really is to wait until the +first event work item coming from acpi_ec_dispatch_gpe() is +complete, because it should produce system wakeup events if +that is a valid EC-based system wakeup, so calling +flush_scheduled_work() followed by flushing ec_query_wq is also +sufficient for that purpose. + +Rework the code to follow the above observations. + +Fixes: 56b9918490 ("PM: sleep: Simplify suspend-to-idle control flow") +Reported-by: Kenneth R. Crudup <kenny@panix.com> +Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> +--- + drivers/acpi/ec.c | 36 +++++++++++++----------------------- + 1 file changed, 13 insertions(+), 23 deletions(-) + +diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c +index da1e5c5ce150..bd75caff8322 100644 +--- a/drivers/acpi/ec.c ++++ b/drivers/acpi/ec.c +@@ -525,26 +525,10 @@ static void acpi_ec_enable_event(struct acpi_ec *ec) + } + + #ifdef CONFIG_PM_SLEEP +-static bool acpi_ec_query_flushed(struct acpi_ec *ec) ++static void __acpi_ec_flush_work(void) + { +- bool flushed; +- unsigned long flags; +- +- spin_lock_irqsave(&ec->lock, flags); +- flushed = !ec->nr_pending_queries; +- spin_unlock_irqrestore(&ec->lock, flags); +- return flushed; +-} +- +-static void __acpi_ec_flush_event(struct acpi_ec *ec) +-{ +- /* +- * When ec_freeze_events is true, we need to flush events in +- * the proper position before entering the noirq stage. +- */ +- wait_event(ec->wait, acpi_ec_query_flushed(ec)); +- if (ec_query_wq) +- flush_workqueue(ec_query_wq); ++ flush_scheduled_work(); /* flush ec->work */ ++ flush_workqueue(ec_query_wq); /* flush queries */ + } + + static void acpi_ec_disable_event(struct acpi_ec *ec) +@@ -554,15 +538,21 @@ static void acpi_ec_disable_event(struct acpi_ec *ec) + spin_lock_irqsave(&ec->lock, flags); + __acpi_ec_disable_event(ec); + spin_unlock_irqrestore(&ec->lock, flags); +- __acpi_ec_flush_event(ec); ++ ++ /* ++ * When ec_freeze_events is true, we need to flush events in ++ * the proper position before entering the noirq stage. ++ */ ++ __acpi_ec_flush_work(); + } + + void acpi_ec_flush_work(void) + { +- if (first_ec) +- __acpi_ec_flush_event(first_ec); ++ /* Without ec_query_wq there is nothing to flush. */ ++ if (!ec_query_wq) ++ return; + +- flush_scheduled_work(); ++ __acpi_ec_flush_work(); + } + #endif /* CONFIG_PM_SLEEP */ + +-- +2.24.1 + diff --git a/0007-ACPI-PM-s2idle-Rework-ACPI-events-synchronization.patch b/0007-ACPI-PM-s2idle-Rework-ACPI-events-synchronization.patch new file mode 100644 index 000000000000..9e2f2eea4496 --- /dev/null +++ b/0007-ACPI-PM-s2idle-Rework-ACPI-events-synchronization.patch @@ -0,0 +1,78 @@ +From d29867e0b11ce1db3802aa6370ee4d40d43351db Mon Sep 17 00:00:00 2001 +From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> +Date: Thu, 28 Nov 2019 23:50:40 +0100 +Subject: [PATCH 7/8] ACPI: PM: s2idle: Rework ACPI events synchronization + +Note that the EC GPE processing need not be synchronized in +acpi_s2idle_wake() after invoking acpi_ec_dispatch_gpe(), because +that function checks the GPE status and dispatches its handler if +need be and the SCI action handler is not going to run anyway at +that point. + +Moreover, it is better to drain all of the pending ACPI events +before restoring the working-state configuration of GPEs in +acpi_s2idle_restore(), because those events are likely to be related +to system wakeup, in which case they will not be relevant going +forward. + +Rework the code to take these observations into account. + +Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> +--- + drivers/acpi/sleep.c | 26 +++++++++++++++++++------- + 1 file changed, 19 insertions(+), 7 deletions(-) + +diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c +index 2af937a8b1c5..6747a279621b 100644 +--- a/drivers/acpi/sleep.c ++++ b/drivers/acpi/sleep.c +@@ -977,6 +977,16 @@ static int acpi_s2idle_prepare_late(void) + return 0; + } + ++static void acpi_s2idle_sync(void) ++{ ++ /* ++ * The EC driver uses the system workqueue and an additional special ++ * one, so those need to be flushed too. ++ */ ++ acpi_ec_flush_work(); ++ acpi_os_wait_events_complete(); /* synchronize Notify handling */ ++} ++ + static void acpi_s2idle_wake(void) + { + /* +@@ -1001,13 +1011,8 @@ static void acpi_s2idle_wake(void) + * should be missed by canceling the wakeup here. + */ + pm_system_cancel_wakeup(); +- /* +- * The EC driver uses the system workqueue and an additional +- * special one, so those need to be flushed too. +- */ +- acpi_os_wait_events_complete(); /* synchronize EC GPE processing */ +- acpi_ec_flush_work(); +- acpi_os_wait_events_complete(); /* synchronize Notify handling */ ++ ++ acpi_s2idle_sync(); + + rearm_wake_irq(acpi_sci_irq); + } +@@ -1024,6 +1029,13 @@ static void acpi_s2idle_restore_early(void) + + static void acpi_s2idle_restore(void) + { ++ /* ++ * Drain pending events before restoring the working-state configuration ++ * of GPEs. ++ */ ++ acpi_os_wait_events_complete(); /* synchronize GPE processing */ ++ acpi_s2idle_sync(); ++ + s2idle_wakeup = false; + + acpi_enable_all_runtime_gpes(); +-- +2.24.1 + @@ -61,7 +61,7 @@ _localmodcfg= ### IMPORTANT: Do no edit below this line unless you know what you're doing pkgbase=linux-ck -_srcver=5.4.2-arch1 +_srcver=5.4.3-arch1 pkgver=${_srcver%-*} pkgrel=1 _ckpatchversion=1 @@ -82,21 +82,25 @@ source=( 0003-mfd-intel-lpss-Use-devm_ioremap_uc-for-MMIO.patch 0004-PCI-pciehp-Do-not-disable-interrupt-twice-on-suspend.patch 0005-PCI-pciehp-Prevent-deadlock-on-disconnect.patch + 0006-ACPI-EC-Rework-flushing-of-pending-work.patch + 0007-ACPI-PM-s2idle-Rework-ACPI-events-synchronization.patch ) validpgpkeys=( 'ABAF11C65A2970B130ABE3C479BE3E4300411886' # Linus Torvalds '647F28654894E3BD457199BE38DBBDC86092693E' # Greg Kroah-Hartman ) -sha256sums=('32f98256877ca6b016715ffffcf184f1603df9e17a324787f252cd602e03a557' +sha256sums=('6731682f32e1b1ee53b0e7f66b8dc263d25a0e809e78e2139cb0ed77c378ee51' 'SKIP' - 'b7f23bbc09b6c571b76f851f0389386a6f3a64f3d7b1b8509c8550228b0f4537' + '5d58a2115892839997ae7dcca226697c34b656de7685cb3eb8696451dc5100a0' '8c11086809864b5cef7d079f930bd40da8d0869c091965fa62e95de9a0fe13b5' 'f445eea4d0ec2015a25f1ad625c848f4f2252099795966fa4105e0aa29674c5c' '8919d8cbab83ccc810d8c7eaf6ebb18be8ae011da90a11d98732c2537af11d11' 'f1481e4c6d84de265552eea9ef2e2fa13bf26774becc2f2c36619af1f56bcee4' '88c7e90ac7a1b73b3707feacd23b66feaa4c2cc5bc39ef2807b2301274db3ad2' '786da96d5cc273331bf8a155b0552edcc26d79f194a016c7e4f1c1266aabafc2' - '2d51be4ede2c19a3163899fd783a213cf9f837867915b004e0c70c548e0d96c9') + '2d51be4ede2c19a3163899fd783a213cf9f837867915b004e0c70c548e0d96c9' + 'a2f99ed7314efcdd627bef8356a57554caa68d02d404eee28ca2c04fce2d906a' + '29e71325f9f3a9e2a6fc47f5309e3e0b03328239093f651eee47c52467e9e5bc') export KBUILD_BUILD_HOST=archlinux export KBUILD_BUILD_USER=$pkgbase @@ -6759,7 +6759,7 @@ CONFIG_SND_YMFPCI=m # CONFIG_SND_HDA=m CONFIG_SND_HDA_INTEL=m -CONFIG_SND_HDA_INTEL_DETECT_DMIC=y +# CONFIG_SND_HDA_INTEL_DETECT_DMIC is not set CONFIG_SND_HDA_HWDEP=y CONFIG_SND_HDA_RECONFIG=y CONFIG_SND_HDA_INPUT_BEEP=y |