mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Naman Jain <namjain@linux.microsoft.com>
To: Saurabh Singh Sengar <ssengar@linux.microsoft.com>,
	Michael Kelley <mhklinux@outlook.com>
Cc: Long Li <longli@microsoft.com>,
	Sahil Chandna <sahilchandna@linux.microsoft.com>,
	KY Srinivasan <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	"wei.liu@kernel.org" <wei.liu@kernel.org>,
	Dexuan Cui <DECUI@microsoft.com>,
	"lpieralisi@kernel.org" <lpieralisi@kernel.org>,
	"kwilczynski@kernel.org" <kwilczynski@kernel.org>,
	"mani@kernel.org" <mani@kernel.org>,
	"robh@kernel.org" <robh@kernel.org>,
	"bhelgaas@google.com" <bhelgaas@google.com>,
	"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] PCI: hv: Warn when wait_for_response() waits indefinitely
Date: Fri, 28 Aug 2026 11:10:22 +0530	[thread overview]
Message-ID: <27277d1e-fd41-4dc9-aea2-eae3773ba322@linux.microsoft.com> (raw)
In-Reply-To: <apB1HytkO5xu7jP6@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net>



On 8/27/2026 11:04 PM, Saurabh Singh Sengar wrote:
> On Thu, Aug 27, 2026 at 04:07:06PM +0000, Michael Kelley wrote:
>> From: Long Li <longli@microsoft.com> Sent: Tuesday, August 25, 2026 10:01 AM
>>
>> [snip]
>>
>>>>
>>>> Basically something like this:
>>>>
>>>> #define PCI_RESPONSE_WARN_TIMEOUT_SEC 300
>>>>
>>>> static int wait_for_response(struct hv_device *hdev,
>>>>                    struct completion *comp) {
>>>>       unsigned long warn_at =
>>>>           jiffies + secs_to_jiffies(PCI_RESPONSE_WARN_TIMEOUT_SEC);
>>>>       bool warned = false;
>>>>
>>>>       while (true) {
>>>>           if (hdev->channel->rescind) {
>>>>               dev_warn_once(&hdev->device, "The device is gone.\n");
>>>>               return -ENODEV;
>>>>           }
>>>>
>>>>           if (wait_for_completion_timeout(comp, HZ / 10)) {
>>>>               if (warned || time_after_eq(jiffies, warn_at))
>>>>                   dev_warn(&hdev->device,
>>>>                        "PCI response received after prolonged wait.\n");
>>>>               return 0;
>>>>           }
>>>>
>>>>           if (!warned && time_after_eq(jiffies, warn_at)) {
>>>>               dev_warn(&hdev->device,
>>>>                    "PCI still waiting for response.\n");
>>>>               warned = true;
>>>>           }
>>>>       }
>>>> }
>>>>
>>>> Regards,
>>>> Naman
>>>
>>> This looks better.
>>>
>>
>> I like getting the "response received" message if the response
>> eventually does come in. It's a judgment call, but I would be OK
>> with outputting the "still waiting" message after each wait interval
>> rather than doing it only once. And I would make the interval smaller
>> than 300 seconds. Five minutes is a long time to wait and wonder
>> what's going on when things are hung. 60 or 120 seconds would
>> be OK -- a line in dmesg every 1 or 2 minutes doesn't seem like
>> spamming to me when something is fundamentally broken.
>> And probably don't expect a VM in this broken state to keep running
>> for hours -- the sysadmin or automatic monitoring software will
>> reboot it to get it working again.

I think this is a main point of this discussion. FWIK, this is not 
automatically recovered as of now, ever. With these changes, we could 
get dmesg logs completely filled with this same log, which does not add 
any value. On the other hand, I was suggesting Sahil if this problem is 
not recoverable by Azure fabric layer or other monitoring services, and 
is extremely rare and the VM is unusable, perhaps we should consider 
adding a bug/timeout in this path instead of just logging about it.

Regards,
Naman

> 
> I will also vote for repeated message as long as interval between two
> messages is greater than 60 seconds.
> 
> - Saurabh
> 
>>
>> Just my $.02. Outputting the "still waiting" message only once is
>> also OK. Your call.
>>
>> Michael



  reply	other threads:[~2026-08-28  5:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-25  5:17 Sahil Chandna
2026-08-25  6:46 ` Naman Jain
2026-08-25 12:00   ` Sahil Chandna
2026-08-25 17:00   ` Long Li
2026-08-27 16:07     ` Michael Kelley
2026-08-27 17:34       ` Saurabh Singh Sengar
2026-08-28  5:40         ` Naman Jain [this message]
2026-08-28 14:59           ` Hamza Mahfooz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=27277d1e-fd41-4dc9-aea2-eae3773ba322@linux.microsoft.com \
    --to=namjain@linux.microsoft.com \
    --cc=DECUI@microsoft.com \
    --cc=bhelgaas@google.com \
    --cc=haiyangz@microsoft.com \
    --cc=kwilczynski@kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=longli@microsoft.com \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=mhklinux@outlook.com \
    --cc=robh@kernel.org \
    --cc=sahilchandna@linux.microsoft.com \
    --cc=ssengar@linux.microsoft.com \
    --cc=wei.liu@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®