From owner-freebsd-virtualization@FreeBSD.ORG Tue Oct 1 07:34:18 2013 Return-Path: Delivered-To: freebsd-virtualization@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 ESMTP id 86E2EFFB for ; Tue, 1 Oct 2013 07:34:18 +0000 (UTC) (envelope-from vvm@tut.by) Received: from mail-ea0-x22a.google.com (mail-ea0-x22a.google.com [IPv6:2a00:1450:4013:c01::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0ED1824D4 for ; Tue, 1 Oct 2013 07:34:17 +0000 (UTC) Received: by mail-ea0-f170.google.com with SMTP id h14so3191057eak.15 for ; Tue, 01 Oct 2013 00:34:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tut.by; s=google; h=message-id:from:to:cc:references:subject:date:mime-version :content-type:content-transfer-encoding; bh=Rv+LXMZNhJwMwC8+JCBfEEGCxcDRXkxX4MYNHFcWLhU=; b=Wy54un1M2l41GemYsAOPTUQDAumqwt8LxZ9lL3u189JkHru60TrrexNK1YeGurRNlT Ts92mv+zTnhqDQSwuaYyjVzP7cDhzQ9A0FiCpo35xcHvRS5/bdFg2k+qi2z7VCvRGhfZ z2KvtRZ1FCkq0wjoFjDk1Bz3fQR9qTagWj6pc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:from:to:cc:references:subject:date :mime-version:content-type:content-transfer-encoding; bh=Rv+LXMZNhJwMwC8+JCBfEEGCxcDRXkxX4MYNHFcWLhU=; b=jh7JHN8ygxzM7bnYqK9YBqDmMWOpF2DtrgrpMasm+ivdRlA2cPwQlo2zxq8+zdDPMM seKWcxK/6mW0Z0Zo3hFtfzuhb4CM6oRkkssPA4NMpmdQaFnHXym5EA5CssTHwh4FU8c6 2zIMYcyKFDOPHztHvN5zFzOq96nocoKQLhe6Mtuimv6DT3xXwhQ7hECqJosKEGMQADOh r5YM4A6qvk/NyiEu7zKV3nDfKfzj85OtaxvATVB/D412sjrCedGUbANRbjc0hUoZTDVF WdwMfFq8NdzGTQJkz/lORCBBzk/1IY+b5oFst0B4k46EYLOSNxh8A0xnQhVISd9fQiel SveA== X-Gm-Message-State: ALoCoQnBpAtoOVN6jhhvEzo8ytGAR6gAt/0Qrl3Trn8akSN1TksR+wiPE9E6sd3MjGtEF6l7AGOv X-Received: by 10.15.75.73 with SMTP id k49mr43651211eey.36.1380612855963; Tue, 01 Oct 2013 00:34:15 -0700 (PDT) Received: from TSVVM2 (ns1.st.by. [217.23.123.90]) by mx.google.com with ESMTPSA id j7sm9885340eeo.15.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 01 Oct 2013 00:34:15 -0700 (PDT) Message-ID: From: "Victor Miasnikov" To: "Abhishek Gupta \(LIS\)" , References: Subject: Again: Tmp. disable BlkVSC (paravirtual IDE) functional? On ATA Channel N2 -- minimum Re: Disabling ATA driver for IDE devices on Hyper-V Re: ATA controller and Hyper-V "synthetic storage driver" handle the IDE disks devices ( but not for the CD-ROM) Date: Tue, 1 Oct 2013 10:34:04 +0300 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.3790.4548 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4913 Cc: Alexander Motin , KY Srinivasan X-BeenThere: freebsd-virtualization@freebsd.org X-Mailman-Version: 2.1.14 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: Tue, 01 Oct 2013 07:34:18 -0000 Hi! > This may have been asked before but the solution we have currently is less than ideal. Please bear with me on the > repetition and provide any suggestions you may have. > > One of the issues with Hyper-V is that it does not virtualize the CD device and therefore we rely on the ATA driver in > the guest operating system to manage CDROMs. > What we would like to do is disable the ATA driver for all device types except the CDROM in the presence of Hyper-V. Yes: "disable . . . except the CDROM" need for "LiveCD and (or) .ISO for setup FreeBSD" See P.P.P.S. == ----- Original Message ----- From: "Victor Miasnikov" To: "Alexander Motin" Cc: ; "Larry Melia" ( in fact to 3 e-mail address ) Sent: Tuesday, May 07, 2013 12:00 PM Subject: Re: ATA controller and Hyper-V "synthetic storage driver" handle the IDE disks devices ( but not for the CD-ROM) Re: Hyper-V on FreeBSD . . . > On 07.05.2013 10:40, Victor Miasnikov wrote: >>> prevent default OS driver from attaching to emulated ATA controller >>> when Hyper-V >> >> Disable both primary and secondary ATA controller prevent use CD-ROM >> device in VM ( guest) >> >> Because "synthetic storage driver" not handle CD-ROM devices >> ( IMHO, even more: Hyper-V host work with CD-ROM only as "PCI bus" device) > A.M.> Then may be possibility of blocking/hiding specific ATA channels or A.M.> devices could be investigated. IMHO, this ( or some like this) must be investigated In any case, need carefully testing work CD-ROM ( primary for LiveCD and (or) .ISO for setup FreeBSD) in Hyper-V enviroment == > As of now we have implemented a disengage driver that disables ATA driver permanently on Hyper-V. As _first_ step: temporary disable BlkVSC (paravirtual IDE) functional ( Or ( as best tmp. solution): "turn on" hw.ata.disk_enable by default i.e. implement hw.ata.disk_disable When Hyper-V sysadmin need syntetic/"Hyper-V specific" ATA driver functional, sysadmin use hw.ata.disk_disable When Hyper-V sysadmin need CD-ROM -- sysadmin skip/not use hw.ata.disk_disable ) See in P.P.S. == L.M.>>> Removing our ATA patches, on the other hand, results in a huge L.M.>>> performance loss. This is because the root file system is managed by the L.M.>>> ATA driver, which is emulated under Hyper-V. VVM>> Place on IDE disk only "\boot" ( and bootloader), other on SCSI . + VVM>> Disable both primary and secondary ATA controller prevent use CD-ROM device in VM ( guest) VVM>> Because "synthetic storage driver" not handle CD-ROM devices May be temporary disable BlkVSC (paravirtual IDE) functional? And enable [imm.]after implement work on Hyper-V both CD-ROM and ATA disks == ( And not forget about hv_ata_pci_disengage.c ) >However this is less than desirable and we are looking for a better solution. Please let us know if you have some >thoughts. On _second_ step, we can start inplement "better solution" > Can someone help us in answering the following in this regard: > > a) What is the correct location in the FreeBSD ATA code where we can put in selective disabling? > > b) Is this a good approach? Is there something cleaner you can think of? > Disable non-syntetic/"legacy" ATA driver on ATA channel N1 ( for HDD ) , but enable non-syntetic/"legacy" ATA driver on ATA channel N2 ( for CD-Rom devices) ( Of cource: Enable syntetic/"Hyper-V specific" ATA driver on ATA channel N1 ( for HDD ); Disable syntetic/"Hyper-V specific" ATA driver on ATA channel N2 ( for CD-Rom devices) ) See: ----- Original Message ----- From: "Alexander Motin" To: "Larry Melia" Cc: "Abhishek Gupta (LIS)" ; "KY Srinivasan" ; Sent: Tuesday, June 04, 2013 7:23 PM Subject: Re: more granular detection and control to disable/enable PCI-ATA devices . . . That is why you can't replace driver for a single disk in the same way as you replaced driver for the whole controller. The highest level present in "NewBus" is ATA channel. So if disk and CD-ROM are always live on different channels, you can create dummy driver not for the whole controller (atapciX), but for single hardcoded ATA channel (ataX). . . . -- Best regards, Victor Miasnikov Blog: http://vvm.blog.tut.by/ P.S. ----- Original Message ----- From: "Abhishek Gupta (LIS)" To: freebsd-virtualization (at) freebsd.org Sent: Tuesday, October 01, 2013 12:02 AM Subject: Disabling ATA driver for IDE devices on Hyper-V Hi folks, This may have been asked before but the solution we have currently is less than ideal. Please bear with me on the repetition and provide any suggestions you may have. One of the issues with Hyper-V is that it does not virtualize the CD device and therefore we rely on the ATA driver in the guest operating system to manage CDROMs. What we would like to do is disable the ATA driver for all device types except the CDROM in the presence of Hyper-V. Can someone help us in answering the following in this regard: a) What is the correct location in the FreeBSD ATA code where we can put in selective disabling? b) Is this a good approach? Is there something cleaner you can think of? As of now we have implemented a disengage driver that disables ATA driver permanently on Hyper-V. However this is less than desirable and we are looking for a better solution. Please let us know if you have some thoughts. Thanks, Abhishek -- ----- Original Message ----- From: "Alexander Motin" To: "Larry Melia" Cc: "Abhishek Gupta (LIS)" ;"KY Srinivasan" ; Sent: Tuesday, June 04, 2013 7:23 PM Subject: Re: more granular detection and control to disable/enable PCI-ATA devices Hi. On 04.06.2013 18:30, Larry Melia wrote: > With you suggestions, I finally was able to get the override driver > working-see > https://github.com/FreeBSDonHyper-V/freebsd-snapshot/blob/hyperv-dev-ata-override/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c. > While it operates wonderfully, allowing our "enlightened" driver to > improve performance, some versions of Hyper-V still use the native > CD-ROM driver, because there is no "enlightened" support for it in the > hypervisor. From my limited knowledge of the ATA drivers, it seems > likely that the PCI-ATA driver be attached when a CD-ROM is detected, > but lower-level drivers disabled (during a probe) when a hard drive is > detected. On Hyper-V, therefore, a user would be able to configure a > PCI/IDE virtual controller with two devices, the first device a hard > disk and the second one a CD-ROM. The CD-ROM would operate via the > native driver, whereas the hard disk would use the "enlightened" driver > (to improve performance). Is there an easy way to add more granular > detection, disabling the native ATA driver(s) selectively for hard > drives, while allowing CD-ROM devices to be natively attached? Any > suggestions would be very much appreciated. Unfortunately, CAM subsystem used for both ATA and SCSI stacks in FreeBSD 9.x and above is mostly unaware of "NewBus" infrastructure used for driver probe and attachment. That is why you can't replace driver for a single disk in the same way as you replaced driver for the whole controller. The highest level present in "NewBus" is ATA channel. So if disk and CD-ROM are always live on different channels, you can create dummy driver not for the whole controller (atapciX), but for single hardcoded ATA channel (ataX). Another possible way is to make controller driver not dummy, making it mostly duplicating default one, but filtering out unwanted devices. That may look like overkill, but it is not necessary so, because ATA stack is quite modularized, and you probably don't need to implement all ATA functionality such as mode setting, etc. Only thing that should be different in your driver is a reset method -- never reporting ATA disks to upper layers, only ATAPI devices. You may find number of drivers for example in sys/dev/ata/chipsets. The later way is definitely more complicated then just a few lines hack blocking CAM ada driver (ATA disk driver), but it still can be made modular and non-invasive. -- Alexander Motin P.P.S. ----- Original Message ----- From: "Victor Miasnikov" To: ; "Alexander Motin" ; "Larry Melia" Cc: "Larry Melia" Sent: Saturday, May 18, 2013 9:06 AM Subject: Tmp. disable BlkVSC (paravirtual IDE) functional? Re: ATA controller and Hyper-V "synthetic storage driver" handle the IDE disks devices ( but not for the CD-ROM) Re: Hyper-V on FreeBSD Hi! Short: {{ L.M.>>> Removing our ATA patches, on the other hand, results in a huge L.M.>>> performance loss. This is because the root file system is managed by the L.M.>>> ATA driver, which is emulated under Hyper-V. VVM>> Place on IDE disk only "\boot" ( and bootloader), other on SCSI . + VVM>> Disable both primary and secondary ATA controller prevent use CD-ROM device in VM ( guest) VVM>> Because "synthetic storage driver" not handle CD-ROM devices May be temporary disable BlkVSC (paravirtual IDE) functional? And enable [imm.]after implement work on Hyper-V both CD-ROM and ATA disks == --- 000\hv_storvsc_drv_freebsd.c Wed Apr 10 06:18:58 2013 +++ hv_storvsc_drv_freebsd.c Wed May 08 11:59:06 2013 . . . * Using the type GUID, determine if this is a StorVSC (paravirtual * SCSI or BlkVSC (paravirtual IDE) device. . . . if (!memcmp(p, &gBlkVscDeviceType, sizeof(hv_guid))) { - return DRIVER_BLKVSC; + /* TODO: enable after implement work on Hyper-V both CD-ROM and ATA disks + * return DRIVER_BLKVSC; + */ + return (DRIVER_UNKNOWN); . . . == }} Full: > On Tue, May 7, 2013 at 12:40 AM, Victor Miasnikov wrote: L.M.>> == L.M.>> . . . L.M.>> On 23.04.2013 17:07, Larry Melia wrote: L.M.>> . . . L.M.>> L.M.>>> Removing our ATA patches, on the other hand, results in a huge L.M.>>> performance loss. This is because the root file system is managed by the L.M.>>> ATA driver, which is emulated under Hyper-V. L.M.>>> L.M.>> == VVM>> VVM>> Place on IDE disk only "\boot" ( and bootloader), other on SCSI . VVM>> >>> >>> prevent default OS driver from attaching to emulated ATA controller when Hyper-V >>> VVM>> VVM>> Disable both primary and secondary ATA controller prevent use CD-ROM device in VM ( guest) VVM>> VVM>> Because "synthetic storage driver" not handle CD-ROM devices VVM>> ( IMHO, even more: Hyper-V host work with CD-ROM only as "PCI bus" device) L.M.>Regarding the CD-ROM drive, there's a known problem with CD-ROM support and using our synthetic storage driver. L.M.>At the moment, it's not supported correctly on FreeBSD, L.M.>but . . . there's a workaround ( details skipped by VVM, {= not all simply , "long story" ) , L.M.>which we will try to get working on FreeBSD. L.M.>This will be addressed shortly, but . . . ( skipped by VVM ) . May be temporary disable BlkVSC (paravirtual IDE) functional? And enable after implement work on Hyper-V both CD-ROM and ATA disks == --- 000\hv_storvsc_drv_freebsd.c Wed Apr 10 06:18:58 2013 +++ hv_storvsc_drv_freebsd.c Wed May 08 11:59:06 2013 @@ -1449,22 +1449,25 @@ /** * @brief Determine type of storage device from GUID * * Using the type GUID, determine if this is a StorVSC (paravirtual * SCSI or BlkVSC (paravirtual IDE) device. * * @param dev a device * returns an enum */ static enum hv_storage_type storvsc_get_storage_type(device_t dev) { const char *p = vmbus_get_type(dev); if (!memcmp(p, &gBlkVscDeviceType, sizeof(hv_guid))) { - return DRIVER_BLKVSC; + /* TODO: enable after implement work on Hyper-V both CD-ROM and ATA disks + * return DRIVER_BLKVSC; + */ + return (DRIVER_UNKNOWN); } else if (!memcmp(p, &gStorVscDeviceType, sizeof(hv_guid))) { return DRIVER_STORVSC; } return (DRIVER_UNKNOWN); } == Best regards, Victor Miasnikov Blog: http://vvm.blog.tut.by/ P.S. Sorry, for code style -- is primary demo of _idea_ P.P.P.S. ----- Original Message ----- From: "Victor Miasnikov" To: "Alexander Motin" Cc: ; "Larry Melia" ( in fact to 3 e-mail address ) Sent: Tuesday, May 07, 2013 12:00 PM Subject: Re: ATA controller and Hyper-V "synthetic storage driver" handle the IDE disks devices ( but not for the CD-ROM) Re: Hyper-V on FreeBSD Hi! > On 07.05.2013 10:40, Victor Miasnikov wrote: >>> prevent default OS driver from attaching to emulated ATA controller >>> when Hyper-V >> >> Disable both primary and secondary ATA controller prevent use CD-ROM >> device in VM ( guest) >> >> Because "synthetic storage driver" not handle CD-ROM devices >> ( IMHO, even more: Hyper-V host work with CD-ROM only as "PCI bus" device) > A.M.> Then may be possibility of blocking/hiding specific ATA channels or A.M.> devices could be investigated. IMHO, this ( or some like this) must be investigated In any case, need carefully testing work CD-ROM ( primary for LiveCD and (or) .ISO for setup FreeBSD) in Hyper-V enviroment >> http://lists.freebsd.org/pipermail/freebsd-virtualization/2013-April/001180.html >> >> == >> . . . >> On 23.04.2013 17:07, Larry Melia wrote: >> . . . L.M.>>> Removing our ATA patches, on the other hand, results in a huge L.M.>>> performance loss. This is because the root file system is managed by the L.M.>>> ATA driver, which is emulated under Hyper-V. >> == VVM>> VVM>> Place on IDE disk only "\boot" ( and bootloader), other on SCSI . VVM>> A.M.> A.M.> May be instead of splitting filesystem it could be better to boot from A.M.> "SCSI" completely and forget about "ATA"? A.M.> Or there is no option ROM for SCSI boot in Hyper-V? A.M.> Yes, boot from SCSI disk in Hyper-V VM ( "guest") is impossible Best regards, Victor Miasnikov Blog: http://vvm.blog.tut.by/ ==