Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2044369imu; Thu, 17 Jan 2019 07:30:27 -0800 (PST) X-Google-Smtp-Source: ALg8bN7kycTcn2xdqILnLmf3eNTXocjoqM91bAYlk9qIOZ5bw34B3o/H0PI6NVquFqgc8988pTvA X-Received: by 2002:a62:5793:: with SMTP id i19mr15434430pfj.49.1547739027598; Thu, 17 Jan 2019 07:30:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547739027; cv=none; d=google.com; s=arc-20160816; b=jhA+jJAHmaJFLAzcOEfPbom8nubgCJ3mNRxupBlW0dbpqGf6w0pk85RMS8pooLrjuf iK/X6ZcLW3BsoHX60iLkt2dvMGVS5wHOeYdS6cijvQssdlDB1XbseUrZROVsj8MUxnXE W0O9A4qxs7jnnvNXgxfusHcKCiFgvNdsFQmZ4uDK7eUYpxpC4z2lYO9gkCl6Kw7EkbPZ Mwb18Bz10tXiaJsuJWYCz6knNXuzSfq9jCE7IjLywe3VjDEKlNYC5TMP40abfbwEoFVK uVd/fb5bPmRhGhsruSsr7mLDe1KfBajfNf3KCeYqtxDT2+4d7PkG9rcWMX6LnD0uj2p7 HCzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=LnLAybpdoQnr3UI674Pd3aAhNK3gQ91jeRbiR4dTUzo=; b=h+jhErdv1vefTPW2eT/BOpGtYid9TM+n0XnB8AJJn2VhGr1o5ZuXTJ7Ujj9Tix8sd1 5yZs/0cpzEOT0Z1OslHfK0+N5ch9SpzV5HMmR7xwRSKTWTyAomZPyCInNM6i8OKBCu9Q 8PafFkyeH1823eMl93OB6ADgGwjrbcBjfsjVyOHxifM5ykBPoDmiIOsCXYao+6WeN0e/ 7bwk5A1UN+u7KsjhwA/FplLsRFTvg54OkVez7SLTHeuexMZ3pIhmd3ZlL0o33KQvWgOB 0o8xTs9h4DjA29kJ8hssF/006TxSA1Z/n3/GFp3VeDnLII5H+viB6+bTCUy2bB2o59O4 K0jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LXjcPMfR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j10si2005521plg.123.2019.01.17.07.30.10; Thu, 17 Jan 2019 07:30:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LXjcPMfR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728535AbfAQPWV (ORCPT + 99 others); Thu, 17 Jan 2019 10:22:21 -0500 Received: from mail-it1-f193.google.com ([209.85.166.193]:40491 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727606AbfAQPWV (ORCPT ); Thu, 17 Jan 2019 10:22:21 -0500 Received: by mail-it1-f193.google.com with SMTP id h193so1582226ita.5 for ; Thu, 17 Jan 2019 07:22:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LnLAybpdoQnr3UI674Pd3aAhNK3gQ91jeRbiR4dTUzo=; b=LXjcPMfRXIMWwPJyrnMqKTICp5a1OZY48w+6G2JBs8vl4QdDnuyke2az+Dtx3TKa50 7cu5HMsSCjnWTcdjf0hMKU6WUM1jdboXfI5IBmn39UmDoOW/r4IY2uMcqvJlGTzmWX/P r4KwfWUZK18GUWSzpIaZzNPS/b50y5L7h5AHrP4ZayuOpikN6LIitL7b6+hyBkXJeyF8 DmYo/JkGL1orbYpF7ecKCk8fKY7GYKF1Foz42ZN4onqL7jfICuCQLmzqdiDBCNVXFTnR n74fqkd9CrqapVSUUZuk0WDRg7mKC7JzscM1F7UYpmNw97WERaUttPjZbPilFnqHQS81 opHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LnLAybpdoQnr3UI674Pd3aAhNK3gQ91jeRbiR4dTUzo=; b=iug7dOETu2wxpOJVlLXKuZf3nE6YKFv6uL8ECJwkKbAH8NlZ1QRbL6oTTSYmDeoLru mdMyThB1qyr9J0ZbnNIlPM51TnRx9RCMHdbgRMN62quVJ6L6LGeYijfFZRm+eJeFXM8P NBicblM4/XZFvBHQR36wA98WipdjylBmFQx/cnDlW6/OayI0X0iS+XvZkIgN/hJySAKG qjUTHOfEd4RLF1SvLmEBKWvWa4QJ3UO1GsdhANFsxF9RU/7vzeZX/y8ffKn1Lf52OSwn bt1Gm6nTAbNYkMtLwm/nQf/XOh4CtGdYESvmL/i5mC5eA65t818BcTe3Firwi10wzC6w MA4w== X-Gm-Message-State: AJcUukcKCVmY9ZCl6Nwf0wfOAw0sf+vMWKLMS8eJYSDkp1hhbCFYwOCy cQZqr1fbiB6+FKdCspwIROKrfWHcoZK6Hm9wwMs= X-Received: by 2002:a02:5184:: with SMTP id s126mr7945358jaa.12.1547738540125; Thu, 17 Jan 2019 07:22:20 -0800 (PST) MIME-Version: 1.0 References: <20190116050435.11624-1-ck.hu@mediatek.com> <20190116050435.11624-2-ck.hu@mediatek.com> <1547712032.5318.17.camel@mtksdaap41> In-Reply-To: <1547712032.5318.17.camel@mtksdaap41> From: Jassi Brar Date: Thu, 17 Jan 2019 09:22:09 -0600 Message-ID: Subject: Re: [PATCH 1/3] mailbox: Add ability for clients to abort data in channel To: CK Hu Cc: Matthias Brugger , Houlong Wei , Linux Kernel Mailing List , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, srv_heupstream@mediatek.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 17, 2019 at 2:00 AM CK Hu wrote: > > Hi, Jassi: > > On Wed, 2019-01-16 at 10:22 -0600, Jassi Brar wrote: > > On Tue, Jan 15, 2019 at 11:07 PM CK Hu wrote: > > > > > > This patch supplies a new framework API, mbox_abort_channel(), and > > > a new controller interface, abort_data(). > > > > > > For some client's application, it need to clean up the data in channel > > > but keep the channel so it could send data to channel later. > > > > > > Signed-off-by: CK Hu > > > --- > > > drivers/mailbox/mailbox.c | 23 +++++++++++++++++++++++ > > > include/linux/mailbox_client.h | 1 + > > > include/linux/mailbox_controller.h | 4 ++++ > > > 3 files changed, 28 insertions(+) > > > > > > diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c > > > index c6a7d4582dc6..281647162c76 100644 > > > --- a/drivers/mailbox/mailbox.c > > > +++ b/drivers/mailbox/mailbox.c > > > @@ -428,6 +428,29 @@ struct mbox_chan *mbox_request_channel_byname(struct mbox_client *cl, > > > } > > > EXPORT_SYMBOL_GPL(mbox_request_channel_byname); > > > > > > +/** > > > + * mbox_abort_channel - The client abort all data in a mailbox > > > + * channel by this call. > > > + * @chan: The mailbox channel to be aborted. > > > + */ > > > +void mbox_abort_channel(struct mbox_chan *chan) > > > +{ > > > + unsigned long flags; > > > + > > > + if (!chan || !chan->cl) > > > + return; > > > + > > > + if (chan->mbox->ops->abort_data) > > > + chan->mbox->ops->abort_data(chan); > > > + > > > + /* The queued TX requests are simply aborted, no callbacks are made */ > > > + spin_lock_irqsave(&chan->lock, flags); > > > + chan->cl = NULL; > > > + chan->active_req = NULL; > > > + spin_unlock_irqrestore(&chan->lock, flags); > > > +} > > > > > Why not just release and then request channel again ? > > mbox_abort_channel() is just a copy of mbox_free_channel() and if the > > abort can sleep, that is more reason to just do that. > > The cursor may change position 300 times in one second, so I still > concern the processing time. Request and free channel looks too heavy to > do 300 times per second. You send data 300Hz, not abort ... which is supposed to be a rare event. And then your shutdown/startup is currently empty, while abort isn't quite lightweight. > Conceptually, I just want to clean up the > channel rather than free and request it, so they are somewhat different. > I say it may sleep because mbox_abort_channel() is a copy of > mbox_free_channel(). I could change it to 'must not sleep' because > Mediatek controller does not sleep in abort callback. > No please. Just use the shutdown/startup. Thanks.