From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 47EB3171B1 for ; Sun, 2 Aug 2026 17:47:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785692831; cv=none; b=G/snSBz7h74SHuKIgW7lRB2lNq2tcA4aYbt5FAvQ2guRkRZPgBf+tXUr47cO+scIS6+LSXsT+CKQaPFfvH8k7DLgFZGkcsaWQU6uSdzUdWGsW5Nz4sIeDMJstbJ92Bxzi1Q/tcHP+1JfV358AAvaxH7ATze6MA9ENXz5PdKlCSA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785692831; c=relaxed/simple; bh=DlyweINH+GvftD3lzjrMXVxM0P1aIDv+GXcUBeZjlkc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gFC7WLGuaNgLyr8NQpNqIXzelDDSlDf7elzb8VToi9dHjM/iMD3xE4eXg0iQAmWm09ir6fyAcJECFY9XhaLmeoSWjEI9p+MMtvla/tYnENEC6ZXx+1vPjDXpCJKKkjJqtuSRNdZJNLdv3UiB3EtZyLUvdOsEwXanEeR/i4mK6mg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Rw5+f+zM; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=SAxJnQOA; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Rw5+f+zM"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="SAxJnQOA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1785692828; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=q/zJ7SZsSD5kcxXbfEJ/DIJOA2s+11oRTsQm/YI6m+A=; b=Rw5+f+zMc3V99zSg+93Hicmg+zyVeqO+lKrEHYr6iESEuKkLrCFPB+cSpvopL5659sj/1V /1pEPM9CydnPVVKqpNPraEXs48e/QvCA9uJ7cp5epEryWUtr84SlF3QieTC1SvT+HmTIiV pBaBF+c6r/FCmFEGQopZLNtyzL7scf4= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-359-G4CipMa_PzaPRPOuS9yMyg-1; Sun, 02 Aug 2026 13:47:06 -0400 X-MC-Unique: G4CipMa_PzaPRPOuS9yMyg-1 X-Mimecast-MFC-AGG-ID: G4CipMa_PzaPRPOuS9yMyg_1785692825 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-47407691804so2029305f8f.1 for ; Sun, 02 Aug 2026 10:47:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1785692825; x=1786297625; 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=q/zJ7SZsSD5kcxXbfEJ/DIJOA2s+11oRTsQm/YI6m+A=; b=SAxJnQOAq36avWbAmiz8kaEvRG8TlDDs30ThIaaRqO96VPK7zOcNkCqOTcn7MD/qxc Y4Q6klmHyC7IpKBmSyllu7A0Ude+4fLBJs9mTXJNobLFIOcMkuHxwTw7deau10gpVOpm a0P9hNlCPuIzSV6XxZ0gFlXsy2vaWML/bOwdDtNXp6AcZHtwqj0f87M/joCWrupI4hBU hedk0Z7038RThTjHw/bXu4qKD2cD8vFKASLgvkXWIU9M2qZjFFu9oWUrbRxNWCvCZDtB 8VlBiVmodzkkYuLm4hdE7V+x9ekl1+KjsLuGocNltorBhxor8/RpdtEyWIeWLQwb2AaT xAdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785692825; x=1786297625; 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=q/zJ7SZsSD5kcxXbfEJ/DIJOA2s+11oRTsQm/YI6m+A=; b=Nha/IdDDVVkhQ5AIASVOedKwOQg7v8PJiZXA7cwMf/uJ0j6q0wkGGygNQswloBuay/ ATNpsqEWuK1+M0DXIjnaRTHJuYMHqfrZFDOKuAmauxRQOZrdvvUrnRQMxdblGaiG5CoK CgeOrQ3zRq1qUnVOXW8fAoQCNZYFfWmkmz9HlbZg1aMJppJjDb7c6b73+er69rzpKUqh CjAmV7O/FPul/JNXNkxoX2i6WzYhY6+d2UC53HjCtw6GPMD8tX6ON/OjlL8hUB16hSrM f/m+pXAAMoVmaDRlhOuojUsiW20muzeJ6H9PdvwPTHZ+B+tRVah7Mt/1DKnX5cwAbY2A cJZw== X-Forwarded-Encrypted: i=1; AHgh+Rr2kk6XwyHwHvH3mZX5b6IpiFUEq5RZufWBOwoSVy9czx24rdgZa8q5ag4mk4V4Cvv9WHEP/BOC64zI0PE=@vger.kernel.org X-Gm-Message-State: AOJu0Ywc77r2qC9rYcxsnWvDg7YhT6CUoEBpBAM8m5S2xkQRQ2EEcl4w FWXerQvZNx7xZfbvsf32ZtQpJPjFkINANiBWxLp3VtVKr++2FX3THOLE1EAIJFjf4tyTjh36XbP SQAr7wFrgwoYCKSvcou4EUr60rOxMc8YUspq4kP1X5mMb5wsIxGJtQrXJ/mVAST3+Mw== X-Gm-Gg: AR+sD1202DREvMY5EfHxsoO5NF+v5281lPUKDzgXBqnrVTyG0MC0RSd4WPdkaSyumst Vi7X91+PVgVvkMpyDVOMePD+1jjQM0t4guxcYvI0DjXC8uXDC7fnfabXi9h+PflBWv+eV2n+sGz 63V1Q0A7WuFO12jI0wxgIIgqbOmj2O+UIcckWgwg/IL8rEqWYwgidz3gauy7o1iJZ2aKoSSImvZ c0TIjWN2AajKVyLuGWQ+1xaxMskbbr2b0eQVqgjuQHTT8G/NOG0kumR9TXSm39LDkmLKSbAsEOZ +p9M4LSwQ1lgclmJM+1Qw9AEGMHoB325uAwPISguZMS+Vh3rcVGH0Fblh12dI3QuOyzieFzvgms /atFgVKcd+GjTcmjxsQlhGA== X-Received: by 2002:a05:6000:2887:b0:47f:89cd:b48 with SMTP id ffacd0b85a97d-47fd72a5d23mr19183829f8f.5.1785692825392; Sun, 02 Aug 2026 10:47:05 -0700 (PDT) X-Received: by 2002:a05:6000:2887:b0:47f:89cd:b48 with SMTP id ffacd0b85a97d-47fd72a5d23mr19183778f8f.5.1785692824939; Sun, 02 Aug 2026 10:47:04 -0700 (PDT) Received: from redhat.com (IGLD-80-230-28-14.inter.net.il. [80.230.28.14]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47fd41d1956sm25898382f8f.6.2026.08.02.10.47.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Aug 2026 10:47:04 -0700 (PDT) Date: Sun, 2 Aug 2026 13:47:01 -0400 From: "Michael S. Tsirkin" To: Abhin Parekadan Jose 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: <20260802134443-mutt-send-email-mst@kernel.org> References: <20260802174059.4082-1-abhinjoses@gmail.com> 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: <20260802174059.4082-1-abhinjoses@gmail.com> 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 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. > Reproduced on a modern-transport virtio-blk-pci device: > > # printf '\x00\x00' | dd of=/sys/bus/pci/devices/0000:01:00.0/config \ > bs=1 seek=4 count=2 conv=notrunc > # echo 1 > /sys/bus/pci/devices/0000:01:00.0/remove > > The second command hangs indefinitely without this series; gdb > confirms the CPU is stuck in vp_reset()'s status-polling loop, with > vp_modern_get_status() consistently returning 0xff. > > [1] https://syzbot.org/bug?extid=a1c8effc62c569d4bd25 > > Abhin Parekadan Jose (2): > virtio_pci_modern_dev: warn once on invalid status > virtio_pci_modern: avoid infinite loop in vp_reset() on invalid status > > drivers/virtio/virtio_pci_modern.c | 6 +++++- > drivers/virtio/virtio_pci_modern_dev.c | 8 +++++++- > include/uapi/linux/virtio_config.h | 16 ++++++++++++++++ > 3 files changed, 28 insertions(+), 2 deletions(-) > > -- > 2.51.1