* [PATCH] HID: Intel-ish-hid: Ishtp: Fix sensor reads after ACPI S3 suspend
@ 2024-02-09 6:52 Even Xu
2024-02-09 14:41 ` srinivas pandruvada
0 siblings, 1 reply; 4+ messages in thread
From: Even Xu @ 2024-02-09 6:52 UTC (permalink / raw)
To: srinivas.pandruvada, jikos, benjamin.tissoires, linux-input; +Cc: Even Xu
After legacy suspend/resume via ACPI S3, sensor read operation fails
with timeout. Also, it will cause delay in resume operation as there
will be retries on failure.
This is caused by commit f645a90e8ff7 ("HID: intel-ish-hid:
ishtp-hid-client: use helper functions for connection"), which used
helper functions to simplify connect, reset and disconnect process.
Also avoid freeing and allocating client buffers again during reconnect
process.
But there is a case, when ISH firmware resets after ACPI S3 suspend,
ishtp bus driver frees client buffers. Since there is no realloc again
during reconnect, there are no client buffers available to send connection
requests to the firmware. Without successful connection to the firmware,
subsequent sensor reads will timeout.
To address this issue, ishtp bus driver does not free client buffers on
warm reset after S3 resume. Simply add the buffers from the read list
to free list of buffers.
Fixes: f645a90e8ff7 ("HID: intel-ish-hid: ishtp-hid-client: use helper functions for connection")
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218442
Signed-off-by: Even Xu <even.xu@intel.com>
---
drivers/hid/intel-ish-hid/ishtp/bus.c | 2 ++
drivers/hid/intel-ish-hid/ishtp/client.c | 4 +++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/hid/intel-ish-hid/ishtp/bus.c b/drivers/hid/intel-ish-hid/ishtp/bus.c
index aa6cb033bb06..03d5601ce807 100644
--- a/drivers/hid/intel-ish-hid/ishtp/bus.c
+++ b/drivers/hid/intel-ish-hid/ishtp/bus.c
@@ -722,6 +722,8 @@ void ishtp_bus_remove_all_clients(struct ishtp_device *ishtp_dev,
spin_lock_irqsave(&ishtp_dev->cl_list_lock, flags);
list_for_each_entry(cl, &ishtp_dev->cl_list, link) {
cl->state = ISHTP_CL_DISCONNECTED;
+ if (warm_reset && cl->device->reference_count)
+ continue;
/*
* Wake any pending process. The waiter would check dev->state
diff --git a/drivers/hid/intel-ish-hid/ishtp/client.c b/drivers/hid/intel-ish-hid/ishtp/client.c
index 82c907f01bd3..8a7f2f6a4f86 100644
--- a/drivers/hid/intel-ish-hid/ishtp/client.c
+++ b/drivers/hid/intel-ish-hid/ishtp/client.c
@@ -49,7 +49,9 @@ static void ishtp_read_list_flush(struct ishtp_cl *cl)
list_for_each_entry_safe(rb, next, &cl->dev->read_list.list, list)
if (rb->cl && ishtp_cl_cmp_id(cl, rb->cl)) {
list_del(&rb->list);
- ishtp_io_rb_free(rb);
+ spin_lock(&cl->free_list_spinlock);
+ list_add_tail(&rb->list, &cl->free_rb_list.list);
+ spin_unlock(&cl->free_list_spinlock);
}
spin_unlock_irqrestore(&cl->dev->read_list_spinlock, flags);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] HID: Intel-ish-hid: Ishtp: Fix sensor reads after ACPI S3 suspend
2024-02-09 6:52 [PATCH] HID: Intel-ish-hid: Ishtp: Fix sensor reads after ACPI S3 suspend Even Xu
@ 2024-02-09 14:41 ` srinivas pandruvada
2024-02-13 10:31 ` Jiri Kosina
0 siblings, 1 reply; 4+ messages in thread
From: srinivas pandruvada @ 2024-02-09 14:41 UTC (permalink / raw)
To: Even Xu, jikos, benjamin.tissoires, linux-input
Cc: linux-kernel@vger.kernel.org
On Fri, 2024-02-09 at 14:52 +0800, Even Xu wrote:
> After legacy suspend/resume via ACPI S3, sensor read operation fails
> with timeout. Also, it will cause delay in resume operation as there
> will be retries on failure.
>
> This is caused by commit f645a90e8ff7 ("HID: intel-ish-hid:
> ishtp-hid-client: use helper functions for connection"), which used
> helper functions to simplify connect, reset and disconnect process.
> Also avoid freeing and allocating client buffers again during
> reconnect
> process.
>
> But there is a case, when ISH firmware resets after ACPI S3 suspend,
> ishtp bus driver frees client buffers. Since there is no realloc
> again
> during reconnect, there are no client buffers available to send
> connection
> requests to the firmware. Without successful connection to the
> firmware,
> subsequent sensor reads will timeout.
>
> To address this issue, ishtp bus driver does not free client buffers
> on
> warm reset after S3 resume. Simply add the buffers from the read list
> to free list of buffers.
>
> Fixes: f645a90e8ff7 ("HID: intel-ish-hid: ishtp-hid-client: use
> helper functions for connection")
> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218442
> Signed-off-by: Even Xu <even.xu@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Hi Jiri,
This regression is introduced with 6.8-rc1, so need a pull request for
this rc cycle.
Thanks,
Srinivas
> ---
> drivers/hid/intel-ish-hid/ishtp/bus.c | 2 ++
> drivers/hid/intel-ish-hid/ishtp/client.c | 4 +++-
> 2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hid/intel-ish-hid/ishtp/bus.c
> b/drivers/hid/intel-ish-hid/ishtp/bus.c
> index aa6cb033bb06..03d5601ce807 100644
> --- a/drivers/hid/intel-ish-hid/ishtp/bus.c
> +++ b/drivers/hid/intel-ish-hid/ishtp/bus.c
> @@ -722,6 +722,8 @@ void ishtp_bus_remove_all_clients(struct
> ishtp_device *ishtp_dev,
> spin_lock_irqsave(&ishtp_dev->cl_list_lock, flags);
> list_for_each_entry(cl, &ishtp_dev->cl_list, link) {
> cl->state = ISHTP_CL_DISCONNECTED;
> + if (warm_reset && cl->device->reference_count)
> + continue;
>
> /*
> * Wake any pending process. The waiter would check
> dev->state
> diff --git a/drivers/hid/intel-ish-hid/ishtp/client.c
> b/drivers/hid/intel-ish-hid/ishtp/client.c
> index 82c907f01bd3..8a7f2f6a4f86 100644
> --- a/drivers/hid/intel-ish-hid/ishtp/client.c
> +++ b/drivers/hid/intel-ish-hid/ishtp/client.c
> @@ -49,7 +49,9 @@ static void ishtp_read_list_flush(struct ishtp_cl
> *cl)
> list_for_each_entry_safe(rb, next, &cl->dev->read_list.list,
> list)
> if (rb->cl && ishtp_cl_cmp_id(cl, rb->cl)) {
> list_del(&rb->list);
> - ishtp_io_rb_free(rb);
> + spin_lock(&cl->free_list_spinlock);
> + list_add_tail(&rb->list, &cl-
> >free_rb_list.list);
> + spin_unlock(&cl->free_list_spinlock);
> }
> spin_unlock_irqrestore(&cl->dev->read_list_spinlock, flags);
> }
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] HID: Intel-ish-hid: Ishtp: Fix sensor reads after ACPI S3 suspend
2024-02-09 14:41 ` srinivas pandruvada
@ 2024-02-13 10:31 ` Jiri Kosina
2024-02-19 2:11 ` Xu, Even
0 siblings, 1 reply; 4+ messages in thread
From: Jiri Kosina @ 2024-02-13 10:31 UTC (permalink / raw)
To: srinivas pandruvada
Cc: Even Xu, benjamin.tissoires, linux-input,
linux-kernel@vger.kernel.org
On Fri, 9 Feb 2024, srinivas pandruvada wrote:
> > Fixes: f645a90e8ff7 ("HID: intel-ish-hid: ishtp-hid-client: use
> > helper functions for connection")
> > Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218442
> > Signed-off-by: Even Xu <even.xu@intel.com>
> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
>
> Hi Jiri,
>
> This regression is introduced with 6.8-rc1, so need a pull request for
> this rc cycle.
Right; now queued in hid.git#for-6.8/upstream-fixes. Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] HID: Intel-ish-hid: Ishtp: Fix sensor reads after ACPI S3 suspend
2024-02-13 10:31 ` Jiri Kosina
@ 2024-02-19 2:11 ` Xu, Even
0 siblings, 0 replies; 4+ messages in thread
From: Xu, Even @ 2024-02-19 2:11 UTC (permalink / raw)
To: Jiri Kosina, srinivas pandruvada
Cc: benjamin.tissoires@redhat.com, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org
Thanks Jiri and Srinivas!
Best Regards,
Even Xu
-----Original Message-----
From: Jiri Kosina <jikos@kernel.org>
Sent: Tuesday, February 13, 2024 6:32 PM
To: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: Xu, Even <even.xu@intel.com>; benjamin.tissoires@redhat.com; linux-input@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: Re: [PATCH] HID: Intel-ish-hid: Ishtp: Fix sensor reads after ACPI S3 suspend
On Fri, 9 Feb 2024, srinivas pandruvada wrote:
> > Fixes: f645a90e8ff7 ("HID: intel-ish-hid: ishtp-hid-client: use
> > helper functions for connection")
> > Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218442
> > Signed-off-by: Even Xu <even.xu@intel.com>
> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
>
> Hi Jiri,
>
> This regression is introduced with 6.8-rc1, so need a pull request for
> this rc cycle.
Right; now queued in hid.git#for-6.8/upstream-fixes. Thanks,
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-02-19 2:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-09 6:52 [PATCH] HID: Intel-ish-hid: Ishtp: Fix sensor reads after ACPI S3 suspend Even Xu
2024-02-09 14:41 ` srinivas pandruvada
2024-02-13 10:31 ` Jiri Kosina
2024-02-19 2:11 ` Xu, Even
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).