From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1izLwz-0008I1-Ie for linux-um@lists.infradead.org; Wed, 05 Feb 2020 14:46:46 +0000 Received: by mail-pf1-x443.google.com with SMTP id x185so1322586pfc.5 for ; Wed, 05 Feb 2020 06:46:45 -0800 (PST) Date: Wed, 05 Feb 2020 23:46:39 +0900 Message-ID: From: Hajime Tazaki Subject: Re: [RFC v3 07/26] um lkl: interrupt support In-Reply-To: <800b1132-68df-8c63-5371-015bfc83a511@kot-begemot.co.uk> References: <9d6f93f061b2b248c0fa0a7f1530792936f8e7be.1580882335.git.thehajime@gmail.com> <800b1132-68df-8c63-5371-015bfc83a511@kot-begemot.co.uk> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-um" Errors-To: linux-um-bounces+geert=linux-m68k.org@lists.infradead.org To: anton.ivanov@kot-begemot.co.uk Cc: linux-arch@vger.kernel.org, tavi.purdila@gmail.com, linux-um@lists.infradead.org, retrage01@gmail.com, linux-kernel-library@freelists.org, sigmaepsilon92@gmail.com On Wed, 05 Feb 2020 19:47:36 +0900, Anton Ivanov wrote: > > +/** > > + * This function can be called from arbitrary host threads, so do not > > + * issue any Linux calls (e.g. prink) if lkl_cpu_get() was not issued > > + * before. > > + */ > > +int lkl_trigger_irq(int irq) > > +{ > > + int ret; > > + > > + if (!irq || irq > NR_IRQS) > > + return -EINVAL; > > + > > + ret = lkl_cpu_try_run_irq(irq); > > + if (ret <= 0) > > + return ret; > > + > > + /* > > + * Since this can be called from Linux context (e.g. lkl_trigger_irq -> > > + * IRQ -> softirq -> lkl_trigger_irq) make sure we are actually allowed > > + * to run irqs at this point > > + */ > > + if (!irqs_enabled) { > > + set_irq_pending(irq); > > + lkl_cpu_put(); > > + return 0; > > + } > > + > > + run_irq(irq); > > + > > + lkl_cpu_put(); > > + > > + return 0; > > Isn't that just: > > if (irqs_enabled) > run_irq(irq); > else > set_irq_pending(irq); > > lkl_cpu_put(); > > return 0; Thanks, this is much cleaner. I will fix this in the next turn. -- Hajime _______________________________________________ linux-um mailing list linux-um@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-um