Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1263326pxf; Fri, 9 Apr 2021 04:20:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+pDtQnpBXkL/5wAdCOdRapSFSVde2tr6iIwv19g8ObCnezAefYcqoFDq9Z6FBF7oZ6vxn X-Received: by 2002:a17:902:bf07:b029:e7:137c:2e25 with SMTP id bi7-20020a170902bf07b02900e7137c2e25mr12199847plb.67.1617967213713; Fri, 09 Apr 2021 04:20:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617967213; cv=none; d=google.com; s=arc-20160816; b=b8eVRxy0LqWXvWQkeFuDqU/4k9PbMS/t6+/FSJziihXTW68hR/ys58gDYTpttSHTGo QZM74X0E5p1bGRvSJZOaIBERV1bL3ZJ1fJQpni2nbaNC+YxY35LdYwsHeblQQVRtMCXi xb7CGzCLwZsY65EJ/AkooYX0nUM2ZFyJsHzLUZAnpheAyeqjfryBLCnVK16ulLTh/j+/ jh+mcSLOBzlR9k8kIh2iFzl8vxRJus9wSnP3ZCFA4ljoN2jTYaMeKRPjxB3UO64pZF7o ubQXcpWQ1wkEEYZ9MbEBhGYgqm7LMAZOGK7IhthygLuZl0t0Cj1tpXiSwN1wdOQkqDxQ wTkQ== 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=NZ0GUoV5NUz8hE+Uk6t9Fqrda/6popJtIxpTk8vMhZY=; b=n+WQqFEshB/UqwDd7QudezCMZyu9r4UfLmwXwJKYNQKeaCgN8T1D9pXgGva+PCMcy5 C17QEGk7/1vUH5xr1zrUuI+mdb32CBqzrrboORNiLJECf0AAqxTqWABnEInm7dyYSQek cuHNXEh8hDjcooIdlma0kKt5137mUBbGXo58T6tIuss19/4w5TVPlfROh/daRemv6DJR q44Fr3m59VkyJlfMHuKft8NWRuGIl8qDzmf+0CP8YmrNX8jOjkDl/5UZnJl5xgbz1I8T m5DEZDfRMvaNoBCEJnTefSwFbc3sV6HwKnk+GdbU6IWkYCTNVbg3M/jCpu1/Lp/FTGce crhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=utWGGGSP; 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 u15si2611692pfh.56.2021.04.09.04.20.01; Fri, 09 Apr 2021 04:20:13 -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=utWGGGSP; 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 S234170AbhDILS1 (ORCPT + 99 others); Fri, 9 Apr 2021 07:18:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234019AbhDILSM (ORCPT ); Fri, 9 Apr 2021 07:18:12 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2B93C061760; Fri, 9 Apr 2021 04:17:57 -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=NZ0GUoV5NUz8hE+Uk6t9Fqrda/6popJtIxpTk8vMhZY=; b=utWGGGSPJgLFv3o84RnoQNMr/R BCVG26RMz5SxbkQfQ5IrP4xFaDAEAf5ASKP1uzLJwjH1x7HK6BJ+Exk6BXSTPNV4yh3Z8lx8SM38S ruxp0ryDzBqKWTodmz/kDjE3W1mn+jbR011JcRQ9KeZs7FlgrzICl/FQFl84Q47JKdLs5FwSsou3f e97K75J5yjER6rkUtS6vJaZodNi+BOJzt/m/4bSENEOWmQxmh50PMKkyOoKgyLyI99E0oLxsEV6BV 4y7BGWwLpd+jEkJfmVWHvXd7CGbxhD5Ug5IXrHGA4EOGfMhhiwo9Sef174deyitwc8FOMBFnKOm4u nZpu3syQ==; 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 1lUp7h-000Ggy-7u; Fri, 09 Apr 2021 11:16:35 +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)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id DF6213001E3; Fri, 9 Apr 2021 13:16:24 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id C5C6E23CDCDDD; Fri, 9 Apr 2021 13:16:24 +0200 (CEST) Date: Fri, 9 Apr 2021 13:16:24 +0200 From: Peter Zijlstra To: Florian Weimer Cc: Ard Biesheuvel , 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: <877dlbzq09.fsf@oldenburg.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <877dlbzq09.fsf@oldenburg.str.redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 09, 2021 at 12:55:18PM +0200, Florian Weimer wrote: > * Ard Biesheuvel: > > > Wouldn't that require the compiler to interpret the contents of the > > asm() block? > > Yes and no. It would require proper toolchain support, so in this case > a new ELF relocation type, with compiler, assembler, and linker support > to generate those relocations and process them. As far as I understand > it, the kernel doesn't do things this way. I don't think that all is needed. All we need is for the compiler to recognise that: if (cond) { stmt-A; } if (cond) { stmt-B; } both cond are equivalent and hence can merge the blocks like: if (cond) { stmt-A; stmt-B; } But because @cond is some super opaque asm crap, the compiler throws up it's imaginry hands and says it cannot possibly tell and leaves them as is.