Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1705444ybn; Thu, 26 Sep 2019 00:32:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqyBHlYT4pReS4gIMSNbXtxnGwxG3CwdQGsv0rHydXgC8bF0zmXrBghBeCiUYSoGVUwDtioW X-Received: by 2002:a05:6402:1202:: with SMTP id c2mr2001090edw.190.1569483162929; Thu, 26 Sep 2019 00:32:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569483162; cv=none; d=google.com; s=arc-20160816; b=YusfnYivkbtors/5zmoeZ4/4HZ9Wt42SpFUIOfKql/wMYcAYrUO7nC+KvxS5qpNhri yngJD+lbtRB0Tooc2kmDbbNRJYNjqKObl3GZZzFd9ktTIPKLF4eKPNJ1rscwBqSI0Dqi WzWxYggNZG/ddJy/sHBzcSfAo0ObHmPbieztPxDUU+k92cxaGhdvL+zCgFRnsXMdhbnL Tq7Kq9oR/+hLeF/egbt0SCIFLaw5rdKhYW7PqKZG8nAwhWexlMh7UCRYNGGETgO3WwL9 lbHw9o9lB4l7EiRLJIh0mPww/yVXo7/sxdoqvK+QWMMrqEYdkEcp40XaBM7ms16u3rCU 4BwQ== 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=IJ/5ttaJmCvzVm6kou+A1534wOpOuuE48vLVoA2ufKA=; b=sfH5AoBnhJCBqUK7WoaVzhBmeoPxz3FbmzJfaHXptrfa+/8SfMfFqxBwlRBpcm2Zy/ hop2v8NBt1OZ/vPhS85eCwsOsgyJK71+UEBnezGVmWyZHfmbedIS4SiSID0ozbUn2TFC Yu71PL9bSdjnYcBlpbp+wYlh2sAFrMguthQYOJnvR1PJwvFice12P5u1JiztrgBI7XnN 0l6fjePyPq+CJTkSFwjghbVMkfpSDIccQokEUuBNanjczMIl+FoNRH+rSh5XF+A6liHS Hk6X4zdxaOVLUAh47VF7Wdy3IixfQ/fRjL0+zWKg/h68KU1NSeGbgEhwnTbfzgi+gBI2 XVWg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c54si785449edb.230.2019.09.26.00.32.19; Thu, 26 Sep 2019 00:32:42 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408895AbfIXC4b (ORCPT + 99 others); Mon, 23 Sep 2019 22:56:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34482 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2408880AbfIXC43 (ORCPT ); Mon, 23 Sep 2019 22:56:29 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 41EEB30860C8; Tue, 24 Sep 2019 02:56:29 +0000 (UTC) Received: from mail (ovpn-120-159.rdu2.redhat.com [10.10.120.159]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 807135C219; Tue, 24 Sep 2019 02:56:24 +0000 (UTC) Date: Mon, 23 Sep 2019 22:56:23 -0400 From: Andrea Arcangeli To: Paolo Bonzini Cc: Vitaly Kuznetsov , "Dr. David Alan Gilbert" , Marcelo Tosatti , Peter Xu , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 14/17] KVM: monolithic: x86: inline more exit handlers in vmx.c Message-ID: <20190924025623.GD4658@redhat.com> References: <20190920212509.2578-1-aarcange@redhat.com> <20190920212509.2578-15-aarcange@redhat.com> <6a1d66a1-74c0-25b9-692f-8875e33b2fae@redhat.com> <20190924010056.GB4658@redhat.com> <20190924015527.GC4658@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190924015527.GC4658@redhat.com> User-Agent: Mutt/1.12.1 (2019-06-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 24 Sep 2019 02:56:29 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 23, 2019 at 09:55:27PM -0400, Andrea Arcangeli wrote: > This commit I reverted adds literally 3 inlines called by 3 functions, > in a very fast path, how many bytes of .text difference did you expect > by dropping some call/ret from a very fast path when you asked me to > test it? I mean it's just a couple of insn each. > > I thought the question was if gcc was already inlining without the > hint or not or if it actually grew in size in case I got it wrong and > there were many callers and it was better off not inline, so now I > don't get what was the point of this test if with the result that > confirms it's needed, the patch should be dropped. > > It's possible that this patch may not be relevant anymore with the > rename in place of the vmx/svm functions, but if this patch is to be > dropped with the optimal result, then I recommend you to go ahead and > submit a patch to drop __always_inline from the whole kernel because > if it's not good to use it here in a extreme fast path like > handle_external_interrupt and handle_halt, then I don't know what > __always_inline is good for anywhere else in the kernel. Thinking more at this I don't think the result of the size check was nearly enough to come to any conclusion. The only probably conclusion one can take is that if the size didn't change it was a fail, because there would be high probability that it wouldn't be beneficial because it was a noop (even that wouldn't be 100% certain). One needs to look at why it changed to take any conclusion, and the reason it got smaller is that all dynamic tracing for ftrace was dropped, the functions were already inlined fine in the RETPOLINE case. Those are tiny functions so it looks a positive thing to make them as small as possible, there are already proper tracepoints in kvm_exit/kvm_entry for bpf tracing all all KVM events so there's no need of the fentry in those tiny functions with just an instruction that are only ever compiled as static because of the pointer to function. This however also means it helps the CONFIG_RETPOLINE=n case and it doesn't help at all the CONFIG_RETPOLINE=y case, so it's fully orthogonal to the patchset and can be splitted off but I think it's worth it. Thanks, Andrea