Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 C9273155382 for ; Wed, 10 Apr 2024 09:25:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712741153; cv=none; b=LMar+xV9eQNai3JI9yde/eEthwls1XB2VdPa0I17QALklw7UQVpQRpozlu2CDPAdLr2okiw0KvAHyRza2wOeball/zN/b7FqnTnPIkdLiz5pq2fxQDg4O2he9DpidmUmJmsefYtQLa9pWsBl+aH230wBGWaJ/BfpAHB4up2XDgw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712741153; c=relaxed/simple; bh=G3RFxpADr7+9bFCx1LDFtoeiDnPcQTzAEYiUHczdSs0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X9J5MadUD7fn5JTI5oBXf4vEPZERXwZeqzgem62W957PYs5W2vrScePvZ0L3ddiQQ08imGWNQULNm/LLk8Gt3cYKJ1gmVWWp/+zq9mz+h2RgkNNHSDtHow+NrkMxpnGlPnUWajv5DMCm/fEMDTx32LhM3p3CQ9hXY+Y2PhEWdgU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none 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=GQFZ1SzL; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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="GQFZ1SzL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712741150; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lH6O5SJfzwQhcNuCT957VIyUzkGWkJyXDBbSG+hsK58=; b=GQFZ1SzLlt4pPEosP0dozOYbB9GUxgLCjyyadnG5mpUAV2HySllZjwAsfcLED4TUroZbMz eFtEYZ4Aryp/qmGjPNIWcg0umnnd0hbOffdYJSo6ujnhjCxPat8mkSU+K2XAAjQPVeBivh RHuiY/5Imcne5wJ4HNGThzCsY666Gps= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-418-_IsAH6bZNm2zn5U7rUEevA-1; Wed, 10 Apr 2024 05:25:46 -0400 X-MC-Unique: _IsAH6bZNm2zn5U7rUEevA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7C69E188E9C3; Wed, 10 Apr 2024 09:25:45 +0000 (UTC) Received: from t14s.fritz.box (unknown [10.39.193.162]) by smtp.corp.redhat.com (Postfix) with ESMTP id 888F517AB3; Wed, 10 Apr 2024 09:25:43 +0000 (UTC) From: David Hildenbrand To: stable@vger.kernel.org Cc: David Hildenbrand , stable@kernel.org, "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo Subject: [PATCH 5.15.y] virtio: reenable config if freezing device failed Date: Wed, 10 Apr 2024 11:25:37 +0200 Message-ID: <20240410092537.145487-1-david@redhat.com> In-Reply-To: <20240327121550.2832232-1-sashal@kernel.org> References: <20240327121550.2832232-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 Currently, we don't reenable the config if freezing the device failed. For example, virtio-mem currently doesn't support suspend+resume, and trying to freeze the device will always fail. Afterwards, the device will no longer respond to resize requests, because it won't get notified about config changes. Let's fix this by re-enabling the config if freezing fails. Fixes: 22b7050a024d ("virtio: defer config changed notifications") Cc: Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Xuan Zhuo Signed-off-by: David Hildenbrand Message-Id: <20240213135425.795001-1-david@redhat.com> Signed-off-by: Michael S. Tsirkin (cherry picked from commit 310227f42882c52356b523e2f4e11690eebcd2ab) Signed-off-by: David Hildenbrand --- drivers/virtio/virtio.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index c2b733ef95b0..2f8f3bd56b00 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c @@ -455,13 +455,19 @@ EXPORT_SYMBOL_GPL(unregister_virtio_device); int virtio_device_freeze(struct virtio_device *dev) { struct virtio_driver *drv = drv_to_virtio(dev->dev.driver); + int ret; virtio_config_disable(dev); dev->failed = dev->config->get_status(dev) & VIRTIO_CONFIG_S_FAILED; - if (drv && drv->freeze) - return drv->freeze(dev); + if (drv && drv->freeze) { + ret = drv->freeze(dev); + if (ret) { + virtio_config_enable(dev); + return ret; + } + } return 0; } -- 2.44.0