Re: [edk2] NvmExpressDxe async application crash with UDK debugger
There is a mistake I had in my code. The NVMe command Packet is a local variable to ReadSectors, whose address is being passed to PassThru. So PassThru will return after pushing the command to async submission queue and create an AsyncRequest and insert it in AsyncPassThruQueueand return. So the AsyncRequest->Packet is holding an address of a stack variable of ReadSector. After getting return from PassThru the ReadSector also return after that. This left the address of Packet to be stale which is being access in ProcessAsyncTaskList at // // Copy the Respose Queue entry for this command to the callers // response buffer. // CopyMem ( AsyncRequest->Packet->NvmeCompletion, Cq, sizeof(EFI_NVM_EXPRESS_COMPLETION) ); In this case AsyncRequest->Packet is a stale address. I allocated Packet structure using AllocateZeroPool in ReadSectors and run the application multiple times and have not yet observed crash. Thanks for your effort and apologize for my mistake. Regards, Arka On Thu, Apr 13, 2017 at 11:16 AM, Wu, Hao A wrote: > Hi Arka, > > I will help to look into this problem and will try to reproduce it first. > > Best Regards, > Hao Wu > > >> -Original Message- >> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Arka >> Sharma >> Sent: Wednesday, April 12, 2017 2:05 PM >> To: Tian, Feng >> Cc: edk2-devel@lists.01.org >> Subject: Re: [edk2] NvmExpressDxe async application crash with UDK debugger >> >> Please find attached source. Also the variables to detect completion are >> not volatile. I have checked in disassembly they are fetched from memory in >> the completion loop. >> >> Regards, >> Arka >> >> On 12 Apr 2017 10:37 a.m., "Tian, Feng" wrote: >> >> > Arka, >> > >> > Could you please share us your test code? >> > >> > Thanks >> > Feng >> > >> > -Original Message- >> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of >> > Arka Sharma >> > Sent: Wednesday, April 12, 2017 12:59 PM >> > To: edk2-devel@lists.01.org >> > Subject: [edk2] NvmExpressDxe async application crash with UDK debugger >> > >> > Hi, >> > >> > I am testing async io in NvmExpressDxe. The target system is Asrock >> > Z97 which I have connected to host with serial port where UDK debugger is >> > running. So my application does following >> > >> > 1. CreateEvent >> > 2. Call Passthru >> > 3. CmdSent++; >> > 4. Repeat 1-3 until not ready from driver 5. while (CmdRecd < CmdSent); 4. >> > Close all the events. >> > >> > CmdRecvd is incremented inside EventCallback. I am allocating both CmdSent >> > and CmdRecvd and passing the address of CmdRecvd in CreateEvent. With >> this >> > I face WinDbg exception quite often and it says "Target encountered an >> > exception: Vector = 6, Error Code = ". >> > I can share the application code for more clarity. I am building with /Od >> > and GenFw with --keepexceptiontable >> > >> > Regards, >> > Arka >> > ___ >> > edk2-devel mailing list >> > edk2-devel@lists.01.org >> > https://lists.01.org/mailman/listinfo/edk2-devel >> > >> ___ >> edk2-devel mailing list >> edk2-devel@lists.01.org >> https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] NvmExpressDxe async application crash with UDK debugger
Please find attached source. Also the variables to detect completion are not volatile. I have checked in disassembly they are fetched from memory in the completion loop. Regards, Arka On 12 Apr 2017 10:37 a.m., "Tian, Feng" wrote: > Arka, > > Could you please share us your test code? > > Thanks > Feng > > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of > Arka Sharma > Sent: Wednesday, April 12, 2017 12:59 PM > To: edk2-devel@lists.01.org > Subject: [edk2] NvmExpressDxe async application crash with UDK debugger > > Hi, > > I am testing async io in NvmExpressDxe. The target system is Asrock > Z97 which I have connected to host with serial port where UDK debugger is > running. So my application does following > > 1. CreateEvent > 2. Call Passthru > 3. CmdSent++; > 4. Repeat 1-3 until not ready from driver 5. while (CmdRecd < CmdSent); 4. > Close all the events. > > CmdRecvd is incremented inside EventCallback. I am allocating both CmdSent > and CmdRecvd and passing the address of CmdRecvd in CreateEvent. With this > I face WinDbg exception quite often and it says "Target encountered an > exception: Vector = 6, Error Code = ". > I can share the application code for more clarity. I am building with /Od > and GenFw with --keepexceptiontable > > Regards, > Arka > ___ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel > ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] NvmExpressDxe async application crash with UDK debugger
Hi, I am testing async io in NvmExpressDxe. The target system is Asrock Z97 which I have connected to host with serial port where UDK debugger is running. So my application does following 1. CreateEvent 2. Call Passthru 3. CmdSent++; 4. Repeat 1-3 until not ready from driver 5. while (CmdRecd < CmdSent); 4. Close all the events. CmdRecvd is incremented inside EventCallback. I am allocating both CmdSent and CmdRecvd and passing the address of CmdRecvd in CreateEvent. With this I face WinDbg exception quite often and it says "Target encountered an exception: Vector = 6, Error Code = ". I can share the application code for more clarity. I am building with /Od and GenFw with --keepexceptiontable Regards, Arka ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] NvmExpressDxe TimerEvent frequency
Hi, UEFI Driver Write Guide section 5.1.6 says "UEFI system firmware uses a hardware timer interrupt to measure time. These. These time measurements are used to determine when enough time has passed to signal a timer event programmed with SetTimer(). In most systems, the timer interrupt is generated every 10 ms to 50 ms, but the UEFI Specification does not require any specific interrupt rate. This lack of specificity means that a periodic timer programmed with a period much smaller than 10 ms may only be signaled every 10 ms to 50 ms.". So in case of NvmExpressDxe the Private->TimerEvent is set with 1 ms, so the frequency of the routine ProcessAsyncTaskList might be more than 1 ms as per the frequency of the timer interrupt ? Regards, Arka ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] Using Intel UDk debugger
When I try to set break point after launching the application and CpuBreakpoint() is hit and symbols are seen in lmv command, the breakpoints are set using F9. I can list them with bl. But if I attempt to set a breakpoint with F9 before CpuBreakpoint is called WinDbg pops up a dialog box throwing the following error message "Symbol information for the current line could not be located in the currently loaded symbols.Do you want the debugger to load and search the remaining symbols? Yes performs the search immediately. No returns to the UI while search proceeds. Canel exits the operation.". If I select 'yes' then it shows breakpoint not set. In this case there is no symbols loaded for my application which I confirmed using lmv. The CpuBreakpoint() approach is ok for debugging the application. But I am also debugging the driver whose io routines are called by my application. The driver is loaded from Pci expansion ROM. I can manually load it from shell as well, but that will need code changes and rebuilding of the driver. That is why I am trying to figure out alternative approach. Regards, Arka On Sun, Apr 2, 2017 at 7:26 AM, Ni, Ruiyu wrote: > Arka, > Can you try to set unresolved breakpoint through Graphics UI? > Open the App.c file in WinDbg and put the caret in the line you want > to set breakpoint. Press F9 to set it. than use bl to confirm. > > Regards, > Ray > >>-Original Message- >>From: Arka Sharma [mailto:arka.sw1...@gmail.com] >>Sent: Saturday, April 1, 2017 4:57 PM >>To: Ni, Ruiyu >>Cc: Fan, Jeff ; edk2-devel@lists.01.org >>Subject: Re: [edk2] Using Intel UDk debugger >> >>Thanks Jeff and Ray. As of now I am using CpuBreakPoint() in the entry >>point of my application. Once I start the application __debugbreak() >>is getting called and I am able to set additional breakpoints. Also I >>confirmed the symbols are loaded using lmv. When I am trying to use >>unresolved breakpoint I was using "bu `!>name>:" syntax, when I was not using CpuBreakPoint(). I >>am using the same source in WinDbg as the image and symbol. After >>executing bu command in WinDbg I can find the breakpoint using bl >>command. >> >>On Sat, Apr 1, 2017 at 10:38 AM, Ni, Ruiyu wrote: >>> Arka, >>> Can you make sure that the source code is not modified after the image >>> symbol >>> is generated by compiler? >>> And can you send me a screenshot of WinDbg when you are using the unresolved >>> breakpoint feature? I need to see which command is auto-pasted to WinDbg >>> from >>> UDK Debugger. >>> >>> Thanks/Ray >>> >>>> -Original Message- >>>> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of >>>> Arka Sharma >>>> Sent: Friday, March 31, 2017 5:18 PM >>>> To: Fan, Jeff >>>> Cc: edk2-devel@lists.01.org >>>> Subject: Re: [edk2] Using Intel UDk debugger >>>> >>>> Thanks Jeff. Using CpuBreakPoint() has temporarily solved the purpose. But >>>> I need the symbols to be loaded properly. Please let me know if I missed >>>> something in building the application. As mentioned earlier I have disabled >>>> optimization and used --keepexceptiontable in GenFw. Is there something >>>> else I need to do. >>>> >>>> Regards, >>>> Arka >>>> >>>> On Fri, Mar 31, 2017 at 12:58 PM, Fan, Jeff wrote: >>>> > It seems that symbols are not load correctly. >>>> > >>>> > Could you add CpuBreakpoint () in your application code to trigger SW >>>> breakpoint by code instead of setting unresolved breakpoint by Windbg? >>>> And to check if it could break at CpuBreakpoint() and symbols if could be >>>> loaded correctly. >>>> > >>>> > Jeff >>>> > -Original Message- >>>> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of >>>> > Arka Sharma >>>> > Sent: Friday, March 31, 2017 2:53 PM >>>> > To: Fan, Jeff >>>> > Cc: edk2-devel@lists.01.org >>>> > Subject: Re: [edk2] Using Intel UDk debugger >>>> > >>>> > I have built my application with /Od and /Oy-, and GENFW_FLAGS as -- >>>> keepexceptiontable. After loading DebugAgentDxe I have set an unresolved >>>> breakpoint in main routine of my application, but when I start my >>>> application >>>> in the target no breakpoint is hit. But when the application crashes the >>>> symbols are
Re: [edk2] Using Intel UDk debugger
Thanks Jeff and Ray. As of now I am using CpuBreakPoint() in the entry point of my application. Once I start the application __debugbreak() is getting called and I am able to set additional breakpoints. Also I confirmed the symbols are loaded using lmv. When I am trying to use unresolved breakpoint I was using "bu `!:" syntax, when I was not using CpuBreakPoint(). I am using the same source in WinDbg as the image and symbol. After executing bu command in WinDbg I can find the breakpoint using bl command. On Sat, Apr 1, 2017 at 10:38 AM, Ni, Ruiyu wrote: > Arka, > Can you make sure that the source code is not modified after the image symbol > is generated by compiler? > And can you send me a screenshot of WinDbg when you are using the unresolved > breakpoint feature? I need to see which command is auto-pasted to WinDbg from > UDK Debugger. > > Thanks/Ray > >> -Original Message- >> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of >> Arka Sharma >> Sent: Friday, March 31, 2017 5:18 PM >> To: Fan, Jeff >> Cc: edk2-devel@lists.01.org >> Subject: Re: [edk2] Using Intel UDk debugger >> >> Thanks Jeff. Using CpuBreakPoint() has temporarily solved the purpose. But >> I need the symbols to be loaded properly. Please let me know if I missed >> something in building the application. As mentioned earlier I have disabled >> optimization and used --keepexceptiontable in GenFw. Is there something >> else I need to do. >> >> Regards, >> Arka >> >> On Fri, Mar 31, 2017 at 12:58 PM, Fan, Jeff wrote: >> > It seems that symbols are not load correctly. >> > >> > Could you add CpuBreakpoint () in your application code to trigger SW >> breakpoint by code instead of setting unresolved breakpoint by Windbg? >> And to check if it could break at CpuBreakpoint() and symbols if could be >> loaded correctly. >> > >> > Jeff >> > -Original Message- >> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of >> > Arka Sharma >> > Sent: Friday, March 31, 2017 2:53 PM >> > To: Fan, Jeff >> > Cc: edk2-devel@lists.01.org >> > Subject: Re: [edk2] Using Intel UDk debugger >> > >> > I have built my application with /Od and /Oy-, and GENFW_FLAGS as -- >> keepexceptiontable. After loading DebugAgentDxe I have set an unresolved >> breakpoint in main routine of my application, but when I start my application >> in the target no breakpoint is hit. But when the application crashes the >> symbols are properly loaded in WinDbg and the asm code for the crash is >> displayed. >> > >> > Regards, >> > Arka >> > >> > On Fri, Mar 31, 2017 at 9:03 AM, Fan, Jeff wrote: >> >> Yes. >> >> >> >> If you want to enable flow control, you could set >> gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseHardwareFlowControl|TR >> UE in SourceLevelDebugPkg.dsc when you build DebugAgentDxe.efi. >> >> >> >> It could improve the serial port communication quality. >> >> >> >> Thanks! >> >> Jeff >> >> >> >> -Original Message- >> >> From: Arka Sharma [mailto:arka.sw1...@gmail.com] >> >> Sent: Friday, March 31, 2017 11:23 AM >> >> To: Fan, Jeff >> >> Cc: edk2-devel@lists.01.org >> >> Subject: Re: [edk2] Using Intel UDk debugger >> >> >> >> Thanks a lot Jeff. Setting FlowControl to 0 worked. Now I am able to break >> into the target system. Just wondering is it same as mentioned in >> UDK_Debugger_Tool_User_Manual_V1.11.pdf 2.2.3.2 "If the platform- >> specific Serial Port Library does not support hardware flow control, flow >> control on the host machine should be turned off as well." >> >> >> >> Regards, >> >> Arka >> >> >> >> On Fri, Mar 31, 2017 at 8:23 AM, Fan, Jeff wrote: >> >>> It's good start. Please drop the putty from now. >> >>> >> >>> Please check the following setting in SoftDebugger.ini on HOST side, >> >>> and change FlowControl to 0 and change Trace to 0x10 >> >>> >> >>> [Debug Port] >> >>> Channel = Serial >> >>> Port = COM1 >> >>> FlowControl = 0 >> >>> BaudRate = 115200 >> >>> Server = >> >>> >> >>> [Maintenance] >> >>> ; Uncomment the below line to turn on tracing >> >>> Trace=0x10 >> >>> >>
Re: [edk2] Using Intel UDk debugger
Thanks Jeff. Using CpuBreakPoint() has temporarily solved the purpose. But I need the symbols to be loaded properly. Please let me know if I missed something in building the application. As mentioned earlier I have disabled optimization and used --keepexceptiontable in GenFw. Is there something else I need to do. Regards, Arka On Fri, Mar 31, 2017 at 12:58 PM, Fan, Jeff wrote: > It seems that symbols are not load correctly. > > Could you add CpuBreakpoint () in your application code to trigger SW > breakpoint by code instead of setting unresolved breakpoint by Windbg? And to > check if it could break at CpuBreakpoint() and symbols if could be loaded > correctly. > > Jeff > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Arka > Sharma > Sent: Friday, March 31, 2017 2:53 PM > To: Fan, Jeff > Cc: edk2-devel@lists.01.org > Subject: Re: [edk2] Using Intel UDk debugger > > I have built my application with /Od and /Oy-, and GENFW_FLAGS as > --keepexceptiontable. After loading DebugAgentDxe I have set an unresolved > breakpoint in main routine of my application, but when I start my application > in the target no breakpoint is hit. But when the application crashes the > symbols are properly loaded in WinDbg and the asm code for the crash is > displayed. > > Regards, > Arka > > On Fri, Mar 31, 2017 at 9:03 AM, Fan, Jeff wrote: >> Yes. >> >> If you want to enable flow control, you could set >> gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseHardwareFlowControl|TRUE in >> SourceLevelDebugPkg.dsc when you build DebugAgentDxe.efi. >> >> It could improve the serial port communication quality. >> >> Thanks! >> Jeff >> >> -Original Message- >> From: Arka Sharma [mailto:arka.sw1...@gmail.com] >> Sent: Friday, March 31, 2017 11:23 AM >> To: Fan, Jeff >> Cc: edk2-devel@lists.01.org >> Subject: Re: [edk2] Using Intel UDk debugger >> >> Thanks a lot Jeff. Setting FlowControl to 0 worked. Now I am able to break >> into the target system. Just wondering is it same as mentioned in >> UDK_Debugger_Tool_User_Manual_V1.11.pdf 2.2.3.2 "If the platform-specific >> Serial Port Library does not support hardware flow control, flow control on >> the host machine should be turned off as well." >> >> Regards, >> Arka >> >> On Fri, Mar 31, 2017 at 8:23 AM, Fan, Jeff wrote: >>> It's good start. Please drop the putty from now. >>> >>> Please check the following setting in SoftDebugger.ini on HOST side, >>> and change FlowControl to 0 and change Trace to 0x10 >>> >>> [Debug Port] >>> Channel = Serial >>> Port = COM1 >>> FlowControl = 0 >>> BaudRate = 115200 >>> Server = >>> >>> [Maintenance] >>> ; Uncomment the below line to turn on tracing >>> Trace=0x10 >>> >>> You could start intel UDK debugger tool on HOST side and then load >>> DebugAgentDxe on target side. If you still cannot connect Windbg, please >>> send me udk-debugger-trace.log file under C:\User\xxx\. >>> >>> Thanks! >>> Jeff >>> >>> -Original Message- >>> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf >>> Of Arka Sharma >>> Sent: Friday, March 31, 2017 10:45 AM >>> To: Fan, Jeff >>> Cc: edk2-devel@lists.01.org >>> Subject: Re: [edk2] Using Intel UDk debugger >>> >>> After changing the putty settings I am getting this message "Send INIT >>> break packet and try to connect the HOST (Intel(R) UDK Debugger Tool v1.5)" >>> followed by þ?Yºþ?Yºþ?YºHOST connection is failed! Am I missing some other >>> settings ? >>> >>> Regards, >>> Arka >>> >>> On Fri, Mar 31, 2017 at 7:58 AM, Fan, Jeff wrote: >>>> It's better if there is no Serial driver to manage the serial port. >>>> >>>> DebugAgentDxe built from SourceLevelDebugPkg is consuming >>>> MdeModulePkg\Library\BaseSerialPortLib16550\BaseSerialPortLib16550.inf to >>>> read/write data from serial port. >>>> >>>> SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerial >>>> SerialPortLib|P >>>> SerialPortLib|o >>>> rtLib16550.inf >>>> >>>> It's default Serial port parameters are: BaudRate:115200, Data: 8 bit, >>>> Parity: none, Stop: 1 bit, Flow control: none Please check your putty COM >>>> setting. >
Re: [edk2] Using Intel UDk debugger
I have built my application with /Od and /Oy-, and GENFW_FLAGS as --keepexceptiontable. After loading DebugAgentDxe I have set an unresolved breakpoint in main routine of my application, but when I start my application in the target no breakpoint is hit. But when the application crashes the symbols are properly loaded in WinDbg and the asm code for the crash is displayed. Regards, Arka On Fri, Mar 31, 2017 at 9:03 AM, Fan, Jeff wrote: > Yes. > > If you want to enable flow control, you could set > gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseHardwareFlowControl|TRUE in > SourceLevelDebugPkg.dsc when you build DebugAgentDxe.efi. > > It could improve the serial port communication quality. > > Thanks! > Jeff > > -----Original Message- > From: Arka Sharma [mailto:arka.sw1...@gmail.com] > Sent: Friday, March 31, 2017 11:23 AM > To: Fan, Jeff > Cc: edk2-devel@lists.01.org > Subject: Re: [edk2] Using Intel UDk debugger > > Thanks a lot Jeff. Setting FlowControl to 0 worked. Now I am able to break > into the target system. Just wondering is it same as mentioned in > UDK_Debugger_Tool_User_Manual_V1.11.pdf 2.2.3.2 "If the platform-specific > Serial Port Library does not support hardware flow control, flow control on > the host machine should be turned off as well." > > Regards, > Arka > > On Fri, Mar 31, 2017 at 8:23 AM, Fan, Jeff wrote: >> It's good start. Please drop the putty from now. >> >> Please check the following setting in SoftDebugger.ini on HOST side, >> and change FlowControl to 0 and change Trace to 0x10 >> >> [Debug Port] >> Channel = Serial >> Port = COM1 >> FlowControl = 0 >> BaudRate = 115200 >> Server = >> >> [Maintenance] >> ; Uncomment the below line to turn on tracing >> Trace=0x10 >> >> You could start intel UDK debugger tool on HOST side and then load >> DebugAgentDxe on target side. If you still cannot connect Windbg, please >> send me udk-debugger-trace.log file under C:\User\xxx\. >> >> Thanks! >> Jeff >> >> -Original Message- >> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of >> Arka Sharma >> Sent: Friday, March 31, 2017 10:45 AM >> To: Fan, Jeff >> Cc: edk2-devel@lists.01.org >> Subject: Re: [edk2] Using Intel UDk debugger >> >> After changing the putty settings I am getting this message "Send INIT >> break packet and try to connect the HOST (Intel(R) UDK Debugger Tool v1.5)" >> followed by þ?Yºþ?Yºþ?YºHOST connection is failed! Am I missing some other >> settings ? >> >> Regards, >> Arka >> >> On Fri, Mar 31, 2017 at 7:58 AM, Fan, Jeff wrote: >>> It's better if there is no Serial driver to manage the serial port. >>> >>> DebugAgentDxe built from SourceLevelDebugPkg is consuming >>> MdeModulePkg\Library\BaseSerialPortLib16550\BaseSerialPortLib16550.inf to >>> read/write data from serial port. >>> >>> SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialP >>> SerialPortLib|o >>> rtLib16550.inf >>> >>> It's default Serial port parameters are: BaudRate:115200, Data: 8 bit, >>> Parity: none, Stop: 1 bit, Flow control: none Please check your putty COM >>> setting. >>> >>> When DebugAgentDxe is loaded, we expected the following words could be >>> output from serial port. >>> "Send INIT break packet and try to connect the HOST (Intel(R) UDK >>> Debugger Tool v1.5)" >>> >>> Thanks! >>> Jeff >>> >>> -Original Message- >>> From: Arka Sharma [mailto:arka.sw1...@gmail.com] >>> Sent: Friday, March 31, 2017 10:14 AM >>> To: Fan, Jeff >>> Cc: edk2-devel@lists.01.org >>> Subject: Re: [edk2] Using Intel UDk debugger >>> >>> When I load DebugAgentDxe I get cFÃ×ÿ?käÿÿÿã+þ in putty. Also when I boot >>> to shell there is not IsaSerialDxe or any other driver managing the serial >>> port. I manually located the serial port with "devices". In the shell when >>> I load DebugAgentDxe I get the same text as mentioned in Step 8 of section >>> 9.11 in UDK_Debugger_Tool_User_Manual_V1.11.pdf. >>> And the load status is success. >>> >>> Regards, >>> Arka >>> >>> On Fri, Mar 31, 2017 at 7:19 AM, Fan, Jeff wrote: >>>> DebugAgentDxe will consume Serial Port to setup debug channel with HOST. >>>> >>>> Please shutdown the UDK debug HOST software and use any serial tool (Li
Re: [edk2] Using Intel UDk debugger
Thanks a lot Jeff. Setting FlowControl to 0 worked. Now I am able to break into the target system. Just wondering is it same as mentioned in UDK_Debugger_Tool_User_Manual_V1.11.pdf 2.2.3.2 "If the platform-specific Serial Port Library does not support hardware flow control, flow control on the host machine should be turned off as well." Regards, Arka On Fri, Mar 31, 2017 at 8:23 AM, Fan, Jeff wrote: > It's good start. Please drop the putty from now. > > Please check the following setting in SoftDebugger.ini on HOST side, and > change FlowControl to 0 and change Trace to 0x10 > > [Debug Port] > Channel = Serial > Port = COM1 > FlowControl = 0 > BaudRate = 115200 > Server = > > [Maintenance] > ; Uncomment the below line to turn on tracing > Trace=0x10 > > You could start intel UDK debugger tool on HOST side and then load > DebugAgentDxe on target side. If you still cannot connect Windbg, please > send me udk-debugger-trace.log file under C:\User\xxx\. > > Thanks! > Jeff > > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Arka > Sharma > Sent: Friday, March 31, 2017 10:45 AM > To: Fan, Jeff > Cc: edk2-devel@lists.01.org > Subject: Re: [edk2] Using Intel UDk debugger > > After changing the putty settings I am getting this message "Send INIT break > packet and try to connect the HOST (Intel(R) UDK Debugger Tool v1.5)" > followed by þ?Yºþ?Yºþ?YºHOST connection is failed! Am I missing some other > settings ? > > Regards, > Arka > > On Fri, Mar 31, 2017 at 7:58 AM, Fan, Jeff wrote: >> It's better if there is no Serial driver to manage the serial port. >> >> DebugAgentDxe built from SourceLevelDebugPkg is consuming >> MdeModulePkg\Library\BaseSerialPortLib16550\BaseSerialPortLib16550.inf to >> read/write data from serial port. >> >> SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPo >> rtLib16550.inf >> >> It's default Serial port parameters are: BaudRate:115200, Data: 8 bit, >> Parity: none, Stop: 1 bit, Flow control: none Please check your putty COM >> setting. >> >> When DebugAgentDxe is loaded, we expected the following words could be >> output from serial port. >> "Send INIT break packet and try to connect the HOST (Intel(R) UDK Debugger >> Tool v1.5)" >> >> Thanks! >> Jeff >> >> -Original Message- >> From: Arka Sharma [mailto:arka.sw1...@gmail.com] >> Sent: Friday, March 31, 2017 10:14 AM >> To: Fan, Jeff >> Cc: edk2-devel@lists.01.org >> Subject: Re: [edk2] Using Intel UDk debugger >> >> When I load DebugAgentDxe I get cFÃ×ÿ?käÿÿÿã+þ in putty. Also when I boot to >> shell there is not IsaSerialDxe or any other driver managing the serial >> port. I manually located the serial port with "devices". In the shell when I >> load DebugAgentDxe I get the same text as mentioned in Step 8 of section >> 9.11 in UDK_Debugger_Tool_User_Manual_V1.11.pdf. >> And the load status is success. >> >> Regards, >> Arka >> >> On Fri, Mar 31, 2017 at 7:19 AM, Fan, Jeff wrote: >>> DebugAgentDxe will consume Serial Port to setup debug channel with HOST. >>> >>> Please shutdown the UDK debug HOST software and use any serial tool (Like >>> putty). Are there any output when you load DebugAgentDxe in shell? Could >>> you paste here? >>> >>> You need to make sure the DebugAgentDxe used the correct serial port >>> parameter on your platform. >>> >>> Thanks! >>> Jeff >>> >>> -Original Message- >>> From: Arka Sharma [mailto:arka.sw1...@gmail.com] >>> Sent: Friday, March 31, 2017 9:40 AM >>> To: Kinney, Michael D >>> Cc: Fan, Jeff; edk2-devel@lists.01.org >>> Subject: Re: [edk2] Using Intel UDk debugger >>> >>> Thanks a lot Mike. You are right. I have installed WinDbg 6.11.1404. >>> Now the issue I mentioned earlier is not seen. But I am still not able to >>> break into target system. I have loaded the DebugAgentDxe and loading was >>> success. But in the shell I can find that still the serial port handle is >>> not managed by any driver. >>> >>> Regards, >>> Arka >>> >>> On Thu, Mar 30, 2017 at 9:28 PM, Kinney, Michael D >>> wrote: >>>> Hi Arka, >>>> >>>> I have seen that error when the wrong version of WinDbg is used. >>>> >>>> What version of WinDbg did you install? >>>> >>
Re: [edk2] Using Intel UDk debugger
After changing the putty settings I am getting this message "Send INIT break packet and try to connect the HOST (Intel(R) UDK Debugger Tool v1.5)" followed by þ?Yºþ?Yºþ?YºHOST connection is failed! Am I missing some other settings ? Regards, Arka On Fri, Mar 31, 2017 at 7:58 AM, Fan, Jeff wrote: > It's better if there is no Serial driver to manage the serial port. > > DebugAgentDxe built from SourceLevelDebugPkg is consuming > MdeModulePkg\Library\BaseSerialPortLib16550\BaseSerialPortLib16550.inf to > read/write data from serial port. > > SerialPortLib|MdeModulePkg/Library/BaseSerialPortLib16550/BaseSerialPortLib16550.inf > > It's default Serial port parameters are: BaudRate:115200, Data: 8 bit, > Parity: none, Stop: 1 bit, Flow control: none Please check your putty COM > setting. > > When DebugAgentDxe is loaded, we expected the following words could be output > from serial port. > "Send INIT break packet and try to connect the HOST (Intel(R) UDK Debugger > Tool v1.5)" > > Thanks! > Jeff > > -Original Message- > From: Arka Sharma [mailto:arka.sw1...@gmail.com] > Sent: Friday, March 31, 2017 10:14 AM > To: Fan, Jeff > Cc: edk2-devel@lists.01.org > Subject: Re: [edk2] Using Intel UDk debugger > > When I load DebugAgentDxe I get cFÃ×ÿ?käÿÿÿã+þ in putty. Also when I boot to > shell there is not IsaSerialDxe or any other driver managing the serial port. > I manually located the serial port with "devices". In the shell when I load > DebugAgentDxe I get the same text as mentioned in Step 8 of section 9.11 in > UDK_Debugger_Tool_User_Manual_V1.11.pdf. > And the load status is success. > > Regards, > Arka > > On Fri, Mar 31, 2017 at 7:19 AM, Fan, Jeff wrote: >> DebugAgentDxe will consume Serial Port to setup debug channel with HOST. >> >> Please shutdown the UDK debug HOST software and use any serial tool (Like >> putty). Are there any output when you load DebugAgentDxe in shell? Could >> you paste here? >> >> You need to make sure the DebugAgentDxe used the correct serial port >> parameter on your platform. >> >> Thanks! >> Jeff >> >> -Original Message- >> From: Arka Sharma [mailto:arka.sw1...@gmail.com] >> Sent: Friday, March 31, 2017 9:40 AM >> To: Kinney, Michael D >> Cc: Fan, Jeff; edk2-devel@lists.01.org >> Subject: Re: [edk2] Using Intel UDk debugger >> >> Thanks a lot Mike. You are right. I have installed WinDbg 6.11.1404. >> Now the issue I mentioned earlier is not seen. But I am still not able to >> break into target system. I have loaded the DebugAgentDxe and loading was >> success. But in the shell I can find that still the serial port handle is >> not managed by any driver. >> >> Regards, >> Arka >> >> On Thu, Mar 30, 2017 at 9:28 PM, Kinney, Michael D >> wrote: >>> Hi Arka, >>> >>> I have seen that error when the wrong version of WinDbg is used. >>> >>> What version of WinDbg did you install? >>> >>> Does it match the version listed in the UDK Debugger manual? >>> >>> Mike >>> >>>> -Original Message- >>>> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf >>>> Of Arka Sharma >>>> Sent: Thursday, March 30, 2017 2:43 AM >>>> To: Fan, Jeff >>>> Cc: edk2-devel@lists.01.org >>>> Subject: Re: [edk2] Using Intel UDk debugger >>>> >>>> I have also verified the null modem connection by booting to windows >>>> in my target pc, and I am able to break it in WinDbg. So the >>>> communication is ok. In the target system shell when I load the >>>> DebugAgentDxe it is not appeared in the "drivers -b". Also in my >>>> system the serial port is not managed by any driver initially. So I >>>> located it using "devices" and the issued "load -nc >>>> DebugAgentDxe.efi". >>>> >>>> Regards, >>>> Arka >>>> >>>> On Thu, Mar 30, 2017 at 2:27 PM, Arka Sharma wrote: >>>> > Thanks Jeff for your reply. I followed the steps as mentioned in >>>> > "9.11 Debugging a standalone module loaded in a UEFI shell". I >>>> > have built DebugAgentDxe and loaded it in my target system. I >>>> > cross checked in my target system UEFI setup Serial is enabled. In >>>> > host I have installed >>>> > WinDbgX64 and UDK debugger. I have configured the debug port COM1, >>>&
Re: [edk2] Using Intel UDk debugger
When I load DebugAgentDxe I get cFÃ×ÿ?käÿÿÿã+þ in putty. Also when I boot to shell there is not IsaSerialDxe or any other driver managing the serial port. I manually located the serial port with "devices". In the shell when I load DebugAgentDxe I get the same text as mentioned in Step 8 of section 9.11 in UDK_Debugger_Tool_User_Manual_V1.11.pdf. And the load status is success. Regards, Arka On Fri, Mar 31, 2017 at 7:19 AM, Fan, Jeff wrote: > DebugAgentDxe will consume Serial Port to setup debug channel with HOST. > > Please shutdown the UDK debug HOST software and use any serial tool (Like > putty). Are there any output when you load DebugAgentDxe in shell? Could you > paste here? > > You need to make sure the DebugAgentDxe used the correct serial port > parameter on your platform. > > Thanks! > Jeff > > -Original Message- > From: Arka Sharma [mailto:arka.sw1...@gmail.com] > Sent: Friday, March 31, 2017 9:40 AM > To: Kinney, Michael D > Cc: Fan, Jeff; edk2-devel@lists.01.org > Subject: Re: [edk2] Using Intel UDk debugger > > Thanks a lot Mike. You are right. I have installed WinDbg 6.11.1404. > Now the issue I mentioned earlier is not seen. But I am still not able to > break into target system. I have loaded the DebugAgentDxe and loading was > success. But in the shell I can find that still the serial port handle is not > managed by any driver. > > Regards, > Arka > > On Thu, Mar 30, 2017 at 9:28 PM, Kinney, Michael D > wrote: >> Hi Arka, >> >> I have seen that error when the wrong version of WinDbg is used. >> >> What version of WinDbg did you install? >> >> Does it match the version listed in the UDK Debugger manual? >> >> Mike >> >>> -Original Message- >>> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf >>> Of Arka Sharma >>> Sent: Thursday, March 30, 2017 2:43 AM >>> To: Fan, Jeff >>> Cc: edk2-devel@lists.01.org >>> Subject: Re: [edk2] Using Intel UDk debugger >>> >>> I have also verified the null modem connection by booting to windows >>> in my target pc, and I am able to break it in WinDbg. So the >>> communication is ok. In the target system shell when I load the >>> DebugAgentDxe it is not appeared in the "drivers -b". Also in my >>> system the serial port is not managed by any driver initially. So I >>> located it using "devices" and the issued "load -nc >>> DebugAgentDxe.efi". >>> >>> Regards, >>> Arka >>> >>> On Thu, Mar 30, 2017 at 2:27 PM, Arka Sharma wrote: >>> > Thanks Jeff for your reply. I followed the steps as mentioned in >>> > "9.11 Debugging a standalone module loaded in a UEFI shell". I have >>> > built DebugAgentDxe and loaded it in my target system. I cross >>> > checked in my target system UEFI setup Serial is enabled. In host I >>> > have installed >>> > WinDbgX64 and UDK debugger. I have configured the debug port COM1, >>> > connected the host and target with a null modem cable. Now when I >>> > launch SoftDebugger WinDbg starts with an error message "Could not >>> > start kernel debugging using >>> > exdi:clsid={F56FC1A6-3422-4320-A7F3-41EAEC2A367D} parameters. If I >>> > attempt to reconnect with COM1 it throws "Access denied". Do I need >>> > to enable something more in target system ? >>> > >>> > Regards, >>> > Arka >>> > >>> > On Thu, Mar 30, 2017 at 10:55 AM, Fan, Jeff wrote: >>> >> Arka, >>> >> >>> >> UDK Debugger tool supports your usage model. >>> >> >>> >> Please see the section "9.11 Debugging a standalone module loaded >>> >> in a UEFI >>> shell" @ >>> https://firmware.intel.com/sites/default/files/UDK_Debugger_Tool_User_Manual_V1.11. >>> pdf >>> >> >>> >> Thanks! >>> >> Jeff >>> >> -Original Message- >>> >> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On >>> >> Behalf Of Arka >>> Sharma >>> >> Sent: Thursday, March 30, 2017 1:15 PM >>> >> To: edk2-devel@lists.01.org >>> >> Subject: [edk2] Using Intel UDk debugger >>> >> >>> >> Hi, >>> >> >>> >> I am sorry if it is not a right place to ask this. I have >>> >> installed WinDbg and >>> Intel UDK debugger. I want
Re: [edk2] Using Intel UDk debugger
Thanks a lot Mike. You are right. I have installed WinDbg 6.11.1404. Now the issue I mentioned earlier is not seen. But I am still not able to break into target system. I have loaded the DebugAgentDxe and loading was success. But in the shell I can find that still the serial port handle is not managed by any driver. Regards, Arka On Thu, Mar 30, 2017 at 9:28 PM, Kinney, Michael D wrote: > Hi Arka, > > I have seen that error when the wrong version of WinDbg is used. > > What version of WinDbg did you install? > > Does it match the version listed in the UDK Debugger manual? > > Mike > >> -Original Message- >> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Arka >> Sharma >> Sent: Thursday, March 30, 2017 2:43 AM >> To: Fan, Jeff >> Cc: edk2-devel@lists.01.org >> Subject: Re: [edk2] Using Intel UDk debugger >> >> I have also verified the null modem connection by booting to windows >> in my target pc, and I am able to break it in WinDbg. So the >> communication is ok. In the target system shell when I load the >> DebugAgentDxe it is not appeared in the "drivers -b". Also in my >> system the serial port is not managed by any driver initially. So I >> located it using "devices" and the issued "load -nc >> DebugAgentDxe.efi". >> >> Regards, >> Arka >> >> On Thu, Mar 30, 2017 at 2:27 PM, Arka Sharma wrote: >> > Thanks Jeff for your reply. I followed the steps as mentioned in "9.11 >> > Debugging a standalone module loaded in a UEFI shell". I have built >> > DebugAgentDxe and loaded it in my target system. I cross checked in my >> > target system UEFI setup Serial is enabled. In host I have installed >> > WinDbgX64 and UDK debugger. I have configured the debug port COM1, >> > connected the host and target with a null modem cable. Now when I >> > launch SoftDebugger WinDbg starts with an error message "Could not >> > start kernel debugging using >> > exdi:clsid={F56FC1A6-3422-4320-A7F3-41EAEC2A367D} parameters. If I >> > attempt to reconnect with COM1 it throws "Access denied". Do I need to >> > enable something more in target system ? >> > >> > Regards, >> > Arka >> > >> > On Thu, Mar 30, 2017 at 10:55 AM, Fan, Jeff wrote: >> >> Arka, >> >> >> >> UDK Debugger tool supports your usage model. >> >> >> >> Please see the section "9.11 Debugging a standalone module loaded in a >> >> UEFI >> shell" @ >> https://firmware.intel.com/sites/default/files/UDK_Debugger_Tool_User_Manual_V1.11. >> pdf >> >> >> >> Thanks! >> >> Jeff >> >> -Original Message- >> >> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of >> >> Arka >> Sharma >> >> Sent: Thursday, March 30, 2017 1:15 PM >> >> To: edk2-devel@lists.01.org >> >> Subject: [edk2] Using Intel UDk debugger >> >> >> >> Hi, >> >> >> >> I am sorry if it is not a right place to ask this. I have installed >> >> WinDbg and >> Intel UDK debugger. I want to debug a driver and an application on an Asrock >> borad, >> but going through the UDK debugger user manual I realize that >> SourceLevelDebugPkg >> has to be included in target firmware image. Now in this case what option do >> I have >> to proceed with the debugging ? I am launching my application from shell and >> in the >> shell post codes are disabled, the application code get stuck randomly. So >> far I >> was trying to debug with AsciiPrints. Is there any way to use DEBUG macro to >> redirect debug messages from UEFI driver as well as application to some >> serial port >> in this case ? >> >> >> >> Regards, >> >> Arka >> >> ___ >> >> edk2-devel mailing list >> >> edk2-devel@lists.01.org >> >> https://lists.01.org/mailman/listinfo/edk2-devel >> ___ >> edk2-devel mailing list >> edk2-devel@lists.01.org >> https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] Using Intel UDk debugger
I have also verified the null modem connection by booting to windows in my target pc, and I am able to break it in WinDbg. So the communication is ok. In the target system shell when I load the DebugAgentDxe it is not appeared in the "drivers -b". Also in my system the serial port is not managed by any driver initially. So I located it using "devices" and the issued "load -nc DebugAgentDxe.efi". Regards, Arka On Thu, Mar 30, 2017 at 2:27 PM, Arka Sharma wrote: > Thanks Jeff for your reply. I followed the steps as mentioned in "9.11 > Debugging a standalone module loaded in a UEFI shell". I have built > DebugAgentDxe and loaded it in my target system. I cross checked in my > target system UEFI setup Serial is enabled. In host I have installed > WinDbgX64 and UDK debugger. I have configured the debug port COM1, > connected the host and target with a null modem cable. Now when I > launch SoftDebugger WinDbg starts with an error message "Could not > start kernel debugging using > exdi:clsid={F56FC1A6-3422-4320-A7F3-41EAEC2A367D} parameters. If I > attempt to reconnect with COM1 it throws "Access denied". Do I need to > enable something more in target system ? > > Regards, > Arka > > On Thu, Mar 30, 2017 at 10:55 AM, Fan, Jeff wrote: >> Arka, >> >> UDK Debugger tool supports your usage model. >> >> Please see the section "9.11 Debugging a standalone module loaded in a UEFI >> shell" @ >> https://firmware.intel.com/sites/default/files/UDK_Debugger_Tool_User_Manual_V1.11.pdf >> >> Thanks! >> Jeff >> -Original Message- >> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Arka >> Sharma >> Sent: Thursday, March 30, 2017 1:15 PM >> To: edk2-devel@lists.01.org >> Subject: [edk2] Using Intel UDk debugger >> >> Hi, >> >> I am sorry if it is not a right place to ask this. I have installed WinDbg >> and Intel UDK debugger. I want to debug a driver and an application on an >> Asrock borad, but going through the UDK debugger user manual I realize that >> SourceLevelDebugPkg has to be included in target firmware image. Now in this >> case what option do I have to proceed with the debugging ? I am launching my >> application from shell and in the shell post codes are disabled, the >> application code get stuck randomly. So far I was trying to debug with >> AsciiPrints. Is there any way to use DEBUG macro to redirect debug messages >> from UEFI driver as well as application to some serial port in this case ? >> >> Regards, >> Arka >> ___ >> edk2-devel mailing list >> edk2-devel@lists.01.org >> https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] Using Intel UDk debugger
Thanks Jeff for your reply. I followed the steps as mentioned in "9.11 Debugging a standalone module loaded in a UEFI shell". I have built DebugAgentDxe and loaded it in my target system. I cross checked in my target system UEFI setup Serial is enabled. In host I have installed WinDbgX64 and UDK debugger. I have configured the debug port COM1, connected the host and target with a null modem cable. Now when I launch SoftDebugger WinDbg starts with an error message "Could not start kernel debugging using exdi:clsid={F56FC1A6-3422-4320-A7F3-41EAEC2A367D} parameters. If I attempt to reconnect with COM1 it throws "Access denied". Do I need to enable something more in target system ? Regards, Arka On Thu, Mar 30, 2017 at 10:55 AM, Fan, Jeff wrote: > Arka, > > UDK Debugger tool supports your usage model. > > Please see the section "9.11 Debugging a standalone module loaded in a UEFI > shell" @ > https://firmware.intel.com/sites/default/files/UDK_Debugger_Tool_User_Manual_V1.11.pdf > > Thanks! > Jeff > -Original Message- > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Arka > Sharma > Sent: Thursday, March 30, 2017 1:15 PM > To: edk2-devel@lists.01.org > Subject: [edk2] Using Intel UDk debugger > > Hi, > > I am sorry if it is not a right place to ask this. I have installed WinDbg > and Intel UDK debugger. I want to debug a driver and an application on an > Asrock borad, but going through the UDK debugger user manual I realize that > SourceLevelDebugPkg has to be included in target firmware image. Now in this > case what option do I have to proceed with the debugging ? I am launching my > application from shell and in the shell post codes are disabled, the > application code get stuck randomly. So far I was trying to debug with > AsciiPrints. Is there any way to use DEBUG macro to redirect debug messages > from UEFI driver as well as application to some serial port in this case ? > > Regards, > Arka > ___ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] Using Intel UDk debugger
Hi, I am sorry if it is not a right place to ask this. I have installed WinDbg and Intel UDK debugger. I want to debug a driver and an application on an Asrock borad, but going through the UDK debugger user manual I realize that SourceLevelDebugPkg has to be included in target firmware image. Now in this case what option do I have to proceed with the debugging ? I am launching my application from shell and in the shell post codes are disabled, the application code get stuck randomly. So far I was trying to debug with AsciiPrints. Is there any way to use DEBUG macro to redirect debug messages from UEFI driver as well as application to some serial port in this case ? Regards, Arka ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] Closing events and releasing resources in notify function
Thanks Andrew for your reply. In this case I am creating the event with CreateEvent() and not with CreateEventEx(). I am attempting to free the Context inside the notify function which will be called after Event is signaled, and Context is only accessed before CreateEvent() and inside the NotifyRoutine(). So the change you are suggesting is inside the notify function I should call CloseEvent() first before freeing Context right ? On Fri, Mar 24, 2017 at 12:07 PM, Andrew Fish wrote: > >> On Mar 23, 2017, at 11:22 PM, Arka Sharma wrote: >> >> Hi, >> >> Is it ok to close the event and release the resource allocated to be >> sent as context inside the notify function. May be something like this >> >> VOID >> EFIAPI >> NotifyRoutine ( >> EFI_EVENT Event, >> VOID *Context >> ) >> { >> // >> // Perform intended task >> // >> FreePool (Context); >> gBS->CloseEvent (Event); > > You should close the event before you free the context, or you will have a > race. You need to make sure there is no way for EFI to signal the event > before you free the context. > > This all assumes you don't have other code doing crazy stuff with the Context > or Event. It would be a different answer for CreateEventEx() > > Thanks, > > Andrew Fish > >> } >> >> In the above example Context was allocated before creating the event >> and passed as a parameter to CreateEvent(). >> >> Regards, >> Arka >> ___ >> edk2-devel mailing list >> edk2-devel@lists.01.org >> https://lists.01.org/mailman/listinfo/edk2-devel > ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] Closing events and releasing resources in notify function
Hi, Is it ok to close the event and release the resource allocated to be sent as context inside the notify function. May be something like this VOID EFIAPI NotifyRoutine ( EFI_EVENT Event, VOID *Context ) { // // Perform intended task // FreePool (Context); gBS->CloseEvent (Event); } In the above example Context was allocated before creating the event and passed as a parameter to CreateEvent(). Regards, Arka ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] Testing NVMe async commands
We have developed an application to test the async flow in NvmExpressDxe. We have allocated a buffer of size 8 MB and in that buffer we are reading 128k chunks, which results in 64 commands as the async submission queue depth is 64, after calling passthru with the Event we increment a counter and inside the notification function we decrement the counter. After sending all the commands we wait till the counter becomes 0. After 64 reads are completed we issue 64 write command passing the buffer we have just read. So after 8 MB is done we increment the lba and repeat the same. In the application we are putting the starting lba of each 8 mb operation, so it increments as 0x0, 0x4000, 0x8000 as lba size of the device is 512 bytes. We are observing a hang at lba 0x66E4000, after processing 210720 commands. We are creating and closing the events after each 8 MB read and write. This stuck is seen consistently. May be there is something wrong we are doing in the application. Please let me know if there is any reference UEFI application to test async ? ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] "[edk] Caculating time delay in milliseconds"
Thanks Mike for the reply but EFI_TIMESTAMP_PROTOCOL is not there in my platform. I tried to open it using gBS->LocateProtocol() and it returned EFI_NOT_FOUND On Thu, Mar 2, 2017 at 11:38 PM, Kinney, Michael D wrote: > For UEFI Drivers/Applications there is also the EFI_TIMESTAMP_PROTOCOL > if it is available on your platform. > > Mike > >> -Original Message- >> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of >> Michael >> Zimmermann >> Sent: Thursday, March 2, 2017 4:06 AM >> To: Arka Sharma >> Cc: edk2-devel@lists.01.org >> Subject: Re: [edk2] "[edk] Caculating time delay in milliseconds" >> >> AFAIK the only way to do that is to use the platform specific TimerLib >> like this: >> >> UINT64 >> GetTimeMs ( >> VOID >> ) >> { >> return GetTimeInNanoSecond(GetPerformanceCounter()) / 100ULL; >> } >> >> Thanks >> Michael >> >> On Thu, Mar 2, 2017 at 12:53 PM, Arka Sharma wrote: >> > gRT->GetTime() is accurate about seconds.Is there any way to calculate >> > time difference in milliseconds ? >> > Let's say >> > >> > Time1 = GetTimeMs(); >> > >> > // >> > // Some tasks >> > // >> > >> > Time2 = GetTimeMs(); >> > >> > // >> > // Time taken >> > // >> > GetTimeDiff (Time1, Time2); >> > >> > Something like this >> > >> > Regards, >> > Arka >> > ___ >> > edk2-devel mailing list >> > edk2-devel@lists.01.org >> > https://lists.01.org/mailman/listinfo/edk2-devel >> ___ >> edk2-devel mailing list >> edk2-devel@lists.01.org >> https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] "[edk] Caculating time delay in milliseconds"
Thanks Michael for your reply.The function GetPerformanceCounter() is returning 0 is my platform. On Thu, Mar 2, 2017 at 11:38 PM, Kinney, Michael D wrote: > For UEFI Drivers/Applications there is also the EFI_TIMESTAMP_PROTOCOL > if it is available on your platform. > > Mike > >> -Original Message- >> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of >> Michael >> Zimmermann >> Sent: Thursday, March 2, 2017 4:06 AM >> To: Arka Sharma >> Cc: edk2-devel@lists.01.org >> Subject: Re: [edk2] "[edk] Caculating time delay in milliseconds" >> >> AFAIK the only way to do that is to use the platform specific TimerLib >> like this: >> >> UINT64 >> GetTimeMs ( >> VOID >> ) >> { >> return GetTimeInNanoSecond(GetPerformanceCounter()) / 100ULL; >> } >> >> Thanks >> Michael >> >> On Thu, Mar 2, 2017 at 12:53 PM, Arka Sharma wrote: >> > gRT->GetTime() is accurate about seconds.Is there any way to calculate >> > time difference in milliseconds ? >> > Let's say >> > >> > Time1 = GetTimeMs(); >> > >> > // >> > // Some tasks >> > // >> > >> > Time2 = GetTimeMs(); >> > >> > // >> > // Time taken >> > // >> > GetTimeDiff (Time1, Time2); >> > >> > Something like this >> > >> > Regards, >> > Arka >> > ___ >> > edk2-devel mailing list >> > edk2-devel@lists.01.org >> > https://lists.01.org/mailman/listinfo/edk2-devel >> ___ >> edk2-devel mailing list >> edk2-devel@lists.01.org >> https://lists.01.org/mailman/listinfo/edk2-devel ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] "[edk] Caculating time delay in milliseconds"
gRT->GetTime() is accurate about seconds.Is there any way to calculate time difference in milliseconds ? Let's say Time1 = GetTimeMs(); // // Some tasks // Time2 = GetTimeMs(); // // Time taken // GetTimeDiff (Time1, Time2); Something like this Regards, Arka ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] Mapping of PrpList in NvmExpressDxe
Thanks Andrew for your response. Actually my question related to EfiPciOperationBusMasterCommonBuffer was only in case of PrpList buffer which is allocated and mapped in NvmeCreatePrpList function. In case of queues the mapping with EfiPciOperationBusMasterCommonBuffer is understood as in case of Completion queue the device will post the response of a command and driver will also poll the phase tag to detect a new completion entry so coherent buffer is needed. But in case of PrpList buffer such simultaneous access is not done. The host will update the prp entries and device will pick them up only after host update submission queue doorbell. So my question is in case of particularly PrpList buffer why it is mapped as EfiPciOperationBusMasterCommonBuffer, where as per my understanding EfiPciOperationBusMasterRead would have sufficed. Regards, Arka On Fri, Feb 17, 2017 at 10:13 PM, Andrew Fish wrote: > >> On Feb 17, 2017, at 5:54 AM, Arka Sharma wrote: >> >> I am wondering what is the reason for mapping the PrpList buffer with >> EfiPciIoOperationBusMasterCommonBuffer, as host will fill the Prp >> entries and after updating the submission queue doorbell device will >> start processing the command and fetch the Prp entries. So I am >> thinking the Prplist buffer could have been mapped as >> EfiPciIoOperationBusMasterRead. Is there any reason for mapping it as >> CommonBuffer that I am not able to figure out ? >> > > Arka, > > Good question. Historically there have been a lot of bugs in DMA code in EFI. > The reason being if you don't follow the rules the code still works since DMA > is so coherent in hardware on an x86 PC. This is not the case for a lot of > ARM platforms. > > There is a good overview of UEFI DMA operations in the UEFI Spec PCI Bus > Support Chapter. > > DMA Bus Master Read Operation > • Call Map() for EfiPciOperationBusMasterRead or > EfiPciOperationBusMasterRead64. > • Program the DMA Bus Master with the DeviceAddress returned by Map(). > • Start the DMA Bus Master. > • Wait for DMA Bus Master to complete the read operation. > • Call Unmap(). > > DMA Bus Master Write Operation > • Call Map() for EfiPciOperationBusMasterWrite or > EfiPciOperationBusMasterRead64. > • Program the DMA Bus Master with the DeviceAddress returned by Map(). > • Start the DMA Bus Master. > • Wait for DMA Bus Master to complete the write operation. > • Perform a PCI controller specific read transaction to flush all PCI write > buffers (See PCI Specification Section 3.2.5.2) . > • Call Flush(). > • Call Unmap(). > > DMA Bus Master Common Buffer Operation > • Call AllocateBuffer() to allocate a common buffer. > • Call Map() for EfiPciOperationBusMasterCommonBuffer or > EfiPciOperationBusMasterCommonBuffer64. > • Program the DMA Bus Master with the DeviceAddress returned by Map(). > • The common buffer can now be accessed equally by the processor and the DMA > bus master. > • Call Unmap(). > • Call FreeBuffer(). > > So to answer your question. The Read and Write operations are one shot on the > buffer, while Common Buffer is a buffer that is DMA coherent and can be > reused. Thats probably why Common Buffer is used by the NVMe driver. > > Basically the common usage for the Read and Write mappings are the caller > passing a buffer (like a block on the disk). The Queues that run DMA are > common buffer as the PCI hardware and the CPU both need to access them > intermittently. To be clear for the read and write case the CPU only has a > coherent view of the buffer after the Unmap() is called. > > I think the only way you can enforce most of the UEFI driver DMA rules on x86 > is to turn on an IOMMU that would cause faults if you don't follow the rules. > Basically you have the IOMMU fault on DMA transactions to a buffer that is > not following the rules above. > > Thanks, > > Andrew Fish > >> Regards, >> Arka >> ___ >> edk2-devel mailing list >> edk2-devel@lists.01.org >> https://lists.01.org/mailman/listinfo/edk2-devel > ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] Mapping of PrpList in NvmExpressDxe
I am wondering what is the reason for mapping the PrpList buffer with EfiPciIoOperationBusMasterCommonBuffer, as host will fill the Prp entries and after updating the submission queue doorbell device will start processing the command and fetch the Prp entries. So I am thinking the Prplist buffer could have been mapped as EfiPciIoOperationBusMasterRead. Is there any reason for mapping it as CommonBuffer that I am not able to figure out ? Regards, Arka ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] Closing PciIo protocol inside Stop()
Actually I am thinking if it will be possible to use PciIo from a driver on a ControllerHandle which managed by another driver which has been stopped. So is it possible that driver which wants to access it restarts the ControllerHandle with it's own DriverBindingHandle, or it is that as soon as the driver closes PciIo and DevicePath on the ControllerHandle inside Stop() function, the ControllerHandle is destroyed. On Thu, Dec 15, 2016 at 11:38 PM, Andrew Fish wrote: > > On Dec 15, 2016, at 3:15 AM, Arka Sharma wrote: > > I am wondering if the PciIo protocol instance for a PCI driver, is > opened with _BY_DRIVER | EXCLUSIVE in Start() function, is not closed > in the Stop() will the instance be uninstalled and the > ControllerHandle removed ? > > > Don't do that. The Start() and Stop() need to be symmetric. If you don't > Stop() properly I think your Stop() function could get called again, and > that would be really bad if you your driver was unloaded or something like > that. > > > Also is it possible to Close() the PciIo in Stop() and reopen the > PciIo instance on the same controller handle from some other driver > image with _BY_DRIVER attribute and accessing Pci resources on the > ControllerHandle even after Stop() is called. I know it is not > recommended way but curious about it. Or it could be specific to the > implementation ? > > > Maybe you should just ask what you want to do? > > If you just want to dump out PCI info you can use > gEfiPciRootBridgeIoProtocolGuid ByProtocol. There is an example in the Shell > PCI command: > https://github.com/tianocore/edk2/blob/master/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c#L2537 > > Note: On a large server, or exotic SoC there could be multiple > gEfiPciRootBridgeIoProtocolGuid instances, and the Shell command deals with > that. > > Thanks, > > Andrew Fish > > > Thanks & Regards, > ___ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel > > ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] Closing PciIo protocol inside Stop()
I am wondering if the PciIo protocol instance for a PCI driver, is opened with _BY_DRIVER | EXCLUSIVE in Start() function, is not closed in the Stop() will the instance be uninstalled and the ControllerHandle removed ? Also is it possible to Close() the PciIo in Stop() and reopen the PciIo instance on the same controller handle from some other driver image with _BY_DRIVER attribute and accessing Pci resources on the ControllerHandle even after Stop() is called. I know it is not recommended way but curious about it. Or it could be specific to the implementation ? Thanks & Regards, ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel