Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp724938imm; Thu, 4 Oct 2018 02:12:52 -0700 (PDT) X-Google-Smtp-Source: ACcGV60v6LoPeqnPob0dgLt45I+l8YdwGKTHCCjouJDqYpnirB3Ntf1AN7CMJJg62vrHWWmwZylS X-Received: by 2002:a17:902:7c96:: with SMTP id y22-v6mr5620937pll.321.1538644372059; Thu, 04 Oct 2018 02:12:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538644372; cv=none; d=google.com; s=arc-20160816; b=DGv1Sk3eir634Q/RMD0nQ/glO/7F5TX5emGSzMyFzH+m2Er0eIVt3wW3hvIRX3MKIm pYS0vRVp4o+9lzxRIYC3attdBmRMlnh3qrnxfLrmPJAQhMAySU4QsLLb+jY4ni+jn6hL 8O34KBO+IZDYSfkPLzLwQFX2flBbevIbILVjuSYoNOuCqNdrVcyh7GMO4NUgvbQ2mJGl j4TgrOHmNXTreA9RmCTWZWRytmiv0UxNlZdNI2kEunZ5lMjA1r5wYr4rK+jow4d2cA2c BZmq5Z+o9izBZPJCQ6MkM60qcJ05Xx54+MsrisydU9LUhsHKgzYcBRauOo9Z8X2mwNNw Y7DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=83P2dvg1cXHB7jtJWUE/b28+Sf5/oJK7GJm847GksEs=; b=zMMD50JifupuzORgx6JCUQfR14SoMBCfiSD30Dy9sAWBQwPzKl0/vkZ5n666xk8WTM jUDf3eXIK4z/8dWFu1alTkiXFY+m7JSjkkAo2fN4cglhV+5u4CcuzQSBrWJpSENpWggC uIGrcREQxZ5cE2H0t9Q6HG0kPnFc6YitkFCN3HoYIljwJSqcWTgKe+rfbtUWYB5D7KPf E0Yepl+XtA/vucQbXa08BRwVy5bnTpLFcdhXqwa9FK10GZ6JZ7/NLKGynvPTyW7aV/6v WJ6GuumyHFEMdOk70fI/ahcgQw/4wCrDvS1eZr61j+66Y9ED9zya8pX1MWFZPjZ+KEUd +Lug== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=h+ec1scs; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w16-v6si4609699pll.234.2018.10.04.02.12.36; Thu, 04 Oct 2018 02:12:52 -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=fail header.i=@gmail.com header.s=20161025 header.b=h+ec1scs; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727293AbeJDQEq (ORCPT + 99 others); Thu, 4 Oct 2018 12:04:46 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:35522 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726998AbeJDQEp (ORCPT ); Thu, 4 Oct 2018 12:04:45 -0400 Received: by mail-wr1-f65.google.com with SMTP id w5-v6so9061568wrt.2 for ; Thu, 04 Oct 2018 02:12:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=83P2dvg1cXHB7jtJWUE/b28+Sf5/oJK7GJm847GksEs=; b=h+ec1scst3lKxWcLqZpqvqdFSsIXy8jKeZ/jItqq8StlQW0QF+jslq+3Av2AeohzNR +wyTArg/0qqYffm9eg9VHYWCmKrXGi7fAoCoeecDlfqoFYUrSqbZ9FAgZER90xxCCZct uRqxMa6L9bNcE17rIATiuyivW6T539zS0mIWnOxoe/mRdiP5m/thSdI3PUA+i1pQNhkb fuBf/psvQLjbfovJ1Tw+SLTfZsfAOZOhr2+lbX2pRQlNH324h+m8cJIoE8ktYgAvRKRp g4Xjdgvo8/u1P8KCGH/AFyxbAlpIuh7uktvYVh8Kz0tH8Nsb91UawsXfP970nkOPdWXW m5JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=83P2dvg1cXHB7jtJWUE/b28+Sf5/oJK7GJm847GksEs=; b=knRHTDPGzu+vfUwBemKvUEwAasnHGKlRCDQvJPzXWs9/fUOo2QWwAT/MOyJmDjNiin wb4b9qWY80+2b1sZws4LBUGWCNRlaK7lFDwhsjzksGTcr7CL3uKFEXmsiJwEeX+HYu7P HatOF/6/KTZwJM5qYFxnIOWvkUKSc8bG78VutDTy+JRSmpXqR/F3MsAZf8LJWMGl17iA Y+2lAewffWzDvCLNzftOskRZ7u31FNLOqImk4GOKtXeJ7fJUDnky5kr7tpqPSBtkBCyv U/rkyCHLVhgOkLX0quRwxPk7m58WJcGAofjYcr/9aNdMp8x5/TpOCafqxNmVnVXFq2ov OWRA== X-Gm-Message-State: ABuFfogepetZsFmNeaIZEd/DyQl3DGLLdMOlp+k2yH6twfh1QsWhxl8p Ex8+E/DBm64FT0y9e6frW4A= X-Received: by 2002:adf:a1dd:: with SMTP id v29-v6mr4008779wrv.50.1538644345000; Thu, 04 Oct 2018 02:12:25 -0700 (PDT) Received: from gmail.com (2E8B0CD5.catv.pool.telekom.hu. [46.139.12.213]) by smtp.gmail.com with ESMTPSA id t14-v6sm3267957wmi.35.2018.10.04.02.12.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Oct 2018 02:12:24 -0700 (PDT) Date: Thu, 4 Oct 2018 11:12:22 +0200 From: Ingo Molnar To: Nadav Amit Cc: "hpa@zytor.com" , Ingo Molnar , "linux-kernel@vger.kernel.org" , "x86@kernel.org" , Thomas Gleixner , Jan Beulich , Josh Poimboeuf , Linus Torvalds , Peter Zijlstra , Andy Lutomirski Subject: Re: [PATCH v9 04/10] x86: refcount: prevent gcc distortions Message-ID: <20181004091222.GB21864@gmail.com> References: <20181003213100.189959-1-namit@vmware.com> <20181003213100.189959-5-namit@vmware.com> <20181004075755.GA3353@gmail.com> <20181004083333.GA9802@gmail.com> <10D29A50-C352-4407-A824-0C3C06CD8592@zytor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Nadav Amit wrote: > I can run some tests. (@hpa: I thought you asked about the -pipe overhead; > perhaps I misunderstood). Well, tests are unlikely to show the overhead of extra lines of this magnitude, unless done very carefully, yet the added bloat exists and is not even mentioned by the changelog, it just says: Subject: [PATCH v9 02/10] Makefile: Prepare for using macros for inline asm Using macros for inline assembly improves both readability and compilation decisions that are distorted by big assembly blocks that use alternative sections. Compile macros.S and use it to assemble all C files. Currently, only x86 will use it. > I guess you regard to the preprocessing of the assembler. Note that the C > preprocessing of macros.S obviously happens only once. That’s the reason > I assumed it’s not that expensive. True - so first we build macros.s, and that gets included in every C file build, right? macros.s is smaller: 275 lines only in the distro test build I tried, which looks a lot better than my first 4,200 lines guesstimate. > Anyhow, I remember that we discussed at some point doing something like > ‘asm(“.include XXX.s”)’ and somebody said it is not good, but I don’t > remember why and don’t see any reason it is so. Unless I am missing > something, I think it is possible to take each individual header and > preprocess the assembly part of into a separate .s file. Then we can put in > the C part of the header ‘asm(".include XXX.s”)’. > > What do you think? Hm, this looks quite complex - macros.s is better I think. Also, 275 straight assembly lines is a lot better than 4,200. Another, separate question I wanted to ask: how do we ensure that the kernel stays fixed? I.e. is there some tooling we can use to actually measure whether there's bad inlining decisions done, to detect all these bad patterns that cause bad GCC code generation? Thanks, Ingo