Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp752574imm; Thu, 4 Oct 2018 02:45:47 -0700 (PDT) X-Google-Smtp-Source: ACcGV63N/u/dkvT36aNOD1f0ez4DhwWHClYZcSPDV876kHkEVROWTY8mdeCW1R+rWUBPUo1DB+9p X-Received: by 2002:a63:8c4:: with SMTP id 187-v6mr5016046pgi.396.1538646347057; Thu, 04 Oct 2018 02:45:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538646347; cv=none; d=google.com; s=arc-20160816; b=FukVqp35S2mSNzyqO0sF3hwZNetz4C8XaT2wJOiGADGcyHnWKsudB1emPyy7yVlW68 UiFMP/LRGDh5eoRp5MquAUHN8Kppvuu3Dwalu8jVMwTyRYqXmUJeK+AYalx9sXvdvInT OKdyI4vn+O1uxdYko3Cba730P+YX9SgFGk4rKVREtl/UYr+2dvmWiOMOmVWgnWOZThlY aIRy35DH4yBi6oaW1G4dlyOapqubXLRMpNm4v7zixguJMnnejHrgJkCVUyKuV4ybyvw/ +B2yxZA2zD9hU8676ovzCBS2GpJWFzEa6DmuuE8luCxSlnyGOrGJnehk0uHGd/QIyv0I rBUw== 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=HDicjxug5RKfq+HhpP3ZQdTUad2l64SudYBZtE7m778=; b=Gmr/dOQXD/47lnlL3XD/0WxFbkz5j9gMFPaaDHnMMlxO9EGDlDz1l7ReGIKO2Euhvx T/B3NQzbLQi63KxSFc0mo2O63gw98u9TUOx3my4mfBaGEZ8VSwLozaocUsfXXoaeyTmr DXeeBcWzyXmyLtS0SzqeICtinnSIgN/zXTqoKmAE+6gs+3q8o6twDA0/UKWwTN9vfst4 f+tinwMfIRA3NWdSyySvUyQDgCNmPZ4ff02rmM3IZcdQ1baCWb02yOdjhEGaiW1q901b 8dubhZ1mCwLIyWKcplqtqIctjqO2wvo7W1Hoo/MJp2r5ZxpkmoVFIgmk/m8Fc93qaZy8 WJPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="bfw/7MCI"; 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 c2-v6si4629659plb.384.2018.10.04.02.45.30; Thu, 04 Oct 2018 02:45:47 -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="bfw/7MCI"; 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 S1727479AbeJDQhv (ORCPT + 99 others); Thu, 4 Oct 2018 12:37:51 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:45362 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727046AbeJDQhu (ORCPT ); Thu, 4 Oct 2018 12:37:50 -0400 Received: by mail-wr1-f66.google.com with SMTP id q5-v6so9136997wrw.12 for ; Thu, 04 Oct 2018 02:45:23 -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=HDicjxug5RKfq+HhpP3ZQdTUad2l64SudYBZtE7m778=; b=bfw/7MCIyusllTKOr5PPN2d2p4KbGjfdN2fxUWzMxi4egP2VLACACovo6Lj9IhBgt8 WSW1HVLPTzL/N0RkI3eS/5Md30x//tVZmTDeKPzkZCKKJYot12lYjDRGx0gsRKGUHulP wiTwHPpfsjt+eJ8DhLDl1wm99I1o09qnOmiMf5bYY9Brm9UUdq4+1NLbXjVFD6jlOKT9 Mu7bT71Rbgth7ZeeEjOn+d1oDjAfjt6JV95mVXBs08pl2OdCeocRzMUo7owxuRyPJcct edebjwYx5kwkQoUt+wIIWpYQ1/28WNj/8lNdjXZ2BCXWlKD/awjNXQoGwVBPUEPu0eJZ nzCQ== 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=HDicjxug5RKfq+HhpP3ZQdTUad2l64SudYBZtE7m778=; b=EUu1PAtIhS2qUx7HvZuqLMoxaKQemOUCDtv8nNkGtM+XFeXLPZc8uUPLQSoYN4NYaG iD7ha63iFYMXQjh5Q2YKlNlJyYgbhhKfIPW7spp9UPwzjp+KEFCGdQK0dLeo1uszIxHd evqDh/AVIrlNZ+gt9g81rJjYk8QPoAZ+DanvZRdIoBB9BQHxVb1OHx7BBnT6iUslRzUD 7lwEV+wPn2NtYHytQFhSu2cZcKcARpsHkxK42opDOn27i/RJK1bH3ndlvt74nTf7TTK/ qZ26CLXlxM4P737FO4FpsRizKCmXSI2Y5eue52XG9yvOKa7Ifb5naKz9ALAIc7b9/xCV ERZA== X-Gm-Message-State: ABuFfohoEZ0simW1h4PWhR0jNqhIKjVZ2wvTWh4RseD76KNAp+KedaQC BilPhs2Nb284MhDpT8dzOP+ohdya X-Received: by 2002:a05:6000:100f:: with SMTP id a15mr4106822wrx.271.1538646322494; Thu, 04 Oct 2018 02:45:22 -0700 (PDT) Received: from gmail.com (2E8B0CD5.catv.pool.telekom.hu. [46.139.12.213]) by smtp.gmail.com with ESMTPSA id b81-v6sm4437649wmh.47.2018.10.04.02.45.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Oct 2018 02:45:21 -0700 (PDT) Date: Thu, 4 Oct 2018 11:45:19 +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: <20181004094519.GA97692@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> <20181004091222.GB21864@gmail.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: > > 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? > > Good question. First, I’ll indicate that this patch-set does not handle all > the issues. There is still the issue of conditional use of > __builtin_constant_p(). > > One indication for bad inlining decisions is the inlined functions have > multiple (non-inlined) instances in the binary and are short. I don’t > have an automatic solution, but you can try, for example to run: > > nm --print-size ./vmlinux | grep ' t ' | cut -d' ' -f2- | sort | uniq -c | \ > grep -v '^ 1' | sort -n -r | head -n 5 > > There are however many false positives. After these patches, for example, I > get: > > 11 000000000000012f t jhash > 7 0000000000000017 t dst_output > 6 0000000000000011 t kzalloc > 5 000000000000002f t acpi_os_allocate_zeroed > 5 0000000000000029 t acpi_os_allocate > > > jhash() should not have been inlined in my mind, and should have a > non-inlined implementation. dst_output() is used as a function pointer. > kzalloc() and the next two suffer from the __builtin_constant_p() problem I > described in the past. Ok, that's useful info. The histogram suggests that with all your patches applied the kernel is now in a pretty good state in terms of inlining decisions, right? Are you using defconfig or a reasonable distro-config for your tests? Thanks, Ingo