Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp356774pxb; Thu, 5 Nov 2020 01:45:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJy+NUbcEIh4kkRfGxIjPTFUB0DazikwQ+b4CXVqv597WqAZsvEFQvCxsefpdW1iX3+gMZMB X-Received: by 2002:a05:6402:181a:: with SMTP id g26mr1750189edy.8.1604569544801; Thu, 05 Nov 2020 01:45:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604569544; cv=none; d=google.com; s=arc-20160816; b=kZ5agUHl+/GJ8Z2kt+GH6JD+aZz/BlGaQDFunqsShoukkzdt+xlzE2Dq1fB7gspHd9 v8FJ+4flfny42vQvN/Kybfm4az/wqwUc6I73/ilCWwb8yqzlOKy8dK1mLmR3VvKbDOhU Yi+oeI/8vqG0CMnr5efPOGukM6yNjV4GQo9Y9WVWmBG41DwkaoHras5qTLt5twFT7VN7 xMpAqeFY3Brw42xgkTp+kZrfqN0pLY2aS/oEmzcjwfHeFtizmLi1y/FE2j+k4Mdt3Jvo +dEyOzga0AcTrgWQyTMc690pY3lqLL0I6FCUuz5Ggra4TGJdQ4fyeJTJzv26t8A9SZz7 SgEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=3jioIQkyJaK1T1Prd5RYd8oyajQmjOkdKw+PMoKKJk4=; b=1IyaZs2mbMD90Y7hew9yyRkzxahY3hR+brZxGm6wNg/Xj4F1tZcs4UOQieI60OJtNh iuja/igPwFNJoAj4KVxtJSrp8Kx5sP9EbU6NHNd6qKIWB7lf3xU/c5yKYHcNPLAGUcYF LApwuWWtjH94z6eCzgy9rbPw99Hnj2zq0lEVcjECfW9/sbvYg52LXI0oSOYhi/DEopga EacIWDWJPm6A7vVyjojiN0+IovrqCRM1e5Z2wyU/vkv7F2Th83SsxoNQGbaJBUC2UtKa VVHjsUCWAqHbguOSshs1wWCffZMxiZQiiVJBNeDqWyKMRVr9523l+9/BAyrETEpc/ym3 aIFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=Dneg1LHU; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w24si732766ejy.97.2020.11.05.01.45.22; Thu, 05 Nov 2020 01:45:44 -0800 (PST) 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=@broadcom.com header.s=google header.b=Dneg1LHU; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728975AbgKEJnS (ORCPT + 99 others); Thu, 5 Nov 2020 04:43:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727836AbgKEJnS (ORCPT ); Thu, 5 Nov 2020 04:43:18 -0500 Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B29CC0613D2 for ; Thu, 5 Nov 2020 01:43:17 -0800 (PST) Received: by mail-lf1-x144.google.com with SMTP id 184so1341437lfd.6 for ; Thu, 05 Nov 2020 01:43:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3jioIQkyJaK1T1Prd5RYd8oyajQmjOkdKw+PMoKKJk4=; b=Dneg1LHUgtgciGU7ITC8UxW0MYCoCEFOmnfzgDZNVK+jwTMHE7cMeM9C78xqSOhkn5 tw0tdNtQwL4HHkmdoyCb1F3OqZk8sual/+gP8e+SZ3j24eDc/2FENMPWPc2dw8zzwfop s6fbUOssS9v2f3zlQOIYf408TdHBkoD4c9p9E= 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=3jioIQkyJaK1T1Prd5RYd8oyajQmjOkdKw+PMoKKJk4=; b=YNTZTXSHmNdKpMjBKsBtknYKqL61mOlBTK2nx3D3AIiibJHLSQGNTQG4B82AH9YZUX 9erFKTNTADxX2HtUG5XXyqIVwwID0Nhw+ft8k9Gskd5j8/zZ5F4NeIxNcTcqWGAI/Dk3 gtXHF3LyTGQ49a3pQfRFL59cOVm7XJdvod0uXGe6DQJiHu7eKKmaGJOZc27VEez20rr1 Nh05tveNbiwIrbmGpnOiGqdcnkuE4c32laDe8cqIU4p7txvHWkQdWkap4HINt0D2c8qh V8fW/uVE/SDz6DJULsFJL8pnZb2o9+5hO5NTXAkxxIOQo0DxERh9JWKyE3hybMDs2iJy YtWA== X-Gm-Message-State: AOAM532pKKv1V6NoeWZKeDokwJpy58YTJOCaPRLBPxzRaKvNoWx7l7xV 0Jb69fzHqeFx6s5KmO8VvHnJE5uRpVU7rcU7TpT+tA== X-Received: by 2002:a05:6512:1087:: with SMTP id j7mr623808lfg.122.1604569395807; Thu, 05 Nov 2020 01:43:15 -0800 (PST) MIME-Version: 1.0 References: <97a8d7bf-e877-c03a-f789-16cac9bb2643@broadcom.com> <1604562405-25414-1-git-send-email-dphadke@linux.microsoft.com> In-Reply-To: <1604562405-25414-1-git-send-email-dphadke@linux.microsoft.com> From: Rayagonda Kokatanur Date: Thu, 5 Nov 2020 15:13:04 +0530 Message-ID: Subject: Re: [PATCH v3 5/6] i2c: iproc: handle master read request To: Dhananjay Phadke Cc: Ray Jui , Andy Shevchenko , BCM Kernel Feedback , Brendan Higgins , Florian Fainelli , linux-arm Mailing List , linux-i2c , Linux Kernel Mailing List , Lori Hikichi , Ray Jui , Scott Branden , Wolfram Sang Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="000000000000e2501505b358ec45" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --000000000000e2501505b358ec45 Content-Type: text/plain; charset="UTF-8" On Thu, Nov 5, 2020 at 1:16 PM Dhananjay Phadke wrote: > > On Wed, 4 Nov 2020 10:01:06 -0800, Ray Jui wrote: > > >>>> +#define MAX_SLAVE_RX_PER_INT 10 > >>>> > >>> > >>>> In patch [3/6], you've enabled IS_S_RX_THLD_SHIFT in slave ISR bitmask, > >>>> however it's not actually used in processing rx events. > >>>> > >>>> Instead of hardcoding this threshold here, it's better to add a > >>>> device-tree knob for rx threshold, program it in controller and handle > >>>> that RX_THLD interrupt. This will give more flexibility to drain the rx > >>>> fifo earlier than - > >>>> (1) waiting for FIFO_FULL interrupt for transactions > 64B. > >>>> (2) waiting for start of read transaction in case of master write-read. > >> > >> Yes this is one way to implement. > >> But do you see any issue in batching 64 bytes at a time in case of > >> transaction > 64 Bytes. > >> I feel batching will be more efficient as it avoids more number of > >> interrupts and hence context switch. > >> > >>> > >>> The Device Tree is really intended to describe the hardware FIFO size, > >>> not watermarks, as those tend to be more of a policy/work load decision. > >>> Maybe this is something that can be added as a module parameter, or > >>> configurable via ioctl() at some point. > >> > > > >Yes, DT can have properties to describe the FIFO size, if there happens > >to be some variants in the HW blocks in different versions. But that is > >not the case here. DT should not be used to control SW/use case specific > >behavior. > > So the suggestion was to set HW threshold for rx fifo interrupt, not > really a SW property. By setting it in DT, makes it easier to > customize for target system, module param needs or ioctl makes it > dependent on userpsace to configure it. > > The need for tasklet seems to arise from the fact that many bytes are > left in the fifo. If there's a common problem here, such tasklet would be > needed in i2c subsys rather than controller specific tweak, akin to > how networking uses NAPI or adding block transactions to the interface? > > For master write-read event, it seems both IS_S_RD_EVENT_SHIFT and > IS_S_RX_EVENT_SHIFT are detected, which implies that core is late to > drain rx fifo i.e. write is complete and the read has started on the bus? Yes it's true that for master write-read events both IS_S_RD_EVENT_SHIFT and IS_S_RX_EVENT_SHIFT are coming together. So before the slave starts transmitting data to the master, it should first read all data from rx-fifo i.e. complete master write and then process master read. To minimise interrupt overhead, we are batching 64bytes. To keep isr running for less time, we are using a tasklet. Again to keep the tasklet not running for more than 20u, we have set max of 10 bytes data read from rx-fifo per tasklet run. If we start processing everything in isr and using rx threshold interrupt, then isr will run for a longer time and this may hog the system. For example, to process 10 bytes it takes 20us, to process 30 bytes it takes 60us and so on. So is it okay to run isr for so long ? Keeping all this in mind we thought a tasklet would be a good option and kept max of 10 bytes read per tasklet. Please let me know if you still feel we should not use a tasklet and don't batch 64 bytes. Thanks Rayagonda > > > Thanks, > Dhananjay > > --000000000000e2501505b358ec45 Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIIQVwYJKoZIhvcNAQcCoIIQSDCCEEQCAQExDzANBglghkgBZQMEAgEFADALBgkqhkiG9w0BBwGg gg2sMIIE6DCCA9CgAwIBAgIOSBtqCRO9gCTKXSLwFPMwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UE CxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMT Ckdsb2JhbFNpZ24wHhcNMTYwNjE1MDAwMDAwWhcNMjQwNjE1MDAwMDAwWjBdMQswCQYDVQQGEwJC RTEZMBcGA1UEChMQR2xvYmFsU2lnbiBudi1zYTEzMDEGA1UEAxMqR2xvYmFsU2lnbiBQZXJzb25h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