public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* NvmExpressDxe async application crash with UDK debugger
@ 2017-04-12  4:58 Arka Sharma
  2017-04-12  5:07 ` Tian, Feng
  0 siblings, 1 reply; 5+ messages in thread
From: Arka Sharma @ 2017-04-12  4:58 UTC (permalink / raw)
  To: edk2-devel

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 = 00000000".
I can share the application code for more clarity. I am building with
/Od and GenFw with --keepexceptiontable

Regards,
Arka


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: NvmExpressDxe async application crash with UDK debugger
  2017-04-12  4:58 NvmExpressDxe async application crash with UDK debugger Arka Sharma
@ 2017-04-12  5:07 ` Tian, Feng
  2017-04-12  6:05   ` Arka Sharma
  0 siblings, 1 reply; 5+ messages in thread
From: Tian, Feng @ 2017-04-12  5:07 UTC (permalink / raw)
  To: Arka Sharma, edk2-devel@lists.01.org; +Cc: Tian, Feng

Arka,

Could you please share us your test code?

Thanks
Feng

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@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 = 00000000".
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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: NvmExpressDxe async application crash with UDK debugger
  2017-04-12  5:07 ` Tian, Feng
@ 2017-04-12  6:05   ` Arka Sharma
  2017-04-13  5:46     ` Wu, Hao A
  0 siblings, 1 reply; 5+ messages in thread
From: Arka Sharma @ 2017-04-12  6:05 UTC (permalink / raw)
  To: Tian, Feng; +Cc: edk2-devel

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" <feng.tian@intel.com> wrote:

> Arka,
>
> Could you please share us your test code?
>
> Thanks
> Feng
>
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@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 = 00000000".
> 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
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: NvmExpressDxe async application crash with UDK debugger
  2017-04-12  6:05   ` Arka Sharma
@ 2017-04-13  5:46     ` Wu, Hao A
  2017-04-17 12:54       ` Arka Sharma
  0 siblings, 1 reply; 5+ messages in thread
From: Wu, Hao A @ 2017-04-13  5:46 UTC (permalink / raw)
  To: Arka Sharma, Tian, Feng; +Cc: edk2-devel@lists.01.org

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-bounces@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" <feng.tian@intel.com> wrote:
> 
> > Arka,
> >
> > Could you please share us your test code?
> >
> > Thanks
> > Feng
> >
> > -----Original Message-----
> > From: edk2-devel [mailto:edk2-devel-bounces@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 = 00000000".
> > 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: NvmExpressDxe async application crash with UDK debugger
  2017-04-13  5:46     ` Wu, Hao A
@ 2017-04-17 12:54       ` Arka Sharma
  0 siblings, 0 replies; 5+ messages in thread
From: Arka Sharma @ 2017-04-17 12:54 UTC (permalink / raw)
  To: Wu, Hao A; +Cc: Tian, Feng, edk2-devel@lists.01.org

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 <hao.a.wu@intel.com> 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-bounces@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" <feng.tian@intel.com> wrote:
>>
>> > Arka,
>> >
>> > Could you please share us your test code?
>> >
>> > Thanks
>> > Feng
>> >
>> > -----Original Message-----
>> > From: edk2-devel [mailto:edk2-devel-bounces@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 = 00000000".
>> > 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-04-17 12:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-12  4:58 NvmExpressDxe async application crash with UDK debugger Arka Sharma
2017-04-12  5:07 ` Tian, Feng
2017-04-12  6:05   ` Arka Sharma
2017-04-13  5:46     ` Wu, Hao A
2017-04-17 12:54       ` Arka Sharma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox