Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1402931pxb; Wed, 30 Mar 2022 02:42:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmkhoil3HtOynrJOo0yKcIolHH4cwRf/hPj79SAH5f3cfKBpml84neYADz4HEn/IpUH8TC X-Received: by 2002:a17:906:58c7:b0:6da:955b:d300 with SMTP id e7-20020a17090658c700b006da955bd300mr39702553ejs.481.1648633342112; Wed, 30 Mar 2022 02:42:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648633342; cv=none; d=google.com; s=arc-20160816; b=zNxrfmd5ulmE1VlFsdUcmELhp2ShV0PIJBJBCuta6nVa4jhSHE6QT53iOglMlJnQJN 2UeKHkoNuJAsIb1i4nr0npUCOgv6Ea4oWJtCk8bOp3EoCEq2ehKUztyaVmtmS4vkuAOf 4NvkATdZGUkYcOKLOQV+1JL+Y9pcKCDj3tSuwde+nyll6CLbh1/mMl9QUeHk3+cRJal5 zy9xYqOdsKmMeEUq9WhwSH/qjY1b3hMV+LgfXP5Fkd/5xO2BJ9owMRXIyPKTjevCFWms IfmO5ii3LZEtkSpDRQl8nBUhLZBIjlR7AuvgM+kn6H0SI+FYnaJFToJV34EnLYcBsBG3 +gbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=JUrhq9evNqA9x3IGobvT5hE7CTLMIVYRzbuHHy97Qyw=; b=k6MBhdJS9tZ1cGU0xEGTbd4YQSSw1tcTgfBw6CQbH/F4pyehgKzWQNE8uB53ToSyec jUrPoBp9K+b4JCYNuewm2phoFzn6dJawArZqGEq9xssVnAWu8D0Ju08bTc/rBbOgz8go Dgjd+wE6u7HJ0gJYw5VypD/ME8EdWNGjPVKusOJRnUS+u10R/rR1G1dK597jbe77XBZ9 qdxjycSLvSatZugdx2GHu+YdvLW/AEewXc1tDqK/0wlNqoNqjyXE89h1UkduR4Z8V7pW crYg5vPtM+u6QKMv4JjxnCKYX6zhhuVRkRSI/uHmZGYC8EbHMrUEztXvsLo46OaEdlr3 1alg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="nj4/aW6K"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d13-20020aa7d68d000000b00418c2b5be2bsi19584705edr.269.2022.03.30.02.41.55; Wed, 30 Mar 2022 02:42:22 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b="nj4/aW6K"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236809AbiC2SiG (ORCPT + 99 others); Tue, 29 Mar 2022 14:38:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233791AbiC2SiF (ORCPT ); Tue, 29 Mar 2022 14:38:05 -0400 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EFEF149256 for ; Tue, 29 Mar 2022 11:36:21 -0700 (PDT) Received: by mail-io1-xd2e.google.com with SMTP id z7so22082440iom.1 for ; Tue, 29 Mar 2022 11:36:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JUrhq9evNqA9x3IGobvT5hE7CTLMIVYRzbuHHy97Qyw=; b=nj4/aW6Kbl9hIgkEraEI7qLFULOD5EsXDCHMwh1SxLrSK2YgGQ3y+94ZHK97TL7WpP Ch8HtblRcIWAOKuHo8Im5a5bC0dmZJu2ffG2aimykeJQP2qKnYdYTFCuZcgXjPaNoJql 3+6X+JLQYuWQmTCyg8Zgv24+R5OYKlR9xAOxDqyW5ojxT6YdO4C+sT1KkUAcCnHp1v0P Q5kbDOtOJY//ZrhA9Sd6JDY07ZtSBtinAgXN5X8mzwHWjRAkYCuTc6e49DCXRhnyV4aP 8AMGT2yKqSgm1Gjd7CJQ3SPp024WGeIZERrflKsvB2oHa8F8zapXlBfo7um85Qs9YlVF yINg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JUrhq9evNqA9x3IGobvT5hE7CTLMIVYRzbuHHy97Qyw=; b=v2hFca/C1T2/zVyTQlvjM4dJwzyJl2pwsYJGnWvvcxpEfv3QmOB1FYIei07UauzeCr vGfeHKGB7jTgwBOVFWkAyYx/gfy7tZ2FK3pbMcrjaBRMrNwLeR1uEuDmlM78oaIxnC5C TVxhZOTejZab+w3SZ1ClSC8yC3koz9GAL0pYu7eyVcraTY+yw5/esGx/avolMS2/Wa9N etXQrKoU/maJ2q0LLP6yaneglD/nPZQMHPwu2iVAvYt3KxUDbtSwc1/jYumynhdkWSA4 Ry7cj9akPux0X3r3bHb0eQqLAPMoKoT7uBfT0twU2eOyKSW9+nfBoXpgr3XsjVRgG1zH zwaQ== X-Gm-Message-State: AOAM532gMiEKdE6dYzIU4inLbzsiWfBybjfmWYnkfRavBmgI1FEaltOt IBXk3DAHpL0687Fle1Y32NbgYp20u61jp9KhlhQ= X-Received: by 2002:a02:b687:0:b0:323:60e7:121a with SMTP id i7-20020a02b687000000b0032360e7121amr8803432jam.22.1648578980752; Tue, 29 Mar 2022 11:36:20 -0700 (PDT) MIME-Version: 1.0 References: <21e3e20ea58e242e3c82c19abbfe65b579e0e4b8.1648049113.git.andreyknvl@google.com> <20220325134629.99699c921bb8c8db413e8e35@linux-foundation.org> In-Reply-To: <20220325134629.99699c921bb8c8db413e8e35@linux-foundation.org> From: Andrey Konovalov Date: Tue, 29 Mar 2022 20:36:09 +0200 Message-ID: Subject: Re: [PATCH v2 1/4] stacktrace: add interface based on shadow call stack To: Andrew Morton Cc: andrey.konovalov@linux.dev, Marco Elver , Alexander Potapenko , Catalin Marinas , Will Deacon , Dmitry Vyukov , Andrey Ryabinin , kasan-dev , Mark Rutland , Vincenzo Frascino , Sami Tolvanen , Peter Collingbourne , Evgenii Stepanov , Florian Mayer , Linux Memory Management List , LKML , Andrey Konovalov Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 Fri, Mar 25, 2022 at 9:46 PM Andrew Morton wrote: > > On Wed, 23 Mar 2022 16:32:52 +0100 andrey.konovalov@linux.dev wrote: > > > From: Andrey Konovalov > > > > Add a new interface stack_trace_save_shadow() for collecting stack traces > > by copying frames from the Shadow Call Stack. > > > > Collecting stack traces this way is significantly faster: boot time > > of a defconfig build with KASAN enabled gets descreased by ~30%. > > > > The few patches following this one add an implementation of > > stack_trace_save_shadow() for arm64. > > > > The implementation of the added interface is not meant to use > > stack_trace_consume_fn to avoid making a function call for each > > collected frame to further improve performance. > > > > ... > > > > @@ -108,4 +111,16 @@ static inline int stack_trace_save_tsk_reliable(struct task_struct *tsk, > > } > > #endif > > > > +#if defined(CONFIG_STACKTRACE) && defined(CONFIG_HAVE_SHADOW_STACKTRACE) > > +int stack_trace_save_shadow(unsigned long *store, unsigned int size, > > + unsigned int skipnr); > > +#else > > +static inline int stack_trace_save_shadow(unsigned long *store, > > + unsigned int size, > > + unsigned int skipnr) > > +{ > > + return -ENOSYS; > > +} > > +#endif > > checkpatch sayeth "WARNING: ENOSYS means 'invalid syscall nr' and > nothing else". This is done deliberately to mimic stack_trace_save_tsk_reliable(). I'll mention this in the changelog. > checkpatch also picked up a typo in a changelog. Useful thing to run, > is checkpatch. My bad, I ran it on diff instead of the patch. Will fix in v3. Thanks!