From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH v3 1/3] Introduce a workqueue to deliver PIT timer interrupts. Date: Tue, 17 Apr 2012 13:26:01 +0300 Message-ID: <20120417102601.GF11918@redhat.com> References: <1276722673-19011-1-git-send-email-clalance@redhat.com> <1276722673-19011-2-git-send-email-clalance@redhat.com> <4F8C49D6.9010603@siemens.com> <20120417093123.GB11918@redhat.com> <4F8D44B8.1000102@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Jan Kiszka , kvm@vger.kernel.org, Marcelo Tosatti To: Avi Kivity Return-path: Received: from mx1.redhat.com ([209.132.183.28]:63089 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751153Ab2DQK0E (ORCPT ); Tue, 17 Apr 2012 06:26:04 -0400 Content-Disposition: inline In-Reply-To: <4F8D44B8.1000102@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Apr 17, 2012 at 01:23:52PM +0300, Avi Kivity wrote: > On 04/17/2012 12:31 PM, Gleb Natapov wrote: > > On Mon, Apr 16, 2012 at 06:33:26PM +0200, Jan Kiszka wrote: > > > On 2010-06-16 23:11, Chris Lalancette wrote: > > > > We really want to "kvm_set_irq" during the hrtimer callback, > > > > but that is risky because that is during interrupt context. > > > > Instead, offload the work to a workqueue, which is a bit safer > > > > and should provide most of the same functionality. > > > > > > Unfortunately, workqueues do not have fixed kthread associations (and > > > "kvm-pit-wq" would be too unspecific when running multiple VMs). So I > > > just realized that this subtly breaks the ability to run KVM guests with > > > RT priority (boot managers with timeouts hang as the workqueue starves). > > > > > > Before throwing some kthread_worker at this, could someone help me > > > recalling what was "risky" here? That the PIT IRQ may have to be > > > broadcast to a large number of VCPUs? I would offer to include this > > > information in my changelog. ;) > > > > > ioapic and pic irq_set functions uses spinlocks, but not irqsave > > variants. Also I am always forget whether is is safe to kick vcpu from > > irq context. > > It isn't, since you need to send an IPI. > That is exactly what I forget whether you can send IPI from there :) Anyway this is another reason. -- Gleb.