Hyper-V Kernel Debugging

Is it any faster than 115200, or is it just a typical COM debugging session?

-Brandon

On Mon, Nov 5, 2012 at 3:14 PM, Maxim S. Shatskih wrote:

> Redirect the guest’s COM1 to a pipe, and then use this pipe name in
> WinDbg’s command line (see WinDbg docs).
>
> –
> Maxim S. Shatskih
> Windows DDK MVP
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
> “Brandon Falk” wrote in message
> news:xxxxx@ntdev…
> I’ve decided to try out Hyper-V this week, and I’ve heard here and there
> that Hyper-V allows for really quick kernel debugging. Is this true? How do
> I go about kernel debugging ‘properly’ on Hyper-V?
>
>
> -Brandon
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

Brandon Falk wrote:

Is it any faster than 115200, or is it just a typical COM debugging
session?

You should be able to answer that. It’s all virtual. There is no
serial hardware involved, so it runs infinitely fast. So to speak.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

I’ve had issues with VMWare where the emulated hardware emulates the speed
as well. I guess I’ll test it out to see. Hopefully it’s infinitely fast :slight_smile:

-Brandon

On Mon, Nov 5, 2012 at 4:02 PM, Tim Roberts wrote:

> Brandon Falk wrote:
> > Is it any faster than 115200, or is it just a typical COM debugging
> > session?
>
> You should be able to answer that. It’s all virtual. There is no
> serial hardware involved, so it runs infinitely fast. So to speak.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

It is not infinitely fast.

Bill Wandel

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Brandon Falk
Sent: Monday, November 05, 2012 5:09 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Hyper-V Kernel Debugging

I’ve had issues with VMWare where the emulated hardware emulates the speed
as well. I guess I’ll test it out to see. Hopefully it’s infinitely fast :slight_smile:

-Brandon

On Mon, Nov 5, 2012 at 4:02 PM, Tim Roberts wrote:

Brandon Falk wrote:
> Is it any faster than 115200, or is it just a typical COM debugging
> session?

You should be able to answer that. It’s all virtual. There is no
serial hardware involved, so it runs infinitely fast. So to speak.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and
other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the
List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Hi All,

I am new to KMDF USB driver.
I need to develop a USB Function Driver to implement a USB CDC ACM profile.

Output:

  1. Device Manager should display the USB CDC ACM profiles as virtual COM port

  2. When teraterm/Hyperterminal connected to the Virtual COM port, AT command /response should be working through the port
    Can anyone let me know how to proceed?
    I also want to know the difference between Virtual Serial port and usb cdc acm class driver.

Thanks in advance,
Shruthi

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Bill Wandel
Sent: Tuesday, November 06, 2012 3:48 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Hyper-V Kernel Debugging

It is not infinitely fast.

Bill Wandel

From: xxxxx@lists.osr.commailto:xxxxx [mailto:xxxxx@lists.osr.com]mailto: On Behalf Of Brandon Falk
Sent: Monday, November 05, 2012 5:09 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Hyper-V Kernel Debugging

I’ve had issues with VMWare where the emulated hardware emulates the speed as well. I guess I’ll test it out to see. Hopefully it’s infinitely fast :slight_smile:

-Brandon
On Mon, Nov 5, 2012 at 4:02 PM, Tim Roberts > wrote:
Brandon Falk wrote:
> Is it any faster than 115200, or is it just a typical COM debugging
> session?
You should be able to answer that. It’s all virtual. There is no
serial hardware involved, so it runs infinitely fast. So to speak.


Tim Roberts, xxxxx@probo.commailto:xxxxx
Providenza & Boekelheide, Inc.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

________________________________
SASKEN BUSINESS DISCLAIMER: This message may contain confidential, proprietary or legally privileged information. In case you are not the original intended Recipient of the message, you must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message and you are requested to delete it and inform the sender. Any views expressed in this message are those of the individual sender unless otherwise stated. Nothing contained in this message shall be construed as an offer or acceptance of any offer by Sasken Communication Technologies Limited (“Sasken”) unless sent with that express intent and with due authority of Sasken. Sasken has taken enough precautions to prevent the spread of viruses. However the company accepts no liability for any damage caused by any virus transmitted by this email.
Read Disclaimer at http://www.sasken.com/extras/mail_disclaimer.html</mailto:xxxxx></mailto:></mailto:xxxxx>

There is no speed emulation in Hyper-V’s COM port, so, it is very fast (though not infinitely).

According to what MS’s people told on this forum once, it was designed with WinDbg in mind, if not even for WinDbg.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

“Brandon Falk” wrote in message news:xxxxx@ntdev…
I’ve had issues with VMWare where the emulated hardware emulates the speed as well. I guess I’ll test it out to see. Hopefully it’s infinitely fast :slight_smile:

-Brandon

On Mon, Nov 5, 2012 at 4:02 PM, Tim Roberts wrote:

Brandon Falk wrote:
> Is it any faster than 115200, or is it just a typical COM debugging
> session?

You should be able to answer that. It’s all virtual. There is no
serial hardware involved, so it runs infinitely fast. So to speak.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

please read new windbg help topic for Hyper-V role: “Setting Up Network
Debugging of a Virtual Machine Host”

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Brandon Falk
Sent: Monday, November 05, 2012 7:18 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Hyper-V Kernel Debugging

I’ve decided to try out Hyper-V this week, and I’ve heard here and there
that Hyper-V allows for really quick kernel debugging. Is this true? How do
I go about kernel debugging ‘properly’ on Hyper-V?

-Brandon

— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and
other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the
List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Feels a lot like 115200 to me. Although I’m using a Win XP VM right now. Is
there some special configuration besides typical bcdedit/boot.ini settings
to add debugging? I’m going to try out a modern Windows 8 vm with network
and serial debugging and do some testing.

-Brandon

On Tue, Nov 6, 2012 at 7:58 AM, Petr Kurtin wrote:

> please read new windbg help topic for Hyper-V role: ?Setting Up Network
> Debugging of a Virtual Machine Host? **
>
>

>
>

>
> From: xxxxx@lists.osr.com [mailto:
> xxxxx@lists.osr.com] On Behalf Of Brandon Falk
> Sent: Monday, November 05, 2012 7:18 PM
>
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Hyper-V Kernel Debugging

>
> ****
>
> I’ve decided to try out Hyper-V this week, and I’ve heard here and there
> that Hyper-V allows for really quick kernel debugging. Is this true? How do
> I go about kernel debugging ‘properly’ on Hyper-V?
>
>

>
> -Brandon

>
> — NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and
> other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
> the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer ****
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

Petr, I’m pretty sure that Brandon was interested in debugging a guest, not the host. And while it is possible to debug the Hyper-V parent partition using network debugging, it’s more interesting for most people to debug the guest.

If the guest is Windows 8 or Server 2012, or if you manually copy kdvm.dll from Windows 8 to Windows 7, you can debug the guest as if it were a network debugging target, but without ever putting it on a network. We’ve added a debugger transport DLL which passes packets to the Hyper-V parent for placement on the network. This requires a little extra setup, and the integration didn’t make it all the way into Visual Studio. So if you’re comfortable using Windbg or Kd, you can enable another debugging path which is very fast and which doesn’t incur the overhead of the emulated serial port for the guest.

To set it up in the guest OS, you type, for example:

bcdedit /set dbgtransport kdvm.dll
bcdedit /set {default} loadoptions host_ip=“1.2.3.4”,host_port=“50000”,encryption_key=“cl.ea.rt.ext”
bcdedit /set debug on

The encryption key is up to you, but must be validly formed. The port is a dummy value which is ignored.

In the host OS, you tell it which guest(s) you want to enable this for and which ports to use, using the Hyper-V WMI interface. The port is actually used here. (Pick a useful and valid port.) I use a PowerShell script to do this, and it is below.

To start windbg or kd.exe in a way that will connect to this, type:

windbg -k net:port=50000,target=nameofhostmachinehere,key=cl.ea.rt.ext

Note again that this isn’t talking to the guest’s networking stack. It’s talking to the parent OS’s networking stack, using the parent OS’s name. The guest can be network connected, or not.

You can run the debugger itself either in the Parent OS or somewhere else. To the debugger, this is just another network debugging session.

  • Jake Oshins
    Windows Hyper-V Team

Powershell script begins here:

Argument initialization

$nextarg = “none”
$DebugPort = “unassigned”
$targetcomputer = “.”
$VMName = “”
$AutoAssign = “false”
$DebugOff = “false”

function funHelp()
{
$helpText=@"

DESCRIPTION:
NAME: synthdebug.ps1
Displays (and optionally sets) the debugport for synthetic debugging.

PARAMETERS:
-computerName Specifies the name of the computer upon which to run the script
-help prints help file
-vmname name of the VM of interest
-port (optional) ID of the channel to use for debugging
-debugoff
-autoassign

SYNTAX:
synthdebug.ps1 [-computerName targetcomputer] -vmname NameOfVM [-port PortNumber]

"@
$helpText
exit
}

foreach ($argument in $args)
{

parse commands with no following arguments

switch ($argument)
{
“?” {funHelp}
“help” {funHelp}
“-help” {funHelp}
“/?” {funHelp}
“-?” {funHelp}
“autoassign” {$AutoAssign = “true”}
“-autoassign” {$AutoAssign = “true”}
“/autoassign” {$AutoAssign = “true”}
“debugoff” {$DebugOff = “true”}
“-debugoff” {$DebugOff = “true”}
“/debugoff” {$DebugOff = “true”}
default {}
}

parse values that followed a switch

switch ($nextarg)
{
“vmname” {$VMName = $argument}
“-vmname” {$VMName = $argument}
“/vmname” {$VMName = $argument}
“port” {$DebugPort = $argument}
“-port” {$DebugPort = $argument}
“/port” {$DebugPort = $argument}
“-computername” {$targetcomputer = $argument}
default {}
}

$nextarg = $argument
}

if ($VMName -eq “”)
{
funHelp
}

#Get a VMManagementService object
$VMManagementService = gwmi -class “Msvm_VirtualSystemManagementService” -namespace “root\virtualization” -computername $targetcomputer

#Get the VM object that we want to modify
$query = “SELECT * FROM Msvm_ComputerSystem WHERE ElementName='” + $VMName + “'”
$VM = gwmi -query $query -namespace “root\virtualization” -computername $targetcomputer

#Get the VirtualSystemGlobalSettingData of the VM we want to modify
$query = “Associators of {$VM} WHERE AssocClass=MSVM_ElementSettingData ResultClass=Msvm_VirtualSystemGlobalSettingData”
$VMSystemGlobalSettingData = gwmi -query $query -namespace “root\virtualization” -computername $targetcomputer

Set a new debugport

if ($DebugPort -ne “unassigned”)
{
#Change the ElementName property
$VMSystemGlobalSettingData.DebugPort = $DebugPort
$VMSystemGlobalSettingData.DebugPortEnabled = 1

#Update the VM with ModifyVirtualSystem
$Result = $VMManagementService.ModifyVirtualSystem($VM.__PATH,$VMSystemGlobalSettingData.psbase.GetText(1))
}

Enable auto assigned debug ports

if ($AutoAssign -ne “false”)
{
#Change the ElementName property
$VMSystemGlobalSettingData.DebugPortEnabled = 2

#Update the VM with ModifyVirtualSystem
$Result = $VMManagementService.ModifyVirtualSystem($VM.__PATH,$VMSystemGlobalSettingData.psbase.GetText(1))
}

Turn off debugging

if ($DebugOff -ne “false”)
{
#Change the ElementName property
$VMSystemGlobalSettingData.DebugPortEnabled = 0

#Update the VM with ModifyVirtualSystem
$Result = $VMManagementService.ModifyVirtualSystem($VM.__PATH,$VMSystemGlobalSettingData.psbase.GetText(1))
}

$VMSystemGlobalSettingData

exit


From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Petr Kurtin
Sent: Tuesday, November 6, 2012 4:59 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Hyper-V Kernel Debugging

please read new windbg help topic for Hyper-V role: “Setting Up Network Debugging of a Virtual Machine Host”

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Brandon Falk
Sent: Monday, November 05, 2012 7:18 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Hyper-V Kernel Debugging

I’ve decided to try out Hyper-V this week, and I’ve heard here and there that Hyper-V allows for really quick kernel debugging. Is this true? How do I go about kernel debugging ‘properly’ on Hyper-V?

-Brandon
— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Thanks a lot Jake!

Would it be okay if I made a video of setting this all up and put it on
YouTube? I’d be supplying the script you posted.

Also, what is a good way to benchmark communication speeds in WinDbg? If
there isn’t a way, what would be a good way to write an
extension/benchmarking script? I feel like it’d be nice to have.

-Brandon

On Wed, Nov 7, 2012 at 1:30 PM, Jake Oshins wrote:

> Petr, I’m pretty sure that Brandon was interested in debugging a guest,
> not the host. And while it is possible to debug the Hyper-V parent
> partition using network debugging, it’s more interesting for most people to
> debug the guest.
>
> If the guest is Windows 8 or Server 2012, or if you manually copy kdvm.dll
> from Windows 8 to Windows 7, you can debug the guest as if it were a
> network debugging target, but without ever putting it on a network. We’ve
> added a debugger transport DLL which passes packets to the Hyper-V parent
> for placement on the network. This requires a little extra setup, and the
> integration didn’t make it all the way into Visual Studio. So if you’re
> comfortable using Windbg or Kd, you can enable another debugging path which
> is very fast and which doesn’t incur the overhead of the emulated serial
> port for the guest.
>
> To set it up in the guest OS, you type, for example:
>
> bcdedit /set dbgtransport kdvm.dll
> bcdedit /set {default} loadoptions
> host_ip=“1.2.3.4”,host_port=“50000”,encryption_key=“cl.ea.rt.ext”
> bcdedit /set debug on
>
> The encryption key is up to you, but must be validly formed. The port is
> a dummy value which is ignored.
>
> In the host OS, you tell it which guest(s) you want to enable this for and
> which ports to use, using the Hyper-V WMI interface. The port is actually
> used here. (Pick a useful and valid port.) I use a PowerShell script to
> do this, and it is below.
>
> To start windbg or kd.exe in a way that will connect to this, type:
>
> windbg -k net:port=50000,target=nameofhostmachinehere,key=cl.ea.rt.ext
>
> Note again that this isn’t talking to the guest’s networking stack. It’s
> talking to the parent OS’s networking stack, using the parent OS’s name.
> The guest can be network connected, or not.
>
> You can run the debugger itself either in the Parent OS or somewhere else.
> To the debugger, this is just another network debugging session.
>
>
> - Jake Oshins
> Windows Hyper-V Team
>
> Powershell script begins here:
>
> #
> # Argument initialization
> #
>
> $nextarg = “none”
> $DebugPort = “unassigned”
> $targetcomputer = “.”
> $VMName = “”
> $AutoAssign = “false”
> $DebugOff = “false”
>
> function funHelp()
> {
> $helpText=@"
>
> DESCRIPTION:
> NAME: synthdebug.ps1
> Displays (and optionally sets) the debugport for synthetic debugging.
>
> PARAMETERS:
> -computerName Specifies the name of the computer upon which to run the
> script
> -help prints help file
> -vmname name of the VM of interest
> -port (optional) ID of the channel to use for debugging
> -debugoff
> -autoassign
>
> SYNTAX:
> synthdebug.ps1 [-computerName targetcomputer] -vmname NameOfVM [-port
> PortNumber]
>
> "@
> $helpText
> exit
> }
>
>
> foreach ($argument in $args)
> {
> # parse commands with no following arguments
> switch ($argument)
> {
> “?” {funHelp}
> “help” {funHelp}
> “-help” {funHelp}
> “/?” {funHelp}
> “-?” {funHelp}
> “autoassign” {$AutoAssign = “true”}
> “-autoassign” {$AutoAssign = “true”}
> “/autoassign” {$AutoAssign = “true”}
> “debugoff” {$DebugOff = “true”}
> “-debugoff” {$DebugOff = “true”}
> “/debugoff” {$DebugOff = “true”}
> default {}
> }
>
> # parse values that followed a switch
>
> switch ($nextarg)
> {
> “vmname” {$VMName = $argument}
> “-vmname” {$VMName = $argument}
> “/vmname” {$VMName = $argument}
> “port” {$DebugPort = $argument}
> “-port” {$DebugPort = $argument}
> “/port” {$DebugPort = $argument}
> “-computername” {$targetcomputer = $argument}
> default {}
> }
>
> $nextarg = $argument
> }
>
> if ($VMName -eq “”)
> {
> funHelp
> }
>
> #Get a VMManagementService object
> $VMManagementService = gwmi -class “Msvm_VirtualSystemManagementService”
> -namespace “root\virtualization” -computername $targetcomputer
>
> #Get the VM object that we want to modify
> $query = “SELECT * FROM Msvm_ComputerSystem WHERE ElementName='” + $VMName
> + “'”
> $VM = gwmi -query $query -namespace “root\virtualization” -computername
> $targetcomputer
>
> #Get the VirtualSystemGlobalSettingData of the VM we want to modify
> $query = “Associators of {$VM} WHERE AssocClass=MSVM_ElementSettingData
> ResultClass=Msvm_VirtualSystemGlobalSettingData”
> $VMSystemGlobalSettingData = gwmi -query $query -namespace
> “root\virtualization” -computername $targetcomputer
>
> # Set a new debugport
> if ($DebugPort -ne “unassigned”)
> {
> #Change the ElementName property
> $VMSystemGlobalSettingData.DebugPort = $DebugPort
> $VMSystemGlobalSettingData.DebugPortEnabled = 1
>
> #Update the VM with ModifyVirtualSystem
> $Result =
> $VMManagementService.ModifyVirtualSystem($VM.__PATH,$VMSystemGlobalSettingData.psbase.GetText(1))
> }
>
> # Enable auto assigned debug ports
> if ($AutoAssign -ne “false”)
> {
> #Change the ElementName property
> $VMSystemGlobalSettingData.DebugPortEnabled = 2
>
> #Update the VM with ModifyVirtualSystem
> $Result =
> $VMManagementService.ModifyVirtualSystem($VM.__PATH,$VMSystemGlobalSettingData.psbase.GetText(1))
> }
>
> # Turn off debugging
> if ($DebugOff -ne “false”)
> {
> #Change the ElementName property
> $VMSystemGlobalSettingData.DebugPortEnabled = 0
>
> #Update the VM with ModifyVirtualSystem
> $Result =
> $VMManagementService.ModifyVirtualSystem($VM.__PATH,$VMSystemGlobalSettingData.psbase.GetText(1))
> }
>
>
>
> $VMSystemGlobalSettingData
>
> exit
>
>
>
> -------------------------------------------------------------------------
>
>
> From: xxxxx@lists.osr.com [mailto:
> xxxxx@lists.osr.com] On Behalf Of Petr Kurtin
> Sent: Tuesday, November 6, 2012 4:59 AM
> To: Windows System Software Devs Interest List
> Subject: RE: [ntdev] Hyper-V Kernel Debugging
>
> please read new windbg help topic for Hyper-V role: “Setting Up Network
> Debugging of a Virtual Machine Host”
>
>
> From: xxxxx@lists.osr.com [mailto:
> xxxxx@lists.osr.com] On Behalf Of Brandon Falk
> Sent: Monday, November 05, 2012 7:18 PM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] Hyper-V Kernel Debugging
>
> I’ve decided to try out Hyper-V this week, and I’ve heard here and there
> that Hyper-V allows for really quick kernel debugging. Is this true? How do
> I go about kernel debugging ‘properly’ on Hyper-V?
>
> -Brandon
> — NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and
> other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
> the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

My favorite two benchmarks are:

!stacks 2 ndis!
!ndiskd.pendingnbls

Since these are the two things I do most often :slight_smile:

This is a public forum. I’ll never post anything here that you can’t repeat.

Thanks for asking though,
Jake Oshins
Microsoft

From: Brandon Falk [mailto:xxxxx@brandonfa.lk]
Sent: Friday, November 16, 2012 1:07 PM
To: Windows System Software Devs Interest List
Cc: Jake Oshins
Subject: Re: [ntdev] Hyper-V Kernel Debugging

Thanks a lot Jake!

Would it be okay if I made a video of setting this all up and put it on YouTube? I’d be supplying the script you posted.

Also, what is a good way to benchmark communication speeds in WinDbg? If there isn’t a way, what would be a good way to write an extension/benchmarking script? I feel like it’d be nice to have.

-Brandon

On Wed, Nov 7, 2012 at 1:30 PM, Jake Oshins > wrote:
Petr, I’m pretty sure that Brandon was interested in debugging a guest, not the host. And while it is possible to debug the Hyper-V parent partition using network debugging, it’s more interesting for most people to debug the guest.

If the guest is Windows 8 or Server 2012, or if you manually copy kdvm.dll from Windows 8 to Windows 7, you can debug the guest as if it were a network debugging target, but without ever putting it on a network. We’ve added a debugger transport DLL which passes packets to the Hyper-V parent for placement on the network. This requires a little extra setup, and the integration didn’t make it all the way into Visual Studio. So if you’re comfortable using Windbg or Kd, you can enable another debugging path which is very fast and which doesn’t incur the overhead of the emulated serial port for the guest.

To set it up in the guest OS, you type, for example:

bcdedit /set dbgtransport kdvm.dll
bcdedit /set {default} loadoptions host_ip=“1.2.3.4”,host_port=“50000”,encryption_key=“cl.ea.rt.ext”
bcdedit /set debug on

The encryption key is up to you, but must be validly formed. The port is a dummy value which is ignored.

In the host OS, you tell it which guest(s) you want to enable this for and which ports to use, using the Hyper-V WMI interface. The port is actually used here. (Pick a useful and valid port.) I use a PowerShell script to do this, and it is below.

To start windbg or kd.exe in a way that will connect to this, type:

windbg -k net:port=50000,target=nameofhostmachinehere,key=cl.ea.rt.ext

Note again that this isn’t talking to the guest’s networking stack. It’s talking to the parent OS’s networking stack, using the parent OS’s name. The guest can be network connected, or not.

You can run the debugger itself either in the Parent OS or somewhere else. To the debugger, this is just another network debugging session.

- Jake Oshins
Windows Hyper-V Team

Powershell script begins here:

#
# Argument initialization
#

$nextarg = “none”
$DebugPort = “unassigned”
$targetcomputer = “.”
$VMName = “”
$AutoAssign = “false”
$DebugOff = “false”

function funHelp()
{
$helpText=@“

DESCRIPTION:
NAME: synthdebug.ps1
Displays (and optionally sets) the debugport for synthetic debugging.

PARAMETERS:
-computerName Specifies the name of the computer upon which to run the script
-help prints help file
-vmname name of the VM of interest
-port (optional) ID of the channel to use for debugging
-debugoff
-autoassign

SYNTAX:
synthdebug.ps1 [-computerName targetcomputer] -vmname NameOfVM [-port PortNumber]

”@
$helpText
exit
}

foreach ($argument in $args)
{
# parse commands with no following arguments
switch ($argument)
{
“?” {funHelp}
“help” {funHelp}
“-help” {funHelp}
“/?” {funHelp}
“-?” {funHelp}
“autoassign” {$AutoAssign = “true”}
“-autoassign” {$AutoAssign = “true”}
“/autoassign” {$AutoAssign = “true”}
“debugoff” {$DebugOff = “true”}
“-debugoff” {$DebugOff = “true”}
“/debugoff” {$DebugOff = “true”}
default {}
}

# parse values that followed a switch

switch ($nextarg)
{
“vmname” {$VMName = $argument}
“-vmname” {$VMName = $argument}
“/vmname” {$VMName = $argument}
“port” {$DebugPort = $argument}
“-port” {$DebugPort = $argument}
“/port” {$DebugPort = $argument}
“-computername” {$targetcomputer = $argument}
default {}
}

$nextarg = $argument
}

if ($VMName -eq “”)
{
funHelp
}

#Get a VMManagementService object
$VMManagementService = gwmi -class “Msvm_VirtualSystemManagementService” -namespace “root\virtualization” -computername $targetcomputer

#Get the VM object that we want to modify
$query = “SELECT * FROM Msvm_ComputerSystem WHERE ElementName='” + $VMName + “'”
$VM = gwmi -query $query -namespace “root\virtualization” -computername $targetcomputer

#Get the VirtualSystemGlobalSettingData of the VM we want to modify
$query = “Associators of {$VM} WHERE AssocClass=MSVM_ElementSettingData ResultClass=Msvm_VirtualSystemGlobalSettingData”
$VMSystemGlobalSettingData = gwmi -query $query -namespace “root\virtualization” -computername $targetcomputer

# Set a new debugport
if ($DebugPort -ne “unassigned”)
{
#Change the ElementName property
$VMSystemGlobalSettingData.DebugPort = $DebugPort
$VMSystemGlobalSettingData.DebugPortEnabled = 1

#Update the VM with ModifyVirtualSystem
$Result = $VMManagementService.ModifyVirtualSystem($VM.__PATH,$VMSystemGlobalSettingData.psbase.GetText(1))
}

# Enable auto assigned debug ports
if ($AutoAssign -ne “false”)
{
#Change the ElementName property
$VMSystemGlobalSettingData.DebugPortEnabled = 2

#Update the VM with ModifyVirtualSystem
$Result = $VMManagementService.ModifyVirtualSystem($VM.__PATH,$VMSystemGlobalSettingData.psbase.GetText(1))
}

# Turn off debugging
if ($DebugOff -ne “false”)
{
#Change the ElementName property
$VMSystemGlobalSettingData.DebugPortEnabled = 0

#Update the VM with ModifyVirtualSystem
$Result = $VMManagementService.ModifyVirtualSystem($VM.__PATH,$VMSystemGlobalSettingData.psbase.GetText(1))
}

$VMSystemGlobalSettingData

exit

-------------------------------------------------------------------------

From: xxxxx@lists.osr.commailto:xxxxx [mailto:xxxxx@lists.osr.commailto:xxxxx] On Behalf Of Petr Kurtin
Sent: Tuesday, November 6, 2012 4:59 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Hyper-V Kernel Debugging
please read new windbg help topic for Hyper-V role: “Setting Up Network Debugging of a Virtual Machine Host”

From: xxxxx@lists.osr.commailto:xxxxx [mailto:xxxxx@lists.osr.commailto:xxxxx] On Behalf Of Brandon Falk
Sent: Monday, November 05, 2012 7:18 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Hyper-V Kernel Debugging

I’ve decided to try out Hyper-V this week, and I’ve heard here and there that Hyper-V allows for really quick kernel debugging. Is this true? How do I go about kernel debugging ‘properly’ on Hyper-V?

-Brandon
— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx>

Am having trouble getting Hyper-V debugging to work after following Jake’s setup prescription, all I ever see is

"Microsoft (R) Windows Debugger Version 6.2.9200.16384 AMD64
Copyright (c) Microsoft Corporation. All rights reserved.

Using NET for debugging
Opened WinSock 2.0
Waiting to reconnect."

has anyone been successful in getting this to work?

Use emulated serial port instead of net, it works fine.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> Am having trouble getting Hyper-V debugging to work after following Jake’s setup prescription, all I ever see is
>
> “Microsoft (R) Windows Debugger Version 6.2.9200.16384 AMD64
> Copyright (c) Microsoft Corporation. All rights reserved.
>
> Using NET for debugging
> Opened WinSock 2.0
> Waiting to reconnect.”
>
> has anyone been successful in getting this to work?
>

I got it working and it is much faster than serial port debugging.

On Fri, Dec 28, 2012 at 10:54 AM, Maxim S. Shatskih
wrote:

> Use emulated serial port instead of net, it works fine.
>
> –
> Maxim S. Shatskih
> Windows DDK MVP
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
> wrote in message news:xxxxx@ntdev…
> > Am having trouble getting Hyper-V debugging to work after following
> Jake’s setup prescription, all I ever see is
> >
> > “Microsoft (R) Windows Debugger Version 6.2.9200.16384 AMD64
> > Copyright (c) Microsoft Corporation. All rights reserved.
> >
> > Using NET for debugging
> > Opened WinSock 2.0
> > Waiting to reconnect.”
> >
> > has anyone been successful in getting this to work?
> >
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

On 12/29/12, Joseph Parness wrote:
> I got it working and it is much faster than serial port debugging.

may we know why it wasn’t working in the first place

whose wand you got to make your spell

what was the spell

and what other Aramaic words did you uncover that “did what was said”

If people are interested I’ll be happy to post what I learned.

On Dec 28, 2012, at 9:00 PM, raj_r wrote:

> On 12/29/12, Joseph Parness wrote:
>> I got it working and it is much faster than serial port debugging.
>
> may we know why it wasn’t working in the first place
>
> whose wand you got to make your spell
>
> what was the spell
>
> and what other Aramaic words did you uncover that “did what was said”
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

>I got it working and it is much faster than serial port debugging.

Then emulated serial port? it is amazingly fast.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

From what I can tell there is no serial port emulation involved. I appears that the guys on the Hyper-V team installed hooks to allow for network emulation of some kind in conjunction with WMI, from what I have seen the speed is more like 1394 or faster.

On Dec 29, 2012, at 5:22 AM, Maxim S. Shatskih wrote:

>> I got it working and it is much faster than serial port debugging.
>
> Then emulated serial port? it is amazingly fast.
>
> –
> Maxim S. Shatskih
> Windows DDK MVP
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

The emulated serial port transport is not particularly fast. All of the other transports are significantly higher performance, including in Hyper-V.

  • S (Msft)

From: Maxim S. Shatskihmailto:xxxxx
Sent: ?12/?29/?2012 5:23
To: Windows System Software Devs Interest Listmailto:xxxxx
Subject: Re:[ntdev] Hyper-V Kernel Debugging

>I got it working and it is much faster than serial port debugging.

Then emulated serial port? it is amazingly fast.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx>