Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp258626imw; Fri, 8 Jul 2022 02:23:42 -0700 (PDT) X-Google-Smtp-Source: AGRyM1upfRdEcezUJlzgbL6gobt41SwMh3nRW22HGWBUWCe9qcv80g9z5E+e8CmP8ruZdaKxTyk5 X-Received: by 2002:a17:906:7c0c:b0:6f9:1fc:ebf3 with SMTP id t12-20020a1709067c0c00b006f901fcebf3mr2528443ejo.403.1657272222594; Fri, 08 Jul 2022 02:23:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657272222; cv=none; d=google.com; s=arc-20160816; b=w6uStoU7xKwWQy/dDzPtfWByD06STlk3eOHSVZAuwqToCOpSBbIHjUyhILyetudrtX 3/z6gjWgP7mmOj49nkrk0MzP3VOguA6RB6CnO7zO1OWK3iLvL8tGrOlez3tvSy9U3lJl Uh8jcoPucvxajROk+OBg9HYU0UenQJwwdJuhJF3w1f51MZtlIsNofgAv35qS9Mhl6nwk xI3N7rabQ08tkOIdcNOykAQBEJ7gCFWjBOj8l8Pmd8aOGN/pawxjsJ9Nc0AqnsDfG2aY FU6fcWdNNbthYC8yBukxOvWzmfihOLpm1GgwiJVf7hl4FwqbQGdWXrRJr47CLTNV0EIq gvzQ== 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=fOWNNn5DmPPjBp1s7tRwyUB91/M/+yDl/3KDegdcsow=; b=Qe9cVZFSVzBz5kWced9BzPmcx6d5PszaVCAA+ke5FR1ukaYDxhiP5FxRLWtbGfe/Wk 526v2AwBr32fvQrOBooJVRbanhqSOWR0qf1OZePHDgcN+quVwl6A/Aam7zTH1LVoEOnb 66hPYM5U2DfAecI9bKV01WVj6nlhNAQUpzR1jNPuel+eUA4mlEguBYq47ngMawlMb1BS tJOIqcijCOts/J9MuyAj0rPWHsS9PbItzTgNlndOXsTppI3s3P9B0/OupG3SbeIYqaRR 1094eNPBFkmyx3ZTScIPskLDRMKzG2aeZEW8/jSioYVUhdD2vihvE/Ye71zjC8rA1h/C sIuA== 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 9-20020a170906308900b0070d08e9f4fbsi28144769ejv.615.2022.07.08.02.23.15; Fri, 08 Jul 2022 02:23:42 -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 S237748AbiGHIwr (ORCPT + 99 others); Fri, 8 Jul 2022 04:52:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237218AbiGHIwq (ORCPT ); Fri, 8 Jul 2022 04:52:46 -0400 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 153FA823BB for ; Fri, 8 Jul 2022 01:52:44 -0700 (PDT) Received: from mail-yw1-f174.google.com ([209.85.128.174]) by mrelayeu.kundenserver.de (mreue108 [213.165.67.113]) with ESMTPSA (Nemesis) id 1Mj8iJ-1ndPmI0c45-00fEV0 for ; Fri, 08 Jul 2022 10:52:43 +0200 Received: by mail-yw1-f174.google.com with SMTP id 00721157ae682-31c89111f23so142151297b3.0 for ; Fri, 08 Jul 2022 01:52:42 -0700 (PDT) X-Gm-Message-State: AJIora+bBaU/mdFLlL/NA8b9jKvtgieIdnGdQWhadtzUmnhHwdMkMhuX eR3z9C2NGCv8tZRvYF7cO/uqrP9fx8UG633AQ38= X-Received: by 2002:a81:f82:0:b0:31c:f1ae:1ed6 with SMTP id 124-20020a810f82000000b0031cf1ae1ed6mr2718775ywp.249.1657270361974; Fri, 08 Jul 2022 01:52:41 -0700 (PDT) MIME-Version: 1.0 References: <20220707110511.52129-1-zhengqi.arch@bytedance.com> <20220707110511.52129-3-zhengqi.arch@bytedance.com> <42bfd82c-b3fb-c942-d6f2-ae5adec90a26@bytedance.com> <33a63e76-fb71-2b9e-3b3c-cc6f7a675cf3@bytedance.com> In-Reply-To: From: Arnd Bergmann Date: Fri, 8 Jul 2022 10:52:25 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 2/2] arm64: support HAVE_IRQ_EXIT_ON_IRQ_STACK To: Qi Zheng Cc: Arnd Bergmann , Catalin Marinas , Will Deacon , Linux ARM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:HhNm72MdRG79NAoQdknnA17thimFp8wXWFPlhnIEt6c6PtJ3w5l AJoLz3YVQODAKFji+qnY5uJK8iSBmxI7EZwqEDOjQ8tX3Ql/BK8ogulZY2NL90lKB/SngBB I7yDaCl6FZsFqV428pTD4KmVMEL9WCR+9UV6b+zwK94tuKmYQ2iXLWii3CYjbPOqQtUTeJ/ whF82zQxhGK7vxd95QOQA== X-UI-Out-Filterresults: notjunk:1;V03:K0:Azg/2zA8Je8=:h7wDf02orPzYQwXa8pcp+D HF9xQV4XQgyCB+aBkmBYVIVMrKK5O2o5/6Acz35InwqQOc6WhDKCxTzJeIywFeZla90XJOds0 GtoJRhvkdH+TMbkjXkKLCFhV+M8Bm8TfU8llm3SoeVNBhvgqfoqE/EqlpOsR3KzgIcmwm4AQd AszxkGXMoI0+L5tndPfE56Obd+SMMhpW1N2h8LvZEaPTx0GuwLQWKedBq9iGSD7RsE8V2AyKy +dbGtxFN10UW8w+XBY/I/4ODLHnFDymPYcQdnBWNrTnFABaczq4wOnW2mLr8hdL2d2D+pGtV7 rwUf7SB5AHBAP5i0+JR0APnLiztiOzuVH6eBLrX/PlP8SJd+1YCnBj7EGTRybauGamqq+lw2G oMqbdEyQUN4OFIZIIMbBaceTsJqBPmGq8GQGYD4hDRAtwBxDx+0As9o+YRyBTaQE1aQFHvEKo ObprW6+452xZJOUaQ+ddVOoXstGn5s/SCGq/BPI0ZbGVGS7bNhzmiDiPzyUbykzLSKxLut5Z9 +wOryNKt0A/jqfa5IUsKdz9iijlDb4TodbIVJdYHoq76GIqdFPLWk7m01902ejMFkSQNIHZvd TxYwhQwToRhNU/71BJBUkyUqcHNaR7X/unAt8/6EfFexCrDGNskPqM4hLJDluyVJWH+Z4lDHI 3Eod6dl4bOsD3yHhjoORjGcvq/lQu8HL6CuXGeUR/H+Eyw5am73NLDirwododgIZLBNhFSEfm kyLaTTQDrVIcDPXMsvHekB3W7yqx6Rb2W4o1lw== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 Fri, Jul 8, 2022 at 5:13 AM Qi Zheng wrote: > On 2022/7/8 04:55, Arnd Bergmann wrote: > > On Thu, Jul 7, 2022 at 5:00 PM Qi Zheng wrote: > >> On 2022/7/7 22:41, Arnd Bergmann wrote: > >>> On Thu, Jul 7, 2022 at 3:38 PM Qi Zheng wrote: > >>>> On 2022/7/7 20:49, Arnd Bergmann wrote: > >>> > >>> -asmlinkage void noinstr el1h_64_fiq_handler(struct pt_regs *regs) > >>> +asmlinkage void noinstr el1h_64_irq_handler(struct pt_regs *regs) > >>> +{ > >>> + if (on_thread_stack()) > >>> + call_on_irq_stack(regs, el1_irq); > >> > >> IMO, this can't work. Because el1_interrupt() will invoke > >> arm64_preempt_schedule_irq(), which will cause scheduling on the > >> IRQ stack. > > > > Ah, too bad. I spent some more time looking for a simpler approach, > > but couldn't find one I'm happy with. One idea might be to have > > callback functions for each combinations of irq/fiq with irq/pnmi > > to avoid the nested callback pointers. Not sure if that helps. > > Maybe nested callback pointers are not always a wild beast. ;) > This method does not change much, and we can also conveniently stuff > all kinds of things in do_handler() that we want to run on the IRQ > stack in addition to the handler(). Right, your approach is probably the one that changes the existing code the least. I see that x86 handles this by having call_on_irq_stack() in an inline asm, but this in turn complicates the asm implementation, which is also worth keeping simple. Arnd