From: "Ky Srinivasan" Subject: Re: PV drivers for HVM guests Date: Wed, 04 Oct 2006 14:40:29 -0400 Message-ID: <4523C7B0.E57C.0030.0@novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Steve Ofsthun Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org >>> On Tue, Oct 3, 2006 at 6:31 PM, in message <4522E4AA.4020700@virtualir= on.com>, Steve Ofsthun wrote:=20 > Ky Srinivasan wrote: >> I am trying to build PV drivers for SLES9 HVM guests. SLES 9 is based = on the=20 > 2.6.5 kernel. Since the PV driver code is really designed for the = latest=20 > kernel release, I have had many issues/problems in building the PV = drivers=20 > for older Linux OS targets - I have only been looking at the issues = with 2.6.5=20 > kernel base and I suspect the problem will be even worse if one were to = look=20 > at older Linux kernels. This is unfortunate since PV drivers are so = critical=20 > for HVM guests and there is considerable interest in supporting legacy = Linux=20 > environments as HVM guests. The problems I have had to deal with can = be=20 > broadly classified into: >>=20 >> a) Compiler related issues >> b) Missing functionality in the legacy kernel - this includes = features as=20 > well as changed data structures >> c) Implementation differences of a given feature >>=20 >> These differences can be dealt with in a couple of different ways: >> 1) Modify the code in the PV drivers under appropriate compilation = switches=20 > to deal with the differences in the base kernels. >> 2) Introduce a compatibility component that bridges the gap between = the=20 > current PV code and a given Linux target and leave much of the PV driver = =20 > code untouched. >>=20 >> I have implemented both these schemes for the sles9 kernel and would = like to=20 > get your input on your preference. I personally like option 2. Going = forward,=20 > the evolution of PV drivers needs to be constrained by the required = support=20 > for legacy Linux environments. >=20 > We have generally taken approach 1, for supporting SLES9 32/64 & RHEL4 = 32/64,=20 > with others=20 > under development. While the code is uglier, it is also more obvious to = a=20 > maintainer when=20 > they run across something like the following: >=20 > #if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,6,10) > elevator_init(rq, "noop"); > #else > elevator_init(rq, &elevator_noop); > #endif >=20 > or >=20 > #if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,6,15) > end_that_request_last( > req, (bret- >status =3D=3D BLKIF_RSP_OK= AY)); > #else > end_that_request_last(req); > #endif >=20 > In this way, the sensitive areas of the code are obvious. As the PV = drivers=20 > move forward,=20 > new kernel interface changes require similar changes. As you mention, = which=20 > ever method=20 > is used, some level of discipline is required in maintaining the PV = drivers. >=20 > With your suggested option 2, does this require separate "compatibility= =20 > component" code=20 > for each supported kernel version? Or do you envision a single=20 > compatibility layer that=20 > would hide the conditionally compiled code from the PV drivers proper? Based on the nature and extent of the changes we may either go with one = compatibility component for all legacy kernel targets or one for each.=20 >=20 > There is also the issue of whether the PV drivers can/should support=20 > multiple hypervisor=20 > versions moving forward. Good point.=20 >=20 > Steve