Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp354363pxb; Mon, 8 Nov 2021 14:54:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJzjm4vTWkq4FDmEWB6NXJdLzwrcU1ytKwWT7o0HjEvJlnsfQW+yy7fxWKTETwKlDvOB5TH3 X-Received: by 2002:a17:907:3e8a:: with SMTP id hs10mr3613294ejc.404.1636412077997; Mon, 08 Nov 2021 14:54:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636412077; cv=none; d=google.com; s=arc-20160816; b=b9nTcTrnUAGtRMPoqCtlLZUl8u/0P8NWHmnzVhDbPiBjQ0OufJtpvWIjYlQ6hldq74 zoCbQV88s7FHfpCg1qSkGB0HAjIqmOd2UVvZ6z/Iztfw5MlRwaopxLQqqo8bPupL6SKs j65hJMtsrJNTRvJPdBekFbELX1Flq+hRfGnlGd3L34sihAJhpGCfjAPB0O0Oh31/G3gR iop9aR9JDDxUaIWiqc4a/6ibVJ/BsmbtgqYdSg9AAO4uvwsAEJa8QGRR71yrapVxQSS9 mEShSJWGwRmJ5db+SU1aWCK86iBjq43tbUa8ew0NpcN7y38DjefFy8L8hiQKMetTcmBv 2TfA== 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=7Cp1Rx79HPRFWEhhZgz1bOKGe1/Vy9sbxJgrvV4cvSc=; b=qj9VXfAowPBWsgRe5jKNToQxBl0WapB9mR7xw9HeOM5nLO2wwCf0sXTdf8dfhKnRyG 5H4xM5pGuuxnCVadXwarCrJPaupWh9EG1YsIrfsCk3hEPNokdp+s8bAFyelbnhpAbFZ8 qzHVZqttpKCUKFQcErK/CCGHkN9/Sn8raEmmRuRJ5mvB0gjakyp7Ss//+pmHGAfoTLwY gxQNc2IEXBsCw2B5ss/+xETIhmumx03WDrnNwrqOwSGnuct/53cp/3OZb2ogiTFyjHXu SvG2dywJUogRU8JpfnmwJIAO4vJ5GSAWv5X8NR+hIvEU+9FWvjSWr08O/B5Dxj3TeN3M 726w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BGwCgGEB; 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 i4si35382213edc.536.2021.11.08.14.54.11; Mon, 08 Nov 2021 14:54:37 -0800 (PST) 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=BGwCgGEB; 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 S238608AbhKHQxK (ORCPT + 99 others); Mon, 8 Nov 2021 11:53:10 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:20434 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231330AbhKHQxJ (ORCPT ); Mon, 8 Nov 2021 11:53:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636390225; 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: in-reply-to:in-reply-to:references:references; bh=7Cp1Rx79HPRFWEhhZgz1bOKGe1/Vy9sbxJgrvV4cvSc=; b=BGwCgGEBoPUPKOBAbbAvRM42G+ZOxZp26HIAK7GfXSw0YWsS3yGLJHJkbJe+yZiZpvjgP3 RluSXE4bagDn3YH4PCjmn/OAW3RlrG49S8r6lCyfku2mipgRBbNuNRiGR4AIg8hay8+ALq x8ajz3rg5YCWpVO2TzY+BTDG+LklPo4= Received: from mail-ot1-f69.google.com (mail-ot1-f69.google.com [209.85.210.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-438-1B6bXcEiOA6zkRgcx4wkew-1; Mon, 08 Nov 2021 11:50:24 -0500 X-MC-Unique: 1B6bXcEiOA6zkRgcx4wkew-1 Received: by mail-ot1-f69.google.com with SMTP id s38-20020a05683043a600b0055a6f3f8c26so9299445otv.21 for ; Mon, 08 Nov 2021 08:50:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=7Cp1Rx79HPRFWEhhZgz1bOKGe1/Vy9sbxJgrvV4cvSc=; b=mcmJ7wuIe6xmQW3PAck5ofEQ4ATUZysfayk5vocDbvXYG1LobMgLlzsCZ2UK5IyPqV XaqY8TV6fRFk7hqCgdMB5bKsgpg9nX2zdxeqWicGXbzs6uhOnxe02ne7WJ5/wv7nBHsN e0G8hORMCGfVaetv/R6Yk1fSpWBMxYqm4JOo/+W9G0YKkmIz86tAvZjTy1jpRwUjarpD ZWUbWZY02Thc7acFgcsmy672EuJuBEdzlIAmdl+ng25LdrfAjac94FEtgwV37rudrrGP rj0lkuWuMuBJbUsDGK4oL6edtw4lWezr6nrI02apMhbSSNbjC919nkQ6Sjkmlf+WWQNZ DM2w== X-Gm-Message-State: AOAM532lU5n1iVrHCO7b0Rsxbse1DvORvxQHMU9tOZH+2s7qv3tNPmZe l954ArtYPaG4dBBSacn0Ie2OFBpVGG6qELajOdU1k+mN5PuYOXLAOhRyD9AarRsmBtHTqSRndPF lH+Ls+JTuVclD+EhOHm9fHsKb X-Received: by 2002:a05:6808:13c6:: with SMTP id d6mr440836oiw.177.1636390223244; Mon, 08 Nov 2021 08:50:23 -0800 (PST) X-Received: by 2002:a05:6808:13c6:: with SMTP id d6mr440805oiw.177.1636390223013; Mon, 08 Nov 2021 08:50:23 -0800 (PST) Received: from treble ([2600:1700:6e32:6c00::15]) by smtp.gmail.com with ESMTPSA id r26sm2025944otn.15.2021.11.08.08.50.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Nov 2021 08:50:22 -0800 (PST) Date: Mon, 8 Nov 2021 08:50:16 -0800 From: Josh Poimboeuf To: Vasily Gorbik Cc: Peter Zijlstra , Ingo Molnar , Borislav Petkov , Miroslav Benes , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] compiler.h: Avoid using inline asm operand modifiers Message-ID: <20211108165016.kdehec32k3dw4334@treble> References: <20211105165418.ucsrpk53dv5kgu6k@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 08, 2021 at 04:40:38PM +0100, Vasily Gorbik wrote: > > Does this work on s390? > > > > diff --git a/include/linux/compiler.h b/include/linux/compiler.h > > index 3d5af56337bd..42935500a712 100644 > > --- a/include/linux/compiler.h > > +++ b/include/linux/compiler.h > > @@ -115,24 +115,18 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, > > * The __COUNTER__ based labels are a hack to make each instance of the macros > > * unique, to convince GCC not to merge duplicate inline asm statements. > > */ > > -#define __stringify_label(n) #n > > - > > -#define __annotate_reachable(c) ({ \ > > - asm volatile(__stringify_label(c) ":\n\t" \ > > +#define annotate_reachable() ({ \ > > + asm volatile("%c0:\n\t" \ > > ".pushsection .discard.reachable\n\t" \ > > - ".long " __stringify_label(c) "b - .\n\t" \ > > - ".popsection\n\t"); \ > > + ".long %c0b - .\n\t" \ > > + ".popsection\n\t" : : "i" (__COUNTER__ & 0x7f)); \ > > }) > > hm, could we just add asm input back and not use it? and keep > __stringify_label(c) as is? would that work as well? Yeah, that seems to work: diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 3d5af56337bd..429dcebe2b99 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -121,7 +121,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, asm volatile(__stringify_label(c) ":\n\t" \ ".pushsection .discard.reachable\n\t" \ ".long " __stringify_label(c) "b - .\n\t" \ - ".popsection\n\t"); \ + ".popsection\n\t" : : "i" (c)); \ }) #define annotate_reachable() __annotate_reachable(__COUNTER__) @@ -129,7 +129,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, asm volatile(__stringify_label(c) ":\n\t" \ ".pushsection .discard.unreachable\n\t" \ ".long " __stringify_label(c) "b - .\n\t" \ - ".popsection\n\t"); \ + ".popsection\n\t" : : "i" (c)); \ }) #define annotate_unreachable() __annotate_unreachable(__COUNTER__) diff --git a/include/linux/instrumentation.h b/include/linux/instrumentation.h index fa2cd8c63dcc..24359b4a9605 100644 --- a/include/linux/instrumentation.h +++ b/include/linux/instrumentation.h @@ -11,7 +11,7 @@ asm volatile(__stringify(c) ": nop\n\t" \ ".pushsection .discard.instr_begin\n\t" \ ".long " __stringify(c) "b - .\n\t" \ - ".popsection\n\t"); \ + ".popsection\n\t" : : "i" (c)); \ }) #define instrumentation_begin() __instrumentation_begin(__COUNTER__) @@ -50,7 +50,7 @@ asm volatile(__stringify(c) ": nop\n\t" \ ".pushsection .discard.instr_end\n\t" \ ".long " __stringify(c) "b - .\n\t" \ - ".popsection\n\t"); \ + ".popsection\n\t" : : "i" (c)); \ }) #define instrumentation_end() __instrumentation_end(__COUNTER__) #else