Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1462709imu; Tue, 20 Nov 2018 18:48:53 -0800 (PST) X-Google-Smtp-Source: AFSGD/WsohLZfUbZqu7f51qfefnwXeOm81SW/jZwUKPhkXNswni2lItIgNAJgDV8rOYFVuvZS1Qt X-Received: by 2002:a63:2744:: with SMTP id n65mr4269952pgn.65.1542768533690; Tue, 20 Nov 2018 18:48:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542768533; cv=none; d=google.com; s=arc-20160816; b=Ac2RKGFWgPJw7mUIqA+R/VIpC7VgxrTQjrzcEsAaFI1A7+hHsO/pFVTWoNNfJ/1YUt gl6MRMosK7YVcF/Z9N6Q9eZtfbe8wBZj2z0cDBM9Ot1dnC++6uI8gDjSXFykbfiA28py JYpdUOBl9aE/t/otkjg2yyCPwu9W1ckmRvcQRixeB61naJotEPpBshT6oRGZFmEr0U/c wLlk52RDj3tYe2ayQ5JWx98xHWuIQQKvEjDchgD2f9BGV4zzOifcLpPRKwP7I/8dQYxr d9AclhmVb1UHIzh6PYyRRc0D6eXxQ8dTbk8pFR9eb17Y7A84j65NVquujrdZW41/iEw6 S1Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature:dkim-filter; bh=l5a+aW6BpQ54bHtcdpO+NgEUoHC/Oayvxin+NjW35ZA=; b=XJ1Dv/b8JfgCwuvhsbyhNzcPA1bWVhf5J3G7WUHPXtcVVA4CoyUuT8WzDRTiaGkX8O JWdXguRv0esRu3Pk0oqWAl3gynD0ligi8rBpgJL+WhV+Ku86lPU8lGpQLuCmI1c2ccWf eZAw1GEkXAcC6zTRO+b70aXGsxbOMaDQtWju4zXo/xLhVGEIz8L4yc+evsBhrbyHXlTx bL3Mg7FoPdiba7rcPycTrkWamGGg+9k1P8W3hQE7mFhBHVuDjyK+CmiQa18tsshuqbR8 B3GFqUdyjQ4VU5+Hmj8ntrD25H4KsmNTmUyiEv/e5z8fzXwRjEJG+Jyu/4B7buBAHyrR GiHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=HSyDRyVF; 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 m35si1086014pgb.246.2018.11.20.18.48.38; Tue, 20 Nov 2018 18:48:53 -0800 (PST) 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=@nifty.com header.s=dec2015msa header.b=HSyDRyVF; 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 S1726260AbeKUNUX (ORCPT + 99 others); Wed, 21 Nov 2018 08:20:23 -0500 Received: from conssluserg-05.nifty.com ([210.131.2.90]:39528 "EHLO conssluserg-05.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725949AbeKUNUX (ORCPT ); Wed, 21 Nov 2018 08:20:23 -0500 Received: from mail-ua1-f45.google.com (mail-ua1-f45.google.com [209.85.222.45]) (authenticated) by conssluserg-05.nifty.com with ESMTP id wAL2ludb009582; Wed, 21 Nov 2018 11:47:57 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-05.nifty.com wAL2ludb009582 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1542768477; bh=l5a+aW6BpQ54bHtcdpO+NgEUoHC/Oayvxin+NjW35ZA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=HSyDRyVFx75JKCh1kgrphauLwY7wOmjsWIHlbmO/aiIckWcshoZluQ7Gr2/D3GgZ5 W3YHuTM4pgnXMTo3XMIg4RiMoxAH7GGhNW4sSx6sVrHAfTD1haJhX48K9W/nPWKOjT bjMQjfeAv/y2/aYxtisp/EFiYPDTJkHlP34elfoKZhXIAbffcAgOXoO1wHmlWeqTSN FLbUJUcXrAA2lQ8VtdhlIixr5OjLH+g9Hh6Mf6CzpfA2CpzyrizYFKHnWw6buNZsQh 4iZhJ1tmwTxPsDFe78vF0hzZR5twLvn1c7+s48ihzkuX77Wndy4+qJV9HDY9xDHG/O b7+Y9Fmui/VqQ== X-Nifty-SrcIP: [209.85.222.45] Received: by mail-ua1-f45.google.com with SMTP id j3so1423021uap.3; Tue, 20 Nov 2018 18:47:56 -0800 (PST) X-Gm-Message-State: AA+aEWZyAoQ0bILVPkFmFoOIJjBJo8endiJgSXlDVV/AeqpAoYJabS+V kPO7e6YcFb8JEYRrdPLHuhI6DoZ67GPGznaVulM= X-Received: by 2002:ab0:3402:: with SMTP id z2mr2072623uap.6.1542768475630; Tue, 20 Nov 2018 18:47:55 -0800 (PST) MIME-Version: 1.0 References: <20181114204309.18645-1-namit@vmware.com> <20181114204309.18645-2-namit@vmware.com> <1C316B94-8F27-439C-B049-9947DC329780@vmware.com> <1F17E69E-06E8-4A5A-A434-1DCD6C6F0259@vmware.com> In-Reply-To: <1F17E69E-06E8-4A5A-A434-1DCD6C6F0259@vmware.com> From: Masahiro Yamada Date: Wed, 21 Nov 2018 11:47:19 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 1/2] Makefile: Fix distcc compilation with x86 macros To: Nadav Amit Cc: Ingo Molnar , Michal Marek , Thomas Gleixner , Borislav Petkov , "H. Peter Anvin" , X86 ML , Linux Kbuild mailing list , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 20, 2018 at 2:21 AM Nadav Amit wrote: > > at 8:20 PM, Masahiro Yamada wrote: > > > On Sat, Nov 17, 2018 at 6:02 AM Nadav Amit wrote: > >> From: Masahiro Yamada > >> Sent: November 16, 2018 at 7:45:45 AM GMT > >>> To: Nadav Amit > >>> Cc: Ingo Molnar , Michal Marek , Thomas Gleixner , Borislav Petkov = , H. Peter Anvin , X86 ML , Linux Kbuild mai= ling list , Linux Kernel Mailing List > >>> Subject: Re: [PATCH v2 1/2] Makefile: Fix distcc compilation with x86= macros > >>> > >>> > >>> On Thu, Nov 15, 2018 at 1:01 PM Nadav Amit wrote: > >>>> Introducing the use of asm macros in c-code broke distcc, since it o= nly > >>>> sends the preprocessed source file. The solution is to break the > >>>> compilation into two separate phases of compilation and assembly, an= d > >>>> between the two concatenate the assembly macros and the compiled (ye= t > >>>> not assembled) source file. Since this is less efficient, this > >>>> compilation mode is only used when distcc or icecc are used. > >>>> > >>>> Note that the assembly stage should also be distributed, if distcc i= s > >>>> configured using "CFLAGS=3D-DENABLE_REMOTE_ASSEMBLE". > >>>> > >>>> Reported-by: Logan Gunthorpe > >>>> Signed-off-by: Nadav Amit > >>> > >>> > >>> Wow, this is so ugly. > >> > >> Indeed, it is not pretty from the Makefile system point of view. > >> > >> But it does have merits when it comes to the actual use (by developers= ). If > >> you look on x86, there are a lot of duplicated implementation for C an= d Asm > >> and crazy C macros, for example for PV function call or the alternativ= e > >> mechanism. The code is also less readable in its current form. > >> > >>> I realized how much I hated this by now. > >>> > >>> My question is, how long do we need to carry this? > >> > >> If it is purely about performance, I am not sure it would make sense t= o > >> put it in, as it will indeed be (eventually) solved by the compiler, a= nd > >> the penalty is not too great. > > > > > > It is unfortunate to mess up the code > > by having two different ways to achieve the same goal. > > Indeed, but I fail to see how this statement fits with the next sentence. I am not tracking the progress on GCC side. I just did not sure if the 'asm inline' work was on the right track. > > When GCC with asm inline support is shipped, > > would you revert 77b0bf55 ? > > This patch and the following ones were not written to be reverted, i.e., > reverting them later may not be easy since they remove redundant C inline > assembly chunks. > > Since gcc will solve the inline assembly issues, the value of these patch= es > is in unifying the assembly that is used in .c and .S files. Due to the l= ack > of m4-like preprocessor in the Linux make-system, the solution is a bit > =E2=80=9Chacky=E2=80=9D (in other words, I don=E2=80=99t see a reasonable= alternative solution). > > So there is a downside in the form of performance degradation of distcc, = and > hacky (not too hacky?) Makefile changes. On the upside, except addressing > the gcc statement cost computation (inline) issue, the patch removes > redundant code, and improves assembly code readability. It is true that the assembly part itself is readable but the readability as a whole is worse IMHO. Each macro implementation was split into "asm volatile" (in C) + ".macro" (in ASM) parts. > In addition, it > provides the option to make assembly manipulations after compilation, whi= ch > HPA and others (me) look into. > > Anyhow, if after all, the downside is considered greater than the upside= , > it is best to remove the patches sooner than later, as a revert later wil= l > be more painful. Then, I'd be happier with the revert now. -- Best Regards Masahiro Yamada