Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp952001pxb; Wed, 6 Apr 2022 05:10:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1soeyNl633IzLryes6WLBW7wmsZUSnQ8EKdcT9my93SXKiBK+pDbH3y5bl4cNKWSpS7E2 X-Received: by 2002:a05:6e02:15c2:b0:2b8:4642:8e3c with SMTP id q2-20020a056e0215c200b002b846428e3cmr3775424ilu.244.1649247025298; Wed, 06 Apr 2022 05:10:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649247025; cv=none; d=google.com; s=arc-20160816; b=JBfgPt+AMVNe/tuIc0t3eCovnBVf9Tz5DE83pNRhHoDlCVogSG8wL8mAYt3hS6pEVE 42dPOrSc7VlNNvr2DxLg3yvoT/hL7J9LqnYKNQGwUqNn3WlJHyvkwhGhSQuiA6SoWsVF riociD9P3YNnmJNxOgr25M7CLahPTzcObrMqySkexzClQLBsMHk0rhkS4ieS5wifGDo8 iUD53Gvdp3Nse0khYBCDiXCwBemRvmp1p4PMS9Vbdetf0UaDi88HPCruKCmMmF6bMHSj tcazvy5kz06a9s4vszShvhk+vZcSdno4yd3qCiHpTHn0YTtwSJhIww7wrhgBVwyADfjA 5Sxw== 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=VUTUxfwx0BMlegLzejTeqPrh28XK1GfyeFHo2+PzHSA=; b=YYvPsW4yYw2JMVla360pUEDMKQSy9Z2ppGcyIsYDU2jcLJBXArtW8Mng82hDaDTue9 9usS4QanaZH568cA1yHv+s4g2jITPaZt5ehsG6KiFThdsEdpeoKFmmrajWJEhk04kRKW 5WiGsZpoiBT+2zS3ZuWA+4WWAywPqN2maUu9cMDQ6UrvVoWwolvqYfJpVmPUOGKBKxbx VMXmOp0baQePvpifZhhdYUd87Afk3AG74hUvDCnBnnFAX0miXkHrfbu3wuFSK2CSr4+P qeggh7giRSEz+NlLeO01M09+xdzkavdKr0x2zLgHEoxE+oE+r2Hhr9xXI8iUadtD04CL i8Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="X/ggfC92"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id u17-20020a05663825d100b00319a9d57ef1si9337584jat.0.2022.04.06.05.10.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 05:10:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="X/ggfC92"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 985A54FC9DD; Wed, 6 Apr 2022 03:43:35 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238522AbiDFBuT (ORCPT + 99 others); Tue, 5 Apr 2022 21:50:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1456320AbiDEQBb (ORCPT ); Tue, 5 Apr 2022 12:01:31 -0400 Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9895313EFAD for ; Tue, 5 Apr 2022 08:22:30 -0700 (PDT) Received: by mail-io1-xd2d.google.com with SMTP id 9so15563699iou.5 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=fVrScaPYYjUXs0AWCQvrKqRQ6LvyZlE6GNYg/wWtUE5hd8ELjW5Z3MHq7QG9JXJb8Q 3Jae/NEOTAAl0mBkX/AMM/6+CX+OUl8AnolgcnrTzpGIHQkqkha2d0nj+Vcqd38Ifg/r zdV0bbC90KWbDoTwXGBoZ4HDEtiqIq69AvUCzqG6VIpB6lZkN6B/3BKZfvoykhRlVXP8 Dzo1g9/wH+Lmw/y0fLlALiZQRn+sAmnvz/d4RVYeZqD6KJenvVEh2GY1rs6qTAcqdHGg 0qLrGpKQJoaXoitvTIsfJFhgRx1t1OKbp0yD30GAnOSLAHbBnGu7dP8B5RyZJDYxfT8A HjDQ== X-Gm-Message-State: AOAM533plD2j+AeXR0/9I8zIYkao4Hb8U5tfqjvl6ZF+YjKQ5nsCqzSV Z9rTOy7H6SBzwIaXAhp/maXOMWX/1goo4I34KJw= 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-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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, 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.