Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp24863rwr; Wed, 19 Apr 2023 02:53:39 -0700 (PDT) X-Google-Smtp-Source: AKy350autG0YLUrZd+u4g3Av2NIDTJZNm/hT+y8RXRUHA+/YJTnUssHgfprLxkFmO55MFdEPtUX1 X-Received: by 2002:a17:902:d709:b0:1a6:b971:faf8 with SMTP id w9-20020a170902d70900b001a6b971faf8mr3708441ply.53.1681898018918; Wed, 19 Apr 2023 02:53:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681898018; cv=none; d=google.com; s=arc-20160816; b=E60c/TNd8nIGQDwZzvot3BClP+HKNx/TuH0OiiLSZzJ9xEdCY6TVOUdp2UAIEGsSEX jBYsCQPgK/tQU9xd9g80B58FvAkqT4DEEKtQUlH+qz1CEUOJQMhA1lD/aLvnP28C1hD3 OFg79KHoZ0BvJHjRZnhV9TNfWRDeOThEmZn+ON19462gu3ztSPEdS37yMfFFTB6I3ZAN SK8BPB+AgWuSbeZakG095KV7cenZXW4BPcmIZdvjrsK+58ey+8Xx2bPYRgeOmOHUCcpG X3/poz9rFjZRov3bI9tkDB3NLg4I4GHXwg304BU1vZLvHNDSppJF6/Z8UtfMXbI41T+2 jKoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:in-reply-to:from:cc:to:content-language :subject:user-agent:mime-version:date:message-id:dkim-signature :dkim-filter; bh=0kO6mZexP7v1yQRKLBpRg3Wv/Zx4ilaho2niMqHkyn4=; b=x23zWp/athu9O5Pw6ls3aKAFVA9QrsXtw1MjpzGqxoiaBv9Xtc3alqB4BDK4x9Ajxd Obm6KMfHe9baTGpEwV5RdRsrRNy6QmnJnjyI4aAJzdvsIdO8mgfubE3uemRjqjtoPBPW lC9yw5FNRnOlTf6SqOVf+5rbsenWOmGM1jT2L42P8XteH1iR2Lxyia2o3eDhvIp5yRL5 Li2GmI8hRjm3sJ3wdibfzMzjYr7RWzL+Mhwxw6VPqmOBCqmwTBQCnhnGu/wvBIgq0Zyr GrRaxbElt4lYLhQhkwNvYprly4nTAKVSjZ9KDiq0ub3THGFOvt119a6siT0ve+Nu0/lR Jgxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=nQTx83TE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f11-20020a170902ce8b00b001a63c77bb2esi17267695plg.262.2023.04.19.02.53.27; Wed, 19 Apr 2023 02:53:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=nQTx83TE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231574AbjDSJnp (ORCPT + 99 others); Wed, 19 Apr 2023 05:43:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232225AbjDSJnh (ORCPT ); Wed, 19 Apr 2023 05:43:37 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85BD71728 for ; Wed, 19 Apr 2023 02:43:34 -0700 (PDT) Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20230419094331epoutp011dfb0217f939c9a4f8772a180bcab55f~XTMj9wW0J0351603516epoutp01X for ; Wed, 19 Apr 2023 09:43:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20230419094331epoutp011dfb0217f939c9a4f8772a180bcab55f~XTMj9wW0J0351603516epoutp01X DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1681897412; bh=0kO6mZexP7v1yQRKLBpRg3Wv/Zx4ilaho2niMqHkyn4=; h=Date:Subject:To:Cc:From:In-Reply-To:References:From; b=nQTx83TEan1H8heT4hoGGngeXVvavomFqMKXmhplfP06BIIpUPTFNHt6kZUTVvAoc ZB2R7YZhY3SzmN5TiPJU7vtjAnoBjVLfAvdtvxbMnnSA7Y70y386FAaZKia6l9BBnh 5JBH9ejl1J1Fc98YleHpx2uvKYECmRjjetYLoKWU= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas2p1.samsung.com (KnoxPortal) with ESMTP id 20230419094331epcas2p1b73f3a8e6fcbf21380cdd49a91ff8505~XTMjiHUGl0080400804epcas2p1V; Wed, 19 Apr 2023 09:43:31 +0000 (GMT) Received: from epsmges2p4.samsung.com (unknown [182.195.36.89]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4Q1bSz1Rdhz4x9Pr; Wed, 19 Apr 2023 09:43:31 +0000 (GMT) Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 3B.4E.09650.3C7BF346; Wed, 19 Apr 2023 18:43:31 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas2p4.samsung.com (KnoxPortal) with ESMTPA id 20230419094330epcas2p495358693c341dc79d18d7d392c435207~XTMis7jSg3121831218epcas2p4p; Wed, 19 Apr 2023 09:43:30 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230419094330epsmtrp1362e24c6829feee4b8ce638438ccaa4b~XTMir8c970910709107epsmtrp13; Wed, 19 Apr 2023 09:43:30 +0000 (GMT) X-AuditID: b6c32a48-023fa700000025b2-eb-643fb7c3505b Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id E5.EE.08279.2C7BF346; Wed, 19 Apr 2023 18:43:30 +0900 (KST) Received: from [10.229.8.168] (unknown [10.229.8.168]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20230419094330epsmtip10d93a423f325a85b94af2a0671bceed6~XTMieK3Ts1321013210epsmtip1w; Wed, 19 Apr 2023 09:43:30 +0000 (GMT) Message-ID: <9d2e2bda-4213-35d0-55d7-827bad9b13a1@samsung.com> Date: Wed, 19 Apr 2023 18:41:05 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v2 3/4] spi: s3c64xx: add sleep during transfer Content-Language: en-US To: Krzysztof Kozlowski , Mark Brown , Andi Shyti , Alim Akhtar Cc: linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Chanho Park From: Jaewon Kim In-Reply-To: Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrCJsWRmVeSWpSXmKPExsWy7bCmme7h7fYpBvP+cFg8mLeNzWLxj+dM FlMfPmGzuLxf22Lv663sFpseX2O1uLxrDpvFjPP7mCwaP95kd+D0uL7kE7PHplWdbB53ru1h 89i8pN6jb8sqRo/Pm+QC2KKybTJSE1NSixRS85LzUzLz0m2VvIPjneNNzQwMdQ0tLcyVFPIS c1NtlVx8AnTdMnOAblJSKEvMKQUKBSQWFyvp29kU5ZeWpCpk5BeX2CqlFqTkFJgX6BUn5haX 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SwezNvGZrH4x3Mm i6kPn7BZXN6vbbH39VZ2i02Pr7FaXN41h81ixvl9TBaNH2+yO3B6XF/yidlj06pONo871/aw eWxeUu/Rt2UVo8fnTXIBbFFcNimpOZllqUX6dglcGYvvWxY8465Ytk+1gXEtZxcjJ4eEgIlE 1+rV7F2MXBxCArsZJfr6H7JAJGQklj/rY4OwhSXutxxhhSh6ySgx4+YlZpAEr4CdRMfBP2AN LAKqEi2PV7FBxAUlTs58AhYXFYiWuLH8GxOILSzgLLHv1lJ2EJtZQFzi1pP5TCBDRQQWM0p0 XHoLdgazwEZGiZXX1zNDrPvJKPH5xGWwUWwC2hLf1y9mBbE5gVYvmXONDWKUmUTX1i5GCFte YvvbOcwTGIVmIblkFpKNs5C0zELSsoCRZRWjZGpBcW56brFhgWFearlecWJucWleul5yfu4m RnBMaWnuYNy+6oPeIUYmDsZDjBIczEoivGdcrVKEeFMSK6tSi/Lji0pzUosPMUpzsCiJ817o OhkvJJCeWJKanZpakFoEk2Xi4JRqYDp9+OdF4aXv6jYa9KU+jgowYYtZYV68WCsx4tn3BJFD TX9iTXVcPWXPTa32ufTqofL/cmH/vXv8Hu695Hl81wrflM1PghyDs/Z8nrNzb9492+Urcx9I LXM7HrmrrPOIyoysHWGha5pfnAwU28e5vKV4a+OVSzMCs4+8lK53tDTqlDupusWoMd6PXTBY VrFPjHmS2h75rjtvnvm/Klrevz1PcmKBuNFxqRt9PuqztRbK1Kv3xm4/ve38+3VyQjVc+xfd l1tdJH6yf+XRDtZHF5v2aSWF/Uh52fm97Fn3vE/1PwOMLV7+cfENObGs/eaJU5WJ31SrjpSn u5+oq42bMu8i5xLOuo6d8Q5rs3dnyCuxFGckGmoxFxUnAgDT3qPwGAMAAA== X-CMS-MailID: 20230419094330epcas2p495358693c341dc79d18d7d392c435207 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20230419062755epcas2p1bca14bbd5200ebe5241780d2d7ec1596 References: <20230419060639.38853-1-jaewon02.kim@samsung.com> <20230419060639.38853-4-jaewon02.kim@samsung.com> X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23. 4. 19. 17:19, Krzysztof Kozlowski wrote: > On 19/04/2023 08:06, Jaewon Kim wrote: >> In polling mode, the status register is constantly read to check transfer >> completion. It cause excessive CPU usage. >> So, it calculates the SPI transfer time and made it sleep. >> >> Signed-off-by: Jaewon Kim >> --- >> drivers/spi/spi-s3c64xx.c | 8 ++++++++ >> 1 file changed, 8 insertions(+) >> >> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c >> index 886722fb40ea..cf3060b2639b 100644 >> --- a/drivers/spi/spi-s3c64xx.c >> +++ b/drivers/spi/spi-s3c64xx.c >> @@ -561,6 +561,14 @@ static int s3c64xx_wait_for_pio(struct s3c64xx_spi_driver_data *sdd, >> u32 cpy_len; >> u8 *buf; >> int ms; >> + u32 tx_time; >> + >> + /* sleep during signal transfer time */ >> + status = readl(regs + S3C64XX_SPI_STATUS); >> + if (RX_FIFO_LVL(status, sdd) < xfer->len) { >> + tx_time = (xfer->len * 8 * 1000 * 1000) / sdd->cur_speed; >> + usleep_range(tx_time / 2, tx_time); >> + } > Did you actually check the delays introduced by it? Is it worth? Yes, I already test it. Throughput was the same, CPU utilization decreased to 30~40% from 100%. Tested board is ExynosAutov9 SADK. > >> >> /* millisecs to xfer 'len' bytes @ 'cur_speed' */ >> ms = xfer->len * 8 * 1000 / sdd->cur_speed; > You have now some code duplication so this could be combined. > > Best regards, > Krzysztof > > Thanks Jaewon Kim