Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1817634imm; Thu, 9 Aug 2018 02:28:03 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwX5ST/5yGgoyK/TEmtHHIqhZ1ZvzYziME+12YXkgmzJwmNFH5gjGQ7kwnympptqnvup7mK X-Received: by 2002:a65:5c83:: with SMTP id a3-v6mr1413199pgt.164.1533806883346; Thu, 09 Aug 2018 02:28:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533806883; cv=none; d=google.com; s=arc-20160816; b=o/7PkONYDJz5ogusRpkoMS8hcpWaQoze+SyfAgjdg6fZOZYsKFo3B5mmXtctLMsgUC 3IdXkLZzspYJSc1hEWEYb/U3nhXmB9fjPcsw5Ch7sJpAD5TfxEZ8+EERcslDsJEzZjmM glPr6NjkDUkY9fYUHvcOjnjUb7D8RZMMIEcAmsptefXRPIbAm2OGOCjCgwJ9N/qJ8CfW LcY0At7TLq35enq/RvBFnbj/Kx6yktJWl+jQxNKklpHDBIDtbs81mmpNnOGs6k/M6gX2 Fb12EtTn5S9h7vYgM1k1/inNd7CMCIu1/JKR9U9aquIAmE0xlvLAw5ciKShtdjaFLJIA aObA== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=+1csdFyNq7a2Wb7SlXHCwKIKeKiS7tTzRKA5GYgzbAI=; b=SEYdaTKm/Mvv3ofukfB2PkRBiBk4qqld03IqmlRt/h43YPjKaX6C6LTxqqPwIt+zAZ VktLQh//e7EYc3mCVZ7u2QHCgwFQvM8HjBNkv+oawq2Oi7EmnQtaRHqoUxN6FOovX4Ag GMNVjTNzm0VL42FkS1NHGfNxhvVwGchoAJJSVz9KZx3mxd5BBqwil0pJofY8WqtFzKvY zbpFgsoarfByAIsk/bCRgqXuoTvZClzHTjaEd/2SRjnzdGo/VfcF3XNFgZBWtQ4KM2TQ o3f3pdsh28cxx9J6WA71nu4MIvTS+ocNunhMDU1/w8p0GrbdphmOT/GYE0hEPOC9Qe8Y 0uSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oZonKDn0; 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 q12-v6si6648626pgg.532.2018.08.09.02.27.47; Thu, 09 Aug 2018 02:28:03 -0700 (PDT) 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=oZonKDn0; 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 S1730163AbeHILu6 (ORCPT + 99 others); Thu, 9 Aug 2018 07:50:58 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:40868 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727579AbeHILu5 (ORCPT ); Thu, 9 Aug 2018 07:50:57 -0400 Received: by mail-ed1-f67.google.com with SMTP id e19-v6so2544446edq.7; Thu, 09 Aug 2018 02:26:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=+1csdFyNq7a2Wb7SlXHCwKIKeKiS7tTzRKA5GYgzbAI=; b=oZonKDn0ePY+2z1dkkvqhQvBmHOyv+vLa8Ya/e6TfHFPj1SAuXjBJ5cpeTPOM3S4pc j0FDYSaZa79B9zQaRH1D2eQKaSUPCXVGC98SSi/WaEuzq2vD8IqKX1N4+wRoZrJbU1zQ CDC6A09DGM+Z7fkF7WvODRxNddDVifOU8aXGgBo3KUh0MhuDiALKf/iHNdwS79EKvexz 7TGtltNZcbKIX3/NIn71r62n8EYxOtoV9afkYf1JBoSHqtyR3IK3BuBWIMjjEXEiYzDJ i8Mu+tPXBv2mEqfLLj7G5hpFDeKtMQTZmg3ht40YJ1tG41LtjxOHaSBgWupRE5TIX9fa eAoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=+1csdFyNq7a2Wb7SlXHCwKIKeKiS7tTzRKA5GYgzbAI=; b=qHhyV0czqptTFhcgrHIjPwLOV9isLWiix8HEq9F/w6hO7qfx8REhw7wSlGuniShxfV Y64KsjwoMs6tveg+fvggyha/XR0eAStxSFaR7KtHKhLwFB/yfQLDxtNtp9TSzERtXfXt pfbDAfUQVeY+WlVdG1bUyK1r7185+G/trFDjqYmI7ZIhd0TVKMttqWMlV13jIxHugm6m Tkn9QjagEV2c9YBerba8iplQYYI6+bVNE0FpJkaPZotdmuM5HaL9DTjyvRoKLds+oYQn XauuskaG5qNBwyf8ZDJgt7CM0vFmaJakg78BPJMrxHFxgNqHCk+kPyXErK013xkw1bHm HXAw== X-Gm-Message-State: AOUpUlGDw6KrB3uzK4nweasfv6dY3gUZHV7ce8DFG4CZg7OjIOLLDRqB 7Ptxm15Vj1r+cJFe5c+4ZAGVgT/bAOQI0DlkyQ4= X-Received: by 2002:a50:8921:: with SMTP id e30-v6mr2160163ede.213.1533806816557; Thu, 09 Aug 2018 02:26:56 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a50:f68b:0:0:0:0:0 with HTTP; Thu, 9 Aug 2018 02:26:56 -0700 (PDT) In-Reply-To: References: <20180702114033.15654-1-mperttunen@nvidia.com> <20180702114033.15654-4-mperttunen@nvidia.com> <907bac36-0c54-8f38-0f5e-f59196d414c6@kapsi.fi> From: Jassi Brar Date: Thu, 9 Aug 2018 14:56:56 +0530 Message-ID: Subject: Re: [PATCH v3 3/8] mailbox: Add transmit done by blocking option To: Mikko Perttunen Cc: Mikko Perttunen , Greg KH , Thierry Reding , Jon Hunter , Devicetree List , linux-serial@vger.kernel.org, linux-tegra@vger.kernel.org, <", linux-arm-kernel"@lists.infradead.org>, srv_heupstream , srv_heupstream , Linux Kernel Mailing List 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 [dropping everyone else while we discuss the code] Thanks. I assume that branch as all the code that there is. Let me look and get back to you. On Thu, Aug 9, 2018 at 2:19 PM, Mikko Perttunen wrote: > Here's my current code: > > https://github.com/cyndis/linux/commits/wip/t194-tcu-4 > > "fixup! mailbox: tegra-hsp: Add support for shared mailboxes" splits up the > controller into two. "tegra-hsp: use polling" changes it to use polling. > > There are two lines in the top patch with comments: > > - at the end of tegra_hsp_mailbox_send_data, I left a "while > (!tegra_hsp_mailbox_last_tx_done(chan));". Without it I wasn't able to see > even a few garbled characters in the output. > > - as mentioned, if I enable tx_block on the client side, I get a BUG: > scheduling while atomic. I assume this gets printed through the earlycon as > it's printing out correctly. > > Thanks, > Mikko > > > On 08.08.2018 17:46, Mikko Perttunen wrote: >> >> On 08/08/2018 05:39 PM, Jassi Brar wrote: >>> >>> On Wed, Aug 8, 2018 at 8:04 PM, Mikko Perttunen wrote: >>>> >>>> >>>> >>>> On 08/08/2018 05:10 PM, Jassi Brar wrote: >>>>> >>>>> >>>>> On Wed, Aug 8, 2018 at 5:08 PM, Mikko Perttunen >>>>> wrote: >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> On 04.08.2018 13:45, Mikko Perttunen wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>> On 08/03/2018 03:54 PM, Jassi Brar wrote: >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Mon, Jul 2, 2018 at 5:10 PM, Mikko Perttunen >>>>>>>> >>>>>>>> wrote: >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> Add a new TXDONE option, TXDONE_BY_BLOCK. With this option, the >>>>>>>>> send_data function of the mailbox driver is expected to block until >>>>>>>>> the message has been sent. The new option is used with the Tegra >>>>>>>>> Combined UART driver to minimize unnecessary overhead when >>>>>>>>> transmitting >>>>>>>>> data. >>>>>>>>> >>>>>>>> 1) TXDONE_BY_BLOCK flag :- >>>>>>>> Have you tried setting the flag >>>>>>>> mbox_chan->mbox_client->tx_block >>>>>>>> ? >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> No - I suppose I should have done that. I'm a bit concerned about >>>>>>> overhead >>>>>>> as send_data may be called thousands of times per second, so I tried >>>>>>> to >>>>>>> make >>>>>>> it as close as possible to the downstream driver that just pokes the >>>>>>> mailbox >>>>>>> register directly. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> I tried using polling in the mailbox framework. Some printing is done >>>>>> from >>>>>> atomic context so it seems tx_block cannot be used - >>>>>> wait_for_completion_timeout understandably does not work in atomic >>>>>> context. >>>>>> I also tried without tx_block, in which case I got some horribly >>>>>> garbled >>>>>> output, but "Try increasing MBOX_TX_QUEUE_LEN" was readable there. >>>>>> >>>>>> Any opinions? >>>>>> >>>>> The problems arise because your hardware (SM) supports TXDONE_BY_POLL, >>>>> but your client drives it by TXDONE_BY_ACK because the older DB >>>>> channels are so. >>>>> >>>>> Please populate SM channels as a separate controller than DB. >>>>> The DB controller, as is, run by ACK method. >>>>> The SM controller should be run by polling, i.e, set txdone_poll = >>>>> true and the poll period small enough. The virtual tty client driver >>>>> should be able to safely set tx_block from appropriate context. >>>>> >>>> >>>> Sorry, I should have clarified that I already split up the controllers. >>>> The >>>> SM controller has txdone_poll = true. I didn't adjust txpoll_period so I >>>> guess it's zero. >>>> >>> Can you please share your code (controller and client) ? Maybe offline >>> if you wish. >>> >> >> I'll upload a git branch tomorrow -- I'm not at the machine with the code >> now. >> >> Mikko >> -- >> To unsubscribe from this list: send the line "unsubscribe linux-tegra" in >> the body of a message to majordomo@vger.kernel.org >> More majordomo info at http://vger.kernel.org/majordomo-info.html