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 11865C433F5 for ; Tue, 5 Apr 2022 15:22:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9D8BB6B0072; Tue, 5 Apr 2022 11:22:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 986CB6B0073; Tue, 5 Apr 2022 11:22:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 828E76B0074; Tue, 5 Apr 2022 11:22:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id 764CB6B0072 for ; Tue, 5 Apr 2022 11:22:41 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 4513561804 for ; Tue, 5 Apr 2022 15:22:31 +0000 (UTC) X-FDA: 79323192102.04.9A44257 Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) by imf16.hostedemail.com (Postfix) with ESMTP id A64E8180036 for ; Tue, 5 Apr 2022 15:22:30 +0000 (UTC) Received: by mail-io1-f43.google.com with SMTP id 125so15523711iov.10 for ; Tue, 05 Apr 2022 08:22:30 -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=VUTUxfwx0BMlegLzejTeqPrh28XK1GfyeFHo2+PzHSA=; b=X/ggfC92FSIBBaIJoh4Lvf2OOxCHxifc1+KXsolz68JKkTf66vNMPiFv0uTbW3X+Tf MCWTL/SWwwjYkxJkqYzHr5nKXuxeQ2ITjuWzPSExmX/xC8cWsOEbmvFkpDYRaUfhHyjF YDuhAf4nBhRafZIn8gieNVZVSKekDKyUhpxYKncULsJxdUSIzmoZm1iJrwEa/WyoI0QE KkpHVKUW8usvg+8kVn+Z2s+7MMLsuGK6iV9Wd0j31rEPo2merxQ82OdhC1wIctLAeJuO VWjT3E/mBoFcavJc6nyq1omw2lBkJpB44ymHsBeFQsffZIdjl9VvqWhL581O44uA3Mwf +Pjw== 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=VUTUxfwx0BMlegLzejTeqPrh28XK1GfyeFHo2+PzHSA=; b=hPVDMy5Tc0u3eCDs6rWI50rZBn/Y99AueCM0IIFR46ge32PxjvfMbO1MnvorDsAfjT +LZk565JKPVwiCB4AsfIQVFK5grmkU/XJ6n22MoEmX9Ix1tRDTm8/naRRbCPkLIL2Zm5 QUUyhgDqNOsOAgltUu2PCEIsM+8M+Mg1cJWDeQHBbnilHB9t4OJq6vZ/hmrA4CoQgnW9 Hq250xguclVj4HhVK1WaddJt9toXdNbzFSzjaMvXmiByFQvMobT4AFppGDHAiTHicvfk 0kP/d2mtpzZfHJ9HC99mrEP+FasCxxWvt2dT2nSYETuhMajZlsIeyTP8ynFCYqDFWXO+ 1HUg== X-Gm-Message-State: AOAM533gN173FoK5supoRSaUn1z1qxEJBosa9OEFQ48NeWU2fdLSmAgj 025R4tga/vaChYoM99fibA4yAa4cuKaOGRq/mmA= X-Google-Smtp-Source: ABdhPJxDUFQSp6D1AlpXJtxXe8348cZazMDEkUmEcoM1Vu4ZcFMv1Ssr3lWia7cZ321svVePcrIfn7/ykSnzvdg5K14= X-Received: by 2002:a6b:116:0:b0:648:bd29:2f44 with SMTP id 22-20020a6b0116000000b00648bd292f44mr1993367iob.56.1649172150007; Tue, 05 Apr 2022 08:22:30 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Andrey Konovalov Date: Tue, 5 Apr 2022 17:22:19 +0200 Message-ID: Subject: Re: [PATCH v2 2/4] arm64, scs: save scs_sp values per-cpu when switching stacks To: Mark Rutland Cc: andrey.konovalov@linux.dev, Marco Elver , Alexander Potapenko , Catalin Marinas , Will Deacon , Andrew Morton , Dmitry Vyukov , Andrey Ryabinin , kasan-dev , 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-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: A64E8180036 X-Stat-Signature: wzpqgs5gmq7ttdzgixkeq5uzozy5qc8y X-Rspam-User: Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="X/ggfC92"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of andreyknvl@gmail.com designates 209.85.166.43 as permitted sender) smtp.mailfrom=andreyknvl@gmail.com X-HE-Tag: 1649172150-94482 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 11:24 AM Mark Rutland wrote: > > On Wed, Mar 23, 2022 at 04:32:53PM +0100, andrey.konovalov@linux.dev wrote: > > From: Andrey Konovalov > > > > Instead of trying to retrieve the SCS pointers from the stack, change > > interrupt handlers (for hard IRQ, Normal and Critical SDEI) to save the > > previous SCS pointer in a per-CPU variable. > > I'm *really* not keen on *always* poking this in the entry code for the > uncommon case of unwind. It complicates the entry code and means we're always > paying a cost for potentially no benefit. At a high-level, I don't think this > is the right approach. This also gives a 5% slowdown, which is not acceptable. What we can do instead, is to not collect frames from the higher exception levels at all. This would leave SCS-based stack collection method impaired, but this is probably fine for KASAN's use case: currently, stack depot filters out higher-level frames anyway, so KASAN never saves them. And the lower-level part of the stack trace is enough to identify the allocation. Thanks! > For the regular unwinder, I want to rework things such that we can identify > exception boundaries and look into the regs (e.g. so that we can recover the > PC+LR+FP and avoid duplicating part of this in a frame record), and I'd much > prefer that we did the same here.