Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1720409pxk; Sun, 13 Sep 2020 13:38:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4kLmljgHmxlBCEhgUpt1eDV2hL3uk7dTD6KKz++jP34gpAyeC680mSO5Hnpvu1AALhMcG X-Received: by 2002:a17:907:2168:: with SMTP id rl8mr11440547ejb.308.1600029535684; Sun, 13 Sep 2020 13:38:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600029535; cv=none; d=google.com; s=arc-20160816; b=MhO2jxFVEmQIRz9v2afb/mWfo4iQtovywLKpWpQboiKAwSHCEi2luhX20v1YDRVXp3 D+lSw58NPyLC07FbiOhL3U9GqmnEb1NxBZRmKIraT2KKeraNhUJYEUUJNQEVJ0ON4I3X IdmxLRiwr/MTHkd+8sp/9iCX1UnnDZzAcPDw2CQEwfN9oIX2vEKwa/lXxlcdPnR8HtTi vdYd9zGiU29EYJMv5i2N+o6tRiRKqHy9IY3h1QiYudq+C4uiCP5cuztE2mRa5B1qekKZ X13xbaoRXWO/A6+AaRGLYnMDl23g3qb2cFTwx8nOYYhtyuR5bMA2mOYcuwefG+mFEd4p NXDg== 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=7//k4ZnzRlGYM9EKbMfbSQEPgFFjkWDQWTX6iz6Bros=; b=p8wyd4L6aD7dFj4bIdZY0GavBVmampaWDXcIw3tVCwsMz8xOM3Ui4fu2PSHdzmm3ic YvBHuBVp0+Zwf18OWlQn77eslksJdqwdWeM6q+CAq0O0WwTMLrzb0ObtA7oE683pL29W VdTF1Vr6vqF+6cqA5gczYeA7DF1tOSz1KutfVbp/ZYmQ/a/sc/hz8EVkREfTqOXyAsEH d/w9DOzZP6iv2Qay1OpMhOAWMfA8iTcznlX6ccowNNp54r5V6Qm3U8Ign9ilcTwmbGzZ U/AExOENmbdgf6E4gtnciIIlKTRkBShIH9yOJ9UjV6eQQRTaqw3GUt/VQ1xX3go58U0K VOpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=LujPMVoo; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p93si5914358edp.343.2020.09.13.13.38.32; Sun, 13 Sep 2020 13:38: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; dkim=pass header.i=@chromium.org header.s=google header.b=LujPMVoo; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725945AbgIMUfX (ORCPT + 99 others); Sun, 13 Sep 2020 16:35:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725938AbgIMUfV (ORCPT ); Sun, 13 Sep 2020 16:35:21 -0400 Received: from mail-vk1-xa43.google.com (mail-vk1-xa43.google.com [IPv6:2607:f8b0:4864:20::a43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8649C06174A for ; Sun, 13 Sep 2020 13:35:20 -0700 (PDT) Received: by mail-vk1-xa43.google.com with SMTP id e5so3631510vkm.2 for ; Sun, 13 Sep 2020 13:35:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7//k4ZnzRlGYM9EKbMfbSQEPgFFjkWDQWTX6iz6Bros=; b=LujPMVooXKT8EwHc0AmnxI0ZCCFHCgR387ccDWQ2vImrPK7nq6FNW7omZqh2xHS5q7 ReZy3cnXtFX8glJwNY21b3o/pCV/U6w52PLXZ88ougT3nWKZFs1RTWKLVJm5u/TYDye5 iNhGfZce5icXIqJi2H1Vtn3nkYF6WofKz0HRU= 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=7//k4ZnzRlGYM9EKbMfbSQEPgFFjkWDQWTX6iz6Bros=; b=G+4/siDclyly28kN9mLEZoozRUyXhsqzTa/gsbNW8bynIw+vXnzIfJxfb6oNiKFyq7 GpgG5pQtG8pXm97wpCDfp2IF6ltdA/YjZBX4rb3mj1m3angDshrYLVha4mEXhZCfSPvv dZOnvAnGCrcGmHs5QmkXVRjg5Ja14xpsSQfZVwg2kz5Xv0cuJ/L2IfaVoyJoU4BRR0sV vXQsZr8gfnvO8Nx6ICseH41w8Cr6Qs8XPjUj4iQRqtXAA//JqQ0LSgn8fgXWXuXUiCnO 5Uk1zg5fd0MVItISz7hh2JwA2VLPA2B0rvYttmyyqbDELkpBeHejOs+AOt/PGZh74sU7 iS3w== X-Gm-Message-State: AOAM530PWxnf0FV9GIqfAt+SDAeeTCp44uw9wlC2l00CaS8+vupZpRoI l6yPeXuIPHUFOFvxh9o04lEQq/FkQ5LJSQ== X-Received: by 2002:a1f:5c56:: with SMTP id q83mr5350010vkb.40.1600029319692; Sun, 13 Sep 2020 13:35:19 -0700 (PDT) Received: from mail-vs1-f45.google.com (mail-vs1-f45.google.com. [209.85.217.45]) by smtp.gmail.com with ESMTPSA id 68sm1264110vkx.0.2020.09.13.13.35.18 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 13 Sep 2020 13:35:18 -0700 (PDT) Received: by mail-vs1-f45.google.com with SMTP id y5so3810901vsd.5 for ; Sun, 13 Sep 2020 13:35:18 -0700 (PDT) X-Received: by 2002:a67:ff97:: with SMTP id v23mr5969962vsq.11.1600029318182; Sun, 13 Sep 2020 13:35:18 -0700 (PDT) MIME-Version: 1.0 References: <20200912140730.1.Ie67fa32009b94702d56232c064f1d89065ee8836@changeid> <20200912140730.3.Ided778fb4cd078e36c6b240d1b279cd7a534a313@changeid> <20200912225440.GB3715@yoga> In-Reply-To: From: Doug Anderson Date: Sun, 13 Sep 2020 13:35:06 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 3/3] spi: spi-geni-qcom: Slightly optimize setup of bidirectional xfters To: Bjorn Andersson Cc: Mark Brown , Akash Asthana , Stephen Boyd , Andy Gross , linux-arm-msm , LKML , linux-spi 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 Hi, On Sat, Sep 12, 2020 at 6:09 PM Doug Anderson wrote: > > Hi, > > On Sat, Sep 12, 2020 at 3:54 PM Bjorn Andersson > wrote: > > > > On Sat 12 Sep 16:08 CDT 2020, Douglas Anderson wrote: > > > > > When setting up a bidirectional transfer we need to program both the > > > TX and RX lengths. We don't need a memory barrier between those two > > > writes. Factor out the __iowmb() and use writel_relaxed(). This > > > saves a fraction of a microsecond of setup overhead on bidirectional > > > transfers. > > > > > > Signed-off-by: Douglas Anderson > > > --- > > > > > > drivers/spi/spi-geni-qcom.c | 13 ++++++++++--- > > > 1 file changed, 10 insertions(+), 3 deletions(-) > > > > > > diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c > > > index 92d88bf85a90..6c7e12b68bf0 100644 > > > --- a/drivers/spi/spi-geni-qcom.c > > > +++ b/drivers/spi/spi-geni-qcom.c > > > @@ -376,15 +376,22 @@ static void setup_fifo_xfer(struct spi_transfer *xfer, > > > len &= TRANS_LEN_MSK; > > > > > > mas->cur_xfer = xfer; > > > + > > > + /* > > > + * Factor out the __iowmb() so that we can use writel_relaxed() for > > > + * both writes below and thus only incur the overhead once even if > > > + * we execute both of them. > > > + */ > > > > How many passes through this function do we have to take before saving > > the amount of time it took me to read this comment? > > > > Reviewed-by: Bjorn Andersson > > Thanks for the review! Yeah, in Chrome OS we do a crazy amount of SPI > transfers since our EC and security chip are connected over SPI and we > seem to pile a whole lot of stuff into the EC. This means we keep > coming back to the SPI controller again and again when profiling > things. I'm hoping that we'll eventually be able to get DMA enabled > here, but until then at least it's nice to make the FIFO transfers > better... Ugh. Given the problem that the kernel test robot found, I'm gonna say just drop this patch but keep the others I sent. As per the CL description, it's a pretty minor optimization and even though we do a lot of SPI transfers it's probably more worth it to work towards DMA mode than to try to find a cleaner solution for this one. -Doug