From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC292C433EF for ; Thu, 31 Mar 2022 12:39:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 10AF66B0072; Thu, 31 Mar 2022 08:39:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0BAA46B0073; Thu, 31 Mar 2022 08:39:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EC37D6B0074; Thu, 31 Mar 2022 08:39:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0064.hostedemail.com [216.40.44.64]) by kanga.kvack.org (Postfix) with ESMTP id DA7AC6B0072 for ; Thu, 31 Mar 2022 08:39:13 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 84EAEA729D for ; Thu, 31 Mar 2022 12:39:13 +0000 (UTC) X-FDA: 79304636586.17.6B74FE5 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf06.hostedemail.com (Postfix) with ESMTP id C753C180007 for ; Thu, 31 Mar 2022 12:39:12 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B975123A; Thu, 31 Mar 2022 05:39:11 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.21.81]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0BA223F718; Thu, 31 Mar 2022 05:39:08 -0700 (PDT) Date: Thu, 31 Mar 2022 13:39:01 +0100 From: Mark Rutland To: andrey.konovalov@linux.dev Cc: Marco Elver , Alexander Potapenko , Catalin Marinas , Will Deacon , Andrew Morton , Andrey Konovalov , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, Vincenzo Frascino , Sami Tolvanen , Peter Collingbourne , Evgenii Stepanov , Florian Mayer , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: Re: [PATCH v2 0/4] kasan, arm64, scs, stacktrace: collect stack traces from Shadow Call Stack Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: 8npznn3ohm9gzk6nyt4c3drqiau7tu7u Authentication-Results: imf06.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf06.hostedemail.com: domain of mark.rutland@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=mark.rutland@arm.com X-Rspamd-Queue-Id: C753C180007 X-HE-Tag: 1648730352-254805 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Mar 31, 2022 at 10:54:08AM +0100, Mark Rutland wrote: > On Wed, Mar 23, 2022 at 04:32:51PM +0100, andrey.konovalov@linux.dev wrote: > > From: Andrey Konovalov > > > > kasan, arm64, scs, stacktrace: collect stack traces from Shadow Call Stack > > > > Currently, KASAN always uses the normal stack trace collection routines, > > which rely on the unwinder, when saving alloc and free stack traces. > > > > Instead of invoking the unwinder, collect the stack trace by copying > > frames from the Shadow Call Stack whenever it is enabled. This reduces > > boot time by 30% for all KASAN modes when Shadow Call Stack is enabled. > > That is an impressive number. TBH, I'm shocked that this has *that* much of an > improvement, and I suspect this means we're doing something unnecssarily > expensive in the regular unwinder. I've had a quick look into this, to see what we could do to improve the regular unwinder, but I can't reproduce that 30% number. In local testing the worst can I could get to was 6-13% (with both the stacktrace *and* stackdepot logic hacked out entirely). I'm testing with clang 13.0.0 from the llvm.org binary releases, with defconfig + SHADOW_CALL_STACK + KASAN_