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=-4.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 00C01C43470 for ; Mon, 12 Apr 2021 14:03:49 +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 85D16611AD for ; Mon, 12 Apr 2021 14:03:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 85D16611AD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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:MIME-Version:References:In-Reply-To:Subject:Cc:To: From:Message-ID:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=nLlIBmA9bxoYSJSLMaeubDINlxw8Bq+27SVrOowaz34=; b=S5e40EWBG9CLhxSUNu9BrOYGi U1MzwJrblSWt72dVkshH2vLCgGzJGLvh325BubIthr5/aKPdmG4zB1Mk3XWK5nF5Axzc4Zc5CIXMz dqhB5Xt05DZQn4t/yjycDeSWf5CDvBlRlo+hJ3aOz0HymuxbhfVtcXSsmdCQL6LkcJajh/L5IGGct 06qtCjIK1rUFAKNxa7Q4UivHsp7mloAQn8BIzetFYZpnlKHczqEqWWz5ZZHXv90XBHfvVecwTpCud t0Rs3cj75+D3k+8ApwvXJek4rfXCBDyeYK7jUU7LxozVA/seUfP10wixs7thsaZUVaS3sa+lKfEJq insTAdPYw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVx8i-006tpf-RM; Mon, 12 Apr 2021 14:02:08 +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 1lVx8f-006tpa-TT for linux-arm-kernel@desiato.infradead.org; Mon, 12 Apr 2021 14:02:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:MIME-Version:References: In-Reply-To:Subject:Cc:To:From:Message-ID:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=TDvVuWMulMNRX+D/lSYRx1E3otgl5wERElqI4V35mkQ=; b=S9lXy3MswKOzTSF4Ypgc6V7Z/k y3i+B3Mmgn1s5kTAH4UnrhGfA2c3CaoUmU5fMZfRCFV1GTx3dDKkyBrtXGkwxLU6BUYyYtnL8wFJH edp0FGZvi0jRIOEs55/oPM8JObMxX/XxKPVvaa4sitzAFM0WuPqFL75wEho+UIRVWXn4RYtaBMUDJ vyVlbTPM5VHftCSM/jOVpgGEiNf5sCdmq7gMySkhr4MWQkgN9Gd8VIgVKGPocuFHuCsIFEEfytdxo LVZ8nds8Oe6wH882Yxk2f2+lY8gZn3NOXDzIR3L3zB2ltkucALBGdM3wfZfhmHuDX7+6Qj9SmCyBV FEUNo4UQ==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVx8d-006HjX-5o for linux-arm-kernel@lists.infradead.org; Mon, 12 Apr 2021 14:02:04 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CA8826121E; Mon, 12 Apr 2021 14:02:02 +0000 (UTC) Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1lVx8a-0071hf-SL; Mon, 12 Apr 2021 15:02:01 +0100 Date: Mon, 12 Apr 2021 15:02:00 +0100 Message-ID: <875z0rob3b.wl-maz@kernel.org> From: Marc Zyngier To: Catalin Marinas 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 In-Reply-To: <877dl7obpc.wl-maz@kernel.org> References: <26f50e86-dc68-0aca-f29f-19ef2f884c5d@huawei.com> <20210412124637.GE2060@arm.com> <878s5nodjd.wl-maz@kernel.org> <20210412131520.GF2060@arm.com> <877dl7obpc.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: catalin.marinas@arm.com, yangwendong@huawei.com, will@kernel.org, mark.rutland@arm.com, Martin.Weidmann@arm.com, linux-arm-kernel@lists.infradead.org, wanghaibin.wang@huawei.com, yuzenghui@huawei.com, wangjingyi11@huawei.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210412_070203_275362_B290CB09 X-CRM114-Status: GOOD ( 38.30 ) 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, 12 Apr 2021 14:48:47 +0100, Marc Zyngier wrote: > > On Mon, 12 Apr 2021 14:15:21 +0100, > Catalin Marinas wrote: > > > > 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. > > That's my position as well. I'll post a patch dealing with that > shortly. Actually, no need for that. WFIT gets correctly trapped and skipped because ESR_ELx_WFx_ISS_TI only covers bit 0, meaning that WFIT is handled just like WFI. M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel