Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp593877ybz; Wed, 15 Apr 2020 14:45:55 -0700 (PDT) X-Google-Smtp-Source: APiQypLU4vMvgGDhQe5pK00ZUObdrYvOevpcr2pNrkVPJGBF2xugPNlhG+tLs3c/zFPRNyqzceQ4 X-Received: by 2002:a17:906:4e02:: with SMTP id z2mr6829409eju.212.1586987155330; Wed, 15 Apr 2020 14:45:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586987155; cv=none; d=google.com; s=arc-20160816; b=iOPBO/oLOX6RpmXsVdQRKUX/AWv6yOLsg7PW57zLXQ5G4U1gQLiEtpVyzLzl6qJkLR GS16ekb2M4VJXeer4k8sUMoDh+CL2JS8oS+3DAkqw9/Wsy9WZx0ptywy4dzO0wnv/c+X SaYwtUYJrEhI2eSK2m2eYJ/Pt5QXtsHoDBKzNG0GRNTcE3hm6OSHpnzqcjp4h9DxQEDB NWx/SYyMgJPFzymUlCZuBFXMAXq13rd1Zt+cNp7UQtP3Ra4IHLc/Hj6h7gccTm2uhefY GL5DUwB1FhONDOoCDo7UvB07GQvqMmHkWvrdxwv3vlIwcq5isXVcyUx0UXiZFcOBAzBH tg1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=LF4WjAfAohGwiKnR2a7Nj40SDLxMeb6Kso2NdiI4o3M=; b=DUdPALzkTqmreL2uiGfqjqdUmrcegQm3M5B85NRnaqt7IW3W4m3vqwN00AGr3stufg cOKZLp1K074Zb2BMvywmKEKHIcOw8R1HKj4RpDOeOfW1FzqtY6b0kk+lRQ0m/8Oj5NtQ nHAskvnngogakK6oZTdXOSc8APm2aVj8fXn+evpfTkcPDRh5Qg5vhHWgvWo1kDCh8xOt WKDU5hi15V6pa7X7XKeJh1yZOO3dI/vwiJxu+BSdw3pksCKF/GmzpX7wajxo8Rna9mt2 lFDVYih01OQM6TYplrslOlPkxr7/UABjXDQsLkzsxXA6bu4SwN9VbCvf8HOUNb28nYYh Pc+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c23si11761803edv.319.2020.04.15.14.45.31; Wed, 15 Apr 2020 14:45:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391502AbgDNQZZ (ORCPT + 99 others); Tue, 14 Apr 2020 12:25:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2391500AbgDNQZO (ORCPT ); Tue, 14 Apr 2020 12:25:14 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F9B4C061A0C for ; Tue, 14 Apr 2020 09:25:14 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id A32982A0ECD Subject: Re: [PATCH v2 2/2] platform/chrome: cros_ec_ishtp: free ishtp buffer before sending event To: Mathew King , linux-kernel@vger.kernel.org Cc: Jett Rink , Benson Leung , Guenter Roeck , Rushikesh S Kadam References: <20200410162305.76638-1-mathewk@chromium.org> <20200410162305.76638-2-mathewk@chromium.org> From: Enric Balletbo i Serra Message-ID: <6690592e-5423-2f9c-4f59-29d5149c488a@collabora.com> Date: Tue, 14 Apr 2020 18:25:09 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200410162305.76638-2-mathewk@chromium.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jett and Mathew, Thank you for the patch. On 10/4/20 18:23, Mathew King wrote: > From: Jett Rink > > 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 > Signed-off-by: Mathew King 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); > } >