From nobody Mon Feb 9 14:45:35 2026 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=1691441297; cv=none; d=zohomail.com; s=zohoarc; b=frDyrherjGkPbtWX7NzllHWEE2BNCGYjc8H1N8Uzri5jwyzHN/KkwjLWf/TtN80t8Q2pZ3mOaXMDJScjkihA/4vA4h4z8i44lNIDdWqTB0Zi8GAs8gQ5FQosBSudA7LWSe6IT3zV1c1xxnUrigxZRlvtyUA5pwzN5Qas8LS9/UU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691441297; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iTiargiIHnOWuLXbyhF4rrzgv/ceuQWlIyOsdopXpTc=; b=nUq/c+s1DNcFLDp67aOuDHb3CHB127OsXLesUF0mlP+nQfvpLub9QQxLpnltwcM0wTOJifG3jC+kegjln223xCakSf07r+J43pJ1YDR933baQxZf9TCdLzIppx7lsrQenG7sfo95+ZoSEKYjOuLfVXXDn+MvyJVexbaj8vpleW4= 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 1691441297578403.09755089735415; Mon, 7 Aug 2023 13:48:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qT78b-00056p-Oj; Mon, 07 Aug 2023 16:47:37 -0400 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 1qT78Z-00056N-QF for qemu-devel@nongnu.org; Mon, 07 Aug 2023 16:47:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qT78Y-0006a2-AH for qemu-devel@nongnu.org; Mon, 07 Aug 2023 16:47:35 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-442-n5eNEDQ_MvSkgbYOM40Iag-1; Mon, 07 Aug 2023 16:47:30 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9F5DC8DC664; Mon, 7 Aug 2023 20:47:29 +0000 (UTC) Received: from localhost (unknown [10.39.208.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6AE73492C13; Mon, 7 Aug 2023 20:47:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691441253; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iTiargiIHnOWuLXbyhF4rrzgv/ceuQWlIyOsdopXpTc=; b=BZbQWTIL6xwjSWz6N7LLXLFBMj1IMkCo9C2ZAt97zYf3yRWj5LimsSLGux+VGGCdHJaWWd qrX7qf0pVe6EiF2eeC2LpugjbHaRSFc+lMXcdXHIzd7HOJOUb9x8IRROdykCle6c5+vqkk aegGNLdgaRUvOqG5TAz1WGgLgev/QbA= X-MC-Unique: n5eNEDQ_MvSkgbYOM40Iag-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Eduardo Habkost , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , "Michael S. Tsirkin" , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini Subject: [PULL 1/6] chardev: report the handshake error Date: Tue, 8 Aug 2023 00:47:12 +0400 Message-ID: <20230807204717.2483983-2-marcandre.lureau@redhat.com> In-Reply-To: <20230807204717.2483983-1-marcandre.lureau@redhat.com> References: <20230807204717.2483983-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1691441299482100007 From: Marc-Andr=C3=A9 Lureau This can help to debug connection issues. Related to: https://bugzilla.redhat.com/show_bug.cgi?id=3D2196182 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20230510072531.3937189-1-marcandre.lureau@redhat.com> --- chardev/char-socket.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/chardev/char-socket.c b/chardev/char-socket.c index 8c58532171..e8e3a743d5 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -742,8 +742,12 @@ static void tcp_chr_websock_handshake(QIOTask *task, g= pointer user_data) { Chardev *chr =3D user_data; SocketChardev *s =3D user_data; + Error *err =3D NULL; =20 - if (qio_task_propagate_error(task, NULL)) { + if (qio_task_propagate_error(task, &err)) { + error_reportf_err(err, + "websock handshake of character device %s failed= : ", + chr->label); tcp_chr_disconnect(chr); } else { if (s->do_telnetopt) { @@ -778,8 +782,12 @@ static void tcp_chr_tls_handshake(QIOTask *task, { Chardev *chr =3D user_data; SocketChardev *s =3D user_data; + Error *err =3D NULL; =20 - if (qio_task_propagate_error(task, NULL)) { + if (qio_task_propagate_error(task, &err)) { + error_reportf_err(err, + "TLS handshake of character device %s failed: ", + chr->label); tcp_chr_disconnect(chr); } else { if (s->is_websock) { --=20 2.41.0 From nobody Mon Feb 9 14:45:35 2026 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=1691441308; cv=none; d=zohomail.com; s=zohoarc; b=EW9drN9kuutUQOqRzLQPs+GJ4FNC/DJ2tJ5KKJd6JcOR/T3OefJzmBlo+ez4vNAZ9QLnPPVdqUKJ7kfyoS9ttTRv1gQUpugfPD/EWfNEJNVExW6NCw5upn/CwYamzT7r61sVfSzMuhRGcDMTUgCjMyiaUpmJaFWZVOfipaQBfpg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691441308; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=B8/nmnjX/oT/EH2hIfwS++unWGo4NFFSe+H0q8Syim8=; b=JVZa1ACHpgQmrkhLVtQJ75in0xQQ0shuoScbJZlYd155ssFq5L/saxK1gzqVbg538TKwg/g8brB0OMkKxhoe8XeY+wjchZ1quRyaXoCTshs3/OSLxCdlgJCeoOt+d55/npTbylSthUe2rbptwnEgnb5AfxQfAU9QMOev7rBe+qo= 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 1691441308990431.1804722752621; Mon, 7 Aug 2023 13:48:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qT78f-00057L-QJ; Mon, 07 Aug 2023 16:47:41 -0400 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 1qT78e-00056x-8S for qemu-devel@nongnu.org; Mon, 07 Aug 2023 16:47:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qT78c-0006bQ-Q7 for qemu-devel@nongnu.org; Mon, 07 Aug 2023 16:47:40 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-344-5v_NhLx0Ok6l8ZX9kDjxOw-1; Mon, 07 Aug 2023 16:47:36 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 982422815E28; Mon, 7 Aug 2023 20:47:35 +0000 (UTC) Received: from localhost (unknown [10.39.208.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5CB1B403169; Mon, 7 Aug 2023 20:47:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691441258; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=B8/nmnjX/oT/EH2hIfwS++unWGo4NFFSe+H0q8Syim8=; b=J4KJ9OI1Fg65PiQm0oKOQS2qLDl3SqpqA+Q3j4pbtRYcNECV/5NZC/RkjiG21/cjuFD2hV fbPX3Q2HDuAEHKecS1QSrd1Ja3vJ+wcoKcDEtHLR0i7aEbYVRjsA5riJ/fVVJ5cjW3Zxqx oaS4UcDbzxHe2c/q+TFceCX9hM37xR8= X-MC-Unique: 5v_NhLx0Ok6l8ZX9kDjxOw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Eduardo Habkost , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , "Michael S. Tsirkin" , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini Subject: [PULL 2/6] virtio-gpu: free BHs, by implementing unrealize Date: Tue, 8 Aug 2023 00:47:13 +0400 Message-ID: <20230807204717.2483983-3-marcandre.lureau@redhat.com> In-Reply-To: <20230807204717.2483983-1-marcandre.lureau@redhat.com> References: <20230807204717.2483983-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1691441309216100003 From: Marc-Andr=C3=A9 Lureau Acked-by: Dongwon Kim Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20230726173929.690601-2-marcandre.lureau@redhat.com> --- include/hw/virtio/virtio-gpu.h | 1 + hw/display/virtio-gpu-base.c | 2 +- hw/display/virtio-gpu.c | 10 ++++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 7ea8ae2bee..05bee09e1a 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -238,6 +238,7 @@ bool virtio_gpu_base_device_realize(DeviceState *qdev, VirtIOHandleOutput ctrl_cb, VirtIOHandleOutput cursor_cb, Error **errp); +void virtio_gpu_base_device_unrealize(DeviceState *qdev); void virtio_gpu_base_reset(VirtIOGPUBase *g); void virtio_gpu_base_fill_display_info(VirtIOGPUBase *g, struct virtio_gpu_resp_display_info *dpy_info); diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c index 7ab7d08d0a..ca1fb7b16f 100644 --- a/hw/display/virtio-gpu-base.c +++ b/hw/display/virtio-gpu-base.c @@ -244,7 +244,7 @@ virtio_gpu_base_set_features(VirtIODevice *vdev, uint64= _t features) trace_virtio_gpu_features(((features & virgl) =3D=3D virgl)); } =20 -static void +void virtio_gpu_base_device_unrealize(DeviceState *qdev) { VirtIOGPUBase *g =3D VIRTIO_GPU_BASE(qdev); diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index e8603d78ca..b1f5d392bb 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -1392,6 +1392,15 @@ void virtio_gpu_device_realize(DeviceState *qdev, Er= ror **errp) QTAILQ_INIT(&g->fenceq); } =20 +static void virtio_gpu_device_unrealize(DeviceState *qdev) +{ + VirtIOGPU *g =3D VIRTIO_GPU(qdev); + + g_clear_pointer(&g->ctrl_bh, qemu_bh_delete); + g_clear_pointer(&g->cursor_bh, qemu_bh_delete); + virtio_gpu_base_device_unrealize(qdev); +} + void virtio_gpu_reset(VirtIODevice *vdev) { VirtIOGPU *g =3D VIRTIO_GPU(vdev); @@ -1492,6 +1501,7 @@ static void virtio_gpu_class_init(ObjectClass *klass,= void *data) vgbc->gl_flushed =3D virtio_gpu_handle_gl_flushed; =20 vdc->realize =3D virtio_gpu_device_realize; + vdc->unrealize =3D virtio_gpu_device_unrealize; vdc->reset =3D virtio_gpu_reset; vdc->get_config =3D virtio_gpu_get_config; vdc->set_config =3D virtio_gpu_set_config; --=20 2.41.0 From nobody Mon Feb 9 14:45:35 2026 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=1691441292; cv=none; d=zohomail.com; s=zohoarc; b=Rkhz9viA6R+HAS+Ty9QqXFuAGCzQhE9dgB1vFGOiDhpFX1VscVNYeSw5GCh/c0veMYG6A/FicFrMekZVg4wP/VBjraVsrNuH5s2voFKmi8q7/nPtZonvgVzF7YviJOAxuoWZH/7yHiLKMRhILXPDu9AlQa6dx+ljMXZX3yzUHOc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691441292; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xD27uz9lwEBIgcuTs4tdsM5dnZ8LU2gTNw6lVv+7ZdA=; b=QB6s895gt53FWcA3ivhElOHQbSE0UQbJIsO3q3TV/hOY5mpYJtFIrvLOVWs9vYuyhnJzBiFehPFApZzVB2o5GIZq1FmeDSxXDLVl3tNe4WYHnzY+2wbVvMix0Ry2ViDrLk8BYcZDwizVAqTn0fude8OQz1hWhmJWsy5enIKtpQw= 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 1691441292967997.8164222936865; Mon, 7 Aug 2023 13:48:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qT78n-000586-Fd; Mon, 07 Aug 2023 16:47:49 -0400 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 1qT78m-00057v-4C for qemu-devel@nongnu.org; Mon, 07 Aug 2023 16:47:48 -0400 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 1qT78k-0006gr-Ir for qemu-devel@nongnu.org; Mon, 07 Aug 2023 16:47:47 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-643-CPpGrhwePgypIAGB56hIfg-1; Mon, 07 Aug 2023 16:47:41 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 25354185A791; Mon, 7 Aug 2023 20:47:41 +0000 (UTC) Received: from localhost (unknown [10.39.208.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9347E1759C; Mon, 7 Aug 2023 20:47:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691441265; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xD27uz9lwEBIgcuTs4tdsM5dnZ8LU2gTNw6lVv+7ZdA=; b=I+0KAxTBaCvcM9AmfxIcRGUmfUNnS2e25lEZdCNI1ooLn/TD8e5zXS10H/mmgnYqqrgqHA oRcvdfpCQM7ydPSBrsdTAbfHCqa4IxKkE9Dw2kv01G0drZok055v7WcvYswZrL9OuuprJ7 NZSYr52YxXNG1aMzZ2yfkqGaTV/xOu4= X-MC-Unique: CPpGrhwePgypIAGB56hIfg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Eduardo Habkost , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , "Michael S. Tsirkin" , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini Subject: [PULL 3/6] virtio-gpu: reset gfx resources in main thread Date: Tue, 8 Aug 2023 00:47:14 +0400 Message-ID: <20230807204717.2483983-4-marcandre.lureau@redhat.com> In-Reply-To: <20230807204717.2483983-1-marcandre.lureau@redhat.com> References: <20230807204717.2483983-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1691441293615100003 From: Marc-Andr=C3=A9 Lureau Calling OpenGL from different threads can have bad consequences if not carefully reviewed. It's not generally supported. In my case, I was debugging a crash in glDeleteTextures from OPENGL32.DLL, where I asked qemu for gl=3Des, and thus ANGLE implementation was expected. libepoxy did resolution of the global pointer for glGenTexture to the GLES version from the main thread. But it resolved glDeleteTextures to the GL version, because it was done from a different thread without correct context. Oops. Let's stick to the main thread for GL calls by using a BH. Note: I didn't use atomics for reset_finished check, assuming the BQL will provide enough of sync, but I might be wrong. Acked-by: Dongwon Kim Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20230726173929.690601-3-marcandre.lureau@redhat.com> --- include/hw/virtio/virtio-gpu.h | 3 +++ hw/display/virtio-gpu.c | 38 +++++++++++++++++++++++++++------- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 05bee09e1a..390c4642b8 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -169,6 +169,9 @@ struct VirtIOGPU { =20 QEMUBH *ctrl_bh; QEMUBH *cursor_bh; + QEMUBH *reset_bh; + QemuCond reset_cond; + bool reset_finished; =20 QTAILQ_HEAD(, virtio_gpu_simple_resource) reslist; QTAILQ_HEAD(, virtio_gpu_ctrl_command) cmdq; diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index b1f5d392bb..bbd5c6561a 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -14,6 +14,7 @@ #include "qemu/osdep.h" #include "qemu/units.h" #include "qemu/iov.h" +#include "sysemu/cpus.h" #include "ui/console.h" #include "trace.h" #include "sysemu/dma.h" @@ -41,6 +42,7 @@ virtio_gpu_find_check_resource(VirtIOGPU *g, uint32_t res= ource_id, =20 static void virtio_gpu_cleanup_mapping(VirtIOGPU *g, struct virtio_gpu_simple_resource *= res); +static void virtio_gpu_reset_bh(void *opaque); =20 void virtio_gpu_update_cursor_data(VirtIOGPU *g, struct virtio_gpu_scanout *s, @@ -1387,6 +1389,8 @@ void virtio_gpu_device_realize(DeviceState *qdev, Err= or **errp) &qdev->mem_reentrancy_guard); g->cursor_bh =3D qemu_bh_new_guarded(virtio_gpu_cursor_bh, g, &qdev->mem_reentrancy_guard); + g->reset_bh =3D qemu_bh_new(virtio_gpu_reset_bh, g); + qemu_cond_init(&g->reset_cond); QTAILQ_INIT(&g->reslist); QTAILQ_INIT(&g->cmdq); QTAILQ_INIT(&g->fenceq); @@ -1398,20 +1402,44 @@ static void virtio_gpu_device_unrealize(DeviceState= *qdev) =20 g_clear_pointer(&g->ctrl_bh, qemu_bh_delete); g_clear_pointer(&g->cursor_bh, qemu_bh_delete); + g_clear_pointer(&g->reset_bh, qemu_bh_delete); + qemu_cond_destroy(&g->reset_cond); virtio_gpu_base_device_unrealize(qdev); } =20 -void virtio_gpu_reset(VirtIODevice *vdev) +static void virtio_gpu_reset_bh(void *opaque) { - VirtIOGPU *g =3D VIRTIO_GPU(vdev); + VirtIOGPU *g =3D VIRTIO_GPU(opaque); struct virtio_gpu_simple_resource *res, *tmp; - struct virtio_gpu_ctrl_command *cmd; int i =3D 0; =20 QTAILQ_FOREACH_SAFE(res, &g->reslist, next, tmp) { virtio_gpu_resource_destroy(g, res); } =20 + for (i =3D 0; i < g->parent_obj.conf.max_outputs; i++) { + dpy_gfx_replace_surface(g->parent_obj.scanout[i].con, NULL); + } + + g->reset_finished =3D true; + qemu_cond_signal(&g->reset_cond); +} + +void virtio_gpu_reset(VirtIODevice *vdev) +{ + VirtIOGPU *g =3D VIRTIO_GPU(vdev); + struct virtio_gpu_ctrl_command *cmd; + + if (qemu_in_vcpu_thread()) { + g->reset_finished =3D false; + qemu_bh_schedule(g->reset_bh); + while (!g->reset_finished) { + qemu_cond_wait_iothread(&g->reset_cond); + } + } else { + virtio_gpu_reset_bh(g); + } + while (!QTAILQ_EMPTY(&g->cmdq)) { cmd =3D QTAILQ_FIRST(&g->cmdq); QTAILQ_REMOVE(&g->cmdq, cmd, next); @@ -1425,10 +1453,6 @@ void virtio_gpu_reset(VirtIODevice *vdev) g_free(cmd); } =20 - for (i =3D 0; i < g->parent_obj.conf.max_outputs; i++) { - dpy_gfx_replace_surface(g->parent_obj.scanout[i].con, NULL); - } - virtio_gpu_base_reset(VIRTIO_GPU_BASE(vdev)); } =20 --=20 2.41.0 From nobody Mon Feb 9 14:45:35 2026 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=1691441297; cv=none; d=zohomail.com; s=zohoarc; b=CHODErqAHLw7ceQYol8DzfcQ+Z4SCiVmbGuMvtqcuwSZFb7oy5n5Csh/nrfgWYSJNLl5XLJykUE1jcBrFk+XHR4XfXmv02D/dfT/kqEHpyetBJ4586qrFiKGyBXvqVqZkmjYIWSpZXgRBaCmH6USkW/JPasSIuf3noNsE48Vr6I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691441297; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rsm/L74A5zo+k+IhFT6hYdMP2C4/39xIKWiR3NcA1Dc=; b=M7hbAYVstBKrx9lG8RY8v8DPAz8Vl849lXk2RHMncmvbgb7Fv/oCl0tWvmblz3xAK4XjG84am/7SPyFnFV+0namB0WFt8mUB6e+UXuYtF0/wAB0LKbzmxi2kmj//ovn1dhv2b0R5L2RsJlZPfY5Q3C6+zKDWCqSq12E2RvOhxU0= 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 1691441297434993.0398468773245; Mon, 7 Aug 2023 13:48:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qT78z-0005Lc-R4; Mon, 07 Aug 2023 16:48:01 -0400 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 1qT78u-0005IZ-Vm for qemu-devel@nongnu.org; Mon, 07 Aug 2023 16:47:57 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qT78t-0006hz-7q for qemu-devel@nongnu.org; Mon, 07 Aug 2023 16:47:56 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-244-UUm_1RxVPxSWgSnd9DPIIg-1; Mon, 07 Aug 2023 16:47:48 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BB7EA800159; Mon, 7 Aug 2023 20:47:47 +0000 (UTC) Received: from localhost (unknown [10.39.208.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B79840C2076; Mon, 7 Aug 2023 20:47:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691441274; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rsm/L74A5zo+k+IhFT6hYdMP2C4/39xIKWiR3NcA1Dc=; b=gGTM+31hTdc7G09GqSYS6qC88LqZoiok+P5dsNQH9KBLlSDCqQmHAQliw+RPUOjxMTtpEg RskWp5rBzIol7G6pKKmul9D2sWH7S1sJGxKSuIUeBZzM5OlPvw7cgZg0UBwASyqr4RWU6d nZ0GSlPv+NuTw25WNp3ymjtKWrqXGHo= X-MC-Unique: UUm_1RxVPxSWgSnd9DPIIg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Eduardo Habkost , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , "Michael S. Tsirkin" , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini , Dongli Zhang , Joe Jin Subject: [PULL 4/6] dump: kdump-zlib data pages not dumped with pvtime/aarch64 Date: Tue, 8 Aug 2023 00:47:15 +0400 Message-ID: <20230807204717.2483983-5-marcandre.lureau@redhat.com> In-Reply-To: <20230807204717.2483983-1-marcandre.lureau@redhat.com> References: <20230807204717.2483983-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1691441297640100001 From: Dongli Zhang The kdump-zlib data pages are not dumped from aarch64 host when the 'pvtime' is involved, that is, when the block->target_end is not aligned to page_size. In the below example, it is expected to dump two blocks. (qemu) info mtree -f ... ... 00000000090a0000-00000000090a0fff (prio 0, ram): pvtime KVM ... ... 0000000040000000-00000001bfffffff (prio 0, ram): mach-virt.ram KVM ... ... However, there is an issue with get_next_page() so that the pages for "mach-virt.ram" will not be dumped. At line 1296, although we have reached at the end of the 'pvtime' block, since it is not aligned to the page_size (e.g., 0x10000), it will not break at line 1298. 1255 static bool get_next_page(GuestPhysBlock **blockptr, uint64_t *pfnptr, 1256 uint8_t **bufptr, DumpState *s) ... ... 1294 memcpy(buf + addr % page_size, hbuf, n); 1295 addr +=3D n; 1296 if (addr % page_size =3D=3D 0) { 1297 /* we filled up the page */ 1298 break; 1299 } As a result, get_next_page() will continue to the next block ("mach-virt.ram"). Finally, when get_next_page() returns to the caller: - 'pfnptr' is referring to the 'pvtime' - but 'blockptr' is referring to the "mach-virt.ram" When get_next_page() is called the next time, "*pfnptr +=3D 1" still refers to the prior 'pvtime'. It will exit immediately because it is out of the range of the current "mach-virt.ram". The fix is to break when it is time to come to the next block, so that both 'pfnptr' and 'blockptr' refer to the same block. Fixes: 94d788408d2d ("dump: fix kdump to work over non-aligned blocks") Cc: Joe Jin Signed-off-by: Dongli Zhang Reviewed-by: Marc-Andr=C3=A9 Lureau Message-ID: <20230713055819.30497-1-dongli.zhang@oracle.com> --- dump/dump.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dump/dump.c b/dump/dump.c index 1f1a6edcab..d4ef713cd0 100644 --- a/dump/dump.c +++ b/dump/dump.c @@ -1293,8 +1293,8 @@ static bool get_next_page(GuestPhysBlock **blockptr, = uint64_t *pfnptr, =20 memcpy(buf + addr % page_size, hbuf, n); addr +=3D n; - if (addr % page_size =3D=3D 0) { - /* we filled up the page */ + if (addr % page_size =3D=3D 0 || addr >=3D block->target_end) { + /* we filled up the page or the current block is finished = */ break; } } else { --=20 2.41.0 From nobody Mon Feb 9 14:45:35 2026 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=1691441308; cv=none; d=zohomail.com; s=zohoarc; b=lNg75s64RizFHQ44c/YwwXhO8qGNZMbf47ttOVLZheqDL0P+BPJE7Umz44zuiAaM5js8V+XYEvuIJ7IUK6ejv73itxrQZEYKsUYmi9b0gG9jxze/TIp7d7EdFEl1J0h8sR3GUTnlMB6/54yq6t7uTA9CPZVGWqzGRMvqgDNoFi0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691441308; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YGEquOrDYqqCouEnmaVqHGup2MXV07dB8yWThUHILDU=; b=WzUUxE7sliPX/87cO+rGh3m6sYOymYHYAO+7UCfCrwXhjLLqPrD580ay/JzXCE5bCivm4X/BFNyuU4OGbUhjpuC5DCUYLoB9dYkg1tpAvIN91g1JsiF9r2GbwgtQONLcVACAG0m0tnJSM+guEJOoHp7xCz0Iyl5g5ylWiMCnALY= 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 1691441308152406.8874499274434; Mon, 7 Aug 2023 13:48:28 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qT791-0005cQ-Vv; Mon, 07 Aug 2023 16:48:04 -0400 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 1qT78z-0005Ob-Oh for qemu-devel@nongnu.org; Mon, 07 Aug 2023 16:48:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qT78x-0006ig-2O for qemu-devel@nongnu.org; Mon, 07 Aug 2023 16:48:00 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-564-BnrR5ahZMv2255y3ptgS6g-1; Mon, 07 Aug 2023 16:47:54 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7045185C70B; Mon, 7 Aug 2023 20:47:54 +0000 (UTC) Received: from localhost (unknown [10.39.208.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8129C2026D4B; Mon, 7 Aug 2023 20:47:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691441278; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YGEquOrDYqqCouEnmaVqHGup2MXV07dB8yWThUHILDU=; b=Ow65ivFCiVg2kwL7U9y99EqlIivchkQ/74nYl6rlWmIZ+UhuF4Hduz3/E1PFB5LrNFniyL Qab9LRJGKBdeJ4UM5szx9LXSSOGAEp82iJpdbSRN5vp0nsxk9k7mlsLeZdYWFV4OqnTY0d HV1exR0FtwsQxwe/T52KRYSSC2oKLtw= X-MC-Unique: BnrR5ahZMv2255y3ptgS6g-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Eduardo Habkost , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , "Michael S. Tsirkin" , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini , Zongmin Zhou Subject: [PULL 5/6] hw/i386/vmmouse:add relative packet flag for button status Date: Tue, 8 Aug 2023 00:47:16 +0400 Message-ID: <20230807204717.2483983-6-marcandre.lureau@redhat.com> In-Reply-To: <20230807204717.2483983-1-marcandre.lureau@redhat.com> References: <20230807204717.2483983-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1691441309920100005 From: Zongmin Zhou The buttons value use macros instead of direct numbers. If request relative mode, have to add this for guest vmmouse driver to judge this is a relative packet. otherwise,vmmouse driver will not match the condition 'status & VMMOUSE_RELATIVE_PACKET', and can't report events on the correct(relative) input device, result to relative mode unuseful. Signed-off-by: Zongmin Zhou Message-ID: <20230413081526.2229916-1-zhouzongmin@kylinos.cn> Reviewed-by: Marc-Andr=C3=A9 Lureau --- hw/i386/vmmouse.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/hw/i386/vmmouse.c b/hw/i386/vmmouse.c index a56c185f15..6cd624bd09 100644 --- a/hw/i386/vmmouse.c +++ b/hw/i386/vmmouse.c @@ -44,6 +44,12 @@ =20 #define VMMOUSE_VERSION 0x3442554a =20 +#define VMMOUSE_RELATIVE_PACKET 0x00010000 + +#define VMMOUSE_LEFT_BUTTON 0x20 +#define VMMOUSE_RIGHT_BUTTON 0x10 +#define VMMOUSE_MIDDLE_BUTTON 0x08 + #ifdef DEBUG_VMMOUSE #define DPRINTF(fmt, ...) printf(fmt, ## __VA_ARGS__) #else @@ -103,15 +109,18 @@ static void vmmouse_mouse_event(void *opaque, int x, = int y, int dz, int buttons_ x, y, dz, buttons_state); =20 if ((buttons_state & MOUSE_EVENT_LBUTTON)) - buttons |=3D 0x20; + buttons |=3D VMMOUSE_LEFT_BUTTON; if ((buttons_state & MOUSE_EVENT_RBUTTON)) - buttons |=3D 0x10; + buttons |=3D VMMOUSE_RIGHT_BUTTON; if ((buttons_state & MOUSE_EVENT_MBUTTON)) - buttons |=3D 0x08; + buttons |=3D VMMOUSE_MIDDLE_BUTTON; =20 if (s->absolute) { x <<=3D 1; y <<=3D 1; + } else{ + /* add for guest vmmouse driver to judge this is a relative packet= . */ + buttons |=3D VMMOUSE_RELATIVE_PACKET; } =20 s->queue[s->nb_queue++] =3D buttons; --=20 2.41.0 From nobody Mon Feb 9 14:45:35 2026 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=1691441343; cv=none; d=zohomail.com; s=zohoarc; b=fms8fAyptZg4Px1qT0kZfMNXdpeRq6mKBcOHSaVK/X/Zp+pzc0WH/DqlYmZ1kG3UNn8gxyPIX2sdDtItx+lLxk4MBhrnIz1SE/H9BH1YXvA+Q4Y8rgjvlRFTieAV994tDZskZbOxOWeMR9YMET3G62rU/1NN0SaFhHlEiVx4gYw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691441343; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=P8ZFlSe/0/0xC1+2/G1PqGE3LwwZEexuiUCyAWa0dhA=; b=NcGBuYfZ44yXpYfyi4ACp9PYymD6xJ1yuEfwcM3E+ebiMar/zl1wuZDPbHRapzbbPbuW12Ah5oj68GdMqpnCkh5SAp5VmAgeZR09F6jK69mRgTGbmepXKPjjT/v9uFNk0zuPrex05x/uSg2PWbdeWnJz7JewBjWyVgMf/pyndk4= 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 1691441343049544.0209572593596; Mon, 7 Aug 2023 13:49:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qT797-00068B-QG; Mon, 07 Aug 2023 16:48:09 -0400 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 1qT796-00065o-OQ for qemu-devel@nongnu.org; Mon, 07 Aug 2023 16:48:08 -0400 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 1qT795-0006kG-62 for qemu-devel@nongnu.org; Mon, 07 Aug 2023 16:48:08 -0400 Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-561-fY7TS5_vPbaN19ET7-x27g-1; Mon, 07 Aug 2023 16:48:01 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B98C11C05157; Mon, 7 Aug 2023 20:48:00 +0000 (UTC) Received: from localhost (unknown [10.39.208.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 637F640C2076; Mon, 7 Aug 2023 20:47:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691441286; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P8ZFlSe/0/0xC1+2/G1PqGE3LwwZEexuiUCyAWa0dhA=; b=HQoUowEq39fckmEVomHWNDLf9iLIDblb2nySFDYe330PYJC0RjEo81GCq/B8aVdXlUoJ43 lyr+QkIPZlkC0tzkfbFGeO05LTVanvx8D7/bL9T47Pj/wDZsOOSwsJPvilF7+jG9CSPgxI 3hcNt9eoeD/YYQRJP7yLd+CrYOwmfs0= X-MC-Unique: fY7TS5_vPbaN19ET7-x27g-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Eduardo Habkost , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , "Michael S. Tsirkin" , Marcel Apfelbaum , Richard Henderson , Paolo Bonzini , Dongwon Kim , Vivek Kasireddy Subject: [PULL 6/6] ui/gtk: set scanout mode in gd_egl/gd_gl_area_scanout_texture Date: Tue, 8 Aug 2023 00:47:17 +0400 Message-ID: <20230807204717.2483983-7-marcandre.lureau@redhat.com> In-Reply-To: <20230807204717.2483983-1-marcandre.lureau@redhat.com> References: <20230807204717.2483983-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, 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 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: 1691441345144100003 From: Dongwon Kim Fixing a regression (black screen) caused by a commit 92b58156e7 ("ui/gtk: set scanout-mode right before scheduling draw"). The commit 92b58156e7 was made with an assumption that the scanout mode needs to be set only if the guest scanout is a dmabuf but there are cases (e.g. virtio-gpu-virgl) where the scanout is still processed in a form of a texture but is not backed by dmabuf. So it is needed to put back the line that sets scanout mode in gd_egl_scanout_texture and gd_gl_area_scanout_texture. Fixes: 92b58156e7 ("ui/gtk: set scanout-mode right before scheduling draw) Reported-by: Volker R=C3=BCmelin Cc: Gerd Hoffmann Cc: Marc-Andr=C3=A9 Lureau Cc: Vivek Kasireddy Signed-off-by: Dongwon Kim Reviewed-by: Marc-Andr=C3=A9 Lureau Message-ID: <20230725001131.24017-1-dongwon.kim@intel.com> --- ui/gtk-egl.c | 1 + ui/gtk-gl-area.c | 1 + 2 files changed, 2 insertions(+) diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index 4c29ac10d0..a1060fd80f 100644 --- a/ui/gtk-egl.c +++ b/ui/gtk-egl.c @@ -246,6 +246,7 @@ void gd_egl_scanout_texture(DisplayChangeListener *dcl, eglMakeCurrent(qemu_egl_display, vc->gfx.esurface, vc->gfx.esurface, vc->gfx.ectx); =20 + gtk_egl_set_scanout_mode(vc, true); egl_fb_setup_for_tex(&vc->gfx.guest_fb, backing_width, backing_height, backing_id, false); } diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c index 1ce34a249e..52dcac161e 100644 --- a/ui/gtk-gl-area.c +++ b/ui/gtk-gl-area.c @@ -268,6 +268,7 @@ void gd_gl_area_scanout_texture(DisplayChangeListener *= dcl, return; } =20 + gtk_gl_area_set_scanout_mode(vc, true); egl_fb_setup_for_tex(&vc->gfx.guest_fb, backing_width, backing_height, backing_id, false); } --=20 2.41.0