From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84C4A25B092 for ; Sun, 2 Aug 2026 18:28:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785695292; cv=none; b=Q9MgxG5qLi1+GIxNGrdtNXaMYKHXc5WMhCCyiF+nnDjnkF3QLue/pNOqqYBwf+9bEukQ7yVh2Ty/dCIIwFRjBFMlFR3O/MtSZRNLz8W2QJ668eh/X5yrrFt16jSj9av5pQMr7CR3x2teCdE9750xc3YqVG5JGEjmFgf6oAsXK5s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785695292; c=relaxed/simple; bh=7HXkHNgH9ELdrRlmACJ7C8pxByRbOLKaeRGZFPBUd1k=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SINnUlFq9f73J+K/1BS/MNfxIhPPKDkuQ2WlByDzTBE6bBYdGjWt/0SltXz26hZIiGBN1Gbjuqb4bz2OirqJiQxyrCqzmY+fuhR/ljflmYeQBiLf5EvSLxjcqo5eoE7J4cepLEo+ipbzACdfziWjnMO6160NeXlo9bMNLcAjQ2I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ccj5eR/i; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ccj5eR/i" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-49548e01d02so7208765e9.0 for ; Sun, 02 Aug 2026 11:28:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785695287; x=1786300087; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=7HXkHNgH9ELdrRlmACJ7C8pxByRbOLKaeRGZFPBUd1k=; b=ccj5eR/icsY1kMNpTHzE5jjnuR9qKnjVA/0ltiE24ghTVWxg+bRqnTcs3AsynK8tpp pZ6oht4fazf3u5/1Mju41GlpJYv1lqdsbfhmtX6/l0l1tc7vGwmxEJF/3dI54DsUrb63 dFMr9/QsBnVr5DPQQBwnjrThRw5uG5tfmEwA9ErFz1mszFAvFssAEO68x8C/zpgeUOmK cERZZSJKJ4z+f04BKs+VJP2F14zMWzS4D1snsaCTEN6JqniO1/2tmelwk+ylUWllCUZr ZIVXVPYUTZ4dDmkvrUPG5wej2ljLniAc4pPq3VbHRo5RPqGUSMxFLA3VP+XiXGVVFBXt +mKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785695287; x=1786300087; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=7HXkHNgH9ELdrRlmACJ7C8pxByRbOLKaeRGZFPBUd1k=; b=PKugy5PX35D1Fo5fQVqoyc6xteiTklD78FXEKaeiOplqQSDV3q1CJN3/4D7XTXzQDJ H8FvykjysasDv/JvXjBBNhiYMM2O34be0PH6n2TVRsQW5HGs30ObyDWJbKt7J1JtIYCh /RsfWBbsP0pfyoz5H6CZUxNSbfHi2MBwpWQmkHzwzdDSLjnfbzwQiMSWri08nWqPricM xF11r6brNQNrdVxiN8zXGYD2TK/+16nDu1HBv/NcL321blWAbdF0/MIn6XD/MqMDoApk g4ODReqtYrDS9Tmb8uQ4Kk7pgN4BZOBNxBC6bmgqea69fSt/dBCThHUJiXbAvLtWMr4f wftw== X-Forwarded-Encrypted: i=1; AHgh+RouOskZfHYgOX98V8cey8mkrtIp4I1712cI9Hz4PncWOHmcRfD7yPwspnRjv3T6f9VVn5QmgA0Npq1g+ls=@vger.kernel.org X-Gm-Message-State: AOJu0YymkhvbU+Hgj29awf/gzZ27UQXuPWHbSEyOAevyYZ9KYQOzX8ac sYqnLg+V0VRiwH0NNU1KGtku8gl+RWoEvGmhLfkPc9FDCG6d+PIifK8g X-Gm-Gg: AR+sD12kT5RcWGlNiYHhx2SP/3dEawnUG89ccSbCOkdnBMaOrEr6e9NWwpvLLDKLeU8 /VGRQ1SFBxXLZP/PM63fnhpm6rTymVmfj02SA8+tRJ1N2VpN68Ii6FwRUCEv9pjJouYrHggBtxF Qf1CEVGKFe7y0FioZe64RAbgRkGOvwPzv1n1IBF9IhDU6f/UzVp0C++2ZKkfzhmb+xDh20gnoz1 eOSpTRVcpaWBaPCEl9UcWjvL5Cfn4+slTnAd0Se8aKrEPeCYXN2APaIohhcIPurmmPTzw/hEjTu vTFyJInewAnKLQiC4O2ryOVPJrvU/9URm+feY+u4zjtK+SUqOHZKufys2H8FwciCVv8xbzRwzE4 WPXDV3yXpf4pbWD59NpoX0YFYF2iKEjTz+V11gJofWelWx17a7ns46dAJh86f+a4vHKr7YIlhea nmncZTTtI+JAmI79iE1RM0YcrH7swXutF+npV4PavtcwkRXmxxG6YMV5FhgJuTMH7Cf0DFvzobw PsyUokh8q8INGuBu1XV87DtBqI6xPGcORAu8yf4fZRRC1wXphN/kg== X-Received: by 2002:a05:600c:54c8:b0:495:7285:a498 with SMTP id 5b1f17b1804b1-4980c693094mr110821335e9.18.1785695286714; Sun, 02 Aug 2026 11:28:06 -0700 (PDT) Received: from 1c44f78ca37e (dynamic-002-214-008-136.2.214.pool.telefonica.de. [2.214.8.136]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-498081a12a3sm229546405e9.8.2026.08.02.11.28.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Aug 2026 11:28:06 -0700 (PDT) Date: Sun, 2 Aug 2026 18:28:03 +0000 From: Abhin Parekadan Jose To: "Michael S. Tsirkin" Cc: jasowangio@gmail.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, virtualization@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/2] virtio_pci_modern: fix vp_reset() hang on unresponsive device Message-ID: References: <20260802174059.4082-1-abhinjoses@gmail.com> <20260802134443-mutt-send-email-mst@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260802134443-mutt-send-email-mst@kernel.org> On Sun, Aug 02, 2026 at 01:47:01PM -0400, Michael S. Tsirkin wrote: > On Sun, Aug 02, 2026 at 05:40:57PM +0000, Abhin Parekadan Jose wrote: > > While investigating a syzbot report of a WARN_ON_ONCE firing in > > virtio_dev_remove() [1], > > > And I responded to that syzbot report, and I quote: > > So it writes 0 into pci command, effectively killing the device, > and then is unhappy that the driver prints warnings? > Who thought it's a good idea? Why? I was learning how to reproduce syzbot bugs when I found this issue by writing 0 to PCI_COMMAND to simulate an unresponsive device. While doing that I noticed that echo 1 > /sys/../remove hung completely rather than just printing the warning. Since the device_status register lives in the virtio common config MMIO space and has defined values(based on the bits set) in the spec. I thought it made sense for virtio to detect this and handle it gracefully rather than spin forever, so I wrote up a small fix for that. > > I found a related but more serious issue: > > vp_reset() in the modern virtio-pci transport can hang indefinitely > > if PCI_COMMAND memory-space decode is disabled while the device is > > bound (e.g. surprise removal, hardware fault, or -- as reproduced > > here -- a direct write to the PCI_COMMAND register). The status > > register poll loop has no way to distinguish "device still resetting" > > from "device unreachable," so it never terminates. > > > > Patch 1 adds a VIRTIO_STATUS_ERROR() check that recognizes an > > all-ones status read as invalid (per spec, bits 4-5 are reserved and > > can never legitimately be set) and warns once at the point the bad > > read actually happens. > > > > Patch 2 uses that check to break out of vp_reset()'s poll loop > > instead of spinning forever. > > Was all this including the cover letter written with ai assistance? > if yes pls disclose this. Yes, I used AI assistance (Claude). The commit messages were written by me and then refined with AI for spelling and grammar; the cover letter was generated by Claude and reviewed by me. The code, testing, and debugging were done by me -- I reproduced the hang in QEMU, debugged to reach the hanging loop, and wrote the actual fix. I should have disclosed this upfront. I'll do so in future submissions. Do I need to add Assisted-by: Claude to the commit messages? P.S. This is my first kernel patch set.