Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1603689pxf; Fri, 9 Apr 2021 12:35:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyS1Hqnv1EljxNXZJfLODLo3V3Buuk2LxYEXt9udR1ToADRFLj7fZeBmMdeCmUkMVYvTLof X-Received: by 2002:a17:90b:388d:: with SMTP id mu13mr15404723pjb.34.1617996936453; Fri, 09 Apr 2021 12:35:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617996936; cv=none; d=google.com; s=arc-20160816; b=C1ojb/BSkgAX+sZs3rG3B/1YSCFbRplYn5sAHMBcfvhg6KfIrqV2n5VZlxbFZ0m9Zy o9N1inzI3BOYAZiJrUAYTEEhR5FeLqDeLN4vLqfOUK574vraiOdpdkAfXCX/WdC3fL+3 Rs13+8G0iYJvoA+bGpMbyLBoXItMcAe3nVZcNOHu5zRtZRlQ9RxQIsEYc3ib4SOvTrzQ DUkfT0RE2W4lhCcg6w4w9A3HxSs6qi5Q0Wxh5ZPy2QU3/e/4Wy4QKNM5WfnVe8FxBimq wQjJV7kw6mv+ihyhwliwCVqCih52VLE+mhbWRmWxzhd6u9lKJaB1icf2WJl1h3t1tuiT SnYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=agSy06aIEctwExyBOpH0Av56/yWfK/K39QTHh943O30=; b=SvDlMep3lOzb0HbgJlAWM/sd8LZE9/TilwpreC69lYmBlmwmCVvC28LW2ulnLmPd1l 4NRTlRJQXLi4xN1VVqfdIu6h8nnnphK6+m+dfNpepih/E7Iz4nqgu0jvK8luPNyxB3z1 iP+mEbtzRypIlhvExzdQ5UZctRamj59UZvwtrp/96x+aOlodXJLH3Gh3+hLkXJe5YLCy cMmNZvQ0GtTY5NSdKjwcbYg1L/MShf1wwUksujePx9sGiKRZYQflKmzMZI7tBAtB7ueO s+gnZkxylHyaeRGkG4qxEeQ+20TK7b784FjD4iLhRIa+X9fgtlKenXb44U9KyFYZBp2w OBFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=M61olKQ5; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hi10si4092964pjb.40.2021.04.09.12.35.23; Fri, 09 Apr 2021 12:35: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=@google.com header.s=20161025 header.b=M61olKQ5; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234785AbhDITd6 (ORCPT + 99 others); Fri, 9 Apr 2021 15:33:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234791AbhDITd4 (ORCPT ); Fri, 9 Apr 2021 15:33:56 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C37AEC061763 for ; Fri, 9 Apr 2021 12:33:42 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id u9so7751546ljd.11 for ; Fri, 09 Apr 2021 12:33:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=agSy06aIEctwExyBOpH0Av56/yWfK/K39QTHh943O30=; b=M61olKQ5+31eeF6oDsDJTw+9q0ID5tuTA1oUYG7DNLA9oXwHDakqaexMtwt84sWv7N 33Gx+Cc5K/Y5fUsk054bWmOYF8bCHWgrKQ3kq3hdqy4mCDd0VKGeFiAHGCw3WvQDvOLC Xp699j8Fkm5g4NfcWDzStV95Q631jBzoXJkecJ1cKDbQbaDuQ0nqmrgDHCYyxjUX22ox F6p9siNDiI7gvpSSNhzzW0hhOHVw0SyRdSfF5TYyzY0H62S/QXKTnP+Ko+RXVsRafdi3 MUN//rqPiHTS/haFSEN+I8Jb9+NPQrisau42+PhAO42jbiFanzUaf546YuNRsnEQ0m+R bKNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=agSy06aIEctwExyBOpH0Av56/yWfK/K39QTHh943O30=; b=DAakK01WTPzMvzlL+s+EjtKnplaQ0BLvpM5sRoGowsQPEbPQlfSc1onS0k9yBIeA4D ptqjnyBIZ46cXAe2iMltHRkQdifctgenXcMwtquqS0vNbM+uE2eeMNwpTbYuyuF+r6ys UJIMSW26U1lTmhLX4ChhsnJ+1OikQZG6b9ZojWwvMUS9TyNnXzQ0beFl6ITQ/sHwV2sM UwVUTXXT33nolASJKeb4AJmAevADwNmr5SqoIkUU3dB3Gya1o17xlftWyK73krPFnst3 HZ8dUMqOZiXMV7orCGkW9lHPVxokefZvIZSaQF+oN2LlXg3Cdzh+3YUN9f5+evoiGCfs ByrQ== X-Gm-Message-State: AOAM5323hQfUMJvN/CvyIP0oa1YEBTvDygQQaeYkScF7HvsOmzf0ZGWn 4bBGBJbQb+zJZ9NNBpm+rfjiPO4+0LZPIH1keFXkxg== X-Received: by 2002:a2e:b88d:: with SMTP id r13mr10166764ljp.479.1617996820957; Fri, 09 Apr 2021 12:33:40 -0700 (PDT) MIME-Version: 1.0 References: <877dlbzq09.fsf@oldenburg.str.redhat.com> In-Reply-To: From: Nick Desaulniers Date: Fri, 9 Apr 2021 12:33:29 -0700 Message-ID: Subject: Re: static_branch/jump_label vs branch merging To: Peter Zijlstra Cc: Florian Weimer , Ard Biesheuvel , linux-toolchains@vger.kernel.org, Linux Kernel Mailing List , Josh Poimboeuf , Jason Baron , "Steven Rostedt (VMware)" , Segher Boessenkool , dmalcolm@redhat.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 9, 2021 at 4:18 AM Peter Zijlstra wrote: > > 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. Right, because if `cond` has side effects (such as is implied by asm statements that are volatile qualified), suddenly those side effects would only occur once whereas previously they occurred twice. Since asm goto is implicitly volatile qualified, it sounds like removing the implicit volatile qualifier from asm goto might help? Then if there were side effects but you forgot to inform the compiler that there were via an explicit volatile qualifier, and it performed the suggested merge, oh well. -- Thanks, ~Nick Desaulniers