From owner-freebsd-virtualization@FreeBSD.ORG Wed Aug 20 09:20:07 2014 Return-Path: Delivered-To: freebsd-virtualization@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-virtualization@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Discussion of various virtualization techniques FreeBSD supports." 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