Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1258632pxf; Fri, 9 Apr 2021 04:13:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/oFpyeVYDSUFbtfkupU6/yJ5X8eJFpuymubJkiuQ5Q2YEOk01Lj9AUTsb+WYJp7lJdM91 X-Received: by 2002:a17:902:b68c:b029:e6:bb9f:7577 with SMTP id c12-20020a170902b68cb02900e6bb9f7577mr12333867pls.0.1617966817007; Fri, 09 Apr 2021 04:13:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617966817; cv=none; d=google.com; s=arc-20160816; b=re5vxdp+6S1n6yOgvAAFjc13YVm2GUQs4QRJuSgDJOjd1JLGCeS86ksGydsl89Sw++ AcX2KaxY/LyIu7BVy9GM6GFhSURLDgez9MOVCRU9KGPzEBR2j02spvKOV67Vy0jQU5xJ akZFYdfaksrgmnwlQgR/o9GTXgrlZ6wA7xVyfgprMyMLdtXts1TcVXlyriZ+TPEp5BxN w9aNso8SLMS5GP9ulH9bAo1vIqDd24PjjHxpQWwCiSQdzqOedFfEChi7JsiMHDukNYjQ w+2Ngri+T8TvMjI5LoG0CoSb1yQi9QvQAUly3zu7Nnywf7k57YohdpO7Sp4acD+dUrOa LDkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Hm8v2BngVc54Q1o/cHItYp3tUBFPm1as5OTivyD8ADc=; b=DKqEEhu3LgQBniKL2jJQuufgV8LWxTFqhJaNYJA+nJb5PGfYv24mjfiGw/onZx2wyw vrL7DQ3SFzrTaDZvXwTya+A7PfuawtQgvts7b8u4dNdFMHcCKb54JiRPfoEPLrcVHhJP SQYR1SCms4Ta7ke04OqcmGQ1Bb94FJc+woLknIFh7iDWLDO7HzELAQaq8a07GFnSuDao WMTlEBZEuyY1cT4FHLqKrd0M+x0L2npvjtddEJpVjexLEQAhrwjh6WYCm93+URNAntVw nOsJioBb8euxSIsz4C8rlZOX2XZwJ3ZYPDI2Xu48seW7hwKr5BKSA5tXiEdUFxG7ChQk z/MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Qc7p+hZV; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k10si2713767pgn.169.2021.04.09.04.13.24; Fri, 09 Apr 2021 04:13:36 -0700 (PDT) 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=@infradead.org header.s=casper.20170209 header.b=Qc7p+hZV; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233790AbhDILNE (ORCPT + 99 others); Fri, 9 Apr 2021 07:13:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233619AbhDILND (ORCPT ); Fri, 9 Apr 2021 07:13:03 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09ABBC061760; Fri, 9 Apr 2021 04:12:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=Hm8v2BngVc54Q1o/cHItYp3tUBFPm1as5OTivyD8ADc=; b=Qc7p+hZVeE4RTBofF7GNthlGbM FGUQORuzdf6qyYPPtQJLKfZRHAB+Q/whVYuMWKyFC3FXSjvcxgk6HwXon6ACrguTOIYCPsR3qx87+ 4xi+khX9wBokaE1Qp3zs9rx9TNrsl1Q96UeXjtjyJchN2i5iFus3hLVmcr7M0mx/QCATcbyN2LClt qdCePxreCijLlV0Iugr6NdrtkC2q7hz3i1hn7zou2ehAh/vgRJKI0v/vJauV4NLUhRJL7NwZg9Cgf vRtRC+Ck0Vt2Q/8msY+JgbBLfjfyL/q4vKS/peY0ybZKq6gQu5PesI958kkla8tKOnmUW/rupg9Jq gOX65sfg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lUp3c-000GIR-SY; Fri, 09 Apr 2021 11:12:17 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 427923001E3; Fri, 9 Apr 2021 13:12:12 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 2BE8723CDCDDC; Fri, 9 Apr 2021 13:12:12 +0200 (CEST) Date: Fri, 9 Apr 2021 13:12:12 +0200 From: Peter Zijlstra To: Ard Biesheuvel Cc: linux-toolchains@vger.kernel.org, Linux Kernel Mailing List , Josh Poimboeuf , Jason Baron , "Steven Rostedt (VMware)" Subject: Re: static_branch/jump_label vs branch merging Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 09, 2021 at 11:57:22AM +0200, Ard Biesheuvel wrote: > On Thu, 8 Apr 2021 at 18:53, Peter Zijlstra wrote: > > Is there *any* way in which we can have the compiler recognise that the > > asm_goto only depends on its arguments and have it merge the branches > > itself? > > > > I do realize that asm-goto being volatile this is a fairly huge ask, but > > I figured I should at least raise the issue, if only to raise awareness. > > > > Wouldn't that require the compiler to interpret the contents of the asm() block? Yeah, this is more or less asking for ponies :-) One option would be some annotation that conveys the desired semantics without it having to untangle the mess in the asm block. The thing the compiler needs to know is that the branch is constant for any @key, and hence allow the obvious optimizations. I'm not sure if this is something compiler folks would be even willing to consider, but I figured asking never hurts.