From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 884072195406F for ; Thu, 20 Apr 2017 18:38:57 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP; 20 Apr 2017 18:38:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,227,1488873600"; d="scan'208";a="1138372621" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga001.fm.intel.com with ESMTP; 20 Apr 2017 18:38:57 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 20 Apr 2017 18:38:57 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.178]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.217]) with mapi id 14.03.0319.002; Fri, 21 Apr 2017 09:38:55 +0800 From: "Wu, Hao A" To: Suman Prakash , "edk2-devel@lists.01.org" CC: "Tian, Feng" Thread-Topic: [edk2] [PATCH] MdeModulePkg/NvmExpressDxe: Handling return of write to sq and cq db Thread-Index: AQHSub1OqpI1RdZIoE6VV4unKm6AI6HPDGHg Date: Fri, 21 Apr 2017 01:38:54 +0000 Message-ID: References: In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] MdeModulePkg/NvmExpressDxe: Handling return of write to sq and cq db 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: Fri, 21 Apr 2017 01:38:57 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks for the catch. The patch is good to me. Reviewed-by: Hao Wu Best Regards, Hao Wu > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of > Suman Prakash > Sent: Thursday, April 20, 2017 6:02 PM > To: edk2-devel@lists.01.org > Cc: Tian, Feng > Subject: [edk2] [PATCH] MdeModulePkg/NvmExpressDxe: Handling return of > write to sq and cq db >=20 > In case of an async command if updating the submission queue tail > doorbell fails then the command will not be picked up by device and > no completion response will be created. This scenario has to be handled. > Also if we create an AsyncRequest element and insert in the async queue, > it will never receive a completion so in the timer routine this element > won't be freed, resulting in memory leak. Also in case of blocking calls > we should capture the status of updating completion queue head doorbell > register and return it to caller of PassThru. >=20 > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Suman Prakash > --- > MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) >=20 > diff --git a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c > b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c > index ef3d772..fb80f39 100644 > --- a/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c > +++ b/MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressPassthru.c > @@ -603,7 +603,7 @@ NvmExpressPassThru ( > Private->SqTdbl[QueueId].Sqt ^=3D 1; > } > Data =3D ReadUnaligned32 ((UINT32*)&Private->SqTdbl[QueueId]); > - PciIo->Mem.Write ( > + Status =3D PciIo->Mem.Write ( > PciIo, > EfiPciIoWidthUint32, > NVME_BAR, > @@ -612,6 +612,10 @@ NvmExpressPassThru ( > &Data > ); >=20 > + if (EFI_ERROR (Status)) { > + goto EXIT; > + } > + > // > // For non-blocking requests, return directly if the command is placed > // in the submission queue. > @@ -695,7 +699,7 @@ NvmExpressPassThru ( > } >=20 > Data =3D ReadUnaligned32 ((UINT32*)&Private->CqHdbl[QueueId]); > - PciIo->Mem.Write ( > + Status =3D PciIo->Mem.Write ( > PciIo, > EfiPciIoWidthUint32, > NVME_BAR, > -- > 1.9.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel