Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1787464imm; Thu, 9 Aug 2018 01:50:55 -0700 (PDT) X-Google-Smtp-Source: AA+uWPz4PEWHibYBedogZ7ctqCh528YNjcFAO4L2S58H1MX0vgnx/BaeO9DJJ6xJhRTejGrrq3cu X-Received: by 2002:a17:902:7d8f:: with SMTP id a15-v6mr1260792plm.332.1533804655037; Thu, 09 Aug 2018 01:50:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533804655; cv=none; d=google.com; s=arc-20160816; b=DnGOYil9XwgsG+zCMiyW0IsSxazeSZUi/1ntRtnoNGjt1O6roZOj7zMoTwGcMHKv1A k9E6Y2bWV3eYNOvsawthzDzMHO6ziitBdRc/DstPiQzzVVMDjQhot0tbNgSCHt5HDe7r nplRSTkCHplKOlE90gOa/lY8keL0vNT0TIzOBAR1yUyxX5TFp1soq+TZLuG5TjkFkHw+ HQ8sIAUaP4xxjBBJSGrTXHhG4dGBZ0cO+Or2v3+jD9uNe9Xxv2C3JUplh6COAIZ/lfrE JmgIEMCQE2AEFsy2IS0UuyqI8wuCVwxvb3SiKzRjMBU/9IhRgEvyOzKWnM6jGY3/Paua R/vg== 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:references:cc:to:from:subject:dkim-signature :arc-authentication-results; bh=SRuVrdpwxT3oI12KDLL4JztXEkubOahLp+YZFWkRy/Y=; b=sjZjb6MwVfuOs1AavAOHraVSAGZ3NOe9BIaw2IubhmL6jmg3H2Se39sotEiasH0N3L Fpz7F75krVOo3dL4YiJbvGZph+fGazKQ0lZKeFgI2GCqXDxGxLbV9dIX/tjn3ZXEZgSM SVR7MyDMzHd2dP5M1C34GqKYf0JdDt9bxwDByCY+rL4Zb75ENo1aq5+894a6OCgwhd5q Q4v658QVFVgPWHNTmZQqWcb8k7Tamz2WTrdpPzOoDSCBFyMSJ1oYU5fjlX6/i9f9j3cU cw15Rmr04VRTHFn3tki8UyM11ibVwW49u3Mrpc4lrLHVw5KfS0d90MzO+BF8n8kdCi45 v0Mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kapsi.fi header.s=20161220 header.b=EQm3pTx4; 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 a90-v6si5249173plc.285.2018.08.09.01.50.40; Thu, 09 Aug 2018 01:50:54 -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=fail header.i=@kapsi.fi header.s=20161220 header.b=EQm3pTx4; 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 S1729869AbeHILNX (ORCPT + 99 others); Thu, 9 Aug 2018 07:13:23 -0400 Received: from mail.kapsi.fi ([91.232.154.25]:52201 "EHLO mail.kapsi.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727601AbeHILNX (ORCPT ); Thu, 9 Aug 2018 07:13:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kapsi.fi; s=20161220; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:References:Cc:To:From:Subject:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=SRuVrdpwxT3oI12KDLL4JztXEkubOahLp+YZFWkRy/Y=; b=EQm3pTx4M8/xBvpWLi8IBpczRm oXwBdczjh/FkqwcTzkWwh7cbFWlIhZ7vfRnhSL+Tj5H3HUcj3HOYMLvdNZQSWt1QLuJoS5JwSi5IR I812gU53XW7SM8rSSGGwGTMIL14ycZogtSnO1ZvTCe8vOKGoNd8/JAzBvoCGAoNbrZRd1dd6CvnfP N5hIQ77a3gin/1oeHoRbR5vWZ/tXizctHFEAAJPws0p8/VXrFlv5liD5e/yRuqLJtgLFzrA369kPA +QVG+S4NGqrbc5boLoQgzbXTQ+1qcrs4a3wNC3D4PWy9PqDqcAROXxwt1mIZ8cishEK4Kb9zZMCfH KWUpKu1g==; Received: from [193.209.96.43] (helo=[10.21.26.144]) by mail.kapsi.fi with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1fngdE-0007PI-1J; Thu, 09 Aug 2018 11:49:20 +0300 Subject: Re: [PATCH v3 3/8] mailbox: Add transmit done by blocking option From: Mikko Perttunen To: Jassi Brar 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 References: <20180702114033.15654-1-mperttunen@nvidia.com> <20180702114033.15654-4-mperttunen@nvidia.com> <907bac36-0c54-8f38-0f5e-f59196d414c6@kapsi.fi> Message-ID: Date: Thu, 9 Aug 2018 11:49:19 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 193.209.96.43 X-SA-Exim-Mail-From: cyndis@kapsi.fi X-SA-Exim-Scanned: No (on mail.kapsi.fi); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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