From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hajime Tazaki Subject: Re: [RFC v3 07/26] um lkl: interrupt support Date: Wed, 05 Feb 2020 23:46:39 +0900 Message-ID: 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") Content-Type: text/plain; charset=US-ASCII Return-path: Received: from mail-pg1-f193.google.com ([209.85.215.193]:33825 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726592AbgBEOqp (ORCPT ); Wed, 5 Feb 2020 09:46:45 -0500 Received: by mail-pg1-f193.google.com with SMTP id j4so1082126pgi.1 for ; Wed, 05 Feb 2020 06:46:45 -0800 (PST) In-Reply-To: <800b1132-68df-8c63-5371-015bfc83a511@kot-begemot.co.uk> Sender: linux-arch-owner@vger.kernel.org List-ID: To: anton.ivanov@kot-begemot.co.uk Cc: linux-um@lists.infradead.org, linux-arch@vger.kernel.org, tavi.purdila@gmail.com, 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