From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95E64C433ED for ; Mon, 12 Apr 2021 13:16:51 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0807C611CE for ; Mon, 12 Apr 2021 13:16:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0807C611CE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=tYsmgHb4M6BrGGwkpPjg37tiInHWKAfVVkASG9zyvo0=; b=Qzz+ANc4EE2dU99+rlqbR4cmD JIuxl6fNh4wjF1V17EQ3atcvjsvZM1jAoDh6Mv4kjCRnexp1lxXO25ji8pXyVIa+z8yS680Mg3pbX m1JFhIZ1suLoYnl9RvgtHlUxNKoJGlv3N5TkIAw8UHOC+5oCzVA0vaBv5/8h/Dc5l8EKFT2CK5pK5 TE0ALnrUuIqV8pKtB/sW9Gq54S9YuL9wUhadT7erEVDMJOtxGPha2RnnJeq/y6xvpmsyST2DEz0nX 8AyLAm3sFa3ShtYc2tmyvIRL1fDIZ56FvPWV4fPHTOvC/VHiUKnJCU3ic7e2/wX5lSdwActQUoqZT kQxFkCY5w==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVwPb-006nlt-Qb; Mon, 12 Apr 2021 13:15:32 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVwPY-006nla-1W for linux-arm-kernel@desiato.infradead.org; Mon, 12 Apr 2021 13:15:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=usA+VpaBiSjb/uiKmZS5ZPFTbAPbVVArv6JPpfQNGJk=; b=sMx07+mp203PZJBK3lT5daPBrs 9Ngq5Cg3qJPR2+ldSM00e3Cxrg+LZtd6SAPTpoOgir4mPOQxz7QXJUTFZnIwK78O5LLaxqjeXpQ6+ gPn+tBCdGFmSekqbTVtjwQgorOWRgppkPEfJB8P6UiRCADTnGP7ocUFAe0N7rzRt+e5vi8OEvnp8Z h4Ibz4NqHD0iVe/t6buSASKbAYkrWKf0PgIpbUsIerLfE0FhO7XVAF5MgE9wZ5fNd/1GIAbrkZC0q WYmZTQ4fFkU4F8Rld5Pu+d3USo8TIGRJYiNJNM2FqYTQ/bzJubRFgxGWLe/OwpouTH/01T17EXhcD EerTxL5Q==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVwPV-006Fxn-Ft for linux-arm-kernel@lists.infradead.org; Mon, 12 Apr 2021 13:15:26 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 77EB0611CE; Mon, 12 Apr 2021 13:15:23 +0000 (UTC) Date: Mon, 12 Apr 2021 14:15:21 +0100 From: Catalin Marinas To: Marc Zyngier Cc: yangwendong , Will Deacon , Mark Rutland , Martin Weidmann , linux-arm-kernel@lists.infradead.org, wanghaibin.wang@huawei.com, Zenghui Yu , "wangjingyi (D)" Subject: Re: ARM WFET application scenario consultation Message-ID: <20210412131520.GF2060@arm.com> References: <26f50e86-dc68-0aca-f29f-19ef2f884c5d@huawei.com> <20210412124637.GE2060@arm.com> <878s5nodjd.wl-maz@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <878s5nodjd.wl-maz@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210412_061525_574459_C450A70F X-CRM114-Status: GOOD ( 29.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Apr 12, 2021 at 02:09:10PM +0100, Marc Zyngier wrote: > On Mon, 12 Apr 2021 13:46:37 +0100, > Catalin Marinas wrote: > > > > On Mon, Apr 12, 2021 at 08:08:23PM +0800, yangwendong wrote: > > > Recently, a new feature of WFE with timeouts has been added to ARMv8. > > > I have some doubts about the application scenarios of this feature. > > > > > > 1) Arm spec said that WFE or WFET can be used in spinlock. Since the > > > thread using spinlock can't be sleep, if we use the wfet instruction, we > > > can do nothing but wait when timeout, so what's the difference between > > > the two instructions in this scenario? > > > > Not much point in using it it in a classic spinlock, unless you have > > some specific implementation that's supposed to time out. > > > > Note that we already enabled the event stream in Linux so that an event > > is generated at 100KHz waking up any WFE. One reason we had for this was > > some hardware errata where events between clusters were not generated. > > Another was some small delays required in in certain user programs > > without going through a kernel syscall, though not sure anyone's > > actually using it. > > > > > 2) Are there any other special scenarios where using wfet instructions > > > can be beneficial ? > > > > In the kernel we could replace our udelay loop with WFIT for example > > (not WFET because of the event stream). As for user, we can expose a > > HWCAP but it's up to user libraries to make use of it. > > Note that since c219bc4e9205K ("arm64: Trap WFI executed in > userspace"), we actively prevent WFI from being used in userspace, and > I would expect WFIT to be given the same treatment. It otherwise is a > precise tool for userspace to synchronise against kernel events. I agree. I only thought about using it in the kernel as a simpler udelay(). The user should not attempt WFI/WFIT. Now, if KVM traps WFI/WFIT as well, maybe we should not bother with udelay() in the kernel either. -- Catalin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel