Received: by 10.223.185.116 with SMTP id b49csp3653004wrg; Mon, 19 Feb 2018 03:51:56 -0800 (PST) X-Google-Smtp-Source: AH8x224R2X8wCThp9mKtjfmJ5RBok8jaNi1ot9ILY6Cc0bS5hz959lE8G2GKYcsAy2I30qOrrCvH X-Received: by 2002:a17:902:6ac7:: with SMTP id i7-v6mr5122134plt.434.1519041116114; Mon, 19 Feb 2018 03:51:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519041116; cv=none; d=google.com; s=arc-20160816; b=szIPdsg+OROoSYazaieGqjPx3GLW/ZpP5N6945HLVBk8tcSrqiprdSfW+D1ItW9J5M fL9rqwYznguthCRawUQq44Ny75WSWRGp/KVQaH5foP4h8x8ULGQbZpmmshfdQrlnSS1y BQAY6e4K2zvema9Mx6QC7fhoYq839IanpyYFUserixsgfT9aYMi5VhXZb6CiWhKi66jk QiF2Hht2qLIc7UtZNQvNTBveAx+zoOXKweweeidV3hhRYojSwLSNt3Llhg4rW7+zyixc abF9AhIKqLVqw2hRNZ57wN+MDPubgCzkEhuQAm5ZaR5NIgeqxeRNaAh25LrD3bswW8i1 tMlg== 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:organization:from:references:to:subject:cc :arc-authentication-results; bh=8S80J4lc9GXj3ACbAdgwjDDyvhug7OFvEt5fDrFYUhk=; b=1LE2GK+ajnuCNKK12cjjspRQbET6btfYZgCTwI6Pb6az1MkLps3GuzvNFhehPAuHlG 4Ont9SLPQmIBpcGIok80xdoYJ+fk42Pv4a14L9rmzjqPY9Bk6kt5Tp4aUCN4SGaS5Wp+ FY2JPAhSwEArrr17sPmZtA5q0dVycURBfDZGrUxBTIb29DRvai0vAu396lx2vxNc4AzA o0/sxRbaM75NSwUb7ft4x3wIesoa18p51CohH9HUvguqQmz/8boDsvpTpLUI1F/Xh6ro 9aQw1294cwcsNCU82vuOx2wYxxmBENrIl/bG54AMBGKGL/Tu3/z+uUldkjCc7BDPO1md 3T6w== ARC-Authentication-Results: i=1; mx.google.com; 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 b190si4852378pgc.426.2018.02.19.03.51.40; Mon, 19 Feb 2018 03:51:56 -0800 (PST) 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; 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 S1752674AbeBSLus (ORCPT + 99 others); Mon, 19 Feb 2018 06:50:48 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:58008 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752563AbeBSLur (ORCPT ); Mon, 19 Feb 2018 06:50:47 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EBFEE1435; Mon, 19 Feb 2018 03:50:46 -0800 (PST) Received: from [10.1.210.28] (e107155-lin.cambridge.arm.com [10.1.210.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5E45A3F41F; Mon, 19 Feb 2018 03:50:44 -0800 (PST) Cc: Sudeep Holla , ALKML , LKML , DTML , Roy Franz , Harb Abdulhamid , Nishanth Menon , Loc Ho , Alexey Klimov , Ryan Harkin , Jassi Brar Subject: Re: [PATCH v5 11/20] firmware: arm_scmi: add support for polling based SCMI transfers To: Arnd Bergmann References: <1514904162-11201-1-git-send-email-sudeep.holla@arm.com> <1514904162-11201-12-git-send-email-sudeep.holla@arm.com> From: Sudeep Holla Organization: ARM Message-ID: Date: Mon, 19 Feb 2018 11:50:42 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/02/18 11:32, Arnd Bergmann wrote: > On Tue, Jan 2, 2018 at 3:42 PM, Sudeep Holla wrote: > >> +#define SCMI_MAX_POLLING_TIMEOUT_NS (100 * NSEC_PER_USEC) >> /** >> * scmi_do_xfer() - Do one transfer >> * >> @@ -389,14 +406,30 @@ int scmi_do_xfer(const struct scmi_handle *handle, struct scmi_xfer *xfer) > >> + if (xfer->hdr.poll_completion) { >> + ktime_t stop, cur; >> + >> + stop = ktime_add_ns(ktime_get(), SCMI_MAX_POLLING_TIMEOUT_NS); >> + do { >> + udelay(5); >> + cur = ktime_get(); >> + } while (!scmi_xfer_poll_done(info, xfer) && >> + ktime_before(cur, stop)); > > The 5 microsecond back-off isn't that much smaller than the 100 microsecond > timeout, given that udelay() often waits much longer than the specified time. > > How did you come up with those two numbers? Are you sure this is better > than just using a cpu_relax() instead of the udelay()? > Somehow I assumed that cpu_relax will schedule out and since this is called in the fast switching path, I can't do that. But now I see that it's just an hint and so I can use it. Sorry for missing it earlier, you did point this out in previous version and I retained it based on my wrong assumption. Thanks. -- Regards, Sudeep