From owner-freebsd-hackers@FreeBSD.ORG Mon Apr 6 17:23:13 2009 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 258811065707; Mon, 6 Apr 2009 17:23:13 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id BAFE48FC1D; Mon, 6 Apr 2009 17:23:12 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n36HH9V3010695; Mon, 6 Apr 2009 11:17:09 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Mon, 06 Apr 2009 11:17:55 -0600 (MDT) Message-Id: <20090406.111755.1973602189.imp@bsdimp.com> To: jhb@FreeBSD.org From: "M. Warner Losh" In-Reply-To: <200904061154.19601.jhb@freebsd.org> References: <1366225354.253456.1238948619308.JavaMail.root@vms124.mailsrvcs.net> <200904061154.19601.jhb@freebsd.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@FreeBSD.org, babkin@verizon.net, ivoras@FreeBSD.org Subject: Re: Patch for MS Hyper V (virtualization) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Apr 2009 17:23:13 -0000 In message: <200904061154.19601.jhb@freebsd.org> John Baldwin writes: : On Sunday 05 April 2009 12:23:39 pm Sergey Babkin wrote: : > : > Apr 4, 2009 02:10:23 PM, ivoras@freebsd.org wrote: : > >Can someo=ne please review and commit (if appropriate) the tweak for : > >Hyper-V shu=tdown issue at : > http://shell.peach.ne.jp/aoyama/archives/40 : > >? : > > : > =>>The problem is: the VM appears to hang on shutdown without it : > (hanging : > >the Hyper-V VM with it so the host also can't shutdown or reboot : > >re=liably - someone at MS skipped the part where an error in the VM : > >isn't=supposed to bring the host down with it) : > I don't have the commit =permission any more but I can review :-) : > Yes, Hyper-V does not like th=e writes into the PCI config space. Why not? We need to understand exactly what it doesn't like because this is non-standard compliant behavior. : > Very specifically, : > writing the base=register window address of the simulated 21140 : > screws up something : > tha=t prevents the VM from shutting down. Interestingly, even reading : > and writi=ng : > back the same value has this effect. So the patch is valid. Then the Hyper-V is broken. This is bog-standard PCI behavior. The OS must be able to write to the BARs to size the resource being decoded. In addition, the OS is allowed to move the location of an allocation for a BAR, so avoiding writes to it is bad. Finally, some BIOSes don't allocate resources for a card, and this would totally prevent 21140's from being usable on those machines. : > =>I don't particularly like the hackish checking for the 21140 chip, : > and I'=m not sure : > if if would break some real 21140 chip out there. If the dri=ver does : > the same as another : > one I've seen, the driver tries to align t=he register window to : > 0x80, and in the : > simulated 21140 it's already ali=gned. I've had a quick look but : > couldn't say it : > for sure. I'd do it dif=ferently: check if the value being written is : > the same that was read, : > =and skip the write in this case. : > Let me see, maybe I'll make a dif=ferent patch. : : Hmm, the problem is we need to be able to write to BARs to size them. Any OS : needs to be able to do this to know what address space regions are being : decoded by devices. We can't avoid writing to BARs. Exactly. Not only do we have to read/write them to size the BAR resource, but as I indicated above, one must write to them when the BIOS doesn't assign resources to the BAR and the driver requests that resource. Warner