Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2230721imm; Wed, 16 May 2018 09:44:28 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoQV6pnrGfsxysqf9RzAb4bS2aQP1BjJ070gAs+X5os8xCmpn6A9P2w7Ytoes9A40Yi9UIF X-Received: by 2002:a62:1549:: with SMTP id 70-v6mr1683164pfv.91.1526489068789; Wed, 16 May 2018 09:44:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526489068; cv=none; d=google.com; s=arc-20160816; b=tDXdVamwgvou0xnzUUS21wiA3f7LVdU2fYCQEN9z9NK+xC3eQWLqsPkYJkf1kY2qeB fonO9v62iHppEKlT1uA9lAidoP/wuCUbHRRmZ7LQ8kXa/fxu+RLYriYjM90WtYne+k7d MDKqrNZ4Imx+TcPPyjEbjtEOhO/+Thkcl8B0wVMzvETo2fuxMfIsmEbS3gXAmxfwK5Q/ 6fcpbHehm2uKk/bEje5pB2mxTzycmA4VvaSUAt1NG/rvuE4ELKamKy3hyELEBzgNLfVs nYwErhEcb4eTB5x1+7rpKyJGwn9zgoOs0qm3JJW7RLJMPOudNreq3yMKUBkN2hq7kMCy +Z5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-id:spamdiagnosticmetadata:spamdiagnosticoutput :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=1KO/5fOUez263jjqyWG7W8AVrkNRX+4ocTPIiVfNtrM=; b=ZiIDgDlCg9zJ/woQczJr87a9+kLINHbA02bUx88lojmgkMjNlbdsXNz+yimzZWrF1S /5Drw9p39JZil9NxwQFn7ie49QX7j3PK8xxy8Xvnck8VlQ60N0hy7S4wq4alyfCS9ey7 xcO46jmGtLbrOdvvK1lCeRRrKxPfqv/72HWKSt1e+1pN5A55OLHExfjyNxprwC66DvXB Qeben2C7C/8FXHXyHO0iqflKH16/xpDEfAh8SjIW+sioZCsf7gz5vagvROdxS0o5TRJ8 B4LWvkSX10z4qOJHOp9rj+TN2Euo4YP+Qt2wxT+pJW7kWc2mF+cPH6KwwqdMO4WXLVjN mJ5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@onevmw.onmicrosoft.com header.s=selector1-vmware-com header.b=i+giu3LY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b5-v6si2695629pli.129.2018.05.16.09.44.14; Wed, 16 May 2018 09:44:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@onevmw.onmicrosoft.com header.s=selector1-vmware-com header.b=i+giu3LY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751533AbeEPQoE (ORCPT + 99 others); Wed, 16 May 2018 12:44:04 -0400 Received: from mail-by2nam01on0057.outbound.protection.outlook.com ([104.47.34.57]:31106 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750847AbeEPQoC (ORCPT ); Wed, 16 May 2018 12:44:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=onevmw.onmicrosoft.com; s=selector1-vmware-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1KO/5fOUez263jjqyWG7W8AVrkNRX+4ocTPIiVfNtrM=; b=i+giu3LYJC0VOfCXyE+3SkuNq52sj8TfT8MuW8ZeAi39Y6gBc49+q55XPKJWU2zh9oet9LDB/ErFA9g/014cJ8DqowVhIWtkBLB0D9FtDrGZZ+R8hXHzk9msvr4xufHHCTC6u2YRu3QC40UzHimsCgYkCMvCCXL3pQoPUyUpHmk= Received: from SN2PR05MB2654.namprd05.prod.outlook.com (10.166.212.137) by SN2PR05MB2463.namprd05.prod.outlook.com (10.166.213.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.776.4; Wed, 16 May 2018 16:44:00 +0000 Received: from SN2PR05MB2654.namprd05.prod.outlook.com ([fe80::4924:30ca:59af:89db]) by SN2PR05MB2654.namprd05.prod.outlook.com ([fe80::4924:30ca:59af:89db%4]) with mapi id 15.20.0776.010; Wed, 16 May 2018 16:44:00 +0000 From: Nadav Amit To: Jan Beulich CC: "keescook@chromium.org" , the arch/x86 maintainers , "tglx@linutronix.de" , Josh Poimboeuf , "mingo@redhat.com" , "linux-kernel@vger.kernel.org" , "hpa@zytor.com" Subject: Re: [RFC 5/8] x86: refcount: prevent gcc distortions Thread-Topic: [RFC 5/8] x86: refcount: prevent gcc distortions Thread-Index: AQHT7JOArUMsIGn6skKZaqvOLrG0XKQx8fiAgACfDYA= Date: Wed, 16 May 2018 16:44:00 +0000 Message-ID: <8B7DE95F-5E57-44F0-90E0-CCBA35F98A07@vmware.com> References: <20180515141124.84254-1-namit@vmware.com> <20180515141124.84254-15-namit@vmware.com> <5AFBDA6302000078001C31AC@prv1-mh.provo.novell.com> In-Reply-To: <5AFBDA6302000078001C31AC@prv1-mh.provo.novell.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [208.91.2.2] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;SN2PR05MB2463;7:QV9Rxt27J8KL/DOSgvlqrCNl7wi3NYmt+XtP6dOKZNPx0oFzmYJIk1kM9vhxiHQX9WEVCZ8dTLbmasU1r5DuAYss4dc1aFVR3nYcBllQht05z8QTTYnLqu/4+o+2C/h7SfObMYt3ezwcky7WzuSexkpf+ix/8j4sq9Lr6feevxuzUVNeDtLK/Bg6zatEcq9NuPEW7imrOVo/fyoYkN4N4oRR9Vids6teJHW50xhK0azpdSuvhwZ9c8ujnBlVs3yV;20:6WRfkSPl6HSXX+eVfBbhNXiYGuNtUhIKvEMabsiySFaGfkNBv+KEit0JXDbLp+R3Bf6r5LmNs5TKrqk58+wNZQ3PuJTaVAGd2fMUKCO4AkwUR4enlVPtA/uI2t4AhnfmX5AmzcHO8ed6kAvWXRgIZ8OnX5A1IMuTBRczZNjoQHU= x-ms-exchange-antispam-srfa-diagnostics: SOS; x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:SN2PR05MB2463; x-ms-traffictypediagnostic: SN2PR05MB2463: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(61668805478150); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231254)(944501410)(52105095)(10201501046)(93006095)(93001095)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011);SRVR:SN2PR05MB2463;BCL:0;PCL:0;RULEID:;SRVR:SN2PR05MB2463; x-forefront-prvs: 0674DC6DD3 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(346002)(376002)(366004)(396003)(39380400002)(39860400002)(199004)(189003)(97736004)(83716003)(8936002)(68736007)(5660300001)(4326008)(53936002)(476003)(26005)(2616005)(2900100001)(6512007)(102836004)(186003)(11346002)(6346003)(6246003)(446003)(86362001)(8676002)(82746002)(5250100002)(81166006)(81156014)(486006)(6486002)(105586002)(53546011)(3280700002)(54906003)(6506007)(36756003)(66066001)(6116002)(316002)(76176011)(33656002)(3846002)(478600001)(25786009)(99286004)(14454004)(6436002)(229853002)(2906002)(106356001)(6916009)(305945005)(3660700001)(7736002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN2PR05MB2463;H:SN2PR05MB2654.namprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: vmware.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=namit@vmware.com; x-microsoft-antispam-message-info: Ro0U+HZAY5Tq/hH43PRJY2PJ/2Qx04iYASwF85QqTG7DNyhvX7J/6lHkehxa9Lh/Nv6O+5Uf2W2TD18YbNBmKH2mp1sJimkuWp5j09zojgnlws4hpnis+wt5vk5boiVK4oBnjS8x1i9XGxUNrNYR8shE+7msv+4LG345xsLfKzOC6XvBCmbir8iRgtPEohQ4 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: a2752866-e30e-4ee4-541c-08d5bb4c39b7 X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-Network-Message-Id: a2752866-e30e-4ee4-541c-08d5bb4c39b7 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 May 2018 16:44:00.0936 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR05MB2463 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jan Beulich wrote: >>>> On 15.05.18 at 16:11, wrote: >> --- a/arch/x86/include/asm/refcount.h >> +++ b/arch/x86/include/asm/refcount.h >> @@ -14,34 +14,43 @@ >> * central refcount exception. The fixup address for the exception point= s >> * back to the regular execution flow in .text. >> */ >> -#define _REFCOUNT_EXCEPTION \ >> - ".pushsection .text..refcount\n" \ >> - "111:\tlea %[counter], %%" _ASM_CX "\n" \ >> - "112:\t" ASM_UD2 "\n" \ >> - ASM_UNREACHABLE \ >> - ".popsection\n" \ >> - "113:\n" \ >> + >> +asm ("\n" >> + ".macro __REFCOUNT_EXCEPTION counter:vararg\n\t" >> + ".pushsection .text..refcount\n" >> + "111:\tlea \\counter, %" _ASM_CX "\n" >> + "112:\t" ASM_UD2 "\n\t" >> + ASM_UNREACHABLE >> + ".popsection\n\t" >> + "113:\n" >> _ASM_EXTABLE_REFCOUNT(112b, 113b) >> + ".endm"); >=20 > A few comments on assembly code formatting - while gas at present is > relatively lax in this regard, I wouldn't exclude that there might be a > more strict mode in the future, and that such a mode might eventually > become the default. Furthermore these formatting aspects affect > readability of the assembly produced, should anyone ever find a need > to look at it (perhaps because of some breakage) - I certainly do every > once in a while. >=20 > Labels should be placed without any indentation (but of course there > may be more than one on a line, in which case subsequent ones may > of course be arbitrarily indented). Instructions and directives, otoh, > should be placed with at least a single tab or space of indentation > (unless preceded by a label, in which case the extra white space still > helps readability). Writing these patches, I looked at the generated assembly, and there did no= t appear to be a standard. IIRC, .pushsection directives were not always inlined. I will fix it according to your comments. > I'm also not sure about the purpose of the leading plain newline here. > gcc annotates code resulting from inline assembly anyway iirc, so > proper visual separation should already be available. Right. It was only to get the macro directive not tabulated, but as you said, it should be tabulated, so I will remove it. >=20 > If I was the maintainer of this code, I would also object to the > mis-alignment your file scope asm()-s have ("asm (" is 5 characters, > which doesn't equal a tab's width). I tried many formats (including the one you propose), and eventually went with the one that made checkpatch not yell at me. I will revert to the one you propose, which makes most sense, and ignore checkpatch warnings. Thanks, Nadav