Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp942209pxb; Fri, 15 Apr 2022 16:07:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzsBWDv78DpAmxJ3a1T5apL5CI+GKByCnMB0RjgG890yMLLTqyfV1nFnU0Dv028meNixWhm X-Received: by 2002:a17:906:fc05:b0:6e8:89e7:52e7 with SMTP id ov5-20020a170906fc0500b006e889e752e7mr905097ejb.360.1650064074406; Fri, 15 Apr 2022 16:07:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650064074; cv=none; d=google.com; s=arc-20160816; b=UAj7oOWrCF2Cq2buIuvOrFULlg/ezgvlNP342YjrN3s8VzGBDWgAx4KghvajV8+Kg1 F7rXen267DiVl3ZMpa5WEH/BqfmWkWZAp4faX6JPcjNjhC1lP7qS2O30/7LZYCp7R2W5 11IcGRZDQrzH51vbzz/4nAbvq4mM7XoFRGFLJUemGiWtsB+db+VoAbYhV672ZAteci0K qdyjCp5xNig9q0MAh0tN99KGotheiyFAF5tw3ib6MEubm2BeRbQdlIoTMALHKI/ddVhw jIGYKe2wpPBLuFIl8BiJ5vJAvjMbQkXGfD4MtCzxkaSnlae8iHgZmYdXsYotRsrWoORv pM6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=2VuuKot0bT7dX0fRQ2vxJZG5Y0C9VmUmWbJPaW2UK1Y=; b=hD+hFpAkWjiHC3yLg42mFnzo2nG3Zz5SyW+chQgv6Jnuf0/My/qjaKatBFl9UidXS+ AnSaTUzkpnruB/TwcMraITRNjQbqXMh3JFtBI8zAIvNEASj3uTxioazVcZukyUXp+A9w gx6wyAVHtmf4/tkV6bEnKkDm2oV2x6BJEJxeK5p7C0/ueXcwzlzSmM4KQ+16tl449IWr p/2idZdE33IB7keqfn9erzNlhEnyxMqoLrUs1LGAS/MNe5CLs9YFBaCpj4s3iqN/ml6a dMMHpoLkDzd7qm35nMLdLiSvMFamACwAhU60uBPqcaHov+btH1YLrPnn9bZ26tpPj/ql KEOA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hc11-20020a170907168b00b006e8bbf3d88fsi2115033ejc.15.2022.04.15.16.07.28; Fri, 15 Apr 2022 16:07:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348329AbiDNOwc (ORCPT + 99 others); Thu, 14 Apr 2022 10:52:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344857AbiDNNoo (ORCPT ); Thu, 14 Apr 2022 09:44:44 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F1CBF38BCD for ; Thu, 14 Apr 2022 06:40:26 -0700 (PDT) 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 7E8F9139F; Thu, 14 Apr 2022 06:40:26 -0700 (PDT) Received: from lakrids (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2CA933F70D; Thu, 14 Apr 2022 06:40:24 -0700 (PDT) Date: Thu, 14 Apr 2022 14:40:21 +0100 From: Mark Rutland To: andrey.konovalov@linux.dev Cc: Marco Elver , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, Catalin Marinas , Will Deacon , Vincenzo Frascino , Sami Tolvanen , linux-arm-kernel@lists.infradead.org, Peter Collingbourne , Evgenii Stepanov , Florian Mayer , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: Re: [PATCH v3 0/3] kasan, arm64, scs: 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-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 14, 2022 at 01:36:59PM +0100, Mark Rutland wrote: > As I suspected, you're hitting a known performance oddity with QEMU TCG > mode where pointer authentication is *incredibly* slow when using the > architected QARMA5 algorithm (enabled by default with `-cpu max`). > This overhead has nothing to do with the *nature* of the unwinder, and > is an artifact of the *platform* and the *structure* of the code. > There's plenty that can be done to avoid that overhead FWIW, from a quick look, disabling KASAN instrumentation for the stacktrace object alone (with no other changes) has a significant impact (compounded by the TCG QARMA5 slowdown), and I note that x86 doesn't both instrumenting its stacktrace code anyway, so we could consider doing likewise. Atop that, replacing set_bit() with __set_bit() brings the regular unwinder *really* close to the earlier SCS unwinder figures. I know that the on_accessible_stack() calculations and checks could be ammortized with some refactoring (which I'd planned to do anyway), so I think it's plausible that with some changes to the existing unwinder we can bring the difference into the noise. > generic kasan w/ `-cpu max` > --------------------------- > > master-no-stack-traces: 12.66 > master: 18.39 (+45.2%) > master-no-stack-depot: 17.85 (+40.1%) > up-scs-stacks-v3: 13.54 (+7.0%) master-noasan: 15.67 (+23.8%) master-noasan-__set_bit: 14.61 (+15.5%) > Generic KASAN w/ `-cpu max,pauth-impdef=true` > --------------------------------------------- > > master-no-stack-traces: 2.69 > master: 3.35 (+24.5%) > master-no-stack-depot: 3.54 (+31.5%) > up-scs-stacks-v3: 2.80 (+4.1%) master-noasan: 3.05 (+13.0%) master-noasan-__set_bit: 2.96 (+10.0%) > Generic KASAN w/ `-cpu max,pauth=false` > --------------------------------------- > > master-no-stack-traces: 1.92 > master: 2.27 (+18.2%) > master-no-stack-depot: 2.22 (+15.6%) > up-scs-stacks-v3: 2.06 (+7.3%) master-noasan: 2.14 (+11.4%) master-noasan-__set_bit: 2.10 (+9.4%) Thanks, Mark.