Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp1256790ioo; Fri, 27 May 2022 05:08:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJww0lZSg+VWYSda2y2ZVp1cZdyIM6dSLorqhck1oM8zkXXvlFEw1RXatvhyLWM0v0+g7sBK X-Received: by 2002:a17:907:88cf:b0:6fe:e1e9:4b96 with SMTP id rq15-20020a17090788cf00b006fee1e94b96mr22758095ejc.227.1653653318174; Fri, 27 May 2022 05:08:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653653318; cv=none; d=google.com; s=arc-20160816; b=nUsLIXvrEekOEe8d7FjG6JRT3p8FzqMQq8jwT1zYVDfQhBr6ROgQsJUaCmEuCm0Hxc VncorIAoenPePkxM66xaEEjSWZEP/FnaG7kHqtWQ38BvlpUPI8FlkBu7sH+OJbzH2NjA HTNnM4ps+OBlgIMzoSdE+dm1L7c6nANzf18xik66h+i1AUcG11jeQ1lf+6Ks3SbD2kjM YujuZ4Cml20EAYyfma9VyPf4ZKlWWYutZ1wUVCB0tXL250FcKDWc/pyKsgoN+yO8ril/ GCEhvZN/w++GfEktKqkP6OcaD5RcRVVy7f6qlgEZECAGGcqpyOlXA4SdYfSXIZHDRY8H IKzw== 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=buVKnGxmxQdm9mipHMX7isQeDcZaJCVOyPm61IeMltw=; b=fTbsbJ/LaK6tkLIZtxULGw0+rDqnoMYvx6T6o011/u/rJA7vVRirqDkFMHw3obWJTZ EmXnOBXKKbsPWTlwlY7ZBWiyPFNdmmFRAEnFv98f4EyBFLYKDN8rhlo+NC2Zimx+yNQP V81WwM97w/kh2Bzu/iAbdwzrsb9K3HasCzg1hq/Lssbkk4hM3tRVkhgHRQh7X1r1iKiA QOqKzCqs7RfE0IvvJ9RK87O/r3mjVlQ68ekBvDhZhk8FAD7A+Qk0gR48QcVNXpqHbkh4 J00UHNXEx8lfjnjn4bsHi95AYznVB748hz/8KCkayPcIfJrDzyaYxtmAI2UsAk+ox3Jk AwuQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r13-20020a05640251cd00b0042a9fccd3f2si4656887edd.353.2022.05.27.05.08.10; Fri, 27 May 2022 05:08:38 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243485AbiEZOFw (ORCPT + 99 others); Thu, 26 May 2022 10:05:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233773AbiEZOFw (ORCPT ); Thu, 26 May 2022 10:05:52 -0400 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D36B48CB2B for ; Thu, 26 May 2022 07:05:50 -0700 (PDT) Received: from mail-yb1-f180.google.com ([209.85.219.180]) by mrelayeu.kundenserver.de (mreue011 [213.165.67.97]) with ESMTPSA (Nemesis) id 1MderZ-1nKcFp3xi5-00Zh0u for ; Thu, 26 May 2022 16:05:49 +0200 Received: by mail-yb1-f180.google.com with SMTP id v26so3108945ybd.2 for ; Thu, 26 May 2022 07:05:48 -0700 (PDT) X-Gm-Message-State: AOAM532DpvcBb1OfsOZ1cphC/IyQWjVdyc5oGk437NxjSpWKth6POb38 nfioOA9fsQ38SLUT2Vw03ZeJF7ZHQuqXvs72hXc= X-Received: by 2002:a25:bd8b:0:b0:657:8392:55c3 with SMTP id f11-20020a25bd8b000000b00657839255c3mr1620326ybh.452.1653573947731; Thu, 26 May 2022 07:05:47 -0700 (PDT) MIME-Version: 1.0 References: <20220307140804.1400-1-jszhang@kernel.org> In-Reply-To: From: Arnd Bergmann Date: Thu, 26 May 2022 16:05:30 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] riscv: add irq stack support To: Arnd Bergmann Cc: Jisheng Zhang , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:J/Q0vdQD2zUADWcAM74XBXdR5U/hkYwYQvAmqesjg7yujDiXDxV zzP4u0iFL80GPxQPKUfOlqADCZhwEQJyizbrKD7rXwEdPvfZ4LbXUhzSqHxVH5RoUJKHzgJ gCNtyvT5JbS8UqrMBtGfa8Cj/k+873I8pqGpf/Vm6odrLU3AqIzrG2afMEGz3GPL+Hgxaze w7jjEAQi9m4whSGz+S9sQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:3i/TE4Evtmg=:PlHG1pQyF3PkK/dy5ov6Dr e8LBqruJHSapyxZjTORXDQvKmhVlIy6u8vTHBYcKd8A8Ah4bPw0hk46p8fpFY4JvdYr/IzeW3 E2827WVVgzSX2+yBX2rxaStm6Qc/j1cKxpNLbS/9p24DRRLyNFQugJJPBefKiOyptfjiFW53y RfBHyjDO//rhYzSR+VcHiZSin2YPmAr9j5BnxMKkV7VsRUDlP+k3qjoq4m51d5mg3s2UyvcdR MAvpyruxtv3Mq9sT6l7GPKuNZWfx6KRAd4PIMX0tmfj/eeJl3L+dQFdu7O+1irBN/rFHKsulL Ddn892V3l5F5gfN1UpAeFQiIuLfzNMO27ZoSB1/UliiE/0UhnPzwjvupvZhthm1V2+iVI/eRa oRe9xgj1z7A8P2NACGJdzzNEsJVEHgs0fpqNS41gnFUO4Nyc8aOxLs2SgN/1Ki7JrNQtJlJc7 jZh80yxtU8gJKXrP2xlLyC4aQxdxwdRjI3LQnoy0XCQT8b2Km63j8QGgrdwQwvnVFgOrDdVGT hpEpZ8dFHn1cfmqBw1e4z+kKs2RwKu4ndWz2Rfayeq4hl68MqcWzzn8Zgwu5Fke+/zTrfkWob 2/KnD0UV2Cexneko/hKNxgkmFdzVvf7KGcWO66Q+4UVQTJS37CuxdQv8WM4RGouqFiHtCWvJT eHgDDMOl4d/HcPaDcSAvj1HL/ecSP9IrLLNSNBUobA2EQVKy9CicqzcjnbFqKpf4UnG16M/Ae 9QzQV5286odozgDUs8g9j2GxxqAWICRVTk3wTQ== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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 Mon, May 23, 2022 at 10:16 AM Arnd Bergmann wrote: > > > > + 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. I was actually confused here and mixed up a few things: I thought this was about whether to use vmap stacks unconditionally, and this is in fact not even an architecture specific decision, it's a global option as you are probably aware. Since one can still turn off VMAP_STACK for normal thread stacks, it doesn't make much of a difference whether one can do the same for IRQ stacks. Please just ignore what I said above. I see you already sent a modified v3, and I think either way is fine, feel free to revert back to this method if it makes life easier. Arnd