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.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,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 E817FC433C1 for ; Tue, 30 Mar 2021 11:08:19 +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 8D3E961919 for ; Tue, 30 Mar 2021 11:08:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8D3E961919 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: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=nqVHLyrN/KJ19HJ4mV3GLpHdHKrd8aoAsfq5zzMIaDs=; b=NGIh8/63VC72EjFOR4vLoU8Na iV5Lcgksjpz6UsyIbA2xlNM65HEUHywpEiceRMH6C5cC6dJfIZMvWg1SSOCbZEPj0dAdSNJ7EA/Qm ZONP0OYB2Hnb87qroo4DVRwho+HbxsR4ZcN0BrsIMJwH+/49SnLIWAV3pnGbgeFQ8a8FM9Eo6/xJQ IzigAZjWemuy6WOOUxtkRvDowr5YSUXiPZUBVbRi2A5M6HjxUncwdcYE6XVOP6Dk9ME1Nt4HtCc8O q8J1alllcJucOB1NzEfOsToWeyfqLvxesMe+u94/yRq8aojwO6hHa0V1+fBquFTXkNFeVSs3rGRLo EGC4BgE2Q==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lRCCl-003W2i-9O; Tue, 30 Mar 2021 11:06:39 +0000 Received: from mail.kernel.org ([198.145.29.99]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lRCC7-003VwB-CB for linux-arm-kernel@lists.infradead.org; Tue, 30 Mar 2021 11:06:04 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1C39361985; Tue, 30 Mar 2021 11:05:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617102357; bh=QtIqrNNFAUXj26UKvZlheo4rLd1J+jOuwO4J8RohTBs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KbC+m2fpxDfplhdaQ6pFyoVz+q3BJoAFxXxco6sp+u/WcNWStNQTcyMt9Z3oGnb2/ MCN8u34oCIjAZgfy4JqfeDAcO4xNNAHdm3Ac7MQXsLuhgZ5WP6nQA6l1FV2MXZIzFe CNmkuRLFSFqhlGQ1fHQgptMV0coYAmTR7rfIHlSJwCwv3D6UW8KtyGZ8ZNJDJvqBI3 HaKBTWfo/ZN+a4+tnFdNmN7lKmh+Wu9laL4aF+nSsbkYh2kuCoYqbaqTgVwwB+WC5M 3euKSNC76rGd2qwQ1r+TNeeHRUt1VtwzGiluz6p1KX8xSj2ShBn0kjEv5JgVx60p+V cxuO5THPcjUtw== Date: Tue, 30 Mar 2021 12:05:53 +0100 From: Will Deacon To: Pingfan Liu Cc: linux-arm-kernel@lists.infradead.org, Catalin Marinas , Vincenzo Frascino , Thomas Gleixner , Mark Rutland , Andrei Vagin , Marc Zyngier Subject: Re: [PATCH 2/2] arm64/arch_timer: replace arch_counter_enforce_ordering() with isb Message-ID: <20210330110552.GA5707@willie-the-truck> References: <20210330105719.47760-1-kernelfans@gmail.com> <20210330105719.47760-3-kernelfans@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210330105719.47760-3-kernelfans@gmail.com> 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-20210330_120559_981286_27C7B6D7 X-CRM114-Status: GOOD ( 13.09 ) 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 Tue, Mar 30, 2021 at 06:57:19PM +0800, Pingfan Liu wrote: > The description of getting counter value is not very clear. [1] > 'mrs Xt, cntpct' may execute out of program order, either forward or > backward. > > Now taking a look at this group of getting counter routines. All of them > are called from sched_clock(). And there is an isb to protect forward > speculation. But there is no isb for the backward speculation. > > The current code enforces read dependency instructions anchored on > getting counter. But it is not enough to protect against other no > dependency instructions, and even function call can not prevent the > speculation between getting counter and them. Which "no dependency instructions"? > > Replacing arch_counter_enforce_ordering() with isb to achieve the aim. > > [1]: AArch64 Programmer's Guides Generic Timer: 3.1. Count and frequency I wouldn't trust that guide as far as I can throw it. Please describe the problem you're trying to solve, and hopefully I can help. ISB is an expensive instruction so we need a good justification to add it here (i.e. an example of why the current scheme is not correct). Thanks, Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel