From owner-freebsd-drivers@FreeBSD.ORG Wed Aug 20 09:20:07 2014 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C9258757; Wed, 20 Aug 2014 09:20:07 +0000 (UTC) Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1lp0141.outbound.protection.outlook.com [207.46.163.141]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "MSIT Machine Auth CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5CDCF32EF; Wed, 20 Aug 2014 09:20:05 +0000 (UTC) Received: from BY1PR0301MB0902.namprd03.prod.outlook.com (25.160.195.141) by BY1PR0301MB0901.namprd03.prod.outlook.com (25.160.195.140) with Microsoft SMTP Server (TLS) id 15.0.1005.10; Wed, 20 Aug 2014 09:19:57 +0000 Received: from BY1PR0301MB0902.namprd03.prod.outlook.com ([25.160.195.141]) by BY1PR0301MB0902.namprd03.prod.outlook.com ([25.160.195.141]) with mapi id 15.00.1005.008; Wed, 20 Aug 2014 09:19:57 +0000 From: Wei Hu To: "freebsd-drivers@freebsd.org" , "freebsd-xen@freebsd.org" Subject: Directly reserve an interrupt IDT entry for Hyper-V Thread-Topic: Directly reserve an interrupt IDT entry for Hyper-V Thread-Index: Ac+8UT9e97G9LT7sSf25pxsUhlOuiA== Date: Wed, 20 Aug 2014 09:19:56 +0000 Message-ID: <3defccd56bc0407c88bdda139b2462ac@BY1PR0301MB0902.namprd03.prod.outlook.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [167.220.232.169] x-microsoft-antispam: BCL:0;PCL:0;RULEID:;UriScan:; x-forefront-prvs: 03094A4065 x-forefront-antispam-report: SFV:NSPM; SFS:(6009001)(164054003)(189002)(199003)(85306004)(101416001)(105586002)(19300405004)(15202345003)(16236675004)(46102001)(54356999)(50986999)(4396001)(33646002)(81542001)(76576001)(106356001)(21056001)(561944003)(74662001)(99396002)(74502001)(81342001)(31966008)(64706001)(86612001)(92566001)(80022001)(95666004)(19580395003)(15975445006)(2656002)(86362001)(77982001)(229853001)(74316001)(66066001)(19625215002)(99286002)(79102001)(108616004)(83072002)(83322001)(20776003)(107046002)(87936001)(85852003)(77096002)(76482001)(24736002); DIR:OUT; SFP:; SCL:1; SRVR:BY1PR0301MB0901; H:BY1PR0301MB0902.namprd03.prod.outlook.com; FPR:; MLV:sfv; PTR:InfoNoRecords; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-OriginatorOrg: microsoft.onmicrosoft.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: "freebsd-virtualization@freebsd.org" X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Aug 2014 09:20:07 -0000 Hello, Sending to Xen, drivers and virtualization mailing lists since this might b= e of interest to the folks on these aliases. I am working for Microsoft to improve the performance of FreeBSD running on= Hyper-V. Right now I am adding a feature in the vmbus driver which could h= andle the host-guest channel communications on all vCPUs simultaneously. In= order to achieve this, the hypervisor will send same interrupt concurrentl= y on all the vCPUs. The traditional way on FreeBSD to set up interrupt hand= ling for devicse, such as calling bus_alloc_resource() to reserve an IRQ li= ne, and then calling bus_setup_intr() to create a vector, doesn't seem to w= ork in this case. It seems if the interrupt is routed via legacy IRQ, it ca= n only be active on one vCPU at a time. In order to allow the same interrup= t to be handled on all vCPUs concurrently, all I need is an IDT entry, not = an IRQ line. I checked current FreeBSD code. It looks to me Xen directly uses the vector= number IDT_EVTCHN (0x93) to achieve the same purpose. I am proposing both = Xen and Hyper-V share this same vector. Following is a little bit detail of= my proposal for the changes in the current kernel. 1. In machdep.c: #ifdef XENHVM setidt(IDT_EVTCHN, &IDTVEC(xen_intr_upcall), SDT_SYSIGT, SEL_UPL, 0= ); #else setidt(IDT_EVTCHN, &IDTVEC(hv_vmbus_intr), SDT_SYSIGT, SEL_UPL, 0); #endif 2. Apic_vector.S Add IDTVEC(hv_vmbus_intr) to call Hyper-V vmbus interrupt service routine. Any thoughts, objections and feedbacks are all welcome. Thanks, Wei Hu Open Source Technology Center Microsoft China From owner-freebsd-drivers@FreeBSD.ORG Wed Aug 20 13:32:04 2014 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EAA85EF4; Wed, 20 Aug 2014 13:32:04 +0000 (UTC) Received: from SMTP.CITRIX.COM (smtp.citrix.com [66.165.176.89]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "mail.citrix.com", Issuer "Cybertrust Public SureServer SV CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C48223F93; Wed, 20 Aug 2014 13:32:03 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.01,902,1400025600"; d="scan'208";a="163375480" Received: from [IPv6:::1] (10.80.16.47) by smtprelay.citrix.com (10.13.107.78) with Microsoft SMTP Server id 14.3.181.6; Wed, 20 Aug 2014 09:31:54 -0400 Message-ID: <53F4A34A.4010807@citrix.com> Date: Wed, 20 Aug 2014 15:31:54 +0200 From: =?ISO-8859-1?Q?Roger_Pau_Monn=E9?= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Wei Hu , "freebsd-drivers@freebsd.org" , "freebsd-xen@freebsd.org" Subject: Re: Directly reserve an interrupt IDT entry for Hyper-V References: <3defccd56bc0407c88bdda139b2462ac@BY1PR0301MB0902.namprd03.prod.outlook.com> In-Reply-To: <3defccd56bc0407c88bdda139b2462ac@BY1PR0301MB0902.namprd03.prod.outlook.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-DLP: MIA2 Cc: "freebsd-virtualization@freebsd.org" X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Aug 2014 13:32:05 -0000 On 20/08/14 11:19, Wei Hu wrote: > Hello, > > Sending to Xen, drivers and virtualization mailing lists since this might be of interest to the folks on these aliases. > > I am working for Microsoft to improve the performance of FreeBSD running on Hyper-V. Right now I am adding a feature in the vmbus driver which could handle the host-guest channel communications on all vCPUs simultaneously. In order to achieve this, the hypervisor will send same interrupt concurrently on all the vCPUs. The traditional way on FreeBSD to set up interrupt handling for devicse, such as calling bus_alloc_resource() to reserve an IRQ line, and then calling bus_setup_intr() to create a vector, doesn't seem to work in this case. It seems if the interrupt is routed via legacy IRQ, it can only be active on one vCPU at a time. In order to allow the same interrupt to be handled on all vCPUs concurrently, all I need is an IDT entry, not an IRQ line. > > I checked current FreeBSD code. It looks to me Xen directly uses the vector number IDT_EVTCHN (0x93) to achieve the same purpose. I am proposing both Xen and Hyper-V share this same vector. Following is a little bit detail of my proposal for the changes in the current kernel. > > > 1. In machdep.c: > > #ifdef XENHVM > > setidt(IDT_EVTCHN, &IDTVEC(xen_intr_upcall), SDT_SYSIGT, SEL_UPL, 0); > > #else > > setidt(IDT_EVTCHN, &IDTVEC(hv_vmbus_intr), SDT_SYSIGT, SEL_UPL, 0); > > #endif > > 2. Apic_vector.S > > Add IDTVEC(hv_vmbus_intr) to call Hyper-V vmbus interrupt service routine. > > Any thoughts, objections and feedbacks are all welcome. Hello, I don't think using the same IDT vector is the right approach, I would just pick a different IDT vector and use that for Hyper-V. Using the same IDT vector (like your suggestion above) would prevent shipping a kernel with with both Hyper-V and Xen support (like it's done now in GENERIC). Roger. From owner-freebsd-drivers@FreeBSD.ORG Wed Aug 20 16:00:43 2014 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C64FE724; Wed, 20 Aug 2014 16:00:43 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9AAAD3082; Wed, 20 Aug 2014 16:00:43 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 7EEC5B9CE; Wed, 20 Aug 2014 12:00:42 -0400 (EDT) From: John Baldwin To: freebsd-drivers@freebsd.org Subject: Re: Directly reserve an interrupt IDT entry for Hyper-V Date: Wed, 20 Aug 2014 11:31:29 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20140415; KDE/4.5.5; amd64; ; ) References: <3defccd56bc0407c88bdda139b2462ac@BY1PR0301MB0902.namprd03.prod.outlook.com> <53F4A34A.4010807@citrix.com> In-Reply-To: <53F4A34A.4010807@citrix.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Message-Id: <201408201131.29399.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 20 Aug 2014 12:00:42 -0400 (EDT) Cc: "freebsd-xen@freebsd.org" , "freebsd-virtualization@freebsd.org" , Roger Pau =?iso-8859-1?q?Monn=E9?= X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Aug 2014 16:00:43 -0000 On Wednesday, August 20, 2014 9:31:54 am Roger Pau Monn=E9 wrote: > On 20/08/14 11:19, Wei Hu wrote: > > Hello, > >=20 > > Sending to Xen, drivers and virtualization mailing lists since this mig= ht=20 be of interest to the folks on these aliases. > >=20 > > I am working for Microsoft to improve the performance of FreeBSD runnin= g=20 on Hyper-V. Right now I am adding a feature in the vmbus driver which could= =20 handle the host-guest channel communications on all vCPUs simultaneously. I= n=20 order to achieve this, the hypervisor will send same interrupt concurrently= on=20 all the vCPUs. The traditional way on FreeBSD to set up interrupt handling = for=20 devicse, such as calling bus_alloc_resource() to reserve an IRQ line, and t= hen=20 calling bus_setup_intr() to create a vector, doesn't seem to work in this=20 case. It seems if the interrupt is routed via legacy IRQ, it can only be=20 active on one vCPU at a time. In order to allow the same interrupt to be=20 handled on all vCPUs concurrently, all I need is an IDT entry, not an IRQ=20 line. > >=20 > > I checked current FreeBSD code. It looks to me Xen directly uses the=20 vector number IDT_EVTCHN (0x93) to achieve the same purpose. I am proposing= =20 both Xen and Hyper-V share this same vector. Following is a little bit deta= il=20 of my proposal for the changes in the current kernel. > >=20 > >=20 > > 1. In machdep.c: > >=20 > > #ifdef XENHVM > >=20 > > setidt(IDT_EVTCHN, &IDTVEC(xen_intr_upcall), SDT_SYSIGT, SEL_UP= L,=20 0); > >=20 > > #else > >=20 > > setidt(IDT_EVTCHN, &IDTVEC(hv_vmbus_intr), SDT_SYSIGT, SEL_UPL,= =20 0); > >=20 > > #endif > >=20 > > 2. Apic_vector.S > >=20 > > Add IDTVEC(hv_vmbus_intr) to call Hyper-V vmbus interrupt service routi= ne. > >=20 > > Any thoughts, objections and feedbacks are all welcome. >=20 > Hello, >=20 > I don't think using the same IDT vector is the right approach, I would > just pick a different IDT vector and use that for Hyper-V. Using the > same IDT vector (like your suggestion above) would prevent shipping a > kernel with with both Hyper-V and Xen support (like it's done now in > GENERIC). >=20 > Roger. Hmm, can't you make this a runtime check to only call setidt() if you detec= t=20 you are under the appropriate hypervisor? Also, bhyve currently has a hackish way of requesting a free IDT slot. =20 Perhaps it would be best if I added little API to reserve an IDT slot assum= ing=20 that callers could accept a dynamic IDT vector rather than a static one. =2D-=20 John Baldwin From owner-freebsd-drivers@FreeBSD.ORG Wed Aug 20 16:33:11 2014 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 818D6896; Wed, 20 Aug 2014 16:33:11 +0000 (UTC) Received: from SMTP02.CITRIX.COM (smtp02.citrix.com [66.165.176.63]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "mail.citrix.com", Issuer "Cybertrust Public SureServer SV CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2881C355F; Wed, 20 Aug 2014 16:33:09 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.01,903,1400025600"; d="scan'208";a="164166878" Received: from [IPv6:::1] (10.80.16.47) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.3.181.6; Wed, 20 Aug 2014 12:33:00 -0400 Message-ID: <53F4CDBA.8040500@citrix.com> Date: Wed, 20 Aug 2014 18:32:58 +0200 From: =?ISO-8859-1?Q?Roger_Pau_Monn=E9?= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: John Baldwin , Subject: Re: Directly reserve an interrupt IDT entry for Hyper-V References: <3defccd56bc0407c88bdda139b2462ac@BY1PR0301MB0902.namprd03.prod.outlook.com> <53F4A34A.4010807@citrix.com> <201408201131.29399.jhb@freebsd.org> In-Reply-To: <201408201131.29399.jhb@freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-DLP: MIA1 Cc: "freebsd-xen@freebsd.org" , "freebsd-virtualization@freebsd.org" X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Aug 2014 16:33:11 -0000 On 20/08/14 17:31, John Baldwin wrote: > On Wednesday, August 20, 2014 9:31:54 am Roger Pau Monné wrote: >> Hello, >> >> I don't think using the same IDT vector is the right approach, I would >> just pick a different IDT vector and use that for Hyper-V. Using the >> same IDT vector (like your suggestion above) would prevent shipping a >> kernel with with both Hyper-V and Xen support (like it's done now in >> GENERIC). >> >> Roger. > > Hmm, can't you make this a runtime check to only call setidt() if you detect > you are under the appropriate hypervisor? > > Also, bhyve currently has a hackish way of requesting a free IDT slot. > Perhaps it would be best if I added little API to reserve an IDT slot assuming > that callers could accept a dynamic IDT vector rather than a static one. That would work for Xen. The IDT vector doesn't need to be fixed since it's registered with Xen when the system boots. Roger. From owner-freebsd-drivers@FreeBSD.ORG Wed Aug 20 18:09:27 2014 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6FF9652D; Wed, 20 Aug 2014 18:09:27 +0000 (UTC) Received: from mail-qc0-x233.google.com (mail-qc0-x233.google.com [IPv6:2607:f8b0:400d:c01::233]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F25C232CD; Wed, 20 Aug 2014 18:09:26 +0000 (UTC) Received: by mail-qc0-f179.google.com with SMTP id m20so8043244qcx.38 for ; Wed, 20 Aug 2014 11:09:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=rpfhyTrWXSaDNoQ0vRyWpYIV3ZMpB7tCNjjy9foBTGQ=; b=LL64HgwQQUN3SJPjch3PF2jk1uVZebx8Lc1EIu7j8pW0uqfYb1WVYhAPyS6oicHSR4 TcaMszQOB/7D0e+ud5DrfJ/JuRgaAn0YZzPKJYDmQJ2TXaDhRBFZsc2J7ZnXZ/xuQ4JC VCzV2DwjmJ/t3eKk+6tPi59e6rPS5juuqbD/m/1m9a6ooUrkpzYeAwmozLUnXS+eeWdL BjdKpAG1RHWXRXyctGYtQXWwBUW6FvsrRX2RSn8K/AsE2D4tq/Q1o78i9OCLbJNh4kej FEHOKZLXDywNjbdeKaQYeX6kZ3fXfLPLOqjFvljP4SzQxGQNSWpVfi0OL1cE5oEuWgVZ Yyyw== MIME-Version: 1.0 X-Received: by 10.140.83.242 with SMTP id j105mr69306093qgd.38.1408558164957; Wed, 20 Aug 2014 11:09:24 -0700 (PDT) Received: by 10.140.84.80 with HTTP; Wed, 20 Aug 2014 11:09:24 -0700 (PDT) In-Reply-To: <201408201131.29399.jhb@freebsd.org> References: <3defccd56bc0407c88bdda139b2462ac@BY1PR0301MB0902.namprd03.prod.outlook.com> <53F4A34A.4010807@citrix.com> <201408201131.29399.jhb@freebsd.org> Date: Wed, 20 Aug 2014 11:09:24 -0700 Message-ID: Subject: Re: Directly reserve an interrupt IDT entry for Hyper-V From: Neel Natu To: John Baldwin Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: "freebsd-xen@freebsd.org" , freebsd-drivers@freebsd.org, "freebsd-virtualization@freebsd.org" X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Aug 2014 18:09:27 -0000 Hi John, On Wed, Aug 20, 2014 at 8:31 AM, John Baldwin wrote: > On Wednesday, August 20, 2014 9:31:54 am Roger Pau Monn=C3=A9 wrote: >> On 20/08/14 11:19, Wei Hu wrote: >> > Hello, >> > >> > Sending to Xen, drivers and virtualization mailing lists since this mi= ght > be of interest to the folks on these aliases. >> > >> > I am working for Microsoft to improve the performance of FreeBSD runni= ng > on Hyper-V. Right now I am adding a feature in the vmbus driver which cou= ld > handle the host-guest channel communications on all vCPUs simultaneously.= In > order to achieve this, the hypervisor will send same interrupt concurrent= ly on > all the vCPUs. The traditional way on FreeBSD to set up interrupt handlin= g for > devicse, such as calling bus_alloc_resource() to reserve an IRQ line, and= then > calling bus_setup_intr() to create a vector, doesn't seem to work in this > case. It seems if the interrupt is routed via legacy IRQ, it can only be > active on one vCPU at a time. In order to allow the same interrupt to be > handled on all vCPUs concurrently, all I need is an IDT entry, not an IRQ > line. >> > >> > I checked current FreeBSD code. It looks to me Xen directly uses the > vector number IDT_EVTCHN (0x93) to achieve the same purpose. I am proposi= ng > both Xen and Hyper-V share this same vector. Following is a little bit de= tail > of my proposal for the changes in the current kernel. >> > >> > >> > 1. In machdep.c: >> > >> > #ifdef XENHVM >> > >> > setidt(IDT_EVTCHN, &IDTVEC(xen_intr_upcall), SDT_SYSIGT, SEL_U= PL, > 0); >> > >> > #else >> > >> > setidt(IDT_EVTCHN, &IDTVEC(hv_vmbus_intr), SDT_SYSIGT, SEL_UPL= , > 0); >> > >> > #endif >> > >> > 2. Apic_vector.S >> > >> > Add IDTVEC(hv_vmbus_intr) to call Hyper-V vmbus interrupt service rout= ine. >> > >> > Any thoughts, objections and feedbacks are all welcome. >> >> Hello, >> >> I don't think using the same IDT vector is the right approach, I would >> just pick a different IDT vector and use that for Hyper-V. Using the >> same IDT vector (like your suggestion above) would prevent shipping a >> kernel with with both Hyper-V and Xen support (like it's done now in >> GENERIC). >> >> Roger. > > Hmm, can't you make this a runtime check to only call setidt() if you det= ect > you are under the appropriate hypervisor? > > Also, bhyve currently has a hackish way of requesting a free IDT slot. > Perhaps it would be best if I added little API to reserve an IDT slot ass= uming > that callers could accept a dynamic IDT vector rather than a static one. > Yup, it'll be good to get rid of vmm_ipi.c. best Neel > -- > John Baldwin > _______________________________________________ > freebsd-virtualization@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization > To unsubscribe, send any mail to "freebsd-virtualization-unsubscribe@free= bsd.org" From owner-freebsd-drivers@FreeBSD.ORG Thu Aug 21 03:24:53 2014 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F17947A8; Thu, 21 Aug 2014 03:24:52 +0000 (UTC) Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1blp0189.outbound.protection.outlook.com [207.46.163.189]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "MSIT Machine Auth CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2C1E23AF5; Thu, 21 Aug 2014 03:24:50 +0000 (UTC) Received: from BY1PR0301MB0902.namprd03.prod.outlook.com (25.160.195.141) by BY1PR0301MB0902.namprd03.prod.outlook.com (25.160.195.141) with Microsoft SMTP Server (TLS) id 15.0.1005.10; Thu, 21 Aug 2014 03:24:48 +0000 Received: from BY1PR0301MB0902.namprd03.prod.outlook.com ([25.160.195.141]) by BY1PR0301MB0902.namprd03.prod.outlook.com ([25.160.195.141]) with mapi id 15.00.1005.008; Thu, 21 Aug 2014 03:24:48 +0000 From: Wei Hu To: =?iso-8859-1?Q?Roger_Pau_Monn=E9?= , John Baldwin , "freebsd-drivers@freebsd.org" Subject: RE: Directly reserve an interrupt IDT entry for Hyper-V Thread-Topic: Directly reserve an interrupt IDT entry for Hyper-V Thread-Index: Ac+8UT9e97G9LT7sSf25pxsUhlOuiAAKdvMAAAQtKYAAAiW0AAAWpWPQ Date: Thu, 21 Aug 2014 03:24:48 +0000 Message-ID: <07ddd62e6cc84509aa76aa299c8dbd3c@BY1PR0301MB0902.namprd03.prod.outlook.com> References: <3defccd56bc0407c88bdda139b2462ac@BY1PR0301MB0902.namprd03.prod.outlook.com> <53F4A34A.4010807@citrix.com> <201408201131.29399.jhb@freebsd.org> <53F4CDBA.8040500@citrix.com> In-Reply-To: <53F4CDBA.8040500@citrix.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [167.220.232.169] x-microsoft-antispam: BCL:0;PCL:0;RULEID:;UriScan:; x-forefront-prvs: 0310C78181 x-forefront-antispam-report: SFV:NSPM; SFS:(6009001)(479174003)(199003)(13464003)(377454003)(189002)(51704005)(24454002)(74502001)(101416001)(93886004)(76482001)(74316001)(87936001)(33646002)(31966008)(99286002)(83322001)(46102001)(85306004)(50986999)(86612001)(81542001)(74662001)(99396002)(19580395003)(54356999)(95666004)(105586002)(4396001)(77096002)(76176999)(19580405001)(77982001)(21056001)(83072002)(80022001)(66066001)(106356001)(20776003)(107046002)(64706001)(92566001)(81342001)(86362001)(76576001)(108616004)(2656002)(85852003)(24736002); DIR:OUT; SFP:; SCL:1; SRVR:BY1PR0301MB0902; H:BY1PR0301MB0902.namprd03.prod.outlook.com; FPR:; MLV:sfv; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.onmicrosoft.com Cc: "freebsd-xen@freebsd.org" , "freebsd-virtualization@freebsd.org" X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Aug 2014 03:24:53 -0000 Hi Roger and John, I will request a free IDT slot instead of sharing the same vector with Xen.= It would be great to have an API to do this. Before the API is available, = I will probably use the same way as in vmm_ipi.c to find a free slot. Thanks so much for your help, Wei =20 -----Original Message----- From: Roger Pau Monn=E9 [mailto:roger.pau@citrix.com]=20 Sent: Thursday, August 21, 2014 12:33 AM To: John Baldwin; freebsd-drivers@freebsd.org Cc: Wei Hu; freebsd-xen@freebsd.org; freebsd-virtualization@freebsd.org Subject: Re: Directly reserve an interrupt IDT entry for Hyper-V On 20/08/14 17:31, John Baldwin wrote: > On Wednesday, August 20, 2014 9:31:54 am Roger Pau Monn=E9 wrote: >> Hello, >> >> I don't think using the same IDT vector is the right approach, I=20 >> would just pick a different IDT vector and use that for Hyper-V.=20 >> Using the same IDT vector (like your suggestion above) would prevent=20 >> shipping a kernel with with both Hyper-V and Xen support (like it's=20 >> done now in GENERIC). >> >> Roger. >=20 > Hmm, can't you make this a runtime check to only call setidt() if you=20 > detect you are under the appropriate hypervisor? >=20 > Also, bhyve currently has a hackish way of requesting a free IDT slot. =20 > Perhaps it would be best if I added little API to reserve an IDT slot=20 > assuming that callers could accept a dynamic IDT vector rather than a sta= tic one. That would work for Xen. The IDT vector doesn't need to be fixed since it's= registered with Xen when the system boots. Roger.