Received: from eggs.gnu.org ([2001:4830:134:3::10]:49406) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cAFoA-000824-7u for qemu-devel@nongnu.org; Fri, 25 Nov 2016 07:40:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cAFo4-00074h-BV for qemu-devel@nongnu.org; Fri, 25 Nov 2016 07:40:50 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45016) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cAFo4-00074J-38 for qemu-devel@nongnu.org; Fri, 25 Nov 2016 07:40:44 -0500 References: <20161118103659.10448-1-lersek@redhat.com> <20161124003835.GA20281@morn.lan> <20161124062859-mutt-send-email-mst@kernel.org> <20161125055952-mutt-send-email-mst@kernel.org> <0067a71d-74e8-d727-a2cb-a5e6dfd09127@redhat.com> From: Laszlo Ersek Message-ID: <6f8e7da4-b581-9bf2-9209-4100c591c7a6@redhat.com> Date: Fri, 25 Nov 2016 13:40:38 +0100 MIME-Version: 1.0 In-Reply-To: <0067a71d-74e8-d727-a2cb-a5e6dfd09127@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 for-2.9 0/3] q35: add negotiable broadcast SMI List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" , Paolo Bonzini Cc: Kevin O'Connor , qemu devel list , Gerd Hoffmann , Igor Mammedov , "Jordan Justen (Intel address)" , Michael Kinney On 11/25/16 13:31, Laszlo Ersek wrote: > On 11/25/16 05:00, Michael S. Tsirkin wrote: >> On Thu, Nov 24, 2016 at 09:37:41AM +0100, Laszlo Ersek wrote: >>> On 11/24/16 05:29, Michael S. Tsirkin wrote: >>>> On Wed, Nov 23, 2016 at 07:38:35PM -0500, Kevin O'Connor wrote: >>>>> As a general comment - it does seem unfortunate that we keep building >>>>> adhoc interfaces to communicate information from firmware to QEMU. We >>>>> have a generic mechanism (fw_cfg) for passing adhoc information from >>>>> QEMU to the firmware, but the inverse seems to always involve magic >>>>> pci registers, magic io space registers, specific init ordering, etc. >>>> >>>> FWIW I posted a proposal >>>> fw-cfg: support writeable blobs >>>> a while ago to try to address that >>>> >>> >>> Yes, here's the discussion (Feb 2016): >>> >>> https://www.mail-archive.com/qemu-devel@nongnu.org/msg354852.html >>> >>> and it was even part of a pull req (Mar 2016): >>> >>> https://www.mail-archive.com/qemu-devel@nongnu.org/msg359348.html >>> >>> but it wasn't merged, apparently. >>> >>> If QEMU (re)gains this feature, I can try basing the broadcast SMI >>> negotiation on it. >>> >>> Thanks >>> Laszlo >> >> I dropped since it wasn't used yet. Go ahead and include it >> in your patchset if you like it. >> > > I can do that, but I'm no longer sure Paolo still approves of the > broadcast SMI idea. > > The way I see it, I can work on getting broadcast SMI functional (with > whichever negotiation method we deem suitable), and make the basic > feature set (which ignores VCPU hotplug entirely) reliable, for now. > Then, later, we can look into VCPU hotplug. VCPU hotplug is already > broken in OVMF and whatever we do for broadcast SMI cannot worsen the > user-observable VCPU hotplug status. > > (Note that VCPU hotplug will require a whole bunch of non-platform code > in edk2, such as UefiCpuPkg/Library/MpInitLib, UefiCpuPkg/CpuMpPei, and > UefiCpuPkg/CpuDxe, UefiCpuPkg/PiSmmCpuDxeSmm.) > > Or, we can delay (or even drop) broadcast SMI until we divine a design > that, with a lot of code everywhere, makes (a) the basic SMM feature set > reliable *and* (b) VCPU hotplug functional, at the exact same time. I'm > not saying this is impossible, but you'll need a better guy for that > than I am. I always work in incremental, small steps, especially where > the subject matter is hard for me to grasp. If you see me walking down > the wrong path and yank me back, that's appreciated, but the broadcast > SMI idea doesn't look wrong, considering feedback from Jordan as to what > real hardware does (and the edk2 UefiCpuPkg.dec default settings). > > So, I'm asking for guidance on: > > (1) what interface would be preferred for negotiating SMI: > (1a) APM_STS > (1b) writeable fw_cfg > (1c) another IO port > > (2) whether to prevent, and if so, how exactly, VCPU hotplug, when the > broadcast SMI is negotiated. By "how", I mean "what code to modify in QEMU". > > For (1), my preference is (1a), simply because it's ready. I do see > perspective in (1b) writeable fw_cfg, so if that's preferred, I can > include Michael's patch and rework my patches to utilize it. (As far as > I see, the textual documentation for fw_cfg is not extended by Michael's > patch, so I guess I'd have to do that too.) If I understand correctly, one argument against the current state of writeable fw_cfg, captured in , is that callbacks on write are not supported. Apparently, QEMU code that uses the data written by the guest is supposed to just read that data, not to expect a notification about it. I'm unsure how this can work for actual negotiation, where the guest usually does a read/write/read cycle, and expects some kind of change between steps #2 and #3. I don't see how that can be implemented in QEMU without write callbacks (i.e. how QEMU can confirm or reject the negotiation attempt). Thanks Laszlo > (1c) is inferior to (1b) in > my opinion and shouldn't be chosen. > > Re (2), I'm clueless. Not sure we should care about it. Even if it is a > security problem, that problem exists within the guest, and triggering > it (i.e., hot-plugging a VCPU) requires a host admin action. The host > admin can cause a bunch of other security problems for the guest, via > different misconfigurations. So if we care about (2), it should be > something minimal, to catch "inadvertent" VCPU hotplug attempts. And > then please tell me what code to mess with. > > Thanks > Laszlo >