Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1286334pxf; Fri, 9 Apr 2021 04:59:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXum+mNwG7rHFDnq2LoEHX9yRA8ApvMHfB5gq8vMUnAbAIT6s+C7iyI7iGJjCJDlZZjX3k X-Received: by 2002:a17:906:a51:: with SMTP id x17mr15916585ejf.25.1617969560918; Fri, 09 Apr 2021 04:59:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617969560; cv=none; d=google.com; s=arc-20160816; b=tsPZ+rKCsoBtetk1FY18RYik0qx/LoKNlXiFIOEuWGAh7S/ySeE4iriogrnrFwMpvf Il7sXs4D/btp2Iu9QmxC3BnmrK10uI+2+QJwSBzp6XBe26Tv2qRW6hyeXdqjPxgSSn4S +DAWHs3uGPEpM1n/5JW/xi+YfQvCAptwAwRDZCk/1sKb/MWz0ZI1QmKPvmgduklaUbfl /2NH0R1966dObn465Bjeb0Pu3mOEuM3uDFp+0yy4QZooizfsZom04zCfjIs+xiAV13HE rEJzZQ6+7io6C+MlAdIP1eUqmanwRHEEumZyh7/UCEtxsUHbSi6o2Te3YbnBYQtqtyAV bLUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=iRJa8TFvtmvXz2BbVWf2leybWHb8YZANyyLewNghcak=; b=S2n0ZkwSZaPa+wahagAkU8YkjcE4CSge+cdOLIFV6Yxl0DpW/b5wz32KvYKNdvpZnf 52AS7bZOePW312C62OAWqa9kf9NG53d6gnvFAivFYy6Lru7wqm2lDus3rs0diOIZ5FyF BcMyRmcLpdxRyYHeRd4afe3cMlyNNTOuQe8geb4EocApGm3fYi0adjBt+9Kr35ngrFkX Odg7bMUKe3nHrdMkBCsiKF4nyBuv6Z0jJuFPnV2HL+sq+i+4u15kEzfCG78HGUTEL5MA uIj7SYcmohJhwm0nu8wb3gqxeavom+pQUGfiPHfAyat92PEh5QSinCoiHsBqkoHd0BM0 I9Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OCkh7thC; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s20si2488488edd.177.2021.04.09.04.58.57; Fri, 09 Apr 2021 04:59:20 -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=@redhat.com header.s=mimecast20190719 header.b=OCkh7thC; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232295AbhDIL4D (ORCPT + 99 others); Fri, 9 Apr 2021 07:56:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:21263 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231611AbhDIL4C (ORCPT ); Fri, 9 Apr 2021 07:56:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617969349; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iRJa8TFvtmvXz2BbVWf2leybWHb8YZANyyLewNghcak=; b=OCkh7thC1pXWWcck0qcPLan5jzVJYJ9WFhKWSAjOmySmx/N87d5W3/SZU74XAFcEOdXRHZ DhinSxYNO29/lIM66cKayK30aQHCyPknwmvYAvy+cb4l/ppcj3tfBSrXikaGTVEthHiHTz m51E4f8J7upcEIgGmiU36YmW1/OqIl8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-543-KAmZKu7gNBi7H3KMmJWkJw-1; Fri, 09 Apr 2021 07:55:45 -0400 X-MC-Unique: KAmZKu7gNBi7H3KMmJWkJw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 542BC1008061; Fri, 9 Apr 2021 11:55:44 +0000 (UTC) Received: from t14s.localdomain (ovpn-112-65.phx2.redhat.com [10.3.112.65]) by smtp.corp.redhat.com (Postfix) with ESMTP id 735D85C1D5; Fri, 9 Apr 2021 11:55:43 +0000 (UTC) Message-ID: <5f78b7e2f9ae937271ef52ee9e999a91c2719da9.camel@redhat.com> Subject: Re: static_branch/jump_label vs branch merging From: David Malcolm To: Peter Zijlstra , Ard Biesheuvel Cc: linux-toolchains@vger.kernel.org, Linux Kernel Mailing List , Josh Poimboeuf , Jason Baron , "Steven Rostedt (VMware)" Date: Fri, 09 Apr 2021 07:55:42 -0400 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.3 (3.38.3-1.fc33) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2021-04-09 at 13:12 +0200, Peter Zijlstra wrote: > 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. > Sorry if this is a dumb question, but does the function attribute: __attribute__ ((pure)) help here? It's meant to allow multiple calls to a predicate to be merged - though I'd be nervous of using it here, the predicate isn't 100% pure, since AIUI the whole point of what you've built is for predicates that very rarely change - but can change occasionally. Hope this is constructive Dave