From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-x230.google.com (mail-lf0-x230.google.com [IPv6:2a00:1450:4010:c07::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C112320D7A3CB for ; Mon, 17 Apr 2017 05:54:26 -0700 (PDT) Received: by mail-lf0-x230.google.com with SMTP id t144so64940893lff.1 for ; Mon, 17 Apr 2017 05:54:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=eWXeTANz532hOqzn32u5Y96Hg56eguxzmC7/Za8WVb4=; b=Bol6v9c+Pm/3mMA7C54Nf5aJei1CUNrvIeUXBkP8KmOpr2RkOAt3YG1XmEwINWpY+S 3prPhrIeGPSjsiAhei7Cl1gSKbvvIJ7SQOTllp8eOV/XMgDLvvEwoqt2Qeap5HNYMdZx FhNTXn3y46QZkTDuCKogY+Y5oXoqexlozbd84HoTDcxpyRa8FvYhFgdDjMMnXSCElS6k 9PwN3n2Kvn1nDz5r/qMrzPPpHtPUewTIZDiXtq7jEvvLvgf0XwXVvw71T1GklBSxlaz9 ZDEOdnszP/Fsi0OgA9YRLWb9tgh6581oLmzHrPdc4u99MJOOIuajX7Q0YMyIy0rblGLj k48g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=eWXeTANz532hOqzn32u5Y96Hg56eguxzmC7/Za8WVb4=; b=DoOIvOHLrv06+RZqe0T/w+1sUjpncUhDwKsQZNddKT725+gKb2KyT5uueRfcIqkUTW cBRCH+4pwMxRdt7PHn6rcFcVcTSDsxawCCW4623eY9v9OLUW2W+Z2EIEqg0icXIj8KDq az5bIGqQRhkvYx1HekIFlIBnJbTzWLuWoZEmOaCCXhCnRD5Kc6AhJ/7N61H/mI6wlk+q ifIMVIPD0r+YnRCpf+giswIeZYad16Ut6J9GYQTN3axEHPl5S9j5jjOwg6v2npCoLUMG 2bkpYXF0haNM2fWdMyMKUrbUFeW1J6DxdE773sRpgSlTMXvwNo/XbPdqgjDeVGMfBxxZ rCug== X-Gm-Message-State: AN3rC/6TMamniam6kjvlTaZV7zcC5Ul1Yls4NuOpSKRpMp5oGYnr0RWQ M7g6sHfZu0y5cRl+fpnieGrqXBUm+A== X-Received: by 10.25.115.212 with SMTP id h81mr3289523lfk.108.1492433664644; Mon, 17 Apr 2017 05:54:24 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.225.17 with HTTP; Mon, 17 Apr 2017 05:54:23 -0700 (PDT) In-Reply-To: References: <7F1BAD85ADEA444D97065A60D2E97EE5699E44A8@SHSMSX101.ccr.corp.intel.com> From: Arka Sharma Date: Mon, 17 Apr 2017 18:24:23 +0530 Message-ID: To: "Wu, Hao A" Cc: "Tian, Feng" , "edk2-devel@lists.01.org" Subject: Re: NvmExpressDxe async application crash with UDK debugger X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Apr 2017 12:54:27 -0000 Content-Type: text/plain; charset=UTF-8 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-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" 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