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.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 4704E30F958 for ; Mon, 22 Jun 2026 14:59:30 +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=1782140372; cv=none; b=fvwQJtG8qzYjoWQbtgn1uvfzj0bld71N6IXEONFqmvXGrY1OEukAqYJxkPD+9+uq4tIYEOuDm/u2cWfId1eykSVds1UEw0Vm5kMuYS0Ot/qjfV+0YzCPuXycMH4sMyo9K/lSWQLZPPrQMo5hjujaL10Xy1xN+6wagF7UUSBTDlA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782140372; c=relaxed/simple; bh=x8scsJ8h9+Y2mMCa8zH4nxbUTE01RW8OACRJR3AcP84=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PjXocZxTjrVVQYlYGxUItE2TzMBQ+OhpJvnHTeo2oAhpG2B5RywUymIx2XSX0GbOBzzHEQhrizlohJqp2M7aM0qGHnQgJGXBogk8Yje3dOK2PqN/pk8y4c8KKh1IZF/ciOxEcuAbv4XS6ks+7AFFpAbnAMVktTy1Oas63UWM054= 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=N0RTDfZd; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=uFFzgdcr; arc=none smtp.client-ip=170.10.133.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="N0RTDfZd"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="uFFzgdcr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1782140369; 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=/pjQ8vb9svPPFU7KuY+JwsGZZ/nfauUvUk0GUL7V9kc=; b=N0RTDfZdA5gFlWyIMYG5mteoFqRUwPA/jgn6m2C2UUgKA0ijfwrNOeSF4/1gI4+9xqgAwv LHJFxsri0w6o34OS4Bo0a9U6Aq0rsG6HhnsYMyWhheGVUzzgC/e3OhONu+t9+vEajpvHCw M6RfBlwhxHjTljOqAgdSkcOhaqC8/rU= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-128-m9XvJNf4OiC5tv6bREZTmw-1; Mon, 22 Jun 2026 10:59:28 -0400 X-MC-Unique: m9XvJNf4OiC5tv6bREZTmw-1 X-Mimecast-MFC-AGG-ID: m9XvJNf4OiC5tv6bREZTmw_1782140367 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-46016bedbaaso3405209f8f.1 for ; Mon, 22 Jun 2026 07:59:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1782140367; x=1782745167; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=/pjQ8vb9svPPFU7KuY+JwsGZZ/nfauUvUk0GUL7V9kc=; b=uFFzgdcrnzX5XpErOt3jm2+vbinGroOFhST/aqbtK0nOYhfcogtHFeKpxlOdBgOnyZ dii0/cQd0HYUNRlrUMZDvY+lTKbyl5z7S2u0MNXc+QMPrDhYmz7jy+5zx/mJBzYWJogV dhiqFtZJ8QxG+ev96ILy5P/qWta4ye6XCnmHtBKPzoZ1wxG22pV6IyjF4sTi9NAvj77Z kd5TgG7+IxNWnR/jAukHggwVqd1gIOEpyIhZ7lpKV7kAcNI6cU6qd+TXYFDh5Efm2ZBD SkEv+fxqXonwHfsmCbK5fKHKBvMSOvv6hLOOUZkiMgYx3jkeAkdtqIPmtHt9FM9amDjv Umlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782140367; x=1782745167; h=in-reply-to:content-disposition: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; bh=/pjQ8vb9svPPFU7KuY+JwsGZZ/nfauUvUk0GUL7V9kc=; b=Dam+uM0zJvB39GR9J39/5lFf4wsNcFmgPq1NV/5oDlWdXu8PPCtDIZ43z8WXTaQNXQ v6ybZmgQUgKaOkwNcOyyRIqZfPACEqoPn6iGJxAtBhV+p/K+l8f0Ilyn2rVzchYyBQQe Qlb0SH2uAXTGr+8E7ZjrQ2bUAJ+2/A8PVLLLB5oFLNRplQii5YBxbfGzRlLHXUC5spGw 2aIxY1G0xkaWvGwIMzBXXwTho0/FVE7n+MJmb1JuJo9Cn7eFYKjzIid5zDIMr6yRoj1r AmYRh72Kofm7iKWXYSVMPeAe+fhtEZqYadvGa+noDT9QUZyr+ilZfWxWYT32WceNvvtX bmpA== X-Forwarded-Encrypted: i=1; AHgh+Rp8ldOReoxsiLSOgHQ/J6GNai4M+8b3Pg6++vs/5J0I6pjVUqMO7B6Q9wkX76UeZIOKcF2crGSyt9dEf0g=@vger.kernel.org X-Gm-Message-State: AOJu0Yw16Uh7I5WMUPXriYjzrHDgKTxYJR3gsh6qJnH4DfDi2Zr0ENjL JFO29rR4S7XQy5mM9fTgB8QYMMkGxwFNfkJJrkCcpgG4s3N4Olqckre9bgwfIWGVjNcP0sMtyxu 3Dgj744d3SX2/YXIfSLX5k8C12Y+5T8cUHP+oLH7u/A5/Ve7W5VrjK854fwjO+JCdCw== X-Gm-Gg: AfdE7cnWXh/TXFOFtFmaIZ0W5TwhSJ46NBOpf+3HVZLTNdo8mo3bV3GogYmNS3+0pmx jWAa9sdQGMOSnxEu7uaSBPvba6msGwMHXSidlYLAe3KKlhLnd8FTigpv6X2LbPbx+TCxcmQHg8Z +5P8pkYBhJAZRUcaHUPKgkuEKe42SJSXE6KOyqU7rhd39vWw8LNriXozbLYjpEzroLQDLlRj6QP YOzCjCmroTJHxJpnbZYqG0q6JDRpDHUAyZ5RrXR1SXUmbH9cHAZWyHdRP1mkk5Y5YHv+osmPfa1 iD9gEF7+q4KSG6XouAc6rCumdugD7+GhOuGfKExIE2YZC0PwEXpSVcFj7z9GcuHQEM2Wq3Cro53 57f4Cuwktwl4fhbzSRHdRsU0DNncyKo3c X-Received: by 2002:a05:6000:41cb:b0:46a:6474:83a8 with SMTP id ffacd0b85a97d-46a647488b9mr422307f8f.40.1782140366423; Mon, 22 Jun 2026 07:59:26 -0700 (PDT) X-Received: by 2002:a05:6000:41cb:b0:46a:6474:83a8 with SMTP id ffacd0b85a97d-46a647488b9mr422210f8f.40.1782140365398; Mon, 22 Jun 2026 07:59:25 -0700 (PDT) Received: from redhat.com (IGLD-80-230-85-71.inter.net.il. [80.230.85.71]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-466643f563dsm24534651f8f.3.2026.06.22.07.59.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jun 2026 07:59:24 -0700 (PDT) Date: Mon, 22 Jun 2026 10:59:22 -0400 From: "Michael S. Tsirkin" To: "David Hildenbrand (Arm)" Cc: "Denis V. Lunev" , virtualization@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] virtio_balloon: factor out virtballoon_quiesce() Message-ID: <20260622105912-mutt-send-email-mst@kernel.org> References: <20260622133715.3707707-1-den@openvz.org> <20260622133715.3707707-2-den@openvz.org> <79aa1649-acbb-4898-b533-4c991a6ca19b@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: <79aa1649-acbb-4898-b533-4c991a6ca19b@kernel.org> On Mon, Jun 22, 2026 at 04:46:48PM +0200, David Hildenbrand (Arm) wrote: > On 6/22/26 15:37, Denis V. Lunev wrote: > > virtballoon_remove() stops all of the balloon's asynchronous work (the > > free page reporting worker, the inflate/deflate and stats workers, the > > OOM notifier and the free page shrinker) before tearing the device > > down. A following change needs the same teardown from a .shutdown > > handler, so move it into a virtballoon_quiesce() helper. > > > > No functional change. > > > > Signed-off-by: Denis V. Lunev > > --- > > drivers/virtio/virtio_balloon.c | 27 ++++++++++++++++++++------- > > 1 file changed, 20 insertions(+), 7 deletions(-) > > > > diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c > > index 088b3a0e6ce6..5b02d9191ac6 100644 > > --- a/drivers/virtio/virtio_balloon.c > > +++ b/drivers/virtio/virtio_balloon.c > > @@ -1098,26 +1098,39 @@ static void remove_common(struct virtio_balloon *vb) > > vb->vdev->config->del_vqs(vb->vdev); > > } > > > > -static void virtballoon_remove(struct virtio_device *vdev) > > +/* > > + * Stop all asynchronous balloon work. The device must still be alive so that > > + * in-flight requests can drain via the host before it is reset or freed. > > + */ > > +static void virtballoon_quiesce(struct virtio_balloon *vb) > > { > > - struct virtio_balloon *vb = vdev->priv; > > + struct virtio_device *vdev = vb->vdev; > > > > - if (virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_REPORTING)) > > + if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_REPORTING)) > > page_reporting_unregister(&vb->pr_dev_info); > > Most functions here grab mutexes and can sleep. I assume that's fine in shutdown > context. > > Nothing jumped at me > > > Sashiko asks whether ->remove (hotunplug/driver-unloading) can follow a > ->shutdown callback. I don't know, seems questionable if this could happen and > should probably be handled by the core? > > If it's possible you'd have to remember that stuff was already quiesce'ed. Maybe > simply by checking early in virtballoon_quiesce() whether vb->stop_update == > true already. > > -- > Cheers, > > David I don't think it can happen. -- MST