Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp621358ybz; Wed, 22 Apr 2020 04:59:36 -0700 (PDT) X-Google-Smtp-Source: APiQypLG5tHP0/Y4eTqHhGhnfUFPLgU7XTmgbMj+UIHIwYF8qiHxAIs5EQHI6bdco2nVPC9XEE0R X-Received: by 2002:a17:906:c839:: with SMTP id dd25mr25220220ejb.164.1587556776008; Wed, 22 Apr 2020 04:59:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587556776; cv=none; d=google.com; s=arc-20160816; b=km2hQYxsMQF21gOrH9swk+dEHKte9l1jl0W+ZVBm4c8xg00JvP2yQyVrI0AfKXxHZr vBy6CYxzHO4p6Jq/O12TFddgD1fjFKc3JLfVWf5dq1bHk1ZbBz2w8sr8xOW1t+JoRUjs k5cDYlCf7qStKkuit7X8rc3YX1/o9H8jH85+Gd+ohb6deXSCzHpjAO7cO/nUCghvtErw UQx6ZU0Q8yh5T3Ywm/1wzY7eSrdeYux/RD99DZFGb/Bw+11u3W6dJv7ppWw1BQHd3tCH 0ixHot6E3vSxdI4kR/0nwow69N2EBwuzTaDD9JvQRKBHeqBknvC4Lys1dWBd+a/7CF0r qgpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Q5EdoJCMzSX8ObFId59V+/EeQTDjOONNPRUBS6ekIMo=; b=NjwAZ2SZ5uAX6eA/DgNQvJLJR6Dez/sm7ngDPUiq8KgIwC8uosCmWdBH4YWgy0kN3i DVy1QvOSdS+OR0JUsoVWuP8OdaIQSfduQRLARX4p79AUd3mOrrjs14WcHfZHPs5IX0fO /VA1uIMxGKK10eMWZ2BCMIKlXcJEIf+VPznFfFTPd5JuTM3Mz8yR0yKmKXp7r6aD7M5P pKswZPPg2WAmmld8aZ3PcW83ikfHev/FYxO/5cpfdK2U/z1L5ezBuKEdsw9fd7DzOLGG h6f/T/BjEx9aflzG7j+HnMsCmZGkjxYtBThgoQiVvQdJAh0w89gcRSWz30zEs22TS7TN 6mcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=H6DEi+1F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y21si3347475ejq.259.2020.04.22.04.59.11; Wed, 22 Apr 2020 04:59:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=H6DEi+1F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727961AbgDVL5E (ORCPT + 99 others); Wed, 22 Apr 2020 07:57:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726043AbgDVL5D (ORCPT ); Wed, 22 Apr 2020 07:57:03 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99FB9C03C1A8 for ; Wed, 22 Apr 2020 04:57:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Q5EdoJCMzSX8ObFId59V+/EeQTDjOONNPRUBS6ekIMo=; b=H6DEi+1Fr4K+9SCI+mpSPESOEV 41xscm2AjknStl6+QwcYRh8sNFcQ+gDAX161vMzB9njCXtM2xD5Yrrva7FWre1UPiKWsnMTBo9XRl QNcz9owv5+k3mJYjWZLu5+km3R0lPhvq8VcgzK9lt9YmfkaQbKR/bblGBHfqzfJ7wxIgz7ynrt5Jk WdRQGpBp2enCxa6/uHeQZdroztoSu+GND4l7S1bNJG+KrFHDyli742oCvoDQFrUqtpIgfpNehFT4Y g9VCR6uyt0Hooq8GlXann3rTeqILFTfULmwRveBE3I9ohPfNtYUIPhIcpKt/5Hp9INoTWxUOCb38m 6zVDx3Gw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jRDzw-0008T1-Vi; Wed, 22 Apr 2020 11:57:01 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 58714304CFD; Wed, 22 Apr 2020 13:56:59 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 3F1AC2028047D; Wed, 22 Apr 2020 13:56:59 +0200 (CEST) Date: Wed, 22 Apr 2020 13:56:59 +0200 From: Peter Zijlstra To: Ingo Molnar Cc: Josh Poimboeuf , Linus Torvalds , Thomas Gleixner , Masahiro Yamada , Linux Kernel Mailing List , the arch/x86 maintainers Subject: Re: [GIT pull] perf/urgent for 5.7-rc2 Message-ID: <20200422115659.GF20730@hirez.programming.kicks-ass.net> References: <158730459860.31269.9496277256253823777.tglx@nanos.tec.linutronix.de> <158730460101.31269.5005570498545135614.tglx@nanos.tec.linutronix.de> <20200419200758.3xry3vn2a5caxapx@treble> <20200420074845.GA72554@gmail.com> <20200420082728.GA20696@hirez.programming.kicks-ass.net> <20200422074512.GA19309@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200422074512.GA19309@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 22, 2020 at 09:45:12AM +0200, Ingo Molnar wrote: > > * Peter Zijlstra wrote: > > > On Mon, Apr 20, 2020 at 09:48:45AM +0200, Ingo Molnar wrote: > > > Fortunately, much of what objtool does against vmlinux.o can be > > > parallelized in a rather straightforward fashion I believe, if we build > > > with -ffunction-sections. > > > > So that FGKASLR is going to get us -ffunction-sections, but > > parallelizing objtool isn't going to be trivial, it's data structures > > aren't really build for that, esp. decode_instructions() which actively > > generates data. > > > > Still, it's probably doable. > > So AFAICS in the narrow code section I identified as the main overhead, > only the instruction hash needs threading, i.e. this step: > > hash_add(file->insn_hash, &insn->hash, insn->offset); > list_add_tail(&insn->list, &file->insn_list); > > Objtool can still be single-threaded before and after generating the > instruction hash. > > 99% of the overhead within decode_instructions() is in > arch_decode_instruction(), which is fully thread-safe AFAICS. Correct; I suppose you can farm out the sections to N threads for arch_decode_instruction() and then have the main thread collect decoded sections and frob them in the global data structures. Another pass you can probably parallize fairly easily is validate_functions() / validate_unwind_hints(). While that modifies state, the state it modifies should be local to the section at hand. That needs an audit of course, but it should be entirely doable.