Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1811075imu; Thu, 17 Jan 2019 03:43:04 -0800 (PST) X-Google-Smtp-Source: ALg8bN6yjjb6VenXRngnnRkF/2WmOy17Cp0+4QFXq1QWUZDW2ug1HyWSIs5ZMWv8I1PPYvYXMYSh X-Received: by 2002:a62:22d4:: with SMTP id p81mr15026349pfj.16.1547725384358; Thu, 17 Jan 2019 03:43:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547725384; cv=none; d=google.com; s=arc-20160816; b=LLsEUtNORhI5B7XWawDpXTzt94D3fTDJUmehYKFTy41tor4RK5bTs2qtX+JbnEq2pu O1DKcDRN7zbiX42sJCi7pVapkLD3ZZeBThOKYRBzznppzhknttXjVjn8pEOFMwtp1tjh BfIC5DeXvU1dkRCu9/7ksAodQDhrjnDJtD7AnqpPauCY3+WMefb4cJYWir1nj3/w4Z1Z 2B5lv5Z0/1tR6BCnUu0hkVaMHJbjQKbXeMuEV7w5rXQUiABB0lUNByialeWVDsnhAGZz /5waVW4l0zKfowS42KgdSajzWuUTQC3NLLlDHJb4vFz02Xuch2M3O6wq0nACRKZ5Jf2X dkDw== 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:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=Y7RmV3FBYDCNhoSz69qfU2EdGkVcYS7ufPoPswQGYDo=; b=l7slSyR9R5N9bJ6W9tZsWKXnzxzk3MPenVpE7UzCuWHy6t4gV1Rl7UaUKfjJCyCqIp sSIT8xTucnNEW5vjwQUE4GakYmeQveJLm32neUwwRQf485GkcVL1X3rN+S39hkVNcd2o oD9jIjtS3PdlM7N1uErt0tM/vu1cY0jAljVsIIrVLeWKM7f9PvdUaixnsV+FOk/hQmiO 6vnpErqFoqHkYIBLKbUiCXhZYTpOASES56ZIAVxUs/d34mc56hqeMdLYRitYwYmPCYwQ UqdwqNyP82HJHedzgs9/r9jl/ogHb+0nL9JU+LWdSWSgWWsrVK/KJ7IIJUdZTPcYRd4R /TZg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b12si1471056plx.159.2019.01.17.03.42.48; Thu, 17 Jan 2019 03:43:04 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729081AbfAQIAj (ORCPT + 99 others); Thu, 17 Jan 2019 03:00:39 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:34414 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727491AbfAQIAj (ORCPT ); Thu, 17 Jan 2019 03:00:39 -0500 X-UUID: ea431d14c2c54d268671b5d4f52924a8-20190117 X-UUID: ea431d14c2c54d268671b5d4f52924a8-20190117 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 153089909; Thu, 17 Jan 2019 16:00:34 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs03n2.mediatek.inc (172.21.101.182) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 17 Jan 2019 16:00:32 +0800 Received: from [172.21.77.4] (172.21.77.4) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Thu, 17 Jan 2019 16:00:32 +0800 Message-ID: <1547712032.5318.17.camel@mtksdaap41> Subject: Re: [PATCH 1/3] mailbox: Add ability for clients to abort data in channel From: CK Hu To: Jassi Brar CC: Matthias Brugger , Houlong Wei , Linux Kernel Mailing List , , , Date: Thu, 17 Jan 2019 16:00:32 +0800 In-Reply-To: References: <20190116050435.11624-1-ck.hu@mediatek.com> <20190116050435.11624-2-ck.hu@mediatek.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-SNTS-SMTP: 0AE1DE8F454E571EC2C12497B1F87F8F86732474482BE7D983F49524CDF2F1912000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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. Regards, CK