From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754922AbbJ0Vhl (ORCPT ); Tue, 27 Oct 2015 17:37:41 -0400 Received: from mga02.intel.com ([134.134.136.20]:17560 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754961AbbJ0Vhg (ORCPT ); Tue, 27 Oct 2015 17:37:36 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,207,1444719600"; d="scan'208";a="589196801" Date: Tue, 27 Oct 2015 14:26:48 -0700 From: Yunhong Jiang To: Paolo Bonzini Cc: Alex Williamson , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH] VFIO: Add a parameter to force nonthread IRQ Message-ID: <20151027212648.GA22916@jnakajim-build> References: <1445908801-14732-1-git-send-email-yunhong.jiang@linux.intel.com> <1445917034.8018.220.camel@redhat.com> <20151027063501.GA22054@jnakajim-build> <562F43F8.1040101@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <562F43F8.1040101@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 27, 2015 at 10:29:28AM +0100, Paolo Bonzini wrote: > > > On 27/10/2015 07:35, Yunhong Jiang wrote: > > On Mon, Oct 26, 2015 at 09:37:14PM -0600, Alex Williamson wrote: > >> On Mon, 2015-10-26 at 18:20 -0700, Yunhong Jiang wrote: > >>> An option to force VFIO PCI MSI/MSI-X handler as non-threaded IRQ, > >>> even when CONFIG_IRQ_FORCED_THREADING=y. This is uselful when > >>> assigning a device to a guest with low latency requirement since it > >>> reduce the context switch to/from the IRQ thread. > >> > >> Is there any way we can do this automatically? Perhaps detecting that > >> we're on a RT kernel or maybe that the user is running with RT priority? > >> I find that module options are mostly misunderstood and misused. > > > > Alex, thanks for review. > > > > It's not easy to detect if the user is running with RT priority, since > > sometimes the user start the thread and then set the scheduler priority > > late. > > > > Also should we do this only for in kernel irqchip scenario and not for user > > space handler, since in kernel irqchip has lower overhead? > > The overhead of the non-threaded IRQ handler is the same for kernel or > userspace irqchip, since the handler just writes 1 to the eventfd. IIUC, the handler not only write1 1 to the eventfd, it also invoke the wait queue function, and the in kernel irqchip has different callback with the user space irqchip, am I right? But I should not state that in kernel irqchip has lower overhead since I have no data for it. > > On RT kernels however can you call eventfd_signal from interrupt > context? You cannot call spin_lock_irqsave (which can sleep) from a > non-threaded interrupt handler, can you? You would need a raw spin lock. Thanks for pointing this out. Yes, we can't call spin_lock_irqsave on RT kernel. Will do this way on next patch. But not sure if it's overkill to use raw_spinlock there since the eventfd_signal is used by other caller also. Thanks --jyh > > Paolo > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/