From: Enric Balletbo i Serra <enric.balletbo@collabora.com>
To: Mathew King <mathewk@chromium.org>, linux-kernel@vger.kernel.org
Cc: Jett Rink <jettrink@chromium.org>,
Benson Leung <bleung@chromium.org>,
Guenter Roeck <groeck@chromium.org>,
Rushikesh S Kadam <rushikesh.s.kadam@intel.com>
Subject: Re: [PATCH v2 2/2] platform/chrome: cros_ec_ishtp: free ishtp buffer before sending event
Date: Tue, 14 Apr 2020 18:25:09 +0200 [thread overview]
Message-ID: <6690592e-5423-2f9c-4f59-29d5149c488a@collabora.com> (raw)
In-Reply-To: <20200410162305.76638-2-mathewk@chromium.org>
Hi Jett and Mathew,
Thank you for the patch.
On 10/4/20 18:23, Mathew King wrote:
> From: Jett Rink <jettrink@chromium.org>
>
> Recycle the ISH buffer before notifying of a response or an event. Often
> a new message is sent in response to an event and in high traffic
> scenarios this can lead to exhausting all available buffers. We can
> ensure we are using the fewest buffers possible by freeing buffers as
> soon as they are used.
>
> Signed-off-by: Jett Rink <jettrink@chromium.org>
> Signed-off-by: Mathew King <mathewk@chromium.org>
Queued for 5.8
> ---
> v2: Reword the commit message
> ---
> drivers/platform/chrome/cros_ec_ishtp.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/platform/chrome/cros_ec_ishtp.c b/drivers/platform/chrome/cros_ec_ishtp.c
> index e673a7f738fc..ed794a7ddba9 100644
> --- a/drivers/platform/chrome/cros_ec_ishtp.c
> +++ b/drivers/platform/chrome/cros_ec_ishtp.c
> @@ -303,6 +303,10 @@ static void process_recv(struct ishtp_cl *cros_ish_cl,
> rb_in_proc->buffer.data, data_len);
>
> error_wake_up:
> + /* Free the buffer since we copied data or didn't need it */
> + ishtp_cl_io_rb_recycle(rb_in_proc);
> + rb_in_proc = NULL;
> +
> /* Set flag before waking up the caller */
> client_data->response.received = true;
>
> @@ -312,12 +316,14 @@ static void process_recv(struct ishtp_cl *cros_ish_cl,
> break;
>
> case CROS_MKBP_EVENT:
> + /* Free the buffer. This is just an event without data */
> + ishtp_cl_io_rb_recycle(rb_in_proc);
> + rb_in_proc = NULL;
> /*
> * Set timestamp from beginning of function since we actually
> * got an incoming MKBP event
> */
> client_data->ec_dev->last_event_time = timestamp;
> - /* The event system doesn't send any data in buffer */
> schedule_work(&client_data->work_ec_evt);
>
> break;
> @@ -327,8 +333,9 @@ static void process_recv(struct ishtp_cl *cros_ish_cl,
> }
>
> end_error:
> - /* Free the buffer */
> - ishtp_cl_io_rb_recycle(rb_in_proc);
> + /* Free the buffer if we already haven't */
> + if (rb_in_proc)
> + ishtp_cl_io_rb_recycle(rb_in_proc);
>
> up_read(&init_lock);
> }
>
next prev parent reply other threads:[~2020-04-14 16:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-10 16:23 [PATCH v2 1/2] platform/chrome: cros_ec_ishtp: skip old cros_ec responses Mathew King
2020-04-10 16:23 ` [PATCH v2 2/2] platform/chrome: cros_ec_ishtp: free ishtp buffer before sending event Mathew King
2020-04-14 16:25 ` Enric Balletbo i Serra [this message]
2020-04-14 16:24 ` [PATCH v2 1/2] platform/chrome: cros_ec_ishtp: skip old cros_ec responses Enric Balletbo i Serra
2020-04-14 16:45 ` Jett Rink
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6690592e-5423-2f9c-4f59-29d5149c488a@collabora.com \
--to=enric.balletbo@collabora.com \
--cc=bleung@chromium.org \
--cc=groeck@chromium.org \
--cc=jettrink@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathewk@chromium.org \
--cc=rushikesh.s.kadam@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®