From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH 3/3] KVM: x86: Optimize NMI watchdog delivery Date: Fri, 17 Oct 2008 19:40:00 +0200 Message-ID: <48F8CDF0.4070902@web.de> References: <20081015142748.385784583@mchn012c.ww002.siemens.net> <20081015142748.931910158@mchn012c.ww002.siemens.net> <20081017170654.GA22408@yukikaze> <48F8C9F5.5070500@web.de> <20081017173414.GD22408@yukikaze> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig8B0B2A1C5D8761045B1663C1" Cc: Jan Kiszka , kvm@vger.kernel.org, avi@redhat.com, jiajun.xu@intel.com To: sheng@linux.intel.com Return-path: Received: from fmmailgate01.web.de ([217.72.192.221]:57446 "EHLO fmmailgate01.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752892AbYJQRkD (ORCPT ); Fri, 17 Oct 2008 13:40:03 -0400 In-Reply-To: <20081017173414.GD22408@yukikaze> Sender: kvm-owner@vger.kernel.org List-ID: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig8B0B2A1C5D8761045B1663C1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Sheng Yang wrote: > On Fri, Oct 17, 2008 at 07:23:01PM +0200, Jan Kiszka wrote: >> Sheng Yang wrote: >>> On Wed, Oct 15, 2008 at 04:27:51PM +0200, Jan Kiszka wrote: >>>> As suggested by Avi, this patch introduces a counter of VCPUs that h= ave >>>> LVT0 set to NMI mode. Only if the counter > 0, we push the PIT ticks= via >>>> all LAPIC LVT0 lines to enable NMI watchdog support. >>>> >>> I feel a little strange about: if *counter > 0*, we push to *all*. Ca= n we >>> only push NMIs to the ones that set NMI for LVT0? >> We don't do that due to !kvm_apic_accept_pic_intr(). The counter is on= ly >> about optimizing that case where we don't have to walk the whole chain= , >> asking every vcpu if it would like to receive the IRQ. >=20 > I don't agree to use kvm_apic_accept_pic_intr() here, as I explained in= the > first mail. It's not a normal path, and current KVM handle it well. Current KVM only support PIC Mode, which is fine, but not sufficient for NMI watchdog support. We need to get the Virtual Wire Mode in, but correctly. >>> How about add a field in struct kvm_lapic? We can quickly know if we = need to >>> inject NMI for this vcpu. Well, though kernel mostly enable NMI watch= dog on >>> all vcpu, I think this is more precise, and match the logic, and avoi= d one >>> more field in kvm_arch... >> The point of this patch is to avoid touching vcpu structures AT ALL wh= en >> there is no interest in the NMI watchdog (normally, OSes will either >> enable the WD trick for all CPUSs or keep it off). >=20 > Logically, I think lapic is more proper place. And put a bool there won= 't > affect much. I think we can do it more straightly here. If you have dozens of lapics, you don't want to check them all if they are ALL switched of anyway. That information is better encoded in a single, (virtual) system-wide bool. That's the most common case we want to speed up. And it is the core of the optimization Avi suggested (unless I totally misunderstood him). Jan --------------enig8B0B2A1C5D8761045B1663C1 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iEYEARECAAYFAkj4zfAACgkQniDOoMHTA+kNowCfdmzf884h+KHGAfMi9tb9qE+/ VLkAn0LfB8FCT/hfWxL7qSCYMU+ewBAc =Fl9i -----END PGP SIGNATURE----- --------------enig8B0B2A1C5D8761045B1663C1--