From: Sahil Chandna <sahilchandna@linux.microsoft.com>
To: Hamza Mahfooz <hamzamahfooz@linux.microsoft.com>,
Naman Jain <namjain@linux.microsoft.com>
Cc: Saurabh Singh Sengar <ssengar@linux.microsoft.com>,
Michael Kelley <mhklinux@outlook.com>,
Long Li <longli@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: Tue, 1 Sep 2026 16:44:11 +0530 [thread overview]
Message-ID: <b66a428d-b6c0-4ec1-8644-504749be308c@linux.microsoft.com> (raw)
In-Reply-To: <apGiT0ZKIetmsbn8@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net>
On 28-08-2026 20:29, Hamza Mahfooz wrote:
> On Fri, Aug 28, 2026 at 11:10:22AM +0530, Naman Jain wrote:
>>
>>
>> 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
>
Thanks everyone for review, based on dmesg logs recovered from affected
VMs this does introduce non-recoverable hang for hours, I am going to
work on this in a patch along with fixing sashiko warnings.
> Along with what everyone else has suggested I would suggest printing out the
> state of the device's VMBus channel (i.e. the child_relid and inbound and
> outbound status in particular). Since, that information is useful to the hv
> guys and should help disambiguate between "host never picked it up" vs.
> "host picked it up but never replied."
>
> Hamza
>
Ack.
>>
>>>
>>> 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
>>
>>
I am going to send next version to log "stuck waiting for response"
warning only once at 2 mins boundary and will also log late completion
as per feedback.
Regards,
Sahil
prev parent reply other threads:[~2026-09-01 11:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-25 5:17 [PATCH] PCI: hv: Warn when wait_for_response() waits indefinitely Sahil Chandna
2026-08-25 5:30 ` sashiko-bot
2026-08-25 12:03 ` 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
2026-08-28 14:59 ` Hamza Mahfooz
2026-09-01 11:14 ` Sahil Chandna [this message]
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=b66a428d-b6c0-4ec1-8644-504749be308c@linux.microsoft.com \
--to=sahilchandna@linux.microsoft.com \
--cc=DECUI@microsoft.com \
--cc=bhelgaas@google.com \
--cc=haiyangz@microsoft.com \
--cc=hamzamahfooz@linux.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=namjain@linux.microsoft.com \
--cc=robh@kernel.org \
--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