[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [win-pv-devel] [PATCH 2/2] Fix race calculating SrbExt->Count

  • To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Andreas Kinzler <ml-ak@xxxxxxxxx>
  • Date: Thu, 16 Feb 2017 20:20:17 +0100
  • Delivery-date: Thu, 16 Feb 2017 19:20:33 +0000
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

In the analysis of my hangs it also turned out that an incorrect value
of SrbExt->Count caused the loss of the SRB. In PdoCompleteResponse I
added the following debug code

-    if (InterlockedDecrement(&SrbExt->ReqCount) == 0) {
+       c = (ULONG) InterlockedDecrement(&SrbExt->Count);
+       if (c + 1 > Pdo->maxReqsPerSrb)
+       {
+               Pdo->maxReqsPerSrb = c + 1;
+               Warning("new maximum reqs/SRB = %08x, PDO = %I64x, SRB = %I64x\n", 
Pdo->maxReqsPerSrb, (ULONGLONG) Pdo, (ULONGLONG) Srb);
+       }
+    if (c == 0) {

Then in the debug log I saw the following line

XENVBD|PdoCompleteResponse:new maximum reqs/SRB = ffffffff, PDO = 
ffffe001ff1b2020, SRB = ffffe00200d439f0

just seconds before the PDO resets started. That means the count had
dropped to -2. However I did not (yet) find the reason for that. Thanks
for finding the race. Since the issue is quite clear now, I don't think
the debug code is needed. Attached is my patch (only for the count
issue) with a renaming of the "Count" field to make it more clear what
kind of count it is.

Regards Andreas

On 16.02.2017 11:11, owen.smith@xxxxxxxxxx wrote:
From: Owen Smith <owen.smith@xxxxxxxxxx>

It is possible under heavy loads for the backend to start completing
sub-requests of a Srb before the SrbExt Count is set. This would
leave the count unable to reach 0 (as 1 or more requests are skipped
by count being overridden)

Attachment: srbext-count.patch
Description: Text document

win-pv-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.