Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1732480ioo; Mon, 23 May 2022 01:49:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1Js5huknChcW1BHDM1e5ROrWXBus52cwf2tavBWfN6wWDHdBESEkx32BdFFyKk94IExQp X-Received: by 2002:a05:6a00:1307:b0:50d:b02e:11df with SMTP id j7-20020a056a00130700b0050db02e11dfmr22705141pfu.4.1653295795961; Mon, 23 May 2022 01:49:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653295795; cv=none; d=google.com; s=arc-20160816; b=n7pyPFKQf7FkPU8gjgn5g2aaNcSaAP1vdXd3euXKZiifKlikLJ37vsGZwMlYkDmIlS l8i89W45mqmOYzBi0urKHIZ4a2Xfn69rcxCXHnV76MX6EIIsr6yettwDRB38EiWlLD3y Awzj6xwnVbW0UEIC/KjwURNXc5653vjWm9cjANGvQfEZt2jxH/wB90yDZQYnWFmOZobT /TAH8mU+VDrweUZElAKXbA6HmK+nzvIEE9Rx9HiaJViMtMGB4r3OUjJFF/aiyJC8to1B 32FLP+UNs++w6XwDplcSqh/uSn7h2Q51wxlMUOFKVInLHrl3LVhAZy0CflOgxRYGdLTI u+Tw== 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; bh=Q5ZBptchO8/tiiN8trAggT7MAu9gcRs+qmew6fONwZ8=; b=H/dSB7pz1e8r3Ifzoz5UDAbcTfU+Hs4ogGhedXIm0A0sDf9r61L6C3H9eH4+neYIwa ZXgG5bK1jj5FYwF/r20+Z4SqEUJTNfphlXxFk8tszdEy+4QEW7ba9ELQElWH4Hn9T2PF cvbyUpQiZysLEBt+jXQ5gRrC5Ya1uaW2Szew9ygaUet0fG+tf6Ju8HfO2HAcZ079AMA2 xw8ruiwK+ogA7v9f8fPMsdRD30wAlb3Ql6I6LY1MToMFQMGqY+zaYEPJ3y4C2kQZIstF ai09ZHArAqP4VOh9bjmjTYAuqJPWxBl+P+guddt7NgA3bJYSOYi13Q1E7EjpzfWqMJg1 LiKw== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id u16-20020a17090341d000b001620bc89356si7906707ple.482.2022.05.23.01.49.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 01:49:55 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 84B551157; Mon, 23 May 2022 01:17:28 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231712AbiEWIRV (ORCPT + 99 others); Mon, 23 May 2022 04:17:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231670AbiEWIRR (ORCPT ); Mon, 23 May 2022 04:17:17 -0400 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D843E25587 for ; Mon, 23 May 2022 01:17:15 -0700 (PDT) Received: from mail-yb1-f171.google.com ([209.85.219.171]) by mrelayeu.kundenserver.de (mreue012 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MODeL-1oCX0i35Dt-00OWyn for ; Mon, 23 May 2022 10:17:13 +0200 Received: by mail-yb1-f171.google.com with SMTP id z7so2778842ybf.7 for ; Mon, 23 May 2022 01:17:13 -0700 (PDT) X-Gm-Message-State: AOAM530fQqFaZa7WPvH41eeVsuSESxDt2jlk2Wx+sU/vN4ZYujv0Dvbk R1/7FJhm7ZdpCRM+CAT3qTohNa2HPT0p5wreXyY= X-Received: by 2002:a25:c747:0:b0:64f:62fb:f55e with SMTP id w68-20020a25c747000000b0064f62fbf55emr13378958ybe.106.1653293832593; Mon, 23 May 2022 01:17:12 -0700 (PDT) MIME-Version: 1.0 References: <20220307140804.1400-1-jszhang@kernel.org> In-Reply-To: From: Arnd Bergmann Date: Mon, 23 May 2022 10:16:56 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] riscv: add irq stack support To: Jisheng Zhang Cc: Arnd Bergmann , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:3mvfU8MEw7zAZ2vwDUR0VEJ7gLIarGDDwRYYoWCDsTx7aSH7UVF L+lhVqI4BtLrdZjGMDTSA6zkgTgwf08nwlkVjHEGH6BI05upf5gL3ZngWnIE6k0vdYAEtYN XoRm/OkEPaDBYpbo7p53Y4njWw8OGG9GeJaGaHHp48YizAGTBDYuIrDMUrWQWtaOLO320Gf 42daTkxAbeMFEvuiid4xQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:bnuN2gPifV0=:nOOywJmXYXyGbFHsu4taLO lT/TkiL7crpLFLzZV8WqF4MfuJS0onNfklH5hSTQKQat8SER3SJMEkUTEEtHTONSv2WfBzQng lCI3Azv2hiDmtIFtS574CK8XvB7ycZuSvaebVV4rfIo+79MHHe5P52c61gjO87L3NC5ozAUji 76PXab7pZ7BINgjt9lOHcEjdD7ZKUHXKXCllo9sVeu3wx/zeF71NFfuKBGlmkw9vSuJDfCe/A drGHBBP02EdRuhSTZrfms7YuUbeTWZgw/+6fnPDfq67WGKGLqIXuXZghwY7eYWj3ON6L/n8QT wN+Y4lm71O+OJqe7yI6ztz59aO0hY6AQw44m26x7+GD8+A8B8XsHt6C1f4LreMClQ12VojSJE HSA+VPOGv8Iv+0WX1NwybCE1HjLBMZMgBEUMQI442L+mk2hwS7JCbeOQmqgiYpQs6EL7sI0qG Pv1ZOKygNhoe3OBT4kKVr+hZZ49rMviE/wFTYntFwBVKDeQl4wCwJwM1d8NWUjEYVRlhO8reG UTURwZJUW7Di2Amnc8qSC7N28G49CGexgiktn2tkQW4lLq8/up+vfLnDqHLpGmWAhbZrOHVqB yoWcC7ybGIZ1gbh4u11hrpOp8kcm/SKsimzUfYgJ+N3Za9GQqq4PZZnIkamB1IAVZUEXvBdcB p0Fxs1mpgmO1rqL5HN3VJgD2afe76iwVyggh1xgktarjfrPUPvXu/wa646WKYJu0lubJnd4CM jHc/pz8SO6Nt0g9wyIhrj7D1i9H8kT5tDIqu81/mfabNYB4Yi+6BjKM4cSZH402kEG9i+01bh e8ano53UC/bL1Ql7rTGjqZvgvnnQr0GXnIWDhMePNVQ/y/yIoyu2EcNAK5t8MYqmAjmCJbLYt 44HyoLHbW2M7DSL0OZ2sj4DtcUvIZrJAfYREenA/0= X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, 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 Sun, May 15, 2022 at 7:14 AM Jisheng Zhang wrote: > On Mon, Mar 07, 2022 at 08:19:35PM +0100, Arnd Bergmann wrote: > > On Mon, Mar 7, 2022 at 3:08 PM Jisheng Zhang wrote: > > > +2: > > > > What is the benefit of doing this in assembler? Is it measurably faster? > > > > I see that arm64 does the same thing in C code, and it would be best to > > have a common implementation for doing this, in terms of maintainability. > > > > Sorry for delay. The assembler code is mainly to cal the stack ptr then > change the SP to use the stack, which equals to arm64 call_on_irq_stack() > which is implemented in assembler too. I understand that you need to be in asm code to switch the stack, it just felt that the arm64 method is a bit easier to debug here. I suppose being able to keep using generic_handle_arch_irq() is also beneficial, so it doesn't make much difference either way. > > > + for_each_possible_cpu(cpu) { > > > +#ifdef CONFIG_VMAP_STACK > > > + void *s = __vmalloc_node(IRQ_STACK_SIZE, THREAD_ALIGN, > > > + THREADINFO_GFP, cpu_to_node(cpu), > > > + __builtin_return_address(0)); > > > +#else > > > + void *s = (void *)__get_free_pages(GFP_KERNEL, get_order(IRQ_STACK_SIZE)); > > > +#endif > > > > On a related topic: is there a reason to still keep the non-VMAP_STACK > > irq stack is 16KB on RV64 now, vmalloc doesn't gurantee physical > continuous pages, I want to keep the stack physical continuous > characteristic for !VMAP_STACK case. I don't understand. What is the benefit of having a physically continuous stack? If this is required for something, you could still get that with a VMAP stack by using alloc_pages() to allocate the stack and them using vmap() to put it into the vmalloc range with appropriate guard pages. I think we really want to avoid the case of missing guard pages around the stack, and eliminate the part where the stack is in the linear map. Arnd