From 6804f8904923f65abe078921e85fc6feacb3b569 Mon Sep 17 00:00:00 2001 From: Chris Lew Date: Tue, 27 Oct 2020 13:54:52 -0700 Subject: [PATCH 1/2] net: qrtr: Make wakeup timeout configurable The qrtr driver can guarantee that the packet gets queued to the socket but cannot guarantee the client process will get time to run if auto sleep is enabled. This config will help mitigate missed packets on systems where auto sleep is too aggressive. Use the pm_wakeup_ws_event() api so a hard wakeup can be specified. This will ensure a resume occurs if the data coming in happens while the device is going into suspend. Change-Id: Ic596e06e585b3479a6faa1d0210c016fc9138c6e Signed-off-by: Chris Lew --- net/qrtr/Kconfig | 11 +++++++++++ net/qrtr/qrtr.c | 5 +++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/net/qrtr/Kconfig b/net/qrtr/Kconfig index 360f56ae9b33..78c078284532 100644 --- a/net/qrtr/Kconfig +++ b/net/qrtr/Kconfig @@ -26,6 +26,17 @@ config QRTR_NODE_ID but the name service application is not priveleged enough to use netlink sockets. +config QRTR_WAKEUP_MS + int "QRTR Wakeup timeout" + default 0 + help + This option is used to configure the wakesource timeout that QRTR + should take when a packet is received. The qrtr driver can guarantee + that the packet gets queued to the socket but cannot guarantee the + client process will get time to run if auto sleep is enabled. This + config will help mitigate missed packets on systems where auto sleep + is aggressive. + config QRTR_SMD tristate "SMD IPC Router channels" depends on RPMSG || (COMPILE_TEST && RPMSG=n) diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c index a5e76ebb730b..2e7fb5518ec4 100644 --- a/net/qrtr/qrtr.c +++ b/net/qrtr/qrtr.c @@ -117,6 +117,7 @@ static inline struct qrtr_sock *qrtr_sk(struct sock *sk) } static unsigned int qrtr_local_nid = CONFIG_QRTR_NODE_ID; +static unsigned int qrtr_wakeup_ms = CONFIG_QRTR_WAKEUP_MS; /* for node ids */ static RADIX_TREE(qrtr_nodes, GFP_ATOMIC); @@ -886,7 +887,7 @@ int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len) if (cb->type != QRTR_TYPE_DATA || cb->dst_node != qrtr_local_nid) { skb_queue_tail(&node->rx_queue, skb); kthread_queue_work(&node->kworker, &node->read_data); - __pm_wakeup_event(node->ws, 0); + pm_wakeup_ws_event(node->ws, qrtr_wakeup_ms, true); } else { ipc = qrtr_port_lookup(cb->dst_port); if (!ipc) { @@ -899,7 +900,7 @@ int qrtr_endpoint_post(struct qrtr_endpoint *ep, const void *data, size_t len) /* Force wakeup for all packets except for sensors */ if (node->nid != 9) - __pm_wakeup_event(node->ws, 0); + pm_wakeup_ws_event(node->ws, qrtr_wakeup_ms, true); qrtr_port_put(ipc); } From 8ee7ea64d6fb4e1d2cd65d109180644250566f4f Mon Sep 17 00:00:00 2001 From: Chris Lew Date: Thu, 5 Nov 2020 12:51:00 -0800 Subject: [PATCH 2/2] arm64: defconfig: Set qrtr wakeup for genericarmv8 Set the wakeup timeout for qrtr to 500 ms for genericarmv8. This change will help ensure the TUI client thread gets a chance to run before the system is suspended again. Change-Id: Iaaa84e99c0e1f8c29b6e80746440b7d960887193 Signed-off-by: Chris Lew --- arch/arm64/configs/vendor/genericarmv8-64_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/configs/vendor/genericarmv8-64_defconfig b/arch/arm64/configs/vendor/genericarmv8-64_defconfig index ab231e287d61..22da3d46d77e 100644 --- a/arch/arm64/configs/vendor/genericarmv8-64_defconfig +++ b/arch/arm64/configs/vendor/genericarmv8-64_defconfig @@ -111,6 +111,7 @@ CONFIG_UNIX=y CONFIG_INET=y CONFIG_QRTR=y CONFIG_QRTR_NODE_ID=20 +CONFIG_QRTR_WAKEUP_MS=500 CONFIG_QRTR_HAVEN=y CONFIG_BPF_JIT=y CONFIG_NEURON_SERVICE=y