From nobody Wed Nov 27 00:37:18 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1703582725; cv=none; d=zohomail.com; s=zohoarc; b=k7qFafTXCk4nVAnsscc2GcCSCQvQav/9ZSkSaOE/lBR9F8RkuaykLkwxPet7j2lvhZOIrBTXFIqTylQkJtitqWTvCr3KAmed+aMdDVVaaQAb3TS2zn3d7YBPolJ5YvxUFOvVcpC8C7LhLGG4UsDzyDDdV96qSbtiZHNwyUEPETY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1703582725; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=MlOqSlfgZan+WoAwKqTBR2Fe+bYpSsLlMzeyIzh7tJo=; b=ODtJMuTo7P5sMqDJ/n/VT3zMpTFxbfvNf43QLTSB/ROKwHh5J2Ik+gLUbgFfBn1r+LnBZL2UDyFr78zVIXcXgiVKu2p4EpfbeSktZrHYcnPbSsMoA7xDHMl/Qlux/RxWZ91lQ2X8BwP8565CTPv2sugTqysOpf+PGLiXr2FtZZA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 170358272544737.3645554130286; Tue, 26 Dec 2023 01:25:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rI3g4-0001gy-R3; Tue, 26 Dec 2023 04:24:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rI3fv-0001LI-ST for qemu-devel@nongnu.org; Tue, 26 Dec 2023 04:24:39 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rI3fu-0008I0-Dp for qemu-devel@nongnu.org; Tue, 26 Dec 2023 04:24:35 -0500 Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-241-sO7JgxYVN-Kbc81VXA6yIg-1; Tue, 26 Dec 2023 04:24:32 -0500 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-40d5bf5ca25so229815e9.0 for ; Tue, 26 Dec 2023 01:24:32 -0800 (PST) Received: from redhat.com ([2.55.177.189]) by smtp.gmail.com with ESMTPSA id h9-20020a05600c350900b0040d5aca25f1sm1189620wmq.17.2023.12.26.01.24.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Dec 2023 01:24:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703582673; 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=MlOqSlfgZan+WoAwKqTBR2Fe+bYpSsLlMzeyIzh7tJo=; b=MGltQlZP4Nfxw/qV8S8LebL86qxgcFX8ForvGhGp8cRULbG3OsIs/A1CEorgJE2UqWKBPf QmfW0eJwVTPgXX23Lg9udqA+9B/V956q/fA2jaJaMiV+SNPZESz+rH+/ora+MEIL06zC65 tnmYh+V52C1dNzmC7fzOCela1W/5rvM= X-MC-Unique: sO7JgxYVN-Kbc81VXA6yIg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703582669; x=1704187469; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=MlOqSlfgZan+WoAwKqTBR2Fe+bYpSsLlMzeyIzh7tJo=; b=GHiMixTPF2fKgXtBz5ksY1ufqCAxW3PQyjNKdUGtV0IcHRCrv6/Kzm1TuFpdwhKtWr KpnaVQsGsfvEyi9z01OQRPImpLvVNayUjjEDjOGO6/dtv4khhzKYEgl+Nxbpk123jwYf FfrReDqW80oqyojKgmkfCeYsRDjNufxgOO+h2MCuDt7P9qbccoTsAJFluyUJrfoKZPuu luRce79EAHhINc1sSfAInit3QF2RB1F/mjCoXkxY9VyCdKJPpbriiT/jZhTgS7iN00a1 BvawuZ4rGNtr3hdclkzas+AcQfxSRiXeq68rZrFkByMKzp6Q6JPuuVab1T/7OdFTDMYv KoQg== X-Gm-Message-State: AOJu0YyVKmB2hweHSlIdMtYbjsNP4ExxyYYN8/GNth4igOvZpswnPLQM q+yL8E4XI51fHAzRB1wEmM6k9d0qsNlkidthtHtUn5B47BKnDBTO7ul1keNdRXoMtSllyUj3KSv k/HtMt++A7qZHvZ3h7nG4yJSCGayZqAzSgYS5KY0aWToK1RFTBvk0By8EJvcul7inXVOfPdCaUu cc X-Received: by 2002:a05:600c:1e1b:b0:40c:4a25:8cf9 with SMTP id ay27-20020a05600c1e1b00b0040c4a258cf9mr3886690wmb.50.1703582669547; Tue, 26 Dec 2023 01:24:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IFyP2iDaERehvVnpEElQF830GO5A2ihZHyWx+DmdGnBIbL3BvtCnjHn09FG31Z4nhDxA5Q2tg== X-Received: by 2002:a05:600c:1e1b:b0:40c:4a25:8cf9 with SMTP id ay27-20020a05600c1e1b00b0040c4a258cf9mr3886682wmb.50.1703582669106; Tue, 26 Dec 2023 01:24:29 -0800 (PST) Date: Tue, 26 Dec 2023 04:24:26 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Cc: Peter Maydell , wangmeiling , Binfeng Wu , Gerd Hoffmann Subject: [PULL 07/21] Fix bugs when VM shutdown with virtio-gpu unplugged Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -50 X-Spam_score: -5.1 X-Spam_bar: ----- X-Spam_report: (-5.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.977, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1703582727690100003 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: wangmeiling Virtio-gpu malloc memory for the queue when it realized, but the queues was= not released when it unrealized, which resulting in a memory leak. In addition, vm_change_state_handler is not cleaned up, which is related to vdev and will lead to segmentation fault when VM shutdown. Signed-off-by: wangmeiling Signed-off-by: Binfeng Wu Message-Id: <7bbbc0f3-2ad9-83ca-b39b-f976d0837daf@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/display/virtio-gpu-base.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c index 37af256219..4fc7ef8896 100644 --- a/hw/display/virtio-gpu-base.c +++ b/hw/display/virtio-gpu-base.c @@ -251,7 +251,11 @@ void virtio_gpu_base_device_unrealize(DeviceState *qdev) { VirtIOGPUBase *g =3D VIRTIO_GPU_BASE(qdev); + VirtIODevice *vdev =3D VIRTIO_DEVICE(qdev); =20 + virtio_del_queue(vdev, 0); + virtio_del_queue(vdev, 1); + virtio_cleanup(vdev); migrate_del_blocker(&g->migration_blocker); } =20 --=20 MST