Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2579494imm; Sun, 7 Oct 2018 07:15:08 -0700 (PDT) X-Google-Smtp-Source: ACcGV62ALH1K32QvC0Y+XvDc1RIayKrHiv+eMRXNwXAMfEgfRk+Bp6RdnVVlyacPxiLq2wcA3oC2 X-Received: by 2002:a63:a309:: with SMTP id s9-v6mr17585202pge.106.1538921708686; Sun, 07 Oct 2018 07:15:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538921708; cv=none; d=google.com; s=arc-20160816; b=Ua630I3Xx9TTbtoTYOvjLR0dMK25Pi8wQIN5iUZbAzatGx9rafkt7Wklpl/aDsQIH9 cYkjUKW8npykspNPX9/3X1Rv0au0zHG8RD6mGmveCvdBSI2++pN23xKG0qCsFv2ZAfEp 4OX0lRQGXq1fIJk6jdV6Amihfik06o7fNmt6W6ynSHrrZFyD7DIVWBL7a1MGKzgNYk6V Q6thByNOsnZF9cRbO1bhcQn2hLETMOPzPvFoq8YtMROtEOGrg0AWUHp4rwu3AdCnVKgA oKAjuftVFb3XcBJqp0PyCYk2xDrQklwr8C66F0pTwaxfeh6F9Qfxl0s1RROKsdCB3wVF ErUA== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=9g4hhre0U0CHr1VeZQGFe41xp4V58NEWA6d4uTJ2uX4=; b=xdE3kIGCpy9sA6WxOyaDWYRJA3u7wCR/FDwmu6Zglv15vUb+E0y7FwcOhRQEgD4BnR 7Tm8XylsIJ3Ez5DfaPTQzbrhYXDKT0e4OBYCYXNKEx9T7sP2WPAXNuo12RJIf+Ak5zhX wx3lDBazRiEizvCUd8et8cCYiFZbQkCRBWOdeCaWecyT7j9SQ8VJzmahRT0dbUFapVco umTa1/1t6iksoBXW2N8RzyOonccwuyeGrOhnxN+6ZKSzHBbDDRBc21tTsH2DwATmQw/c Y/nlSnOPxQJ6oxYAuYG6enMEWw+SYiA50RDIMzNnzf4N1hcoYfJy3mkZgJ4hbVy3f5AM MWww== ARC-Authentication-Results: i=1; mx.google.com; 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 17-v6si10657547pgz.577.2018.10.07.07.14.08; Sun, 07 Oct 2018 07:15:08 -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; 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 S1728072AbeJGVVY (ORCPT + 99 others); Sun, 7 Oct 2018 17:21:24 -0400 Received: from mail.skyhub.de ([5.9.137.197]:35372 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727142AbeJGVVY (ORCPT ); Sun, 7 Oct 2018 17:21:24 -0400 X-Virus-Scanned: Nedap ESD1 at mail.skyhub.de Received: from mail.skyhub.de ([127.0.0.1]) by localhost (blast.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id XsiTcyLhSPP1; Sun, 7 Oct 2018 16:14:01 +0200 (CEST) Received: from zn.tnic (p200300EC2BCA7500329C23FFFEA6A903.dip0.t-ipconnect.de [IPv6:2003:ec:2bca:7500:329c:23ff:fea6:a903]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id E22AB1EC01F6; Sun, 7 Oct 2018 16:14:00 +0200 (CEST) Date: Sun, 7 Oct 2018 16:13:49 +0200 From: Borislav Petkov To: Segher Boessenkool Cc: gcc@gcc.gnu.org, Richard Biener , Michael Matz , Nadav Amit , Ingo Molnar , linux-kernel@vger.kernel.org, x86@kernel.org, Masahiro Yamada , Sam Ravnborg , Alok Kataria , Christopher Li , Greg Kroah-Hartman , "H. Peter Anvin" , Jan Beulich , Josh Poimboeuf , Juergen Gross , Kate Stewart , Kees Cook , linux-sparse@vger.kernel.org, Peter Zijlstra , Philippe Ombredanne , Thomas Gleixner , virtualization@lists.linux-foundation.org, Linus Torvalds , Chris Zankel , Max Filippov , linux-xtensa@linux-xtensa.org Subject: Re: PROPOSAL: Extend inline asm syntax with size spec Message-ID: <20181007141349.GD30687@zn.tnic> References: <20181003213100.189959-1-namit@vmware.com> <20181007091805.GA30687@zn.tnic> <20181007132228.GJ29268@gate.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20181007132228.GJ29268@gate.crashing.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 07, 2018 at 08:22:28AM -0500, Segher Boessenkool wrote: > GCC already estimates the *size* of inline asm, and this is required > *for correctness*. I didn't say it didn't - but the heuristic could use improving. > So I guess the real issue is that the inline asm size estimate for x86 > isn't very good (since it has to be pessimistic, and x86 insns can be > huge)? Well, the size thing could be just a "parameter" or "hint" of sorts, to tell gcc to inline the function X which is inlining the asm statement into the function Y which is calling function X. If you look at the patchset, it is moving everything to asm macros where gcc is apparently able to do better inlining. > > 3) asm ("...") __attribute__((asm_size())); > > Eww. Why? > More precise *size* estimates, yes. And if the user lies he should not > be surprised to get assembler errors, etc. Yes. Another option would be if gcc parses the inline asm directly and does a more precise size estimation. Which is a lot more involved and complicated solution so I guess we wanna look at the simpler ones first. :-) > I don't like 2) either. But 1) looks interesting, depends what its > semantics would be? "Don't count this insn's size for inlining decisions", > maybe? Or simply "this asm statement has a size of 1" to mean, inline it everywhere. Which has the same caveats as above. > Another option is to just force inlining for those few functions where > GCC currently makes an inlining decision you don't like. Or are there > more than a few? I'm afraid they're more than a few and this should work automatically, if possible. Thx. -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply.