From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513790279614937.3832955598734; Wed, 20 Dec 2017 09:17:59 -0800 (PST) Received: from localhost ([::1]:60333 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRi04-0005eX-99 for importer@patchew.org; Wed, 20 Dec 2017 12:17:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56023) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhxx-0004EW-Cs for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhxv-0006wP-6d for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:37 -0500 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:45820) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhxu-0006vk-Sd for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:35 -0500 Received: by mail-wr0-x244.google.com with SMTP id h1so22876631wre.12 for ; Wed, 20 Dec 2017 09:15:34 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.15.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:15:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pSbIuouZDhWTtLy30GP+w3YNF/ziuwp3NIZfSvgHxVk=; b=MaTD90K1i5ts39nZMiEsR1uBmyIPFxas99Za+j5noS3Ej0QdtCMvtbBb0iOuXrFE61 LOnh7ntn0rboGAQHUgKCqWhenpCTtNcu7rdz+CcG9+X3Kzd1jv621HV9niyo//mcQzRw XQsgjtWjuOpwhoGNGI5kFu36dlbQ0++ljBchQlh8MbtIIxt7YpxXFdTUwq6ESAQ/MjMd Jo+ZQXTkAnm2oY52LeEyTU6FxHLjVRc6BOCGEliACZWcP9iYrXcyGkPMFY997KB/iQfm n6nLP5wdtz/mxkWEyLvt2Bc7rP8fr2wMCLki41DGp8JQ7ErGaVnBEiE05H8cCVDzDPey qZrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=pSbIuouZDhWTtLy30GP+w3YNF/ziuwp3NIZfSvgHxVk=; b=Ahy1CZgYTW6NasLkriLoETNEv7ZCYJStmwPUn+kyyCQnsDvU0cZO/7gB9Pef+hPMxK KWGuWBFiq2ItW67o1Of0w4gU0dByAfyW++yksTb8zrKbM7hjjBOQNloZ1H8kgZ59SACG sS5GVPyLpyrr8odJtHjzlT2j2dAgk2QJYGkTSgObEC7ijFNE+azqdluZrWJB1kKGQpFb AM7v6D3RtnNjMo8mXwH4BC4F5RO466QFqHOZxDnvR3zopQUI7su1UJr3W7R3kUGLLd6K z3hiNvaqw75asDjwuxD53B7oy5z1VkmY1gzhTBZnoSaKMRi3HKmMtfeF64ZZGFdV7HCO ajOw== X-Gm-Message-State: AKGB3mKTLcMSYU9eyMZ3sCBQeBCm5UO0viLlL2Vl3/v+lDJn7SmQ9Zys xgsnZFzFLPRJRTv7hvf/GJrBv0e7 X-Google-Smtp-Source: ACJfBotvTBTJG0cu+4tfspz0UpVaYpp9B74Av7TnrpEjb9MbYmUl0iKvpKA2gVu3LPUGBuBZlFEdrw== X-Received: by 10.223.190.135 with SMTP id i7mr9783894wrh.184.1513790133544; Wed, 20 Dec 2017 09:15:33 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:13 +0100 Message-Id: <1513790098-9815-2-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PULL 01/46] memfd: fix configure test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Recent glibc added memfd_create in sys/mman.h. This conflicts with the definition in util/memfd.c: /builddir/build/BUILD/qemu-2.11.0-rc1/util/memfd.c:40:12: error: static= declaration of memfd_create follows non-static declaration Fix the configure test, and remove the sys/memfd.h inclusion since the file actually does not exist---it is a typo in the memfd_create(2) man page. Cc: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- configure | 2 +- util/memfd.c | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 9c8aa5a..99ccc17 100755 --- a/configure +++ b/configure @@ -3923,7 +3923,7 @@ fi # check if memfd is supported memfd=3Dno cat > $TMPC << EOF -#include +#include =20 int main(void) { diff --git a/util/memfd.c b/util/memfd.c index 4571d1a..412e94a 100644 --- a/util/memfd.c +++ b/util/memfd.c @@ -31,9 +31,7 @@ =20 #include "qemu/memfd.h" =20 -#ifdef CONFIG_MEMFD -#include -#elif defined CONFIG_LINUX +#if defined CONFIG_LINUX && !defined CONFIG_MEMFD #include #include =20 --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513790479696970.8426467762295; Wed, 20 Dec 2017 09:21:19 -0800 (PST) Received: from localhost ([::1]:60347 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRi36-0008Be-4Z for importer@patchew.org; Wed, 20 Dec 2017 12:20:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56031) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhxx-0004Eq-Sh for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhxw-0006xR-Bz for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:37 -0500 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:34984) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhxw-0006wd-1W for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:36 -0500 Received: by mail-wr0-x241.google.com with SMTP id l19so10549020wrc.2 for ; Wed, 20 Dec 2017 09:15:35 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.15.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:15:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=jY3EPEj1ZRqWUh1Q+gBi0qZbIT31FfMrZu7CmFspgX4=; b=FXhCUaOA84uNzR3OT6T85St4Zi1rv6E7HN5XAr4W4WVh98olwMGxclPCy337wq+dRl mwFPrCtbcdXWFnBR02sbN9lX9ZAvkEZ8hRXqT3CraSzerU3tJ4F74Tj1QLgWweOxm/v2 etnCTWMDA4xh7jApPVw7OWiKp2gViVdZluxNQP2JeanrDhhhqbL4Cmp552F5uOPotIxr wC+C3/yX9kpw34bYw/oenRagDYYp+GLGCl5sFrpOPAncniQk7PkjsamYaHqGJbR+INvF VyTsdPXnH7kpr3Euz5Ep0niwuBu7eh1Z5/ALuu9mRfPhxQXMgLVS3piT2XiVscOwBJqN D37A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=jY3EPEj1ZRqWUh1Q+gBi0qZbIT31FfMrZu7CmFspgX4=; b=N5QXPQMduiXHNCaxyxMEdcfS2Jf28sATcyeiQrDaR48nZTMPyRTvnylzjPEqA9BzDK UGBjiURfaW17bUaeTsApGHSHXN+zJ+kr7Bw8FLwnXyzzurU+zukY+WQA1et61pTwCgDa AQyMMlhSG/c+kV58zyoSzli74bvJSK0w/s/cIWj6CzZhywNlCZTys0D+Nl47YABbCnFx XJl7XUozkjQ4XbpgX08Fz469prGrF4Y4BMoF2BUHZ15IFNTwaHiziIW+0Y5T11IVaKax hg3l4sAX39HEkaYFtHZEovMh+WvwcDUn5WpcV5+oLS2i5+yB+mqyG4kMt9N7BQRSKz+M ytOA== X-Gm-Message-State: AKGB3mIDRMagTjykiIEwcxd5ML4HtZaYAZaIyFs1MSEpFVIsNkaJqPhS P5l6MglBfbAqMr1bGo2PE3D81FvM X-Google-Smtp-Source: ACJfBotRkFnERvds15goRRbeIg5JPpg7jCDTfBslNjtlErhMBdfqsQgKlJ83/VS6Zb/e/kVYTXTKSw== X-Received: by 10.223.157.41 with SMTP id k41mr8430746wre.281.1513790134634; Wed, 20 Dec 2017 09:15:34 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:14 +0100 Message-Id: <1513790098-9815-3-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PULL 02/46] qemu-thread: fix races on threads that exit very quickly X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linzhecheng Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: linzhecheng If we create a thread with QEMU_THREAD_DETACHED mode, QEMU may get a segfau= lt with low probability. The backtrace is: #0 0x00007f46c60291d7 in __GI_raise (sig=3Dsig@entry=3D6) at ../nptl/sy= sdeps/unix/sysv/linux/raise.c:56 #1 0x00007f46c602a8c8 in __GI_abort () at abort.c:90 #2 0x00000000008543c9 in PAT_abort () #3 0x000000000085140d in patchIllInsHandler () #4 #5 pthread_detach (th=3D139933037614848) at pthread_detach.c:50 #6 0x0000000000829759 in qemu_thread_create (thread=3Dthread@entry=3D0x= 7ffdaa8205e0, name=3Dname@entry=3D0x94d94a "io-task-worker", start_routine= =3Dstart_routine@entry=3D0x7eb9a0 , arg=3Darg@entry=3D0x3f5cf70, mode=3Dmode@entry=3D1) at util/qemu_thr= ead_posix.c:512 #7 0x00000000007ebc96 in qio_task_run_in_thread (task=3D0x31db2c0, work= er=3Dworker@entry=3D0x7e7e40 , opaque=3D= 0xcd23380, destroy=3D0x7f1180 ) at io/task.c:141 #8 0x00000000007e7f33 in qio_channel_socket_connect_async (ioc=3Dioc@en= try=3D0x626c0b0, addr=3D, callback=3Dcallback@entry=3D0x55e0= 80 , opaque=3Dopaque@entry=3D0x42862c0, destroy=3Ddestroy@entry=3D0x0) at io/channel_socket.c:194 #9 0x000000000055bdd1 in socket_reconnect_timeout (opaque=3D0x42862c0) = at qemu_char.c:4744 #10 0x00007f46c72483b3 in g_timeout_dispatch () from /usr/lib64/libglib-= 2.0.so.0 #11 0x00007f46c724799a in g_main_context_dispatch () from /usr/lib64/lib= glib-2.0.so.0 #12 0x000000000076c646 in glib_pollfds_poll () at main_loop.c:228 #13 0x000000000076c6eb in os_host_main_loop_wait (timeout=3D348000000) a= t main_loop.c:273 #14 0x000000000076c815 in main_loop_wait (nonblocking=3Dnonblocking@entr= y=3D0) at main_loop.c:521 #15 0x000000000056a511 in main_loop () at vl.c:2076 #16 0x0000000000420705 in main (argc=3D, argv=3D, envp=3D) at vl.c:4940 The cause of this problem is a glibc bug; for more information, see https://sourceware.org/bugzilla/show_bug.cgi?id=3D19951. The solution for this bug is to use pthread_attr_setdetachstate. There is a similar issue with pthread_setname_np, which is moved from creating thread to created thread. Signed-off-by: linzhecheng Message-Id: <20171128044656.10592-1-linzhecheng@huawei.com> Reviewed-by: Fam Zheng [Simplify the code by removing qemu_thread_set_name, and free the arguments before invoking the start routine. - Paolo] Signed-off-by: Paolo Bonzini --- util/qemu-thread-posix.c | 59 ++++++++++++++++++++++++++++++++++----------= ---- 1 file changed, 42 insertions(+), 17 deletions(-) diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c index 7306475..fcd369b 100644 --- a/util/qemu-thread-posix.c +++ b/util/qemu-thread-posix.c @@ -479,15 +479,29 @@ static void __attribute__((constructor)) qemu_thread_= atexit_init(void) } =20 =20 -/* Attempt to set the threads name; note that this is for debug, so - * we're not going to fail if we can't set it. - */ -static void qemu_thread_set_name(QemuThread *thread, const char *name) -{ #ifdef CONFIG_PTHREAD_SETNAME_NP - pthread_setname_np(thread->thread, name); -#endif +typedef struct { + void *(*start_routine)(void *); + void *arg; + char *name; +} QemuThreadArgs; + +static void *qemu_thread_start(void *args) +{ + QemuThreadArgs *qemu_thread_args =3D args; + void *(*start_routine)(void *) =3D qemu_thread_args->start_routine; + void *arg =3D qemu_thread_args->arg; + + /* Attempt to set the threads name; note that this is for debug, so + * we're not going to fail if we can't set it. + */ + pthread_setname_np(pthread_self(), qemu_thread_args->name); + g_free(qemu_thread_args->name); + g_free(qemu_thread_args); + return start_routine(arg); } +#endif + =20 void qemu_thread_create(QemuThread *thread, const char *name, void *(*start_routine)(void*), @@ -496,29 +510,40 @@ void qemu_thread_create(QemuThread *thread, const cha= r *name, sigset_t set, oldset; int err; pthread_attr_t attr; + QemuThreadArgs *qemu_thread_args; =20 err =3D pthread_attr_init(&attr); if (err) { error_exit(err, __func__); } =20 + if (mode =3D=3D QEMU_THREAD_DETACHED) { + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + } + /* Leave signal handling to the iothread. */ sigfillset(&set); pthread_sigmask(SIG_SETMASK, &set, &oldset); - err =3D pthread_create(&thread->thread, &attr, start_routine, arg); - if (err) - error_exit(err, __func__); =20 +#ifdef CONFIG_PTHREAD_SETNAME_NP if (name_threads) { - qemu_thread_set_name(thread, name); + qemu_thread_args =3D g_new0(QemuThreadArgs, 1); + qemu_thread_args->name =3D g_strdup(name); + qemu_thread_args->start_routine =3D start_routine; + qemu_thread_args->arg =3D arg; + + err =3D pthread_create(&thread->thread, &attr, + qemu_thread_start, qemu_thread_args); + } else +#endif + { + err =3D pthread_create(&thread->thread, &attr, + start_routine, arg); } =20 - if (mode =3D=3D QEMU_THREAD_DETACHED) { - err =3D pthread_detach(thread->thread); - if (err) { - error_exit(err, __func__); - } - } + if (err) + error_exit(err, __func__); + pthread_sigmask(SIG_SETMASK, &oldset, NULL); =20 pthread_attr_destroy(&attr); --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513790279329617.1576037194213; Wed, 20 Dec 2017 09:17:59 -0800 (PST) Received: from localhost ([::1]:60334 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRi08-0005gd-Nt for importer@patchew.org; Wed, 20 Dec 2017 12:17:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56047) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhxy-0004FU-P8 for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhxx-0006yQ-OF for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:38 -0500 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:40523) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhxx-0006xh-Dj; Wed, 20 Dec 2017 12:15:37 -0500 Received: by mail-wr0-x244.google.com with SMTP id q9so22924736wre.7; Wed, 20 Dec 2017 09:15:37 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.15.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:15:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=ua6laq8wqloPHGxZ79mgaXiK6imCsz6ecREUuSmQghk=; b=RRZ2Mqz7/DUIGLHYyS+I0fuOaE1Pjpe90m8HZnHw7M/mvRBT72A6rgOCmFTWK+xIzE 5p7HMyLxWRsd7CoHIXltMXXtIqBO97dlZKPfAEo3vMzC5/0iZ8riBQQdAcVRxnFqzSR+ xrma/CyWI4a2EytiakSBw6K/Lm+S9j1Xzd9KnLqJtf73QsVpBF5kxSxm6uL4bGxsODnh I00WBLHYf3krL32wM6el9H6S0XmyfpriYMCCvf7hnEcl7bBcQzxbVCNl1SA8Rtxv8LsF 6ut0b/8eemH+giB/LuClhPf9eOZPmxdcuZbdEf5GTj4ioLZkoAV39bA1XfqWF13Am+eT u30g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=ua6laq8wqloPHGxZ79mgaXiK6imCsz6ecREUuSmQghk=; b=OSv09+l8nNpSHeGWSspf6doxzQ/xWU01lUFGHSvshLZnEjbaj+PYF2UBPfxM88gfjm Ybd6jkAzWNEfsA+noVaD8eJFg4XGpYrd1jdnOGpCKkzvW5ZqgTg3bDRlcSIa9AdhUbym BGqzaiwdPBSltie9qjiiN8AX5gzMl4XoekQe50Jx8fDr45nWzca3vjX2BqEUIchg9ffR Rx/kjncZm6RtQmAdIMUFzqc7AF8gZ5wYyJhMtHnl0XqWdZjT0737zOneAf+qxvMMTOOf 4aTHZFe7aijS+4431tqoTaDCXUTRzNfzGu5SSafNk0g2oMuyW0ty2dZIV8jXNLvTbAEo RqDg== X-Gm-Message-State: AKGB3mJSdXX/X9WXapLE0/Zb6N+t2lI215PE4Pqp1rFDw/Ji+X4u7ChL C4YrEPBrVc4JhOrNG61LVkDA6DgX X-Google-Smtp-Source: ACJfBosG3SzXmOOR28+cirMSPvAey/37oril9VVeT51JsWvV4ZWOQITOzELy90VuAiULrk+MxVu+2Q== X-Received: by 10.223.152.178 with SMTP id w47mr9753598wrb.254.1513790135973; Wed, 20 Dec 2017 09:15:35 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:15 +0100 Message-Id: <1513790098-9815-4-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PULL 03/46] qemu-pr-helper: miscellaneous fixes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 1) Return a generic sense if TEST UNIT READY does not provide one; 2) Fix two mistakes in copying from the spec. Cc: qemu-stable@nongnu.org Reported-by: Dr. David Alan Gilbert Signed-off-by: Paolo Bonzini --- include/scsi/utils.h | 6 +++++- scsi/qemu-pr-helper.c | 30 ++++++++++++++++++++++++++---- scsi/utils.c | 10 ++++++++++ 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/include/scsi/utils.h b/include/scsi/utils.h index 00a4bdb..eb07e47 100644 --- a/include/scsi/utils.h +++ b/include/scsi/utils.h @@ -76,7 +76,11 @@ extern const struct SCSISense sense_code_LUN_FAILURE; extern const struct SCSISense sense_code_LUN_COMM_FAILURE; /* Command aborted, Overlapped Commands Attempted */ extern const struct SCSISense sense_code_OVERLAPPED_COMMANDS; -/* LUN not ready, Capacity data has changed */ +/* Medium error, Unrecovered read error */ +extern const struct SCSISense sense_code_READ_ERROR; +/* LUN not ready, Cause not reportable */ +extern const struct SCSISense sense_code_NOT_READY; +/* Unit attention, Capacity data has changed */ extern const struct SCSISense sense_code_CAPACITY_CHANGED; /* Unit attention, SCSI bus reset */ extern const struct SCSISense sense_code_SCSI_BUS_RESET; diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c index dd97851..9fe615c 100644 --- a/scsi/qemu-pr-helper.c +++ b/scsi/qemu-pr-helper.c @@ -314,6 +314,22 @@ static int is_mpath(int fd) return !strncmp(tgt->target_type, "multipath", DM_MAX_TYPE_NAME); } =20 +static SCSISense mpath_generic_sense(int r) +{ + switch (r) { + case MPATH_PR_SENSE_NOT_READY: + return SENSE_CODE(NOT_READY); + case MPATH_PR_SENSE_MEDIUM_ERROR: + return SENSE_CODE(READ_ERROR); + case MPATH_PR_SENSE_HARDWARE_ERROR: + return SENSE_CODE(TARGET_FAILURE); + case MPATH_PR_SENSE_ABORTED_COMMAND: + return SENSE_CODE(IO_ERROR); + default: + abort(); + } +} + static int mpath_reconstruct_sense(int fd, int r, uint8_t *sense) { switch (r) { @@ -329,7 +345,13 @@ static int mpath_reconstruct_sense(int fd, int r, uint= 8_t *sense) */ uint8_t cdb[6] =3D { TEST_UNIT_READY }; int sz =3D 0; - return do_sgio(fd, cdb, sense, NULL, &sz, SG_DXFER_NONE); + int r =3D do_sgio(fd, cdb, sense, NULL, &sz, SG_DXFER_NONE); + + if (r !=3D GOOD) { + return r; + } + scsi_build_sense(sense, mpath_generic_sense(r)); + return CHECK_CONDITION; } =20 case MPATH_PR_SENSE_UNIT_ATTENTION: @@ -449,7 +471,7 @@ static int multipath_pr_out(int fd, const uint8_t *cdb,= uint8_t *sense, memset(¶mp, 0, sizeof(paramp)); memcpy(¶mp.key, ¶m[0], 8); memcpy(¶mp.sa_key, ¶m[8], 8); - paramp.sa_flags =3D param[10]; + paramp.sa_flags =3D param[20]; if (sz > PR_OUT_FIXED_PARAM_SIZE) { size_t transportid_len; int i, j; @@ -478,8 +500,8 @@ static int multipath_pr_out(int fd, const uint8_t *cdb,= uint8_t *sense, j +=3D offsetof(struct transportid, n_port_name[8]); i +=3D 24; break; - case 3: - case 0x43: + case 5: + case 0x45: /* iSCSI transport. */ len =3D lduw_be_p(¶m[i + 2]); if (len > 252 || (len & 3) || i + len + 4 > transportid_le= n) { diff --git a/scsi/utils.c b/scsi/utils.c index 5684951..e4182a9 100644 --- a/scsi/utils.c +++ b/scsi/utils.c @@ -211,6 +211,16 @@ const struct SCSISense sense_code_LUN_COMM_FAILURE =3D= { .key =3D ABORTED_COMMAND, .asc =3D 0x08, .ascq =3D 0x00 }; =20 +/* Medium Error, Unrecovered read error */ +const struct SCSISense sense_code_READ_ERROR =3D { + .key =3D MEDIUM_ERROR, .asc =3D 0x11, .ascq =3D 0x00 +}; + +/* Not ready, Cause not reportable */ +const struct SCSISense sense_code_NOT_READY =3D { + .key =3D NOT_READY, .asc =3D 0x04, .ascq =3D 0x00 +}; + /* Unit attention, Capacity data has changed */ const struct SCSISense sense_code_CAPACITY_CHANGED =3D { .key =3D UNIT_ATTENTION, .asc =3D 0x2a, .ascq =3D 0x09 --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513790509781858.7550064784798; Wed, 20 Dec 2017 09:21:49 -0800 (PST) Received: from localhost ([::1]:60351 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRi3m-0000Ih-Jj for importer@patchew.org; Wed, 20 Dec 2017 12:21:38 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56064) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhxz-0004G6-Oy for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhxy-0006zA-PL for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:39 -0500 Received: from mail-wr0-x232.google.com ([2a00:1450:400c:c0c::232]:41923) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhxy-0006yW-I9 for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:38 -0500 Received: by mail-wr0-x232.google.com with SMTP id p69so14070847wrb.8 for ; Wed, 20 Dec 2017 09:15:38 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.15.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:15:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=i3RFLYp6OTWNFmDWnNz9yMuxNiGnfTnhDJSqA98pBuU=; b=W4mt92r8TsTSDDcjk4XMkisfpiRKigi/u3UsSEcA6FWohBNCkIuJ1xUIi6jYEB8agl a+CRE0NVorhvAb04Vk14orUSzKFdj41IAsJU0//hiLwhEDoWLqPFuhrnpu8XL14iQZiS iUVuoEBBYPYfjOh/qngHo6zo4eiM29XdtGapzKw6zyAUxJPwXy0yRyz5g0btVugHCIRX CgkqxDmiPiUH4IZdHSCp5R2+HcPRk9sBsx6x4EGJC7bn8Pv0nXGV/UbcaJx3c+EpyP7n yb2+IbbNeSJf8BqDP2l/asapOJnDZw0NDleNBs9NlCOdgfSzbFZiWWFqFJxpT/BQlKCB AY/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=i3RFLYp6OTWNFmDWnNz9yMuxNiGnfTnhDJSqA98pBuU=; b=QQ9DOQxZtp30CjhyI+DQZjnkFVtOah21b4YCQt9uNMfNvNZXjRmHu9k9xrF8ZTsydS y9dsafXv61xDFJ8Qu2FaSn/lNaRF2L8Vvv/Rr0nxqr+vZibA6PErMMp2u2WKZW5rbmaR vksPIJ3e4NenI7DxCEhdem07h66aVPhslKo7ICjBFHE/Pxm/J6tOIfH9q397onyp6aHR 4lWGvbNjIQGZjyv8mIV5knsX4ZQmQFEXbf28vZE6Ku+p1/PUazd1l8UgzWaxhyrpB2xh Fk0w6AVo22AhuWo1WT2Ld8f04Usquf8f7yeHvVcgQCWP4SuPOUjasW4HVWUfeoczt0tY o6fg== X-Gm-Message-State: AKGB3mLquRJrl+UWISnb81D3+6dZ4HyRsl0w/8A36+ZcOG7JBQJL1u9M iYNjJoF31uSimF0qxVil1pOe1nmN X-Google-Smtp-Source: ACJfBosOiBI+OjPMPMxkINvalLpHWqwUdF/6eg3BDGFF1P3zzY/iIbmikGaJMHPiCNLwB0jLe2tf4g== X-Received: by 10.223.132.129 with SMTP id 1mr9207512wrg.218.1513790137168; Wed, 20 Dec 2017 09:15:37 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:16 +0100 Message-Id: <1513790098-9815-5-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::232 Subject: [Qemu-devel] [PULL 04/46] contrib: add systemd unit files X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This lets distros standardize on how QEMU should install systemd services for qemu-ga and qemu-pr-helper. The qemu-ga unit file comes from Fedora, but I checked that Debian is using the same path for the virtio-serisal port. I would like to include this in 2.11, so that the qemu-pr-helper socket can be standardized across distros. Note however that the files are not installed. We can add a configure option in 2.12 perhaps, but it's too late now; documenting the files in the release notes should do. Suggested-by: Daniel P. Berrange Signed-off-by: Paolo Bonzini Message-Id: <20171124164422.3960-1-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini --- contrib/systemd/qemu-guest-agent.service | 11 +++++++++++ contrib/systemd/qemu-pr-helper.service | 15 +++++++++++++++ contrib/systemd/qemu-pr-helper.socket | 9 +++++++++ 3 files changed, 35 insertions(+) create mode 100644 contrib/systemd/qemu-guest-agent.service create mode 100644 contrib/systemd/qemu-pr-helper.service create mode 100644 contrib/systemd/qemu-pr-helper.socket diff --git a/contrib/systemd/qemu-guest-agent.service b/contrib/systemd/qem= u-guest-agent.service new file mode 100644 index 0000000..51cd7b3 --- /dev/null +++ b/contrib/systemd/qemu-guest-agent.service @@ -0,0 +1,11 @@ +[Unit] +Description=3DQEMU Guest Agent +BindTo=3Ddev-virtio\x2dports-org.qemu.guest_agent.0.device +After=3Ddev-virtio\x2dports-org.qemu.guest_agent.0.device + +[Service] +ExecStart=3D-/usr/bin/qemu-ga +Restart=3Dalways +RestartSec=3D0 + +[Install] diff --git a/contrib/systemd/qemu-pr-helper.service b/contrib/systemd/qemu-= pr-helper.service new file mode 100644 index 0000000..a1d27b0 --- /dev/null +++ b/contrib/systemd/qemu-pr-helper.service @@ -0,0 +1,15 @@ +[Unit] +Description=3DPersistent Reservation Daemon for QEMU + +[Service] +WorkingDirectory=3D/tmp +Type=3Dsimple +ExecStart=3D/usr/bin/qemu-pr-helper +PrivateTmp=3Dyes +ProtectSystem=3Dstrict +ReadWritePaths=3D/var/run +RestrictAddressFamilies=3DAF_UNIX +Restart=3Dalways +RestartSec=3D0 + +[Install] diff --git a/contrib/systemd/qemu-pr-helper.socket b/contrib/systemd/qemu-p= r-helper.socket new file mode 100644 index 0000000..9d7c3e5 --- /dev/null +++ b/contrib/systemd/qemu-pr-helper.socket @@ -0,0 +1,9 @@ +[Unit] +Description=3DPersistent Reservation Daemon for QEMU + +[Socket] +ListenStream=3D/run/qemu-pr-helper.sock +SocketMode=3D0600 + +[Install] +WantedBy=3Dmulti-user.target --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513790284678100.57176677297491; Wed, 20 Dec 2017 09:18:04 -0800 (PST) Received: from localhost ([::1]:60335 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRi0A-0005hr-05 for importer@patchew.org; Wed, 20 Dec 2017 12:17:54 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56082) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhy0-0004Gy-Ul for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhxz-0006zy-OZ for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:40 -0500 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:42662) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhxz-0006zT-Hl for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:39 -0500 Received: by mail-wr0-x242.google.com with SMTP id s66so22902171wrc.9 for ; Wed, 20 Dec 2017 09:15:39 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.15.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:15:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=NkWrHNer7czEX6bJWfRsr03ZXd8gt2HtjwdAtM487Mw=; b=pGoioW0YlZehn9GerxKGu7UDePVAKci8xenudbdUnC5D7fdQwqBz7aNyIopHKhKcdm yAI7b7x/4OZKtnELC6+Yyz07gQOamwo0Y/K+DPThktxvkwDCrrrz0LKw7gFUJLiruNmc bFP6llV77oR8e7hQ+NUWwZRGKWy9Y84Y/KiK6ug8OPhJN6+qgr+8D9W7D4bWQjLu8ouF KKnQi+H23J/kLprUPkSxFm7Q8ewQksyS217He1PrJxxt416WbxOq9M3GCgZkszVTXMTe ONVvNFqaIkKMcKp389zXx3+PTgz8Q3gff9C/gSAKX5dkcSKCeaevCcSwOhj+xe/ievc1 zQyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=NkWrHNer7czEX6bJWfRsr03ZXd8gt2HtjwdAtM487Mw=; b=mK1aWX3eIqXNXD2UN6WwSobcj8SmBNCoc7OCmNCaC6NjoDh8SBjk5d/GXICGCMOKeW kOD8nCpxIOoEbrDQ/KsK0Cl0XQhKwXP3FCQB6mtKYwoxDeXcjt5aeuAp6ueLY4srtr4d 6sF7BW91Z3kt86mHyvqMN7zRZF3UdyMCBD2ItPwm4aux/qY//2EpZNvKPwq+z4wPSfJa SWkNwCPiaOMQ6vymobWMrHUOZv/4fcTuVlPZ2IHNKeMy578FfM6pSAJukYkckIimp1hE 6c3vAN78g4cneCvhii9WV4EJHKLxGBEpbpF7k7avpLNQvVlF16eubp4U8uWx3kQ/h21p g04g== X-Gm-Message-State: AKGB3mJrE5wWHeA/0//HxErlT1FeHsYVqpItFlCozvrp6QyIqhljXFwo wS0xfBCAyHpRyWG0BOVacmP0vDF9 X-Google-Smtp-Source: ACJfBouHwZUG/NChl+HpJH/DN5hH4iVw2VoH8ORfHoo21E4EA+1Fpzq9APMUtVFY0LZP50pT3UYp7Q== X-Received: by 10.223.135.77 with SMTP id 13mr9273674wrz.142.1513790138259; Wed, 20 Dec 2017 09:15:38 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:17 +0100 Message-Id: <1513790098-9815-6-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 05/46] Revert "docker: Enable features explicitly in test-full" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Fam Zheng This reverts commit 5e8a7fe673ca5949bd51939ee36faaf3b1320de8. It's hard to get all images to have all these packages, the usual "FEATURES" and "require" mechanism doesn't scale with so many features. With that change, the test basically only works in ubuntu. Until a better way comes up, leave the feature enabling to ./configure detection. But don't remove the "-e" removal. Reported-by: Paolo Bonzini Signed-off-by: Fam Zheng Signed-off-by: Paolo Bonzini --- tests/docker/test-full | 79 +++-------------------------------------------= ---- 1 file changed, 4 insertions(+), 75 deletions(-) diff --git a/tests/docker/test-full b/tests/docker/test-full index 816d5a3..b4e42d2 100755 --- a/tests/docker/test-full +++ b/tests/docker/test-full @@ -1,8 +1,8 @@ #!/bin/bash # -# Compile all the targets with as many features enabled as possible +# Compile all the targets. # -# Copyright 2016, 2017 Red Hat Inc. +# Copyright (c) 2016 Red Hat Inc. # # Authors: # Fam Zheng @@ -13,77 +13,6 @@ =20 . common.rc =20 -cd "$BUILD_DIR" || exit 1 +cd "$BUILD_DIR" =20 -build_qemu \ - --enable-attr \ - --enable-bluez \ - --enable-brlapi \ - --enable-bsd-user \ - --enable-bzip2 \ - --enable-cap-ng \ - --enable-coroutine-pool \ - --enable-crypto-afalg \ - --enable-curl \ - --enable-curses \ - --enable-debug \ - --enable-debug-info \ - --enable-debug-tcg \ - --enable-docs \ - --enable-fdt \ - --enable-gcrypt \ - --enable-glusterfs \ - --enable-gnutls \ - --enable-gprof \ - --enable-gtk \ - --enable-guest-agent \ - --enable-jemalloc \ - --enable-kvm \ - --enable-libiscsi \ - --enable-libnfs \ - --enable-libssh2 \ - --enable-libusb \ - --enable-linux-aio \ - --enable-linux-user \ - --enable-live-block-migration \ - --enable-lzo \ - --enable-modules \ - --enable-numa \ - --enable-opengl \ - --enable-pie \ - --enable-profiler \ - --enable-qom-cast-debug \ - --enable-rbd \ - --enable-rdma \ - --enable-replication \ - --enable-sdl \ - --enable-seccomp \ - --enable-smartcard \ - --enable-snappy \ - --enable-spice \ - --enable-stack-protector \ - --enable-system \ - --enable-tcg \ - --enable-tcg-interpreter \ - --enable-tools \ - --enable-tpm \ - --enable-trace-backend=3Dftrace \ - --enable-usb-redir \ - --enable-user \ - --enable-vde \ - --enable-vhost-net \ - --enable-vhost-scsi \ - --enable-vhost-user \ - --enable-vhost-vsock \ - --enable-virtfs \ - --enable-vnc \ - --enable-vnc-jpeg \ - --enable-vnc-png \ - --enable-vnc-sasl \ - --enable-vte \ - --enable-werror \ - --enable-xen \ - --enable-xen-pci-passthrough \ - --enable-xen-pv-domain-build \ - --enable-xfsctl \ -&& make check $MAKEFLAGS && install_qemu +build_qemu && make check $MAKEFLAGS && install_qemu --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513790483169855.6190116226409; Wed, 20 Dec 2017 09:21:23 -0800 (PST) Received: from localhost ([::1]:60349 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRi3A-0008DF-PF for importer@patchew.org; Wed, 20 Dec 2017 12:21:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56100) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhy1-0004Hv-Sa for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhy1-000710-0l for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:41 -0500 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:45819) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhy0-00070U-QZ for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:40 -0500 Received: by mail-wr0-x242.google.com with SMTP id h1so22876955wre.12 for ; Wed, 20 Dec 2017 09:15:40 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.15.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:15:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=1JyhuFz6vA+QwJlxJ3+wuthoUSv2p9/kdMuhTF+lpnU=; b=pT6CUXFctWWqtQ7kFu2Ho2R5cCK299YpIz7D1a+WqEbh66+iN3lNJBHrGT1aRm9DgE ap9jjifZcwYz8O79XPtvTIcjb/G3vg3AzjBr5PUuqrTy+2Z5LSCRXviIZ5NoaO8o2MvL Kahl03W6D62cD5CifgGp03+dEguBFgUQaRTBstRCiUTwTluG++RA7hW0xvFh7KKBvF/i JPqoV/0KTI9UHryIL1LGfYzA4EtakGzzMdTE9ARY47ygjl0Cs8F3RV5sl8Ud6mk2pk6c fu1U+AwVtmC6pw01HN5iR/KJaPreivTxwf/u1tml7ZYoqN6HhcObnO/hKQUsiMNtqod+ DmyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=1JyhuFz6vA+QwJlxJ3+wuthoUSv2p9/kdMuhTF+lpnU=; b=B/N8N+uSmdYJimFrIHVsTdD4pkNUZEUlH2QXA7xstjhBxGRrFanpSff2Hr2apxczV+ QBtdgz4rN1SbypbPUITp5KHIfQwCKxz7TH5AD4ygWBfHUGPi1CHDT6B00/wV3Zo+C+4K dLNhIBlnOSgPom/45wNz8nIfsMoF3FbaMzbcCp3GAbxko9AZlICFpmkUx6oPkSW3EQmt Wx8OkrSrI4OzW0qNnjp6fQB37l6XZVSGLFMe9faTgYmsu5CjDWzAEwIH+lvfMfGPXBOf 1XsWC8fkllGgGN0vA2or0qMTZjI+cYOOtoQCFtKZQU3SfuUBpz1zgz7yGgqNHlQmLlwg GfRw== X-Gm-Message-State: AKGB3mJNI9foz+ELfYSSf3SsJUIq7a1Q5J8EWBDO8tVX1kBgExAni1JY Ijiba3n64KsY00XkfPJtfw8I2giK X-Google-Smtp-Source: ACJfBou3XCtjFSxKJk1yb9ayhHKxQ8bmIOi07D4iMzixGl1UZndTzuYOrG+qhWlnDVF8Ho9rhsXx4Q== X-Received: by 10.223.131.132 with SMTP id 4mr8642502wre.217.1513790139484; Wed, 20 Dec 2017 09:15:39 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:18 +0100 Message-Id: <1513790098-9815-7-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 06/46] scsi-block: Add share-rw option X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Fam Zheng Scsi-block doesn't use the DEFINE_BLOCK_PROPERTIES() macro so it didn't gain the share-rw back when it was added to all other storage devices. This option is meaningful here, and need to be used when attaching a shared storage to guest. Signed-off-by: Fam Zheng Message-Id: <20171205071928.30242-1-famz@redhat.com> Signed-off-by: Paolo Bonzini --- hw/scsi/scsi-disk.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 870d9ae..e58833a 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -3004,6 +3004,7 @@ static const TypeInfo scsi_cd_info =3D { static Property scsi_block_properties[] =3D { DEFINE_BLOCK_ERROR_PROPERTIES(SCSIDiskState, qdev.conf), \ DEFINE_PROP_DRIVE("drive", SCSIDiskState, qdev.conf.blk), + DEFINE_PROP_BOOL("share-rw", SCSIDiskState, qdev.conf.share_rw, false), DEFINE_PROP_UINT16("rotation_rate", SCSIDiskState, rotation_rate, 0), DEFINE_PROP_END_OF_LIST(), }; --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513790460609715.1568725937567; Wed, 20 Dec 2017 09:21:00 -0800 (PST) Received: from localhost ([::1]:60348 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRi36-0008D1-DI for importer@patchew.org; Wed, 20 Dec 2017 12:20:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56120) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhy3-0004JB-5Y for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhy2-000723-7m for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:43 -0500 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:40523) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhy2-00071V-1I for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:42 -0500 Received: by mail-wr0-x243.google.com with SMTP id q9so22924988wre.7 for ; Wed, 20 Dec 2017 09:15:41 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.15.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:15:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=qq8XIzk+mL3HxEKhBGsyRebe+3HdwEb3qgOYv8yWF/c=; b=CChAXtHdIm4OsQaLES6eDggUV8eXvh27bF4q+ovkusMI5gnqQecGF+YvJH8uChqoy/ P0I80xh18LmRr9vRzy7D4eMw/pS4BuO/VhfZSIO50SZ4V5OWKMN0H4j8v598uxTAnziF kmtEW0PIoFSdme1yLFQCPDXG6ots8W4jFxLbiP7wqw3bOlZuj12dMBLJb0HuoH7AgUkA 7oSPNkfaqjZRU3T9ifabhnC7JFcd5ydFsBdwMnuME7tngORdDLqrp2paSW8NqpHQdznU EIUSb8GpW3Zu8lzG7HVqcbFj8ojYHlezkPStGn4ReqPjU6kis9nGmnN6xSFnE1OhqvkS lF1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=qq8XIzk+mL3HxEKhBGsyRebe+3HdwEb3qgOYv8yWF/c=; b=uja9jT25Oc1C2jxWtv5Owf+LKv1ZDv49cAzlbiMAmyLQN0jUfis5LvYdcHHV/JxiZg 85GW/IeQyAIz9wGdbBajFR8x9oU9oE//sIpXbDdsKkUH+nZvwuGN3Z9RY/zQ7pXlYzLE RLh03Jzxh4r4CQJcjWgHpI2cAoLwkA0rU3jG1rEKj8yxSQqry9eWbsF08oOwVOszBgih MGL7cnYDE8j0p6jmHtDobVW2v7bBVwp/9KQfFCFAg5GVuVX1NNonu15FxhbNNy+Z+j5m BhHPZ6Yex7OFoNYYHQDEGDOtWzm1Iuw6HKumW+/9rfUEVImv5ErVGFDpTbQxxrQhIVqS JHrw== X-Gm-Message-State: AKGB3mJGlE8nZaQ0vQ6IsxY0dBmuvPiMZKFdbMNINGfkBa1rhrkAc5TV qhL4wcekEOVPGg1k+AIlVD6E1PGx X-Google-Smtp-Source: ACJfBosYznL6gZcI8R6/meXwOBHP7xSrsPKjyyMfATUZy4TF6D6CAEhP8PFuRQhcGbbfW9s1rlP4Mw== X-Received: by 10.223.184.200 with SMTP id c8mr9123546wrg.268.1513790140682; Wed, 20 Dec 2017 09:15:40 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:19 +0100 Message-Id: <1513790098-9815-8-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::243 Subject: [Qemu-devel] [PULL 07/46] MAITAINERS: List Fam Zheng as reviewer for SCSI patches X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Fam Zheng Just so that I notice those patches more easily. Signed-off-by: Fam Zheng Message-Id: <20171205072220.885-1-famz@redhat.com> Signed-off-by: Paolo Bonzini --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 8859a50..73a5555 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1011,6 +1011,7 @@ T: git git://github.com/jasowang/qemu.git net =20 SCSI M: Paolo Bonzini +R: Fam Zheng S: Supported F: include/hw/scsi/* F: hw/scsi/* @@ -1271,6 +1272,7 @@ T: git git://github.com/stefanha/qemu.git block =20 Block SCSI subsystem M: Paolo Bonzini +R: Fam Zheng L: qemu-block@nongnu.org S: Supported F: include/scsi/* --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513790692351123.95845670680444; Wed, 20 Dec 2017 09:24:52 -0800 (PST) Received: from localhost ([::1]:60369 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRi6r-0003EI-82 for importer@patchew.org; Wed, 20 Dec 2017 12:24:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56199) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhy6-0004N8-VZ for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhy3-00073B-EQ for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:46 -0500 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:45257) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhy3-00072b-7g for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:43 -0500 Received: by mail-wm0-x244.google.com with SMTP id 9so11255301wme.4 for ; Wed, 20 Dec 2017 09:15:43 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.15.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:15:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=lFg0Ry8UCcKigP9kQ7VbWr1NKXXJ1drur2P3IJKJ9zc=; b=vZVLVEODYOdGUkkrMB1hAO26db1lfjQxZ6wAnaQ+1Otsh/wHUc6a67xn9+ny10oVnw 3mZqkUmPXsIgy0KKrrzTy9+Aq8npqqkmM9oxUM465DxBeWhwLtksu6PSMaU0gJXR3arb j8NYy2Px2406HW3HbMQtI9pJNhejM/6YwSEqkXdwjeJjrF1dcy0dvDAZlJ0w0XP/MiTU N7iu4IT9oiw/rhoH202XfODO7yYZq2MGw9YLLSqbToEOlRXEeJHtYE/KQL2FLC6YT9lI BhkuXwYnQAvdJAQiQmIMceLlaSy78LXAt10Eh82Qk+18uVprHEYoFfGruLnmK6az14rU 8Xew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=lFg0Ry8UCcKigP9kQ7VbWr1NKXXJ1drur2P3IJKJ9zc=; b=k0yOR7pwdIRF4OOwF/DystV4H7L7cM5lhp2xLGJqtKQUZ1p4dHZzvIPRGZ21z/tW+4 Fj/lpMxHoqE6MfcduckxxmhiX1jOH4gb2rPZtYGsz+RmLw0Upyu4fitWiHHXBqlACfx8 lXidfBzp7KMzt/IS3Td9dwWE8+QUGD0L2uditDrlWDNy7u4lxyCsUfh4vgdfmluqHpSN XDBLbUbIHzwOknBfpv8H6uTpgCzyiE90WEw3gELb5yPYWDTczJDEkjxj5udsZBX7Rqw3 uHdFiw4psWWX/hTH6TZ8FTXHbyUYT6QXa++If7KZmlJHs6oAsguWb4BYAIxsE8BUps+l HswQ== X-Gm-Message-State: AKGB3mIM0LvgQ5lfqa0dSfWbn1ApE6XjnWiWytmx5n9/22iss7xDI/sy cIFrz1N81avRnVvs26y5sy3RfE5X X-Google-Smtp-Source: ACJfBoui5waOwdjWXknpX1Nx34Xpzfj25GN2Iu9p8kh4INyEo63yv/qUajiBwZH4xqfL4vvCP0JB2Q== X-Received: by 10.28.27.206 with SMTP id b197mr7595346wmb.96.1513790141880; Wed, 20 Dec 2017 09:15:41 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:20 +0100 Message-Id: <1513790098-9815-9-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 08/46] x86/cpu: Enable new SSE/AVX/AVX512 cpu features X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yang Zhong Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Yang Zhong Intel IceLake cpu has added new cpu features,AVX512_VBMI2/GFNI/ VAES/VPCLMULQDQ/AVX512_VNNI/AVX512_BITALG. Those new cpu features need expose to guest VM. The bit definition: CPUID.(EAX=3D7,ECX=3D0):ECX[bit 06] AVX512_VBMI2 CPUID.(EAX=3D7,ECX=3D0):ECX[bit 08] GFNI CPUID.(EAX=3D7,ECX=3D0):ECX[bit 09] VAES CPUID.(EAX=3D7,ECX=3D0):ECX[bit 10] VPCLMULQDQ CPUID.(EAX=3D7,ECX=3D0):ECX[bit 11] AVX512_VNNI CPUID.(EAX=3D7,ECX=3D0):ECX[bit 12] AVX512_BITALG The release document ref below link: https://software.intel.com/sites/default/files/managed/c5/15/\ architecture-instruction-set-extensions-programming-reference.pdf Signed-off-by: Yang Zhong Message-Id: <1511335676-20797-1-git-send-email-yang.zhong@intel.com> Signed-off-by: Paolo Bonzini --- target/i386/cpu.c | 6 +++--- target/i386/cpu.h | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 82603e3..325b52e 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -437,9 +437,9 @@ static FeatureWordInfo feature_word_info[FEATURE_WORDS]= =3D { [FEAT_7_0_ECX] =3D { .feat_names =3D { NULL, "avx512vbmi", "umip", "pku", - "ospke", NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, NULL, "avx512-vpopcntdq", NULL, + "ospke", NULL, "avx512vbmi2", NULL, + "gfni", "vaes", "vpclmulqdq", "avx512vnni", + "avx512bitalg", NULL, "avx512-vpopcntdq", NULL, "la57", NULL, NULL, NULL, NULL, NULL, "rdpid", NULL, NULL, NULL, NULL, NULL, diff --git a/target/i386/cpu.h b/target/i386/cpu.h index b086b15..cdbf8b0 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -635,6 +635,12 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS]; #define CPUID_7_0_ECX_UMIP (1U << 2) #define CPUID_7_0_ECX_PKU (1U << 3) #define CPUID_7_0_ECX_OSPKE (1U << 4) +#define CPUID_7_0_ECX_VBMI2 (1U << 6) /* Additional VBMI Instrs */ +#define CPUID_7_0_ECX_GFNI (1U << 8) +#define CPUID_7_0_ECX_VAES (1U << 9) +#define CPUID_7_0_ECX_VPCLMULQDQ (1U << 10) +#define CPUID_7_0_ECX_AVX512VNNI (1U << 11) +#define CPUID_7_0_ECX_AVX512BITALG (1U << 12) #define CPUID_7_0_ECX_AVX512_VPOPCNTDQ (1U << 14) /* POPCNT for vectors of= DW/QW */ #define CPUID_7_0_ECX_LA57 (1U << 16) #define CPUID_7_0_ECX_RDPID (1U << 22) --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513790859223836.2419693514063; Wed, 20 Dec 2017 09:27:39 -0800 (PST) Received: from localhost ([::1]:60386 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRi9a-0005mL-4V for importer@patchew.org; Wed, 20 Dec 2017 12:27:38 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56200) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhy6-0004N9-Vr for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhy4-00074j-NG for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:46 -0500 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:38313) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhy4-00073g-G1 for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:44 -0500 Received: by mail-wm0-x243.google.com with SMTP id 64so11087735wme.3 for ; Wed, 20 Dec 2017 09:15:44 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.15.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:15:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=VvpeUZXaGIWXxlUBDMSIZjNF3q4LxLQAYEcIQMmqcZk=; b=jEw3W6L1xkf2z3iqOkv1e0Nr+xzBUAh/qkt0SVqgwr2X3zPQKZ22XhTyWUHiLbs5PC 9vwAHv1dB946+cLrJqZEDRrI05ZHhXNkEOCpWp+MtDhBvqjN7YZJ9wr6ONmec33H473W ct5jftw9HIodyAWOCQydaT2EoIYRR/IW88B40G3r056zo4xMvBc3IrGgsd1NhfrO4zRf YkJPwvqEZd+Eq8euW9I8VAj/4REV5APbKGxilaTBLEB+TpfqWgPrEs4dQNRgbJObEDfD mV3Hrd9vXMgY5ltWEaaMf7zT2x7vYyvqMttwyeJYGOUaBosKp3wVF9Y4qS2bk/xSbNr4 qN0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=VvpeUZXaGIWXxlUBDMSIZjNF3q4LxLQAYEcIQMmqcZk=; b=BWINo3+/LVhG+R4a+XxRCgN3MMEVKdgY9+LHQfIw4J4osxBDHjrhzBX/QhE/wkYk5R rjZW1/ryco51NgkSbSiiU6xcwtK4uQPnO3nlzuZX79YD0rR2iTr7ffKOi1q/OULU7nJ5 w8jgoav+3Ulb5sEazKi5w/pCO+U3TSy7Kf40Sz7h0+HICG09kdvlfpcDgqYHpicQsqpH YjahJEq4dLAUsvTz3vmh3utd826e71wR6l+TMDmoIptDU6Hn7rp/xnDPqf4/pvWMDVI+ 4VHldVVa0MYlOppcRFZamb3LoeDPo5gbXaxYrS/TDWE8o6/7azwtrzM82JR2QkUd4n7W reLw== X-Gm-Message-State: AKGB3mLbTwpHvjbxqvdp45dBIsLZDIyu5iIvVwHz1md6vLmgRFy9V3Ks 6jQD/qVctubTz4Kb568NnnFAJ5WU X-Google-Smtp-Source: ACJfBosdMMeSWTsdiUjWUjCWazMEwN2AwCLZ2SYyib1gwIRHTvG3BXvZRSSeD4Am599adrqIjq4PaQ== X-Received: by 10.28.29.130 with SMTP id d124mr7752129wmd.73.1513790142942; Wed, 20 Dec 2017 09:15:42 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:21 +0100 Message-Id: <1513790098-9815-10-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PULL 09/46] hyperv: set partition-wide MSRs only on first vcpu X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Evgeny Yakovlev , Roman Kagan Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Evgeny Yakovlev Hyper-V has a notion of partition-wide MSRs. Those MSRs are read and written as usual on each VCPU, however the hypervisor maintains a single global value for all VCPUs. Thus writing such an MSR from any single VCPU affects the global value that is read by all other VCPUs. This leads to an issue during VCPU hotplug: the zero-initialzied values of those MSRs get synced into KVM and override the global values as has already been set by the guest. This change makes the partition-wide MSRs only be synchronized on the first vcpu. Signed-off-by: Evgeny Yakovlev Signed-off-by: Roman Kagan Message-Id: <20171122181418.14180-2-rkagan@virtuozzo.com> Signed-off-by: Paolo Bonzini --- target/i386/cpu.h | 5 ++++- target/i386/kvm.c | 23 +++++++++++++++-------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/target/i386/cpu.h b/target/i386/cpu.h index cdbf8b0..17f1bb7 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1097,10 +1097,13 @@ typedef struct CPUX86State { uint64_t async_pf_en_msr; uint64_t pv_eoi_en_msr; =20 + /* Partition-wide HV MSRs, will be updated only on the first vcpu */ uint64_t msr_hv_hypercall; uint64_t msr_hv_guest_os_id; - uint64_t msr_hv_vapic; uint64_t msr_hv_tsc; + + /* Per-VCPU HV MSRs */ + uint64_t msr_hv_vapic; uint64_t msr_hv_crash_params[HV_CRASH_PARAMS]; uint64_t msr_hv_runtime; uint64_t msr_hv_synic_control; diff --git a/target/i386/kvm.c b/target/i386/kvm.c index d4b2ce2..89fa65e 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -1678,19 +1678,26 @@ static int kvm_put_msrs(X86CPU *cpu, int level) kvm_msr_entry_add(cpu, MSR_CORE_PERF_GLOBAL_CTRL, env->msr_global_ctrl); } - if (has_msr_hv_hypercall) { - kvm_msr_entry_add(cpu, HV_X64_MSR_GUEST_OS_ID, - env->msr_hv_guest_os_id); - kvm_msr_entry_add(cpu, HV_X64_MSR_HYPERCALL, - env->msr_hv_hypercall); + /* + * Hyper-V partition-wide MSRs: to avoid clearing them on cpu hot-= add, + * only sync them to KVM on the first cpu + */ + if (current_cpu =3D=3D first_cpu) { + if (has_msr_hv_hypercall) { + kvm_msr_entry_add(cpu, HV_X64_MSR_GUEST_OS_ID, + env->msr_hv_guest_os_id); + kvm_msr_entry_add(cpu, HV_X64_MSR_HYPERCALL, + env->msr_hv_hypercall); + } + if (cpu->hyperv_time) { + kvm_msr_entry_add(cpu, HV_X64_MSR_REFERENCE_TSC, + env->msr_hv_tsc); + } } if (cpu->hyperv_vapic) { kvm_msr_entry_add(cpu, HV_X64_MSR_APIC_ASSIST_PAGE, env->msr_hv_vapic); } - if (cpu->hyperv_time) { - kvm_msr_entry_add(cpu, HV_X64_MSR_REFERENCE_TSC, env->msr_hv_t= sc); - } if (has_msr_hv_crash) { int j; =20 --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513791028823838.8278035817827; Wed, 20 Dec 2017 09:30:28 -0800 (PST) Received: from localhost ([::1]:60406 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRiCC-00005D-KB for importer@patchew.org; Wed, 20 Dec 2017 12:30:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56201) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhy6-0004NA-Vu for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhy5-00076K-W3 for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:46 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:40597) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhy5-00075V-O2 for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:45 -0500 Received: by mail-wm0-x242.google.com with SMTP id f206so11067847wmf.5 for ; Wed, 20 Dec 2017 09:15:45 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.15.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:15:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=hp6H6xLXrewt/aU0u4d0Z6OgmBUIdDmHp+7nkyFNBp8=; b=HGRl+30NUCNWsfv2SAcavFBdf2LGsr16ObBAAXjoWHMqZQ3hu5FOZBYJsc7WnUxTdC WWAApqgUP4avAzhYI3D5JKgZLQP7mHI+FDRQoXiRYfsjIgQSIBx6WXCOPDKjbaKPFRFP 6X9o1n5DM4apazWOFmxLm5p4uRlkiZlToI6dlSijuwtZXpP3gNKMr5HsMSewVPsG3AhA mhAkplbjNbCSYnxfxVTojFCtTIRr+URdYPc/I3m1CPrd1AqCCaexWnlkv0T7aS9NBrMJ wXnkA8/X7IinUiIoSG8OUBdOaxWZM+lbHb34UO4FsyOD/YMlTVz3r7ghBUJ05Nekv9+G Rrig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=hp6H6xLXrewt/aU0u4d0Z6OgmBUIdDmHp+7nkyFNBp8=; b=LXC6qCL7P7WsPx4JCvAydElDo8n91U9bjPiSN2ZD4M+6tBhg9WbjArlpRm2gruoJ5a y+Z56Z4wGPIwbCpEdIYWS8nAOd9OcPWs84n0QwOR50bKF1IctEryGLewWRvc7++XHaqW yWgHAbTSEb4yVqHxkiEtR/KsOwTFnN4/m0HRaAGPuPcEZKUSGhuNAqiRckCCKIITMt3h cNT3BJbpKFUu+goLBNPdFKUiT/veqYaiO+1IsVIzGCu5ZYVEgChzCf3105mYUGfaWcoM 09LZ6RxsC7RxtrBtED0OKHQeYVcI/d63QBI2cR5GBAxr0H/y7uC6kN8CEvDGZY6ekiBm u8vA== X-Gm-Message-State: AKGB3mIdDGHFFr0F7AFnVql4FlvVk15s6wjcGzl9MBZ68v4iSvwKFSeQ USGLFDIbvxTc1TfFZuo+z3VEQCrR X-Google-Smtp-Source: ACJfBovCd2UU3f3IUinLVH5iD4v3cmdyfdZ1yd9g0MWa1YQu9d5FYuW2RUW92Uvc6DOq8FK/vO+9Pw== X-Received: by 10.28.149.203 with SMTP id x194mr7314699wmd.145.1513790144369; Wed, 20 Dec 2017 09:15:44 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:22 +0100 Message-Id: <1513790098-9815-11-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 10/46] hyperv: ensure SINTx msrs are reset properly X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Roman Kagan Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Roman Kagan Initially SINTx msrs should be in "masked" state. To ensure that happens on *every* reset, move setting their values to kvm_arch_vcpu_reset. Signed-off-by: Roman Kagan Message-Id: <20171122181418.14180-3-rkagan@virtuozzo.com> Signed-off-by: Paolo Bonzini --- target/i386/kvm.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 89fa65e..5d93391 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -662,8 +662,6 @@ static int hyperv_handle_properties(CPUState *cs) env->features[FEAT_HYPERV_EAX] |=3D HV_VP_RUNTIME_AVAILABLE; } if (cpu->hyperv_synic) { - int sint; - if (!has_msr_hv_synic || kvm_vcpu_enable_cap(cs, KVM_CAP_HYPERV_SYNIC, 0)) { fprintf(stderr, "Hyper-V SynIC is not supported by kernel\n"); @@ -672,9 +670,6 @@ static int hyperv_handle_properties(CPUState *cs) =20 env->features[FEAT_HYPERV_EAX] |=3D HV_SYNIC_AVAILABLE; env->msr_hv_synic_version =3D HV_SYNIC_VERSION; - for (sint =3D 0; sint < ARRAY_SIZE(env->msr_hv_synic_sint); sint++= ) { - env->msr_hv_synic_sint[sint] =3D HV_SINT_MASKED; - } } if (cpu->hyperv_stimer) { if (!has_msr_hv_stimer) { @@ -1053,6 +1048,13 @@ void kvm_arch_reset_vcpu(X86CPU *cpu) } else { env->mp_state =3D KVM_MP_STATE_RUNNABLE; } + + if (cpu->hyperv_synic) { + int i; + for (i =3D 0; i < ARRAY_SIZE(env->msr_hv_synic_sint); i++) { + env->msr_hv_synic_sint[i] =3D HV_SINT_MASKED; + } + } } =20 void kvm_arch_do_init_vcpu(X86CPU *cpu) --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513790639561659.0063874488725; Wed, 20 Dec 2017 09:23:59 -0800 (PST) Received: from localhost ([::1]:60368 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRi5v-0002L7-9n for importer@patchew.org; Wed, 20 Dec 2017 12:23:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56225) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhy8-0004OX-1R for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhy7-000778-2a for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:48 -0500 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:44480) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhy6-00076Z-Q5 for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:46 -0500 Received: by mail-wm0-x243.google.com with SMTP id t8so11240968wmc.3 for ; Wed, 20 Dec 2017 09:15:46 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.15.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:15:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=9OB5Er0I9bZluXtDgSIF/pi2giQ9tMbfzNQOIaJ/0K8=; b=kyrp4JPIZSJKp2Z9rEt+FsMPe2S3Ec2PWylQZR57hkU/AfYt6jo0bVOQmyX0N24vIg Yj6DCr6+X8YTZwTgHqUeLDhHGNJqOMMrHLdMNIbVd0KGTcxy0GLirBw49aa1Gm/w1Tof Zt3aJxnS6kbWkj8/AEKvob2yHBcqgUBBAw0X3Zluvfirf/rao/FE+P5UC7mcKt9h6IaP bI/kJsLrEbusX6f6+ZaOTKPHzZ3OgvqhB8k9EfE/myDgqtHHcmNc2tLOr9xV4jPuZ2Vj uKap0IpGMZSyJjw5Pd05PnYLPIoaPwNJIGNtX1li1iy7rBmfaaXWUVbVo67LQltTmO8T haIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=9OB5Er0I9bZluXtDgSIF/pi2giQ9tMbfzNQOIaJ/0K8=; b=FV2F9h0iywucLlneyhy5bdMQgmbhSDlf+vGYvPBZtCiZuKg+tIEsb7x1k9pHqUDFDY yxdFDCC1ccbUGT6Sj2ct9NKA/E+RmSojd1H2a6aL/42VyhPtp8FZzF1wP/OWzW0Sv+uJ uMdlasZ1dSuxpWgxmTONc0LA4Ad/neMo619kxQB+J9w0wIeNl0nF0+Pyf+1FB8daW2Dp oxCXUeoQlKUvEznc7t7xmsGFDCWyE7SNOppEy4BWLsmWcnl2P8JNdhPOsI64YrAnYW1r 9htd5siUC+ThhdNpDDj0iXSy+vBCS/LqKBM84To7dZIrToRv6pHxjIOWolMMsFCTqIOT x02w== X-Gm-Message-State: AKGB3mKJQOLdCQMEd1hkPBi7gPtKPRxn0vQacpvvW+JeBFTnQSjhX1Rd oxUHEXkp5AHwht1BdqGH5QQHgVA7 X-Google-Smtp-Source: ACJfBosIm/nrAEUg51sSCdjMHDOe1tz3JTqtWIoxbrkqYxhUWrtOBrM8y8H7y1iduzOGd1j3Qvkobw== X-Received: by 10.28.19.195 with SMTP id 186mr7133419wmt.20.1513790145496; Wed, 20 Dec 2017 09:15:45 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:23 +0100 Message-Id: <1513790098-9815-12-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PULL 11/46] hyperv: make SynIC version msr constant X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Roman Kagan Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Roman Kagan The value of HV_X64_MSR_SVERSION is initialized once at vcpu init, and is reset to zero on vcpu reset, which is wrong. It is supposed to be a constant, so drop the field from X86CPU, set the msr with the constant value, and don't bother getting it. Signed-off-by: Roman Kagan Message-Id: <20171122181418.14180-4-rkagan@virtuozzo.com> Signed-off-by: Paolo Bonzini --- target/i386/cpu.h | 1 - target/i386/kvm.c | 9 ++------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 17f1bb7..d605cc6 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1107,7 +1107,6 @@ typedef struct CPUX86State { uint64_t msr_hv_crash_params[HV_CRASH_PARAMS]; uint64_t msr_hv_runtime; uint64_t msr_hv_synic_control; - uint64_t msr_hv_synic_version; uint64_t msr_hv_synic_evt_page; uint64_t msr_hv_synic_msg_page; uint64_t msr_hv_synic_sint[HV_SINT_COUNT]; diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 5d93391..351b64f 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -669,7 +669,6 @@ static int hyperv_handle_properties(CPUState *cs) } =20 env->features[FEAT_HYPERV_EAX] |=3D HV_SYNIC_AVAILABLE; - env->msr_hv_synic_version =3D HV_SYNIC_VERSION; } if (cpu->hyperv_stimer) { if (!has_msr_hv_stimer) { @@ -1715,10 +1714,10 @@ static int kvm_put_msrs(X86CPU *cpu, int level) if (cpu->hyperv_synic) { int j; =20 + kvm_msr_entry_add(cpu, HV_X64_MSR_SVERSION, HV_SYNIC_VERSION); + kvm_msr_entry_add(cpu, HV_X64_MSR_SCONTROL, env->msr_hv_synic_control); - kvm_msr_entry_add(cpu, HV_X64_MSR_SVERSION, - env->msr_hv_synic_version); kvm_msr_entry_add(cpu, HV_X64_MSR_SIEFP, env->msr_hv_synic_evt_page); kvm_msr_entry_add(cpu, HV_X64_MSR_SIMP, @@ -2082,7 +2081,6 @@ static int kvm_get_msrs(X86CPU *cpu) uint32_t msr; =20 kvm_msr_entry_add(cpu, HV_X64_MSR_SCONTROL, 0); - kvm_msr_entry_add(cpu, HV_X64_MSR_SVERSION, 0); kvm_msr_entry_add(cpu, HV_X64_MSR_SIEFP, 0); kvm_msr_entry_add(cpu, HV_X64_MSR_SIMP, 0); for (msr =3D HV_X64_MSR_SINT0; msr <=3D HV_X64_MSR_SINT15; msr++) { @@ -2286,9 +2284,6 @@ static int kvm_get_msrs(X86CPU *cpu) case HV_X64_MSR_SCONTROL: env->msr_hv_synic_control =3D msrs[i].data; break; - case HV_X64_MSR_SVERSION: - env->msr_hv_synic_version =3D msrs[i].data; - break; case HV_X64_MSR_SIEFP: env->msr_hv_synic_evt_page =3D msrs[i].data; break; --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513790639188145.65839268441914; Wed, 20 Dec 2017 09:23:59 -0800 (PST) Received: from localhost ([::1]:60366 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRi5t-0002Kf-T2 for importer@patchew.org; Wed, 20 Dec 2017 12:23:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56241) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhy8-0004RC-U7 for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhy7-00077b-Vg for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:48 -0500 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:43968) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhy7-00077D-Oj for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:47 -0500 Received: by mail-wr0-x244.google.com with SMTP id w68so10468667wrc.10 for ; Wed, 20 Dec 2017 09:15:47 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.15.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:15:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=dxT5I7s1r4b5lDBIqSlx7RhiCQ9uy3KMADH6ZbZLR2k=; b=NeFX2pvr0UGtSvlYZ22qCrthckHwMRyyG2n+Q/zIMFumr3/1dbI3o+gauxSjR8TUpM ETFZ09bYa3HUsp7C3FU0SnvMuMWdLqJZKP3Fhgs/MdGNIMTrXCEYroE/c5TCVvz7DayE nK6cCz2GvI2ugwRT0W74qT3Gl7/T24RugK5fUNb/ceU4WhqL8DUHXfPDuaCZP+7PyL3g 8R2G32FLXW8rjVvjOsUNY++ZXz7IL0HOBrVH6fAaLKeU2tDzWgi6gMypPf111QPj5ALU HkosaKQFzbc/nXpLJc0e6X9fVwVIjM9IaCMabnCdwhRYOuY4xqfzVletDgU2h8G2GYE/ FWlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=dxT5I7s1r4b5lDBIqSlx7RhiCQ9uy3KMADH6ZbZLR2k=; b=MXDMqofDx6mMm7J7Ia27GNXdiLq+mELlnIA46e7+QAUHxvFeYbfTmHtQkDUcUtXVPS DpJdhXhaPK82I2DY7c5XKZ6AN0rqgyP0RQkVAFT/FcTldITFaxcm6PvoPNjrZfFzJE/Z 19VFNDwZNINSr3kQvb6GC5fDRWbryCB22DnwdlaPg0/4sAp1gxsGJUMjvTnQFtNF0T9p Kq3tEfOEYgH2KRLtbH/ZT798ab409eWdAkE/7EvVX95NbS1pYaysw+ECkQhF6a9C+pWy qsfYYt4q9O1zRQuI1T3vzRIRg3SMtFr91qeUcihHuQV/2GAR2sgRFm/kAKcAEyEM9JlR FhEA== X-Gm-Message-State: AKGB3mLp+Qh2uq+HjPwKTodY4blvXNEkx3waN493nQvFvAaqCvWI7Mwo ujx/RhBRpgZNuh9MLb5tJ88RPoXV X-Google-Smtp-Source: ACJfBouY8INy0szG1yKXy82lattIRGrdeEkueP2EvpTyUHfBtLXLcUH7DI96I+veYAPsVvWiqksZdQ== X-Received: by 10.223.139.3 with SMTP id n3mr1172061wra.44.1513790146505; Wed, 20 Dec 2017 09:15:46 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:24 +0100 Message-Id: <1513790098-9815-13-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PULL 12/46] cpus: make pause_all_cpus() play with SMP on single threaded TCG X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: David Hildenbrand pause_all_cpus() is sometimes called from a VCPU thread (e.g. s390x during special reset). It cannot deal with multiple VCPUs per Thread (single threaded TCG) yet. Booting an s390x guest with -smp 2 and single threaded TCG from disk currently fails. The DIAG 308 will issue a pause_all_cpus() and wait forever for the CPUs to actually stop. But it is waiting for itself. So let's stop all VCPUs belonging to the current thread. Factor out stopping of a VCPU. Signed-off-by: David Hildenbrand Message-Id: <20171129191215.11323-1-david@redhat.com> Signed-off-by: Paolo Bonzini --- cpus.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/cpus.c b/cpus.c index 114c29b..3740c4d 100644 --- a/cpus.c +++ b/cpus.c @@ -1057,13 +1057,22 @@ static void qemu_tcg_destroy_vcpu(CPUState *cpu) { } =20 +static void qemu_cpu_stop(CPUState *cpu, bool exit) +{ + g_assert(qemu_cpu_is_self(cpu)); + cpu->stop =3D false; + cpu->stopped =3D true; + if (exit) { + cpu_exit(cpu); + } + qemu_cond_broadcast(&qemu_pause_cond); +} + static void qemu_wait_io_event_common(CPUState *cpu) { atomic_mb_set(&cpu->thread_kicked, false); if (cpu->stop) { - cpu->stop =3D false; - cpu->stopped =3D true; - qemu_cond_broadcast(&qemu_pause_cond); + qemu_cpu_stop(cpu, false); } process_queued_cpu_work(cpu); } @@ -1610,12 +1619,12 @@ void pause_all_vcpus(void) =20 qemu_clock_enable(QEMU_CLOCK_VIRTUAL, false); CPU_FOREACH(cpu) { - cpu->stop =3D true; - qemu_cpu_kick(cpu); - } - - if (qemu_in_vcpu_thread()) { - cpu_stop_current(); + if (qemu_cpu_is_self(cpu)) { + qemu_cpu_stop(cpu, true); + } else { + cpu->stop =3D true; + qemu_cpu_kick(cpu); + } } =20 while (!all_vcpus_paused()) { @@ -1799,10 +1808,7 @@ void qemu_init_vcpu(CPUState *cpu) void cpu_stop_current(void) { if (current_cpu) { - current_cpu->stop =3D false; - current_cpu->stopped =3D true; - cpu_exit(current_cpu); - qemu_cond_broadcast(&qemu_pause_cond); + qemu_cpu_stop(current_cpu, true); } } =20 --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15137906555162.631923590282895; Wed, 20 Dec 2017 09:24:15 -0800 (PST) Received: from localhost ([::1]:60367 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRi5v-0002Kz-7U for importer@patchew.org; Wed, 20 Dec 2017 12:23:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56259) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhy9-0004SB-Uf for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhy9-00078N-3S for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:49 -0500 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:45032) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhy8-00077o-SI for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:49 -0500 Received: by mail-wr0-x242.google.com with SMTP id l41so10723741wre.11 for ; Wed, 20 Dec 2017 09:15:48 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.15.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:15:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=hV9xxOXotobaXtz1aicRhVSNmR7PQmRqVGsGcd0yx4M=; b=EyjAq5PJqnkFqDrYxDTvx+yIYYwFm4LbniH2Ovq3Cja12zLPLGrF+sND7THBHuInzn C3fvvvGHk4lfbFw4yYuqbdm5pmwlbUPzkEXqdJCl7fyIHt76m3wSHwR3WKLnNvsQ8COA qk25hpc7TNB61aXpyYswVz0xWaQxKXIj9mpcQWM11d2CRwk7L8zuMjFdngNSsBlLmBZ+ dFGn8UPbCr6996Y4ou7zh7wpQ37/8lcOv7aCrfSowvGBfMSR6huvBRYBlsKXmvcpcANS zT0/mVX/U5xXdui9SmRjoYdqI0myKG5uOq/XXHDfUy5VPEGh8uTUx/DOL9CEabf2OahX C/sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=hV9xxOXotobaXtz1aicRhVSNmR7PQmRqVGsGcd0yx4M=; b=mELUHTRHBd/LeRQpctYqqQgK1VDtzXFF5T9loL1hsDxMcLhpiw3mdOK8q17M6ohgw7 +HnisKCrzhReZsZc/+7N6psbhl94BwQAbMGdaqeUXpDVmur/7BmxiGa3mH3SeyaGYbuu M5V8cBQcxXj+27WK3RIoj2f102z+Z4sHZB9qCNkSLc+4uT18/FQ+HPZqEt+OlXJAL1dj 9CvZ7JYATC2krI5hNmQYfR5m7tnMSE2YavLw03uO6R7MJZjXdLH5ULtDqmiV+9mN3ORu LYZWjDTuHCZHYgbyEvIX8QD4NqGQaG24JPWhDh1Obz8dC8HiXIazFTnhPGMmps7v1yFj 0XQw== X-Gm-Message-State: AKGB3mJUNtQPLB7/alxs0fXdhmSKcyJ/+KXtKSoMmX/2FPbtUsAzfveq iSVXZ5rf+U2noMCELhmSj+YfLES6 X-Google-Smtp-Source: ACJfBovHlG9c0ShTHuMfHhNdFKv2558DNBFr/VYIQGfvq9AI5Z5NlPoA4zX/5HNDuv0iolo+7eriIw== X-Received: by 10.223.175.194 with SMTP id y2mr9207194wrd.106.1513790147597; Wed, 20 Dec 2017 09:15:47 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:25 +0100 Message-Id: <1513790098-9815-14-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 13/46] cpu-exec: fix missed CPU kick during interrupt injection X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: David Hildenbrand The conditional memory barrier not only looks strange but actually is wrong. On s390x, I can reproduce interrupts via cpu_interrupt() not leading to a proper kick out of emulation every now and then. cpu_interrupt() is especially used for inter CPU communication via SIGP (esp. external calls and emergency interrupts). With this patch, I was not able to reproduce. (esp. no stalls or hangs in the guest). My setup is s390x MTTCG with 16 VCPUs on 8 CPU host, running make -j16. Signed-off-by: David Hildenbrand Message-Id: <20171129191319.11483-1-david@redhat.com> Signed-off-by: Paolo Bonzini --- accel/tcg/cpu-exec.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 9b544d8..4452cd9 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -525,19 +525,13 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, TranslationBlock **last_tb) { CPUClass *cc =3D CPU_GET_CLASS(cpu); - int32_t insns_left; =20 /* Clear the interrupt flag now since we're processing * cpu->interrupt_request and cpu->exit_request. + * Ensure zeroing happens before reading cpu->exit_request or + * cpu->interrupt_request (see also smp_wmb in cpu_exit()) */ - insns_left =3D atomic_read(&cpu->icount_decr.u32); - atomic_set(&cpu->icount_decr.u16.high, 0); - if (unlikely(insns_left < 0)) { - /* Ensure the zeroing of icount_decr comes before the next read - * of cpu->exit_request or cpu->interrupt_request. - */ - smp_mb(); - } + atomic_mb_set(&cpu->icount_decr.u16.high, 0); =20 if (unlikely(atomic_read(&cpu->interrupt_request))) { int interrupt_request; --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513790801066435.32567363750513; Wed, 20 Dec 2017 09:26:41 -0800 (PST) Received: from localhost ([::1]:60383 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRi8Y-0004tX-TZ for importer@patchew.org; Wed, 20 Dec 2017 12:26:34 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56276) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhyB-0004TR-9I for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyA-000796-8H for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:51 -0500 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:34986) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyA-00078i-1J for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:50 -0500 Received: by mail-wr0-x242.google.com with SMTP id l19so10549638wrc.2 for ; Wed, 20 Dec 2017 09:15:49 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.15.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:15:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Jg+QOq89gnSHS9nK2EKbekCZaNCnXl9ZSVIbA+4gnV8=; b=KhxL1oZ5Ib66Fk7QXQKlzC0F9WSjNBfKVO+5wuYlYQdtqOS7Zo7HtkAT3+LpYA5rF7 kNLRvAB4Rh+9todz7qe8R+LxzwoXqWB2b9LrRPzfFXwiCiAvmlNKWgRpWe5t5sAjVE7Z aiQTWCAimGJv+Ac3eeEX+ffgpgvcKuIZLfMJEVSkAsUQkNYZTGuiGewgeGtrX5AcEUNb TzJQtR1S+ceOSgxFdHjtK7nBVkAE6JxfU4+VwLMyQ8B0ycIzbu9GHP3n9CIRen10rHmk LjexN+ZQF9dLOPX6sXkOKNvLSjiNG82lYCJkHz14u6lCwsMS238JrV8VbXh2KFdx9ym8 1SqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Jg+QOq89gnSHS9nK2EKbekCZaNCnXl9ZSVIbA+4gnV8=; b=mp/LjlVLYQihdFqmJFvGHy+83j4MXnlbTfoqeh9lP47OKIITbWtwVXNynwE4n/pWv5 8hmb5ymYr6/0uYVfq2ud60/ncAKjXo7gQPHL8z9VzTeuqddrPPM8MbJbHnnxqibaKgFX O5rtEkHIKaKt4j4jD/iJvQO0Lf11+vibmixXM9LJdVGssWrtQ5ZmXoUJLfmpW1o8gyM+ XQwaCLYStkI3NFNexwETENsxjLZCaYQ8QXFLJ+bjSQyPspPYw0FTrZQOclfow0si74LU 39TT9BHGfEXSwmAI7Cr0R/Z6tvRetiqiLWfgKqMXWDOknAAPLizaxoNiwxqKrYojQfxF yJmQ== X-Gm-Message-State: AKGB3mJH6rOLXeioc9CFCo12uzKCVSsUwb5Jq/ZkcXIdnw600MF1Iw1z RF8MGagwS+bQiiU4Q1Rc0NLzWebJ X-Google-Smtp-Source: ACJfBotHvIETXfzew5oVgx1p7R2r4htKsmfsz2fm2X50rkFxHD6Ee9I201WpCsrPS1FwOanNQEbTag== X-Received: by 10.223.200.65 with SMTP id e1mr8614670wrh.133.1513790148762; Wed, 20 Dec 2017 09:15:48 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:26 +0100 Message-Id: <1513790098-9815-15-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 14/46] target/i386: Fix compiler warnings X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Weil Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Stefan Weil These gcc warnings are fixed: target/i386/translate.c:4461:12: warning: variable 'prefixes' might be clobbered by 'longjmp' or 'vfork' [-Wclobbere= d] target/i386/translate.c:4466:9: warning: variable 'rex_w' might be clobbered by 'longjmp' or 'vfork' [-Wclobbered] target/i386/translate.c:4466:16: warning: variable 'rex_r' might be clobbered by 'longjmp' or 'vfork' [-Wclobbered] Tested with x86_64-w64-mingw32-gcc from Debian stretch. Signed-off-by: Stefan Weil Message-Id: <20171113064845.29142-1-sw@weilnetz.de> Signed-off-by: Paolo Bonzini --- target/i386/translate.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/target/i386/translate.c b/target/i386/translate.c index 088a9d9..f410938 100644 --- a/target/i386/translate.c +++ b/target/i386/translate.c @@ -4467,10 +4467,7 @@ static target_ulong disas_insn(DisasContext *s, CPUS= tate *cpu) target_ulong pc_start =3D s->base.pc_next; =20 s->pc_start =3D s->pc =3D pc_start; - prefixes =3D 0; s->override =3D -1; - rex_w =3D -1; - rex_r =3D 0; #ifdef TARGET_X86_64 s->rex_x =3D 0; s->rex_b =3D 0; @@ -4484,6 +4481,10 @@ static target_ulong disas_insn(DisasContext *s, CPUS= tate *cpu) return s->pc; } =20 + prefixes =3D 0; + rex_w =3D -1; + rex_r =3D 0; + next_byte: b =3D x86_ldub_code(env, s); /* Collect prefixes. */ --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 151379081788484.44867019435708; Wed, 20 Dec 2017 09:26:57 -0800 (PST) Received: from localhost ([::1]:60384 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRi8a-0004vY-OW for importer@patchew.org; Wed, 20 Dec 2017 12:26:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56294) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhyC-0004V9-IM for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyB-0007A6-Is for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:52 -0500 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:46960) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyB-00079b-Bq for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:51 -0500 Received: by mail-wr0-x244.google.com with SMTP id g17so13685671wrd.13 for ; Wed, 20 Dec 2017 09:15:51 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.15.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:15:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=3bBzWmpa4CHMaxpBTE/5cnkfXL40/Zg+xkKD3ncHTEI=; b=fYnsij47qi3WVciyFb10a8kd6KH3fW6PsWQ5yTexkNqAVoJzuGrM8EmpkMaIenaiog XVLMHjNowEpoYDi6o2foeGdC/sU/3dDF0VsMWJhoBLE8We4c0UlO5yIAmjQEWfpd6DXd CI+Cwhd/SuEiQ1t+8dUKzqmQoodoi1mhfnHst7dThQyCEF1XPKgIcaKLZplCgbJPTDKh MLBnM3wYkhRSGbeOYRzl0qEc+PXzn8TIA1i6uRzy9btJxbzS5sDfCEVf4N+XitYzaMVn G18sB7BYTsFbypchbMqj1r5kgZq5NSbCe0EAKM72C2R7QrPrbnzI/07Lts79L4OKJT9S kE2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=3bBzWmpa4CHMaxpBTE/5cnkfXL40/Zg+xkKD3ncHTEI=; b=jMcSRs+aj2N498o6DTgqJEMHZQqYMG72M39x3XRha8Hs4tBsqPsolEn9cXahoXkoMI UpKMd5J6Spq4CmNsfNIyXIMhmYDdEy22uYk1Qqw0Aq38vMVkDAk2aV2jl10a7FHSve1V CTVa4mQ/JzD+LmNiwfpCSpsMGhfHGvU1PnAAMwORu3+Tu/U8CaOyKUzfFTEEJver42Ta FMbqAv0I7Jehi1Y04XTw2ekwgrF0FUgYQJxSqnKtS7xmKqtUi2bXi2y2ylRe0itcUkoO brJEvJSyU/rAZDiGFeavZvig/tx9Q4zoq8HilHZN3i0bOHKXOwXKOMsSW51aytG6TLyZ D7eg== X-Gm-Message-State: AKGB3mKXRbTAMroAiucBYcnS8pjr/ZKk/QKXBaoBtuONYDEnkV31iLh9 LwUr7wfvSjoruGeYfz7Jt8KskFkk X-Google-Smtp-Source: ACJfBouYWhv0S1LcgwhAN37UJ/Nrq6sP1Ap3F181l7YV1M+c4eHnGg42ynuMzK86fzxXFrXVZ2Pjwg== X-Received: by 10.223.166.205 with SMTP id t71mr8923991wrc.64.1513790150013; Wed, 20 Dec 2017 09:15:50 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:27 +0100 Message-Id: <1513790098-9815-16-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PULL 15/46] baum: Truncate braille device size to 84x1 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Thibault Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Samuel Thibault Baum device bigger than 84 do not actually exist, but the user's own Braille device might be wider than 84 columns. Some guest drivers would be upset by such sizes, so clamp the device size. Signed-off-by: Samuel Thibault Message-Id: <20171211001950.27843-1-samuel.thibault@ens-lyon.org> Signed-off-by: Paolo Bonzini --- chardev/baum.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/chardev/baum.c b/chardev/baum.c index 67fd783..78b0c87 100644 --- a/chardev/baum.c +++ b/chardev/baum.c @@ -1,7 +1,7 @@ /* * QEMU Baum Braille Device * - * Copyright (c) 2008, 2010-2011, 2016 Samuel Thibault + * Copyright (c) 2008, 2010-2011, 2016-2017 Samuel Thibault * * Permission is hereby granted, free of charge, to any person obtaining a= copy * of this software and associated documentation files (the "Software"), t= o deal @@ -239,6 +239,12 @@ static int baum_deferred_init(BaumChardev *baum) brlapi_perror("baum: brlapi__getDisplaySize"); return 0; } + if (baum->y > 1) { + baum->y =3D 1; + } + if (baum->x > 84) { + baum->x =3D 84; + } =20 con =3D qemu_console_lookup_by_index(0); if (con && qemu_console_is_graphic(con)) { --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513790804948201.66056616365017; Wed, 20 Dec 2017 09:26:44 -0800 (PST) Received: from localhost ([::1]:60385 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRi8c-0004w0-NU for importer@patchew.org; Wed, 20 Dec 2017 12:26:38 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56327) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhyG-0004Yq-B6 for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyC-0007Aw-Pk for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:56 -0500 Received: from mail-wr0-x234.google.com ([2a00:1450:400c:c0c::234]:34283) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyC-0007AQ-G1 for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:52 -0500 Received: by mail-wr0-x234.google.com with SMTP id y21so22926268wrc.1 for ; Wed, 20 Dec 2017 09:15:52 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.15.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:15:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=pfQLpMDKYsor1oD3ANjFSdbVhn39RBTxuYVCgbVqNks=; b=NI9IRY9HYl9UhL58/uuUECdzsdpNcVzXpz0mEWNS1aIztZ0K+KuOLMjf5lEe1lM84A 4lB4FaMoIzFN3/Mdn1+EZmi8LdYhVVJlem0Kz5znpRyqGLB4tn63lRUYcabpNjYjGzFp uqYu9yEtp/xOLnmeAC9192cJygCSeGDNldd+JVCve4V9p1qQiCxQ4Px0COPvwOH1u72z MTLMv4Djn/RsMKm6jy1pQy8Fc+GdHorKjsD0eIfduQAQi2fFJqPQW28QyaB5APo6y2Q9 Xp+QAjyGiXMUcQd1G5W9gsmUsgYA7VmeJMOEBSG+SHk6/YC9vVZzXk0j9IL9kNvTCDVv eJIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=pfQLpMDKYsor1oD3ANjFSdbVhn39RBTxuYVCgbVqNks=; b=F/WId57VUqf/+gnFyR52DIEXg2NFNaxyQ/BZ+KRjyYuTDNvGkOHw1RHy4MunhVuF7J iB9Dq8+dGWt721qDV4o8+Z2XcpfkMZS1FbfE6FdOINOjdKNWCDPZEJ/74pyrwtE04H3o GcOstln1EUkFVDSg2b1IEBUj/xwkP4o+YjJayPpo4z4LC+wsvH1VgmTrmMmXdElX+8RV pXBQL/wqvIE/epbC04DIxlvQyCigGstOgCS0Ss1Rbjf4z3oUg9DO826DsOZiy6nZ2jfT kUu5kIEZnN0MKMlHm26tozfgJZuqx8ZDfjzJ+1qNz7DHMSbGvLG8/RswXi/7On27M8hr B5/w== X-Gm-Message-State: AKGB3mJFzXunD+zQ4ExdnnYH7tyJAx3gVaXmjq+ItvTlwdlnknr9vYhO dfCFhekbg6p0hm75S8E3x1HLskJI X-Google-Smtp-Source: ACJfBot3gb2j/NgzXrjb3WEDlVnqqpUWOHOyu5a393N3+nDIm8oix5Sm/zjCVmu73aPXvBk64rEmYg== X-Received: by 10.223.196.243 with SMTP id o48mr9058819wrf.246.1513790151086; Wed, 20 Dec 2017 09:15:51 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:28 +0100 Message-Id: <1513790098-9815-17-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::234 Subject: [Qemu-devel] [PULL 16/46] sockets: remove obsolete code that updated listen address X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Daniel P. Berrange" When listening on unix/tcp sockets there was optional code that would update the original SocketAddress struct with the info about the actual address th= at was listened on. Since the conversion of everything to QIOChannelSocket, no remaining caller made use of this feature. It has been replaced with the ab= ility to query the listen address after the fact using the function qio_channel_socket_get_local_address. This is a better model when the input address can result in listening on multiple distinct sockets. Signed-off-by: Daniel P. Berrange Reviewed-by: Peter Xu Message-Id: <20171212111219.32601-1-berrange@redhat.com> Signed-off-by: Paolo Bonzini --- include/qemu/sockets.h | 2 +- qga/channel-posix.c | 2 +- util/qemu-sockets.c | 31 +++++-------------------------- 3 files changed, 7 insertions(+), 28 deletions(-) diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h index 4f7311b..8889bcb 100644 --- a/include/qemu/sockets.h +++ b/include/qemu/sockets.h @@ -35,7 +35,7 @@ int inet_connect_saddr(InetSocketAddress *saddr, Error **= errp); =20 NetworkAddressFamily inet_netfamily(int family); =20 -int unix_listen(const char *path, char *ostr, int olen, Error **errp); +int unix_listen(const char *path, Error **errp); int unix_connect(const char *path, Error **errp); =20 SocketAddress *socket_parse(const char *str, Error **errp); diff --git a/qga/channel-posix.c b/qga/channel-posix.c index 3f34465..b812bf4 100644 --- a/qga/channel-posix.c +++ b/qga/channel-posix.c @@ -190,7 +190,7 @@ static gboolean ga_channel_open(GAChannel *c, const gch= ar *path, if (fd < 0) { Error *local_err =3D NULL; =20 - fd =3D unix_listen(path, NULL, strlen(path), &local_err); + fd =3D unix_listen(path, &local_err); if (local_err !=3D NULL) { g_critical("%s", error_get_pretty(local_err)); error_free(local_err); diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c index af4f012..d6a1e17 100644 --- a/util/qemu-sockets.c +++ b/util/qemu-sockets.c @@ -198,7 +198,6 @@ static int try_bind(int socket, InetSocketAddress *sadd= r, struct addrinfo *e) =20 static int inet_listen_saddr(InetSocketAddress *saddr, int port_offset, - bool update_addr, Error **errp) { struct addrinfo ai,*res,*e; @@ -326,15 +325,6 @@ listen_failed: return -1; =20 listen_ok: - if (update_addr) { - g_free(saddr->host); - saddr->host =3D g_strdup(uaddr); - g_free(saddr->port); - saddr->port =3D g_strdup_printf("%d", - inet_getport(e) - port_offset); - saddr->has_ipv6 =3D saddr->ipv6 =3D e->ai_family =3D=3D PF_INET6; - saddr->has_ipv4 =3D saddr->ipv4 =3D e->ai_family !=3D PF_INET6; - } freeaddrinfo(res); return slisten; } @@ -790,7 +780,6 @@ static int vsock_parse(VsockSocketAddress *addr, const = char *str, #ifndef _WIN32 =20 static int unix_listen_saddr(UnixSocketAddress *saddr, - bool update_addr, Error **errp) { struct sockaddr_un un; @@ -855,12 +844,7 @@ static int unix_listen_saddr(UnixSocketAddress *saddr, goto err; } =20 - if (update_addr && pathbuf) { - g_free(saddr->path); - saddr->path =3D pathbuf; - } else { - g_free(pathbuf); - } + g_free(pathbuf); return sock; =20 err: @@ -920,7 +904,6 @@ static int unix_connect_saddr(UnixSocketAddress *saddr,= Error **errp) #else =20 static int unix_listen_saddr(UnixSocketAddress *saddr, - bool update_addr, Error **errp) { error_setg(errp, "unix sockets are not available on windows"); @@ -937,7 +920,7 @@ static int unix_connect_saddr(UnixSocketAddress *saddr,= Error **errp) #endif =20 /* compatibility wrapper */ -int unix_listen(const char *str, char *ostr, int olen, Error **errp) +int unix_listen(const char *str, Error **errp) { char *path, *optstr; int sock, len; @@ -957,11 +940,7 @@ int unix_listen(const char *str, char *ostr, int olen,= Error **errp) saddr->path =3D g_strdup(str); } =20 - sock =3D unix_listen_saddr(saddr, true, errp); - - if (sock !=3D -1 && ostr) { - snprintf(ostr, olen, "%s%s", saddr->path, optstr ? optstr : ""); - } + sock =3D unix_listen_saddr(saddr, errp); =20 qapi_free_UnixSocketAddress(saddr); return sock; @@ -1052,11 +1031,11 @@ int socket_listen(SocketAddress *addr, Error **errp) =20 switch (addr->type) { case SOCKET_ADDRESS_TYPE_INET: - fd =3D inet_listen_saddr(&addr->u.inet, 0, false, errp); + fd =3D inet_listen_saddr(&addr->u.inet, 0, errp); break; =20 case SOCKET_ADDRESS_TYPE_UNIX: - fd =3D unix_listen_saddr(&addr->u.q_unix, false, errp); + fd =3D unix_listen_saddr(&addr->u.q_unix, errp); break; =20 case SOCKET_ADDRESS_TYPE_FD: --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513791159658925.4227590864996; Wed, 20 Dec 2017 09:32:39 -0800 (PST) Received: from localhost ([::1]:60422 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRiE0-0001cS-Bc for importer@patchew.org; Wed, 20 Dec 2017 12:32:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56324) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhyG-0004Yo-AZ for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyD-0007Ba-Tv for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:56 -0500 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:36798) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyD-0007BF-Ne; Wed, 20 Dec 2017 12:15:53 -0500 Received: by mail-wm0-x241.google.com with SMTP id b76so11198092wmg.1; Wed, 20 Dec 2017 09:15:53 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.15.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:15:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Q2ljUrnQOlWDwuU77kMm8UNSZrNNor9Co0MLtkR3Lt0=; b=NvSUI+a6XhBo8dTlw4ql7L+4llEVJlmhDpOQunoGG7zb3KNbGLZz67zAYqQdSZezwF ZP3+3btcvW1JNKvRe0sYrf2rgjs1cXpS+g6AFByrUkadws1A8XcbMgQ1v+JSxU7KPWfn BlX+UNrUj2Tzlq7s79WVvcQE9IWfYeYKnyzXbNQqI6ewWf8qGeS65CX9XgHuymsyjBqT aco/fxh9MKvp8TpCAMFrDs8vck3StmOZkKB7+Z/HV8KFfXEc3yVZ9OqpQnIE4KZeJxqW 51pVXSzAqBykkukvsqsjn+lW7EQTBvMZkpLt46JJBH+f1gShXZ7IH7WXEeL6mTQHBKVD FKRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Q2ljUrnQOlWDwuU77kMm8UNSZrNNor9Co0MLtkR3Lt0=; b=JpzKNZTQgmy+DpBW9km7usGH8f7Rl3PooNMTObBbjMvthqbFaWbByL7DjeER58EeiI FbkZ2LSCI+vvrKIc9lG5RAsLit0TYs/TqU8V+ST4+jPgfR5d1nLARqzCXC8GvmamAkuJ eFn3RuVMwIkFqSsKWQLBw9TDstkYejyaNZKaVxzmDOxpQekwIA2sC37TtdQVX1jWNDOu g5rN3pfeve7a1oIMBj+FXDc4ICzgfpoVy+XGFeD4sofSMv1QHuU0DAoTDsx91/ZU+4PT XsR5R3pNoNrxCOL/4QnMbNn6HMAttDv27tIWlaWCSNZ9hWP3PAQYNoszsCBL5X/SOoj7 Jg1A== X-Gm-Message-State: AKGB3mK8tm3w+GZVZtAyQ0dUBkF7lR4W+FyMg++prA/gye0HnHKZj+ej BXWOqchDUiY3iI4olPgjBWSvXiS2 X-Google-Smtp-Source: ACJfBosKx1X7+8itzY/wgZevi/uYuiTAtbS7cl++OeUVGRMx2ejLU7PkJafUqzIaHsC4TdzN98z4eg== X-Received: by 10.28.69.197 with SMTP id l66mr7386108wmi.67.1513790152286; Wed, 20 Dec 2017 09:15:52 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:29 +0100 Message-Id: <1513790098-9815-18-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 17/46] target/i386: Fix handling of VEX prefixes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Peter Maydell In commit e3af7c788b73a6495eb9d94992ef11f6ad6f3c56 we replaced direct calls to to cpu_ld*_code() with calls to the x86_ld*_code() wrappers which incorporate an advance of s->pc. Unfortunately we didn't notice that in one place the old code was deliberately not incrementing s->pc: @@ -4501,7 +4528,7 @@ static target_ulong disas_insn(DisasContext *s, CPUSt= ate *cpu) static const int pp_prefix[4] =3D { 0, PREFIX_DATA, PREFIX_REPZ, PREFIX_REPNZ }; - int vex3, vex2 =3D cpu_ldub_code(env, s->pc); + int vex3, vex2 =3D x86_ldub_code(env, s); if (!CODE64(s) && (vex2 & 0xc0) !=3D 0xc0) { /* 4.1.4.6: In 32-bit mode, bits [7:6] must be 11b, This meant we were mishandling this set of instructions. Remove the manual advance of s->pc for the "is VEX" case (which is now done by x86_ldub_code()) and instead rewind PC in the case where we decide that this isn't really VEX. Signed-off-by: Peter Maydell Cc: qemu-stable@nongnu.org Reported-by: Alexandro Sanchez Bach Message-Id: <1513163959-17545-1-git-send-email-peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini --- target/i386/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/translate.c b/target/i386/translate.c index f410938..23d7eec 100644 --- a/target/i386/translate.c +++ b/target/i386/translate.c @@ -4548,9 +4548,9 @@ static target_ulong disas_insn(DisasContext *s, CPUSt= ate *cpu) if (!CODE64(s) && (vex2 & 0xc0) !=3D 0xc0) { /* 4.1.4.6: In 32-bit mode, bits [7:6] must be 11b, otherwise the instruction is LES or LDS. */ + s->pc--; /* rewind the advance_pc() x86_ldub_code() did */ break; } - s->pc++; =20 /* 4.1.1-4.1.3: No preceding lock, 66, f2, f3, or rex prefixes= . */ if (prefixes & (PREFIX_REPZ | PREFIX_REPNZ --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513790968399358.9294076809433; Wed, 20 Dec 2017 09:29:28 -0800 (PST) Received: from localhost ([::1]:60403 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRiBF-0007Uw-FW for importer@patchew.org; Wed, 20 Dec 2017 12:29:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56326) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhyG-0004Yp-B6 for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyF-0007C9-39 for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:56 -0500 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:42349) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyE-0007Bt-SH for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:55 -0500 Received: by mail-wm0-x244.google.com with SMTP id b199so11343496wme.1 for ; Wed, 20 Dec 2017 09:15:54 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.15.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:15:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Hoj19C8S1lyR9ziZ3omWYJf7/MGKwsfCxM6/WjQnmXg=; b=Rv3cklmwgvWEH2q5UmvLIKNEBPg3u1XwDrXxwU7C8tl4wP2Qnugp1DFzLUBoFdKLL9 d5wzV8XJLlNIGUhHXcnF7XFICFqCn8FabJ2dWDMrrP9y/xVt8jbEpc4hcNNbDr7KFZK6 5gIT5UX/FR+ELa4aRJXJs75C/m7ZHSegccCb2WT0V+gBf4zq7ZOGhS4JqRPKq8MBCQ9g krZXit2hsgj3+hdV2kzaA74vXkCp0iLCQ3qYoXYs4OVLfHV2dAKv3ax0R9f6bV0hatC5 w1wYAM+NROIW7onT4MCAo6cN45OIwgfoqb/qaLY9IZL1RH+3JzcNSa/KK3s7JjRm5/mS gfBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Hoj19C8S1lyR9ziZ3omWYJf7/MGKwsfCxM6/WjQnmXg=; b=NlvnAQiUbpB/fmtL7aQZtcUYSGglOBexcT0Gqpu7alAOTixQxxqSX43RzAmkD89MxN W1KCV0xZngcZLEU0I24vudCn3i++Wx+q9r2oqXjJdpeSw3cfD0FbpIJWNjzD35t4u8MI fAYxDNRCJr8Trsy/k2muMNNVGMqdjc0X8yGK3okeypzTreWoU8r36LeTtezev79hq7Xm FqJWusgW64WUJhecXoVSh1zXyOGedwXJ0x4Aaz+ItxgXlOOskGjBRUGNDAHpUWGe9+FH 7bpnS0vBmAVtLMUx0OMt9r8fiZLVtiLfvoXEghfwcc/hilvEB6AHlCo12bJIXkCfix1s mW1w== X-Gm-Message-State: AKGB3mIbHZvtWSOvM60Fu0fD8JlabA9nJEUMfUqgQRqOSbdS/MkXboZe cteL1re+0+prE8z7z9xg5OUwCOUj X-Google-Smtp-Source: ACJfBovajlRK58eL9ecVKPBcjZpm4VLASWxGzOOUxIX2JRC+4mQ05QvbuDInvwhl0I8o9fDIplERww== X-Received: by 10.28.55.72 with SMTP id e69mr6931114wma.154.1513790153578; Wed, 20 Dec 2017 09:15:53 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:30 +0100 Message-Id: <1513790098-9815-19-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 18/46] tests/boot-serial-test: Make sure that we check the timeout regularly X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth If the guest continuesly writes characters to the UART, we never leave the inner while loop and thus never check whether we've reached the timeout value. So if we fail to find the expected string in the UART output, the test just hangs and never finishs. Use a counter to regularly break out of the while loop to check the timeout. Signed-off-by: Thomas Huth Message-Id: <1512031988-32490-2-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- tests/boot-serial-test.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/boot-serial-test.c b/tests/boot-serial-test.c index c935d69..fa4183d 100644 --- a/tests/boot-serial-test.c +++ b/tests/boot-serial-test.c @@ -43,12 +43,13 @@ static testdef_t tests[] =3D { static void check_guest_output(const testdef_t *test, int fd) { bool output_ok =3D false; - int i, nbr, pos =3D 0; + int i, nbr, pos =3D 0, ccnt; char ch; =20 /* Poll serial output... Wait at most 60 seconds */ for (i =3D 0; i < 6000; ++i) { - while ((nbr =3D read(fd, &ch, 1)) =3D=3D 1) { + ccnt =3D 0; + while ((nbr =3D read(fd, &ch, 1)) =3D=3D 1 && ccnt++ < 512) { if (ch =3D=3D test->expect[pos]) { pos +=3D 1; if (test->expect[pos] =3D=3D '\0') { --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 151379133048185.89543197665785; Wed, 20 Dec 2017 09:35:30 -0800 (PST) Received: from localhost ([::1]:60439 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRiH1-00049q-Tg for importer@patchew.org; Wed, 20 Dec 2017 12:35:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56355) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhyH-0004a8-Hk for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyG-0007Cu-Gg for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:57 -0500 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:40599) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyG-0007CJ-6n for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:56 -0500 Received: by mail-wm0-x243.google.com with SMTP id f206so11068815wmf.5 for ; Wed, 20 Dec 2017 09:15:56 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.15.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:15:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=k9iqKYchGUQe+Dqq1CjdCLNgT7YcTUbY+pnV2Hx5Le4=; b=oYWhfRr9ANWgk88nqnyFbJuQCmVY2O0rDtYy+UiCe1z9yU1fHsMN092fA5MzMSBVqf q5LDqAzbsCK1RnfnoCOv8/hDK8ozewRPRM2f14r/fZZBlW+HWoudu/T1Oc10GrHDlAqg lntCWOjEtE3z80CDN5HBM4fLzzMu2xh0Ed/qo4YYpGtOucT0q0/736odMHCrACibc/hK 6r9LqDuFFY1k6SKQgVuD7+XM1oQ0tv9Q2FtqjF+KLFWrT8QfnFrqC5BvH7mnWANH6imO VSzdCVPDFuxeGCtJgTMdRsDz/8hHE8ZmGJXp7Wntyei9d/MpAVAspG/C6oL84UCxspoz nFVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=k9iqKYchGUQe+Dqq1CjdCLNgT7YcTUbY+pnV2Hx5Le4=; b=DLkkKAtrq8BEfFk8EVPf8rl5K9ekFzNQn3L7z/BTywGimOiK+KL9GJlf0/6qKyExjF IpAtjRiDXPQGzWuc9iSP3tXqps/Mfm5ZOeEyeT60lzCV9DD37pUS5aGgUmy14kxOMOY7 oHRRkHaZiRU3kzWNRXqA2WfN/h9lAMf79P1TJjC4jwPAoiE04ERtzR74900Lo2MZ6iYl TxGqrik0lIY28x9OTB24K97pSZ8evv1bHfb9SQTOV6O0QzCyBu99uDA+dAeROcIDCHaK veRWRZiVwSHI6wGDqzIIWlLCvcUb88tAWuQ7Gq+EJTvJCRP+oLg7N2WfRRaKlxbFoCOz Wx8A== X-Gm-Message-State: AKGB3mKsjHiz68+kfV3UAJuU6ejGw6xAhktiKQsUuA1d7776I9n05K8W va/j5sAucoBj083TlGKnhqjdW/Sx X-Google-Smtp-Source: ACJfBouRxt7N94Gny2iTNt89abe5bXMib6cK43PLuObx6arl4CTpVu71OB8IZAJ1U8NALmSiiQBRPw== X-Received: by 10.28.190.12 with SMTP id o12mr1692313wmf.148.1513790154869; Wed, 20 Dec 2017 09:15:54 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:31 +0100 Message-Id: <1513790098-9815-20-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PULL 19/46] tests/boot-serial-test: Add code to allow to specify our own kernel or bios X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth QEMU only ships with some few firmware images, i.e. we can currently run the boot-serial test only on a very limited set of machines. But writing some characters to the default UART of a machine can often be done with some few lines of assembly, so we add the possibility to the boot-serial tester to use its own mini-kernels or mini-firmwares. We write such images then into a file that we can load with the "-kernel" or "-bios" parameter when we launch QEMU. Signed-off-by: Thomas Huth Message-Id: <1512031988-32490-3-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- tests/Makefile.include | 2 ++ tests/boot-serial-test.c | 54 +++++++++++++++++++++++++++++++++++++-------= ---- 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index b4bcc87..bbb9d89 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -297,6 +297,8 @@ gcov-files-x86_64-y =3D $(subst i386-softmmu/,x86_64-so= ftmmu/,$(gcov-files-i386-y) =20 check-qtest-alpha-y =3D tests/boot-serial-test$(EXESUF) =20 +check-qtest-m68k-y =3D tests/boot-serial-test$(EXESUF) + check-qtest-mips-y =3D tests/endianness-test$(EXESUF) =20 check-qtest-mips64-y =3D tests/endianness-test$(EXESUF) diff --git a/tests/boot-serial-test.c b/tests/boot-serial-test.c index fa4183d..d997269 100644 --- a/tests/boot-serial-test.c +++ b/tests/boot-serial-test.c @@ -7,9 +7,10 @@ * or later. See the COPYING file in the top-level directory. * * This test is used to check that the serial output of the firmware - * (that we provide for some machines) contains an expected string. - * Thus we check that the firmware still boots at least to a certain - * point and so we know that the machine is not completely broken. + * (that we provide for some machines) or some small mini-kernels that + * we provide here contains an expected string. Thus we check that the + * firmware/kernel still boots at least to a certain point and so we + * know that the machine is not completely broken. */ =20 #include "qemu/osdep.h" @@ -20,6 +21,9 @@ typedef struct testdef { const char *machine; /* Name of the machine */ const char *extra; /* Additional parameters */ const char *expect; /* Expected string in the serial output */ + size_t codesize; /* Size of the kernel or bios data */ + const uint8_t *kernel; /* Set in case we use our own mini kernel */ + const uint8_t *bios; /* Set in case we use our own mini bios */ } testdef_t; =20 static testdef_t tests[] =3D { @@ -72,26 +76,52 @@ done: static void test_machine(const void *data) { const testdef_t *test =3D data; - char tmpname[] =3D "/tmp/qtest-boot-serial-XXXXXX"; - int fd; + char serialtmp[] =3D "/tmp/qtest-boot-serial-sXXXXXX"; + char codetmp[] =3D "/tmp/qtest-boot-serial-cXXXXXX"; + const char *codeparam =3D ""; + const uint8_t *code =3D NULL; + int ser_fd; =20 - fd =3D mkstemp(tmpname); - g_assert(fd !=3D -1); + ser_fd =3D mkstemp(serialtmp); + g_assert(ser_fd !=3D -1); + + if (test->kernel) { + code =3D test->kernel; + codeparam =3D "-kernel"; + } else if (test->bios) { + code =3D test->bios; + codeparam =3D "-bios"; + } + + if (code) { + ssize_t wlen; + int code_fd; + + code_fd =3D mkstemp(codetmp); + g_assert(code_fd !=3D -1); + wlen =3D write(code_fd, code, test->codesize); + g_assert(wlen =3D=3D test->codesize); + close(code_fd); + } =20 /* * Make sure that this test uses tcg if available: It is used as a * fast-enough smoketest for that. */ - global_qtest =3D qtest_startf("-M %s,accel=3Dtcg:kvm " + global_qtest =3D qtest_startf("%s %s -M %s,accel=3Dtcg:kvm " "-chardev file,id=3Dserial0,path=3D%s " "-no-shutdown -serial chardev:serial0 %s", - test->machine, tmpname, test->extra); - unlink(tmpname); + codeparam, code ? codetmp : "", + test->machine, serialtmp, test->extra); + unlink(serialtmp); + if (code) { + unlink(codetmp); + } =20 - check_guest_output(test, fd); + check_guest_output(test, ser_fd); qtest_quit(global_qtest); =20 - close(fd); + close(ser_fd); } =20 int main(int argc, char *argv[]) --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 15137910290462.6330217529608717; Wed, 20 Dec 2017 09:30:29 -0800 (PST) Received: from localhost ([::1]:60407 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRiCE-00006F-S7 for importer@patchew.org; Wed, 20 Dec 2017 12:30:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56369) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhyI-0004b4-BM for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyH-0007DI-D9 for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:58 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:44482) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyH-0007Cy-5p for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:57 -0500 Received: by mail-wm0-x242.google.com with SMTP id t8so11241931wmc.3 for ; Wed, 20 Dec 2017 09:15:57 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.15.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:15:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=DAPOdWnlTJ3vAbdr+n7TMx9mkCW6tmLtqHLH2fWsszg=; b=XM1QFbgySMJiv6ZcbKj5YVVCpObK7QthXnBGfFypbhGRhtbYgnaXe5uYXWNsbe5bSD gpHNEHh3XMSWEI/RgAt5VAsneNcnztR3Ii2piFcGjmaVXQNzSDBnkr8iPtH9fwyHkobV +/wFm/kzGDkxSCEMt2gepD58VfJbcronWe/oh1IrQgIUlaoG2wemupX9VXsP4IRCH1CW P2p6gX5TNDgtUU9aagXr2K0o0zJdXSsgqv7P3m4KhtaTAvJ5iGI1h25ccDkj6zLez02I 96b9N7ipfQ92br8xugjz2DFFYJTmg8+yECcR/0EZ14L72nK4+Ha/axUEeW8iflPOiieI A12Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=DAPOdWnlTJ3vAbdr+n7TMx9mkCW6tmLtqHLH2fWsszg=; b=f/LPFLofbGkfyyKF9+PvB6oMokpSKv4ELyJk5IM4WjuPv0rqU5UKRq9z9bNQvYWOrs nJS5EqhZ8IGCgoOvutLgg311oqJC7J01JvEYlhSGIElqWy3L0ESNmMx75r8zIuAvg6jD 2jzJ1xwhM0hG8PzBgc/hPaSPHs2xlyDnS8fYOFj8tG95kJvz/fcd1rq5U29Y82+BeQWq jNXvLeDX0lVNrGMqnJbke/nHsWzjfq7FFe4Q/nMTCdd/P0q8t+bLoHs8LHhKBK9IEsOR bzXBNJaIlY7s/oCd3vlz7smkLcMLDVBzHKvulzSLCQTmMgKAcQa7ZSogNQfINh9kjwwg Wt0A== X-Gm-Message-State: AKGB3mKMfAXciuv5AaaQzRaMniQq9nViIPWghRbYctGN45BUD2trhObB TlNmkAai/UOpqEFCny1AaU3Q0dxK X-Google-Smtp-Source: ACJfBosZEYWrl4IHhesfvxaFLTDE9hDb+K32PThmGkGvkhp81RYym6XbLYKcw9H5YoIfvJ6KLQoqgw== X-Received: by 10.28.48.4 with SMTP id w4mr7353759wmw.16.1513790155872; Wed, 20 Dec 2017 09:15:55 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:32 +0100 Message-Id: <1513790098-9815-21-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 20/46] tests/boot-serial-test: Add support for the mcf5208evb board X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth We can output a character quite easily here with some few lines of assembly that we provide as a mini-kernel for this board. Signed-off-by: Thomas Huth Message-Id: <1512031988-32490-4-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- tests/boot-serial-test.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/boot-serial-test.c b/tests/boot-serial-test.c index d997269..dd3828c 100644 --- a/tests/boot-serial-test.c +++ b/tests/boot-serial-test.c @@ -16,6 +16,14 @@ #include "qemu/osdep.h" #include "libqtest.h" =20 +static const uint8_t kernel_mcf5208[] =3D { + 0x41, 0xf9, 0xfc, 0x06, 0x00, 0x00, /* lea 0xfc060000,%a0 */ + 0x10, 0x3c, 0x00, 0x54, /* move.b #'T',%d0 */ + 0x11, 0x7c, 0x00, 0x04, 0x00, 0x08, /* move.b #4,8(%a0) Enable= TX */ + 0x11, 0x40, 0x00, 0x0c, /* move.b %d0,12(%a0) Print = 'T' */ + 0x60, 0xfa /* bra.s loop */ +}; + typedef struct testdef { const char *arch; /* Target architecture */ const char *machine; /* Name of the machine */ @@ -41,6 +49,8 @@ static testdef_t tests[] =3D { { "x86_64", "q35", "-device sga", "SGABIOS" }, { "s390x", "s390-ccw-virtio", "-nodefaults -device sclpconsole,chardev=3Dserial0", "virtio device"= }, + { "m68k", "mcf5208evb", "", "TT", sizeof(kernel_mcf5208), kernel_mcf52= 08 }, + { NULL } }; =20 --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513791233960445.9757828256322; Wed, 20 Dec 2017 09:33:53 -0800 (PST) Received: from localhost ([::1]:60428 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRiFa-0002yF-Rg for importer@patchew.org; Wed, 20 Dec 2017 12:33:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56388) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhyJ-0004bu-Au for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyI-0007E5-Gy for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:59 -0500 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:36801) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyI-0007DV-AS for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:58 -0500 Received: by mail-wm0-x244.google.com with SMTP id b76so11198531wmg.1 for ; Wed, 20 Dec 2017 09:15:58 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.15.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:15:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=o2iZOen9UNIlqJN8UFeX8VeCOoWJxRtjxRIwCCzEhZg=; b=SCCbKG943HMLJQO9RVOI8KnXBigpq+6A2JwB4NqVCJp5BwLVaU0Kv8dfTFpzqiUwTl rRtzxcTiTvuAzOkafMq6KPbVx2bk/3V2Jr1dNtFOkCWpOUnpQgHp9pRWzAtRhWKtYCe9 j12SeI7SY6bZuj7+X2ZeU5LOaI3351yDU1LV5UlyHBMlXQcn+WfQ8riHpxWqfppBcyH+ ZNs7+eyEoY8h9/J+tChGVcbx4YdXqZeapCWamTKYd2jJlTUh5xAaHulMGRmVrTE/KR7T agKBBO1v/6RGXjkIOsSihWGVS6m8W4e+h6421zzG3zaar5lULVJbUx0mQj+S4xhFhveh wUEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=o2iZOen9UNIlqJN8UFeX8VeCOoWJxRtjxRIwCCzEhZg=; b=AkBD5B2XLBAuJ/orFgHtTy/HyD23rdebL7/r8BqbQjgJ2VntASaWM4UC4fNCUKo4WE 924hGmu9Um6nW2P0pW9GhGSdke2VqKApJReC23qIYc0INv4UISkRrnJjg487mP8UMFv4 Y/yiHYzBHeFJZwx5zmX7UXyVTQHU1bp+XBf5h93A4CfML4adxfJ8NKs81iQwf7qaEk0u 98esAaeSayPnyfZqLZ1bg1zs19fpO98vtpfzuZbFMUnmKIhkx8snZEMvu7q3BEoYsAVK 0h7iWw0F3/Em/TzZZuqhi36N53irgtEFBRueRby0DWb39TuMJurZ+iSAePnpG0Yb9vTo kFfw== X-Gm-Message-State: AKGB3mIBXwgYofWFnGYVQdHXW0RJNOa+ka/LgcwID5deHP8h778QTuMo WZPsP2Z0/BcBbswih7P5LgmLNmO9 X-Google-Smtp-Source: ACJfBosMFhOWBPf2A9jmDAPUGmklFVMNc+5gMUEO72uJuL2SsDarNbKpOku6JsixwSEGEunSpk9oEw== X-Received: by 10.28.70.131 with SMTP id t125mr7615548wma.92.1513790157079; Wed, 20 Dec 2017 09:15:57 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:33 +0100 Message-Id: <1513790098-9815-22-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 21/46] tests/boot-serial-test: Add tests for microblaze boards X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth This adds two simple TCG + UART tests for the microblaze boards, one in big endian mode, and one in little endian mode. Signed-off-by: Thomas Huth Message-Id: <1512031988-32490-5-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- tests/Makefile.include | 2 ++ tests/boot-serial-test.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/tests/Makefile.include b/tests/Makefile.include index bbb9d89..5789911 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -299,6 +299,8 @@ check-qtest-alpha-y =3D tests/boot-serial-test$(EXESUF) =20 check-qtest-m68k-y =3D tests/boot-serial-test$(EXESUF) =20 +check-qtest-microblaze-y =3D tests/boot-serial-test$(EXESUF) + check-qtest-mips-y =3D tests/endianness-test$(EXESUF) =20 check-qtest-mips64-y =3D tests/endianness-test$(EXESUF) diff --git a/tests/boot-serial-test.c b/tests/boot-serial-test.c index dd3828c..a39273a 100644 --- a/tests/boot-serial-test.c +++ b/tests/boot-serial-test.c @@ -24,6 +24,22 @@ static const uint8_t kernel_mcf5208[] =3D { 0x60, 0xfa /* bra.s loop */ }; =20 +static const uint8_t kernel_pls3adsp1800[] =3D { + 0xb0, 0x00, 0x84, 0x00, /* imm 0x8400 */ + 0x30, 0x60, 0x00, 0x04, /* addik r3,r0,4 */ + 0x30, 0x80, 0x00, 0x54, /* addik r4,r0,'T' */ + 0xf0, 0x83, 0x00, 0x00, /* sbi r4,r3,0 */ + 0xb8, 0x00, 0xff, 0xfc /* bri -4 loop */ +}; + +static const uint8_t kernel_plml605[] =3D { + 0xe0, 0x83, 0x00, 0xb0, /* imm 0x83e0 */ + 0x00, 0x10, 0x60, 0x30, /* addik r3,r0,0x1000 */ + 0x54, 0x00, 0x80, 0x30, /* addik r4,r0,'T' */ + 0x00, 0x00, 0x83, 0xf0, /* sbi r4,r3,0 */ + 0xfc, 0xff, 0x00, 0xb8 /* bri -4 loop */ +}; + typedef struct testdef { const char *arch; /* Target architecture */ const char *machine; /* Name of the machine */ @@ -50,6 +66,10 @@ static testdef_t tests[] =3D { { "s390x", "s390-ccw-virtio", "-nodefaults -device sclpconsole,chardev=3Dserial0", "virtio device"= }, { "m68k", "mcf5208evb", "", "TT", sizeof(kernel_mcf5208), kernel_mcf52= 08 }, + { "microblaze", "petalogix-s3adsp1800", "", "TT", + sizeof(kernel_pls3adsp1800), kernel_pls3adsp1800 }, + { "microblazeel", "petalogix-ml605", "", "TT", + sizeof(kernel_plml605), kernel_plml605 }, =20 { NULL } }; --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15137915222581006.740811626951; Wed, 20 Dec 2017 09:38:42 -0800 (PST) Received: from localhost ([::1]:60502 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRiK1-0006nx-4V for importer@patchew.org; Wed, 20 Dec 2017 12:38:25 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56400) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhyK-0004dc-I8 for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyJ-0007Eq-J6 for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:00 -0500 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:38999) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyJ-0007ED-At for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:15:59 -0500 Received: by mail-wm0-x241.google.com with SMTP id i11so11095013wmf.4 for ; Wed, 20 Dec 2017 09:15:59 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.15.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:15:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=j07DMwrjs2HzsYEyutkHtK8Vcxilk6S37Am6zCA3SnA=; b=lFUJZ7Ih6h68+aO0bxD+UXlit1J8d7o1kWH+7pBHwQV0zK2qFgquiS3Xheexh7C5KR N0Ma+plQybMy+toKICLOmf6TGkggFuKj9zNchNtUkLj2XCx72TOSxLwc1rIJHmBeb3vG TxvZzHxIJkVU6NL5Ys3Eqsy5hrP+D6lSFlqO2LBXBP2geMQUab32ad8ZdQYNzsfSSbd/ AYhWua44fyr4NAXG3Lv/vnu+mneWWrl7aUhp2PiT81MJLQuUhW8kL18Q/BTWKQZos6IB 9e1AeHqyoR/49wUNneB1tnj3vn94jtVe4Vi1OCBA0Bds76fqnWcg0Q2AajTU21xOU9zw btDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=j07DMwrjs2HzsYEyutkHtK8Vcxilk6S37Am6zCA3SnA=; b=j4DvbAjfWGpBArVkSSkmCrVoCO2ROo5B3YtgtMG9eeCVeM1KCgmS2GHxYI+H3Qr2Lu rHLvdSsoSv+fnpu043JEacW0abt+H1AtVGKVn/hCg1gUO/ob+lGZUkzklBaerhbw2zBo oqrLBdsC7/IGyPaFvUirqCfk4P4bh4EniMxlb0FWlxylQ0Yc0opYojTfzxtzFxfQvi7x /kooPxMcYNEUtTP/Wa2w/uL6pkOLMz9FsIH8zfLxqQhdzcyDMubfE/+6oHN5D3AIlvzq VA/dDvTx8TaZ8b2zut0Kf5VFEONJlsMAWJYVBTR867eCvvMfhyVGRa1kSINDkqQn3wk3 8tlA== X-Gm-Message-State: AKGB3mI7+MtmDJHlNb6XjMfJe80vhlYkN64agkt6i47oe/UQqPezYS0s T93gKJbL+3gsepgy1PCu5dmUPgsf X-Google-Smtp-Source: ACJfBot7NAXgFdN8gOM6uyCrRPjKHNL8EGTNTX09Q01b9PVh83S6TfH+P3xW+CQaJGGfTi9nF+t5gQ== X-Received: by 10.28.203.197 with SMTP id b188mr6701465wmg.105.1513790158097; Wed, 20 Dec 2017 09:15:58 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:34 +0100 Message-Id: <1513790098-9815-23-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 22/46] hw/moxie/moxiesim: Add support for loading a BIOS on moxiesim X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth The moxiesim machine already defines a memory region for a firmware, but does not provide the possibility to load an image via "-bios" yet. This will be needed for the boot-serial tester, so let's add support for "-bios" here now. Signed-off-by: Thomas Huth Message-Id: <1512031988-32490-6-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- hw/moxie/moxiesim.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hw/moxie/moxiesim.c b/hw/moxie/moxiesim.c index 3c3ba9d..6c200be 100644 --- a/hw/moxie/moxiesim.c +++ b/hw/moxie/moxiesim.c @@ -25,6 +25,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qemu-common.h" #include "cpu.h" @@ -40,6 +41,8 @@ #include "elf.h" =20 #define PHYS_MEM_BASE 0x80000000 +#define FIRMWARE_BASE 0x1000 +#define FIRMWARE_SIZE (128 * 0x1000) =20 typedef struct { uint64_t ram_size; @@ -122,8 +125,8 @@ static void moxiesim_init(MachineState *machine) memory_region_init_ram(ram, NULL, "moxiesim.ram", ram_size, &error_fat= al); memory_region_add_subregion(address_space_mem, ram_base, ram); =20 - memory_region_init_ram(rom, NULL, "moxie.rom", 128 * 0x1000, &error_fa= tal); - memory_region_add_subregion(get_system_memory(), 0x1000, rom); + memory_region_init_ram(rom, NULL, "moxie.rom", FIRMWARE_SIZE, &error_f= atal); + memory_region_add_subregion(get_system_memory(), FIRMWARE_BASE, rom); =20 if (kernel_filename) { loader_params.ram_size =3D ram_size; @@ -132,6 +135,11 @@ static void moxiesim_init(MachineState *machine) loader_params.initrd_filename =3D initrd_filename; load_kernel(cpu, &loader_params); } + if (bios_name) { + if (load_image_targphys(bios_name, FIRMWARE_BASE, FIRMWARE_SIZE) <= 0) { + error_report("Failed to load firmware '%s'", bios_name); + } + } =20 /* A single 16450 sits at offset 0x3f8. */ if (serial_hds[0]) { --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15137917067731021.7252405327392; Wed, 20 Dec 2017 09:41:46 -0800 (PST) Received: from localhost ([::1]:60565 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRiMo-0000wC-IO for importer@patchew.org; Wed, 20 Dec 2017 12:41:18 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56445) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhyO-0004hi-KB for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyK-0007FU-LG for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:04 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:33268) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyK-0007F3-EG for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:00 -0500 Received: by mail-wm0-x242.google.com with SMTP id g130so16655981wme.0 for ; Wed, 20 Dec 2017 09:16:00 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.15.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:15:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=2CCmnXubKUEs2nKRd/6ahhEnsS2vRIwBwAaOdlmGsds=; b=FZHh3bknriCTlrJip7AMzEg+bKtziDUJu+pm9jdFIV+wyerJbEzAud2NZXT07fNMaz jLoQcnXgcTh3tpKDvu6HjAKbYI9s+KbKdQsbMVAU5slGc1LNYMVO9k6m9lTyhZb4bkwc Acm//YRjkGln0snmRFDRS507GHdR1CWLe7KEk+Ie+MXmI3uDQqe7w99dSWckHMIKPb0J JE/WjVu+L+6H19waOp7fNikSj/FNQFeheivSK4+92EDJPhrvNJAputR139PwuygMvBGI feg9jr+hEgcRkBLG75i4biSZEkP559emTrciYdCjuZpRXPns9tCLspL3yQz5GoAAHNHa QG7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=2CCmnXubKUEs2nKRd/6ahhEnsS2vRIwBwAaOdlmGsds=; b=eoRWPnEtrUJKCX1dGGqceX56mdXZimfqjC0r7W0xsv8R/lfkVsESfaMLJIDXYQj0Qe 0xuXDsW6RcZcD+ZvjlyxSaY5rQXFwFyCR3tP1FzLbo1YIInvH3++QA9DbaHudpM0GdQC uOGEf50zBoxKtdcWTSVAZu4mln1iqwal2gXBXWCGSsaVG7YfaRQLfUeCLL49mBAMsOdd Apq3HAZYo37hzt2fmTPesa2oBQShNOA1K2iOOoMfa2dFu4pBuCQEPjRAbZ6Dih4hwQUW 0XDYAr7YrkkVfPGNGxGSwokH5Nju6AmB+sQZsNWPuf68G9TH8k5KMuooWOT8irpHI8FE QtpQ== X-Gm-Message-State: AKGB3mKEY+s2PBMSM5kGfrcwHYve1K0K9HhkDLk1Oawxgd4h6zUNeHz7 kQPwKKcorW8OB4ddg1GWQ+/L0Eh/ X-Google-Smtp-Source: ACJfBouOi9dw5gIAUi39l9kLlOMf/i0ReT4N9gJWsr+uJlhnnR7iAnwtZ+5WjZgjy0jA47w1OQfmBg== X-Received: by 10.28.194.139 with SMTP id s133mr7406680wmf.14.1513790159157; Wed, 20 Dec 2017 09:15:59 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:35 +0100 Message-Id: <1513790098-9815-24-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 23/46] tests/boot-serial-test: Add a test for the moxiesim machine X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth Now that moxiesim supports the -bios parameter, we can check this machine in the boot-serial tester, too, by supplying a mini bios that only writes 'T' characters to the UART. Signed-off-by: Thomas Huth Message-Id: <1512031988-32490-7-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- tests/Makefile.include | 2 ++ tests/boot-serial-test.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/tests/Makefile.include b/tests/Makefile.include index 5789911..02ca4b2 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -307,6 +307,8 @@ check-qtest-mips64-y =3D tests/endianness-test$(EXESUF) =20 check-qtest-mips64el-y =3D tests/endianness-test$(EXESUF) =20 +check-qtest-moxie-y =3D tests/boot-serial-test$(EXESUF) + check-qtest-ppc-y =3D tests/endianness-test$(EXESUF) check-qtest-ppc-y +=3D tests/boot-order-test$(EXESUF) check-qtest-ppc-y +=3D tests/prom-env-test$(EXESUF) diff --git a/tests/boot-serial-test.c b/tests/boot-serial-test.c index a39273a..1deddb8 100644 --- a/tests/boot-serial-test.c +++ b/tests/boot-serial-test.c @@ -40,6 +40,13 @@ static const uint8_t kernel_plml605[] =3D { 0xfc, 0xff, 0x00, 0xb8 /* bri -4 loop */ }; =20 +static const uint8_t bios_moxiesim[] =3D { + 0x20, 0x10, 0x00, 0x00, 0x03, 0xf8, /* ldi.s r1,0x3f8 */ + 0x1b, 0x20, 0x00, 0x00, 0x00, 0x54, /* ldi.b r2,'T' */ + 0x1e, 0x12, /* st.b r1,r2 */ + 0x1a, 0x00, 0x00, 0x00, 0x10, 0x00 /* jmpa 0x1000 */ +}; + typedef struct testdef { const char *arch; /* Target architecture */ const char *machine; /* Name of the machine */ @@ -70,6 +77,7 @@ static testdef_t tests[] =3D { sizeof(kernel_pls3adsp1800), kernel_pls3adsp1800 }, { "microblazeel", "petalogix-ml605", "", "TT", sizeof(kernel_plml605), kernel_plml605 }, + { "moxie", "moxiesim", "", "TT", sizeof(bios_moxiesim), 0, bios_moxies= im }, =20 { NULL } }; --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513791217286295.94106839381425; Wed, 20 Dec 2017 09:33:37 -0800 (PST) Received: from localhost ([::1]:60425 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRiFD-0002hT-5h for importer@patchew.org; Wed, 20 Dec 2017 12:33:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56424) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhyM-0004fd-KX for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyL-0007Fy-My for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:02 -0500 Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]:38058) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyL-0007Fg-Ge for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:01 -0500 Received: by mail-wm0-x231.google.com with SMTP id 64so11089325wme.3 for ; Wed, 20 Dec 2017 09:16:01 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.15.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:15:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=rBs5bgeAiL0X8rSp2cba9iDjKNbl1yHCvcKcEC5d8s8=; b=mh6jn8V0o+F9MlRKOjvmM2OlPW0uqPRoN4IADT2LLk129spJhsAUDFrvJCyu46+h9B 5vgPmqisn3w8o5rjcDO3PA9ChE87BWkiUQ0bIaO5UcItdHhDKIm+zHYTuWFeUDLzTndB qIYXuKeay4OKTkD6bCzQRbpFV6czvmYZxrYP90WBFwBe5R9J3OyQ3k0tb4OdqbJi6FFJ iWeRrRW6Okqh0P4KD76BRnykJ7xmU4h2ngxR+S2IfIZJPgarBTyPs8HOwBK5474VLDEQ dyxLV13Z0dwekFl/xK25Chsdf+vyRo8E4d5G+WDJU0nS6ELypX5+EAZO5MzANBsvOnqF ZVPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=rBs5bgeAiL0X8rSp2cba9iDjKNbl1yHCvcKcEC5d8s8=; b=WbG/DWgjK0+Rw1NhoFHpws9rKyX7KaveNI09M6JN+pbitp3kdWClOdOmZQXA20vovY g+77kkAGgaceXOCuO8BX74hfPVl/XShOsvPe6BlbrFVIgdEObxpc5FBjXeK5GVTILsrO CgpPI2GLaNdJT7fOrZ1CswltzwvtUCj8HiCBFldfur0AnnFS66GOpXF4BoHY/mUX8meh dcSY/9UjoN7aUHIH5VZNrJQFlqt8DmLdkTsXHCSLkdZmtmHmWc+QHrTQ+FQPGqBQh5jd LXEvQGBgc+WdPKtwbw3Mnt/fZMK94zB+SmY2r1EBWfaG/Meuv0QswpA0zOXVg3p4/jSD R8Eg== X-Gm-Message-State: AKGB3mI59uCwaBZV+069FnnlVKMaV1beqvmXCguge8Ix3yjJGTdosRum yYRQOiYEAs6EeoxjmdfFqfg/qHYX X-Google-Smtp-Source: ACJfBov3GF3cimjDj2TfW0AjwuElW6GY9qm20Il5NI2qEnXafl8kTEfSHz+LZkTercIACWu/N2+oIg== X-Received: by 10.28.230.138 with SMTP id e10mr2077297wmi.141.1513790160174; Wed, 20 Dec 2017 09:16:00 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:36 +0100 Message-Id: <1513790098-9815-25-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::231 Subject: [Qemu-devel] [PULL 24/46] tests/boot-serial-test: Add support for the raspi2 machine X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth The raspi2 machine supports loading firmware images, so we can easily load a small test sequence as raw binary blob here to test the UART. Signed-off-by: Thomas Huth Message-Id: <1512031988-32490-8-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- tests/Makefile.include | 1 + tests/boot-serial-test.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/tests/Makefile.include b/tests/Makefile.include index 02ca4b2..c1a4a22 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -361,6 +361,7 @@ check-qtest-arm-y +=3D tests/virtio-blk-test$(EXESUF) gcov-files-arm-y +=3D arm-softmmu/hw/block/virtio-blk.c check-qtest-arm-y +=3D tests/test-arm-mptimer$(EXESUF) gcov-files-arm-y +=3D hw/timer/arm_mptimer.c +check-qtest-arm-y +=3D tests/boot-serial-test$(EXESUF) =20 check-qtest-aarch64-y =3D tests/numa-test$(EXESUF) =20 diff --git a/tests/boot-serial-test.c b/tests/boot-serial-test.c index 1deddb8..663b78b 100644 --- a/tests/boot-serial-test.c +++ b/tests/boot-serial-test.c @@ -47,6 +47,14 @@ static const uint8_t bios_moxiesim[] =3D { 0x1a, 0x00, 0x00, 0x00, 0x10, 0x00 /* jmpa 0x1000 */ }; =20 +static const uint8_t bios_raspi2[] =3D { + 0x08, 0x30, 0x9f, 0xe5, /* ldr r3,[pc,#8] Get bas= e */ + 0x54, 0x20, 0xa0, 0xe3, /* mov r2,#'T' */ + 0x00, 0x20, 0xc3, 0xe5, /* strb r2,[r3] */ + 0xfb, 0xff, 0xff, 0xea, /* b loop */ + 0x00, 0x10, 0x20, 0x3f, /* 0x3f201000 =3D UART0 base a= ddr */ +}; + typedef struct testdef { const char *arch; /* Target architecture */ const char *machine; /* Name of the machine */ @@ -78,6 +86,7 @@ static testdef_t tests[] =3D { { "microblazeel", "petalogix-ml605", "", "TT", sizeof(kernel_plml605), kernel_plml605 }, { "moxie", "moxiesim", "", "TT", sizeof(bios_moxiesim), 0, bios_moxies= im }, + { "arm", "raspi2", "", "TT", sizeof(bios_raspi2), 0, bios_raspi2 }, =20 { NULL } }; --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513791569831983.7425211822373; Wed, 20 Dec 2017 09:39:29 -0800 (PST) Received: from localhost ([::1]:60548 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRiL0-0007nI-Nc for importer@patchew.org; Wed, 20 Dec 2017 12:39:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56461) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhyQ-0004jT-ET for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyM-0007GV-SF for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:06 -0500 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:33598) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyM-0007G6-Hl for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:02 -0500 Received: by mail-wr0-x242.google.com with SMTP id v21so12206703wrc.0 for ; Wed, 20 Dec 2017 09:16:02 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.16.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:16:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=HH8jAd6ApKsaep6STCiDUVU2eqkznAdNRMGRWWt9OwI=; b=B7Jsu4VsFfQ6Mt+X3az124zNz1+5ED0leALU930V5rUUwmhHqpoUJczFN1m20lsU+w W01M9e8E9VU8sMtWsYFTIf5g8tuJFn43Gf5C9ILPkl9CYLzR9540+BVEUjBOoHorRFy4 Chrg1G28zwVJgy47pseU1Qe2XskSUxEdhHH2ijbzMbtE30BDxxDFFrVnTomPgkga4CSo A+khlXnAVRw7cmrXJmN7oL8J8owKWwn+VdjDdDvxyLIeiidTHN89VhECguRQ2cIIfkFV 757CobfJocjJ04xsUBgH55eh7h8KYZXCHfF3oqSbW2lK6prwOIyjm2QU1etfftbzc8HH jyUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=HH8jAd6ApKsaep6STCiDUVU2eqkznAdNRMGRWWt9OwI=; b=Eixmc+Q1Gw1GPQDwss5wMhah0KLv+ICPTog7H2lo9bRvZmMWISPH3N5x05vwNi5iRc uNgniWJOJ+jEf/fpEaoFJHUYFDoYvT5Qz4yHprEZ9LW2L71P5LKO2YtecFCNdjQpO/aB edOOw9r0szFz4JLKAJ6z5BS10XRiU0iKEm26pVyafv5JjmSeN7zpB1pxAXTCHnEb345t JJ7nWP13xWjmYoeLcpmBKHS1yzKLrgqK6IalLIGFPC/5bWxI2k3NS/qle4iQhrFnEQwf +dmWfobdZ2DESLktaehiV5h2iKmiIfuYF6qqv7oA/QlO9QbGrk+3FM6s/T0iSVE28Wnf Ncag== X-Gm-Message-State: AKGB3mKed7MjSL0o6twXuKeuDkwbLaRpwcE/eJZWgknkS8nTFs2Fqidn P/I1sGWiqLNhGhZzNEB4IB0x6hAR X-Google-Smtp-Source: ACJfBosSmNtOGtQc1bV1nk15vY/MA6b7LJlKijyVmPA1k3uCt43PpDFcgm/XhiNVftloWcHfj+NQJA== X-Received: by 10.223.136.184 with SMTP id f53mr8913425wrf.143.1513790161223; Wed, 20 Dec 2017 09:16:01 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:37 +0100 Message-Id: <1513790098-9815-26-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 25/46] cpu: refactor cpu_address_space_init() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Peter Xu Normally we create an address space for that CPU and pass that address space into the function. Let's just do it inside to unify address space creations. It'll simplify my next patch to rename those address spaces. Signed-off-by: Peter Xu Message-Id: <20171123092333.16085-3-peterx@redhat.com> Signed-off-by: Paolo Bonzini --- cpus.c | 5 +---- exec.c | 7 ++++++- include/exec/exec-all.h | 6 ++++-- target/arm/cpu.c | 13 +++---------- target/i386/cpu.c | 10 ++-------- 5 files changed, 16 insertions(+), 25 deletions(-) diff --git a/cpus.c b/cpus.c index 3740c4d..83700c1 100644 --- a/cpus.c +++ b/cpus.c @@ -1787,11 +1787,8 @@ void qemu_init_vcpu(CPUState *cpu) /* If the target cpu hasn't set up any address spaces itself, * give it the default one. */ - AddressSpace *as =3D g_new0(AddressSpace, 1); - - address_space_init(as, cpu->memory, "cpu-memory"); cpu->num_ases =3D 1; - cpu_address_space_init(cpu, as, 0); + cpu_address_space_init(cpu, 0, "cpu-memory", cpu->memory); } =20 if (kvm_enabled()) { diff --git a/exec.c b/exec.c index 3e7c57e..3ab515e 100644 --- a/exec.c +++ b/exec.c @@ -705,9 +705,14 @@ CPUState *qemu_get_cpu(int index) } =20 #if !defined(CONFIG_USER_ONLY) -void cpu_address_space_init(CPUState *cpu, AddressSpace *as, int asidx) +void cpu_address_space_init(CPUState *cpu, int asidx, + const char *prefix, MemoryRegion *mr) { CPUAddressSpace *newas; + AddressSpace *as =3D g_new0(AddressSpace, 1); + + assert(mr); + address_space_init(as, mr, prefix); =20 /* Target code should have set num_ases before calling us */ assert(asidx < cpu->num_ases); diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 0f51c92..b37f7d8 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -74,8 +74,9 @@ void cpu_reloading_memory_map(void); /** * cpu_address_space_init: * @cpu: CPU to add this address space to - * @as: address space to add * @asidx: integer index of this address space + * @prefix: prefix to be used as name of address space + * @mr: the root memory region of address space * * Add the specified address space to the CPU's cpu_ases list. * The address space added with @asidx 0 is the one used for the @@ -89,7 +90,8 @@ void cpu_reloading_memory_map(void); * * Note that with KVM only one address space is supported. */ -void cpu_address_space_init(CPUState *cpu, AddressSpace *as, int asidx); +void cpu_address_space_init(CPUState *cpu, int asidx, + const char *prefix, MemoryRegion *mr); #endif =20 #if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 7f7a3d1..cc1856c 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -705,9 +705,6 @@ static void arm_cpu_realizefn(DeviceState *dev, Error *= *errp) CPUARMState *env =3D &cpu->env; int pagebits; Error *local_err =3D NULL; -#ifndef CONFIG_USER_ONLY - AddressSpace *as; -#endif =20 cpu_exec_realizefn(cs, &local_err); if (local_err !=3D NULL) { @@ -912,21 +909,17 @@ static void arm_cpu_realizefn(DeviceState *dev, Error= **errp) =20 #ifndef CONFIG_USER_ONLY if (cpu->has_el3 || arm_feature(env, ARM_FEATURE_M_SECURITY)) { - as =3D g_new0(AddressSpace, 1); - cs->num_ases =3D 2; =20 if (!cpu->secure_memory) { cpu->secure_memory =3D cs->memory; } - address_space_init(as, cpu->secure_memory, "cpu-secure-memory"); - cpu_address_space_init(cs, as, ARMASIdx_S); + cpu_address_space_init(cs, ARMASIdx_S, "cpu-secure-memory", + cpu->secure_memory); } else { cs->num_ases =3D 1; } - as =3D g_new0(AddressSpace, 1); - address_space_init(as, cs->memory, "cpu-memory"); - cpu_address_space_init(cs, as, ARMASIdx_NS); + cpu_address_space_init(cs, ARMASIdx_NS, "cpu-memory", cs->memory); #endif =20 qemu_init_vcpu(cs); diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 325b52e..b069eaf 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -3736,11 +3736,6 @@ static void x86_cpu_realizefn(DeviceState *dev, Erro= r **errp) =20 #ifndef CONFIG_USER_ONLY if (tcg_enabled()) { - AddressSpace *as_normal =3D g_new0(AddressSpace, 1); - AddressSpace *as_smm =3D g_new(AddressSpace, 1); - - address_space_init(as_normal, cs->memory, "cpu-memory"); - cpu->cpu_as_mem =3D g_new(MemoryRegion, 1); cpu->cpu_as_root =3D g_new(MemoryRegion, 1); =20 @@ -3755,11 +3750,10 @@ static void x86_cpu_realizefn(DeviceState *dev, Err= or **errp) get_system_memory(), 0, ~0ull); memory_region_add_subregion_overlap(cpu->cpu_as_root, 0, cpu->cpu_= as_mem, 0); memory_region_set_enabled(cpu->cpu_as_mem, true); - address_space_init(as_smm, cpu->cpu_as_root, "CPU"); =20 cs->num_ases =3D 2; - cpu_address_space_init(cs, as_normal, 0); - cpu_address_space_init(cs, as_smm, 1); + cpu_address_space_init(cs, 0, "cpu-memory", cs->memory); + cpu_address_space_init(cs, 1, "cpu-smm", cpu->cpu_as_root); =20 /* ... SMRAM with higher priority, linked from /machine/smram. */ cpu->machine_done.notify =3D x86_cpu_machine_done; --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513790972257797.6532117625488; Wed, 20 Dec 2017 09:29:32 -0800 (PST) Received: from localhost ([::1]:60404 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRiBF-0007VB-T6 for importer@patchew.org; Wed, 20 Dec 2017 12:29:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56460) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhyQ-0004jS-E9 for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyN-0007Gk-Ke for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:06 -0500 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:43968) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyN-0007GS-D7 for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:03 -0500 Received: by mail-wr0-x242.google.com with SMTP id w68so10469437wrc.10 for ; Wed, 20 Dec 2017 09:16:03 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.16.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:16:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=k+ykxptOtTBqrKRW+zLhA7DiT5++LFyCFidvL9aPQjg=; b=Y1oARqtbMzlcd56pq/E6UEDUQU/JvZV7LPgDmOJ9wE5v6kFjpkoxLsHi7jkWDJkHMv Ao8HEOV0EP1wIEcHJlhr8Nsybmm8vXcjdp+ZrK0A/kVFjZdphlFtthrgAQlYoqPKSEGV lTxz+ZwVNmfvpr/Q/1eiGiaBzKaGjfr1XfC7DXDLoAkUpbN1W+z34/I4WchKPaUDO/cA X/7o0EwzsAn6sJWbW4VY+e5ZOERsolEvDxyQ+iauB+h153pkf+UGbhYa6Y78QWIfeQFB SZa/Y0Y9RyRCO6etb6ckHRX49awY0x51mBxuAfEnRz/0N41Xo0pAgpvuHUNqtMLn7Q/p VVug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=k+ykxptOtTBqrKRW+zLhA7DiT5++LFyCFidvL9aPQjg=; b=nUMlI0cyclksyTHOTPAKZwLWB10cZ+rLAYnYfd1OVMcQY3kUOugSbouygwBqrZzFmz tko/hVdHi2M6BI56U+t4C1sCgParjIZVcmguE3f644qQZALmhIL9AEmR9p8I/rZe5KVI EqzcKma0kGVl+liQOp8QYsCaM421aR6rHO9Y7fNpmFLxT+37vWBvr+UnvsPhPuqxA8K6 oUuwRqq2/+6qBEjx1jE+o9xOvLzzIFb+X6RvqOzBqB2POanb6ly8AA335od48Tjp98CI +38ECIgnRnAhmiVEpYBsTrwPyvcCl1voLeSD/GAT4qVZr2ISdPSFUdmOGWDHhbqM2pNf mJHw== X-Gm-Message-State: AKGB3mLBR8DefRDSE1rTOmO2oDZhRAV6eI8Aihq1TKAT3TKq9WT+tZ+Y 3iOyr5dlOCbpT4yY8Gpqb6nNIq+M X-Google-Smtp-Source: ACJfBot4ac0WRkuldXSZq4TyT7S3S5Hch8vmyRuzg4BVuyGJMhfJIExqt71DRm0J84R0xjZUO5e6VQ== X-Received: by 10.223.169.183 with SMTP id b52mr9708130wrd.63.1513790162166; Wed, 20 Dec 2017 09:16:02 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:38 +0100 Message-Id: <1513790098-9815-27-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 26/46] cpu: suffix cpu address spaces with cpu index X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Peter Xu Renaming cpu address space names so that they won't be the same when there are more than one. Signed-off-by: Peter Xu Message-Id: <20171123092333.16085-4-peterx@redhat.com> Signed-off-by: Paolo Bonzini --- exec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/exec.c b/exec.c index 3ab515e..6b5828e 100644 --- a/exec.c +++ b/exec.c @@ -710,9 +710,12 @@ void cpu_address_space_init(CPUState *cpu, int asidx, { CPUAddressSpace *newas; AddressSpace *as =3D g_new0(AddressSpace, 1); + char *as_name; =20 assert(mr); - address_space_init(as, mr, prefix); + as_name =3D g_strdup_printf("%s-%d", prefix, cpu->cpu_index); + address_space_init(as, mr, as_name); + g_free(as_name); =20 /* Target code should have set num_ases before calling us */ assert(asidx < cpu->num_ases); --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513791394601129.27657295976803; Wed, 20 Dec 2017 09:36:34 -0800 (PST) Received: from localhost ([::1]:60492 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRiI9-0005D7-Fy for importer@patchew.org; Wed, 20 Dec 2017 12:36:29 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56459) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhyQ-0004jR-E4 for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyO-0007HI-N8 for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:06 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:37193) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyO-0007Gu-F7; Wed, 20 Dec 2017 12:16:04 -0500 Received: by mail-wm0-x242.google.com with SMTP id f140so11109611wmd.2; Wed, 20 Dec 2017 09:16:04 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.16.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:16:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=EBeIVT1ZE1Pyp/05Hkmtyr+a8ooF3jmdKBEK3lkwY80=; b=NtldP0B2Uaqp4gxTnZEVVYMVxqLbv1ZVfZE9EtUgk1L+uwZUEj6wVL1wY1DUWfR2lk XqsA58oz1+St6nMJllLSikdTpybeLd+v1n04ecQUjt9Sh9aQVEzYfAhk4o7sYq6bdxH6 7n3KMU8EdDZqbKdJIaOIOrtuvQ24OrgvC31YMqQL9J+4Z+pzEOgjBmOVE8JjYcs46C/z KOqHDbt1CwteFZMyirIQwvvapbf05lkjr+Ey7CEpja9EhALP5aMTTpRkVazIXI7DKvn3 IMBvRIY84ZqH/vxPV4Xj2Aom8ROu4Vc6KLip8waXqbf6AjFTRDVdxhFyGOztoTVAjh2e FE5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=EBeIVT1ZE1Pyp/05Hkmtyr+a8ooF3jmdKBEK3lkwY80=; b=UhOmchZUdWIH5wcd0LtbhqS3tAppzs+ZUreTvwdwQTObKJWVG9F2zGHw7OH6qARwnJ e5xdq00fTCq+bpEm05YAKEpooyLJosU5kkOAC5EwA/Co2hJDni2MlZ2nv8mvP3DeOjdN gXVgumO2QBJ9GGRReZalO2fd1DhigW2y1BvnCASNfDgk5fDaJJC4AYjcOcuW+KQuqWJE WHCVoRIFbyf4r3Qwh4r9SrakJZ8dKdL7C44VqWV5p2umsa3CSacjutEISS/uKW/Uri6K NybDKqxtap62XoACmEfhf+VxzgJwyaeUy/VdbQHD4EaAQEu4oZoUzmjhLY0LQu30yunz vG2A== X-Gm-Message-State: AKGB3mJRm59t+Lkqo/0GN6hDIjWaCz37s+UWXZZb55uym7RH+Q8/nh97 psrHeSMWppzRbQqqQAtOgzpjmGu2 X-Google-Smtp-Source: ACJfBov6V7YSxs4QCqIhKZr74nP30rO76j7eBX+FpxX/3GcO6nAz0Load/YiEWjc9hvRrX4bViYcAA== X-Received: by 10.28.175.66 with SMTP id y63mr7730628wme.125.1513790163179; Wed, 20 Dec 2017 09:16:03 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:39 +0100 Message-Id: <1513790098-9815-28-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 27/46] block/iscsi: dont leave allocmap in an invalid state on UNMAP failure X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Lieven , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Peter Lieven we forgot to set the allocmap to invalid if an UNMAP call fails. Cc: qemu-stable@nongnu.org Signed-off-by: Peter Lieven Message-Id: <1512733868-9009-2-git-send-email-pl@kamp.de> Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- block/iscsi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/block/iscsi.c b/block/iscsi.c index 4683f3b..c532ec7 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -2,7 +2,7 @@ * QEMU Block driver for iSCSI images * * Copyright (c) 2010-2011 Ronnie Sahlberg - * Copyright (c) 2012-2016 Peter Lieven + * Copyright (c) 2012-2017 Peter Lieven * * Permission is hereby granted, free of charge, to any person obtaining a= copy * of this software and associated documentation files (the "Software"), t= o deal @@ -1128,6 +1128,9 @@ retry: goto retry; } =20 + iscsi_allocmap_set_invalid(iscsilun, offset >> BDRV_SECTOR_BITS, + bytes >> BDRV_SECTOR_BITS); + if (iTask.status =3D=3D SCSI_STATUS_CHECK_CONDITION) { /* the target might fail with a check condition if it is not happy with the alignment of the UNMAP request @@ -1140,9 +1143,6 @@ retry: goto out_unlock; } =20 - iscsi_allocmap_set_invalid(iscsilun, offset >> BDRV_SECTOR_BITS, - bytes >> BDRV_SECTOR_BITS); - out_unlock: qemu_mutex_unlock(&iscsilun->mutex); return r; --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513791148464347.59325441252065; Wed, 20 Dec 2017 09:32:28 -0800 (PST) Received: from localhost ([::1]:60424 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRiE4-0001fU-Px for importer@patchew.org; Wed, 20 Dec 2017 12:32:16 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56479) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhyR-0004k9-6b for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyP-0007Hm-Sy for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:07 -0500 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:39562) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyP-0007HP-In for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:05 -0500 Received: by mail-wr0-x243.google.com with SMTP id a41so22872028wra.6 for ; Wed, 20 Dec 2017 09:16:05 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.16.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:16:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Wl8kr8vLFKQ5lbit/DElXKfp6cMKMo3EL+UZ0o+IkHE=; b=NknbJyG+ki8GOWc7Gwk1gw5lk2kAagmYdbGbvFuv7wumiHOzVQylvhwVKK2sP2kXcc QjVTpO5Qgj821S3N4UY2Ue3qFjwzAvfytUUcO7e1fbIqIn1VgzZSYlWudlEINrNg8i3n fSoC8NmoRLxAUwpMHclpIKHOmXP44Bf5qI+doVTeG196uXaWnytI7MF/eK5UjQPyL4jF Iu9WUA97yoAVKv7bzCeetC815zGtR5MrgD86hAHHlO7woTiGotTaeETArTVZJG1SjJ5+ npt5F4Z86aYDlXMvw5CODmGB1VZHmywYQKDkau552AGNFm2HkUd2vtvJvp8PBEoRjzL2 5etQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Wl8kr8vLFKQ5lbit/DElXKfp6cMKMo3EL+UZ0o+IkHE=; b=o7o0ImhesMIORLX7Fu9M7BfvXSE09z4KEhsWP86UUGvdgFz5OPetY8UKfCf6oK2Bry qiSOf3fdCvZGG1hxcGA0iEd1KdEldkuEAuitiLLlvWYOKsJ+RnwA60snr+d2AR1j/U8W u2nEgIrmuWz/cav9vdFVxSCtds/wNsTqgoI+6k0hxNMMOhAjNQmlVz1T21jTEQJ1W579 S26MadPPWNbpLI5nTzfX+1eVgssAtgtqLbnOJdKuecvmn1q7wmaMcSNfgb30eq+jKNEl tfyOztHTtsDH08aQTh/Ggyh4+yexoCzNukL8aNH5X+1yXAYOpR/H/D7kr3A9yICjnmP5 jPUw== X-Gm-Message-State: AKGB3mJTQBNkwlaIuYg656KXVc3py5E93uvpcKcCXLF5+av8HfkcC7Ar KcoIeCIEWhkSYmQTfPiIoKAIWROr X-Google-Smtp-Source: ACJfBosjK422wnaZcsWqYTtrcxb4QSGd7rQqap91wchodpK/OXKdjoi73n5XDOlyifbbVMtuprbvQA== X-Received: by 10.223.139.152 with SMTP id o24mr9956946wra.243.1513790164221; Wed, 20 Dec 2017 09:16:04 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:40 +0100 Message-Id: <1513790098-9815-29-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::243 Subject: [Qemu-devel] [PULL 28/46] block/iscsi: only report an iSCSI Failure if we don't handle it gracefully X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Lieven Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Peter Lieven we currently report an "iSCSI Failure" in iscsi_co_generic_cb if the task hasn't completed with SCSI_STATUS_GOOD. However, we expect a failure in some cases and handle it gracefully. This is the case for misaligned UNMAPs and WRITESAME10/16 calls without UNMAP. In this case a failure in the logs can be quite misleading. While we are at it improve the logging to reveal which operation failed at what LBA. Signed-off-by: Peter Lieven Message-Id: <1512733868-9009-3-git-send-email-pl@kamp.de> Signed-off-by: Paolo Bonzini --- block/iscsi.c | 43 ++++++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/block/iscsi.c b/block/iscsi.c index c532ec7..5c0a9e5 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -104,6 +104,7 @@ typedef struct IscsiTask { IscsiLun *iscsilun; QEMUTimer retry_timer; int err_code; + char *err_str; } IscsiTask; =20 typedef struct IscsiAIOCB { @@ -265,7 +266,7 @@ iscsi_co_generic_cb(struct iscsi_context *iscsi, int st= atus, } } iTask->err_code =3D iscsi_translate_sense(&task->sense); - error_report("iSCSI Failure: %s", iscsi_get_error(iscsi)); + iTask->err_str =3D g_strdup(iscsi_get_error(iscsi)); } =20 out: @@ -629,6 +630,8 @@ retry: =20 if (iTask.status !=3D SCSI_STATUS_GOOD) { iscsi_allocmap_set_invalid(iscsilun, sector_num, nb_sectors); + error_report("iSCSI WRITE10/16 failed at lba %" PRIu64 ": %s", lba, + iTask.err_str); r =3D iTask.err_code; goto out_unlock; } @@ -637,6 +640,7 @@ retry: =20 out_unlock: qemu_mutex_unlock(&iscsilun->mutex); + g_free(iTask.err_str); return r; } =20 @@ -651,10 +655,9 @@ static int64_t coroutine_fn iscsi_co_get_block_status(= BlockDriverState *bs, struct scsi_get_lba_status *lbas =3D NULL; struct scsi_lba_status_descriptor *lbasd =3D NULL; struct IscsiTask iTask; + uint64_t lba; int64_t ret; =20 - iscsi_co_init_iscsitask(iscsilun, &iTask); - if (!is_sector_request_lun_aligned(sector_num, nb_sectors, iscsilun)) { ret =3D -EINVAL; goto out; @@ -670,11 +673,13 @@ static int64_t coroutine_fn iscsi_co_get_block_status= (BlockDriverState *bs, goto out; } =20 + lba =3D sector_qemu2lun(sector_num, iscsilun); + + iscsi_co_init_iscsitask(iscsilun, &iTask); qemu_mutex_lock(&iscsilun->mutex); retry: if (iscsi_get_lba_status_task(iscsilun->iscsi, iscsilun->lun, - sector_qemu2lun(sector_num, iscsilun), - 8 + 16, iscsi_co_generic_cb, + lba, 8 + 16, iscsi_co_generic_cb, &iTask) =3D=3D NULL) { ret =3D -ENOMEM; goto out_unlock; @@ -701,6 +706,8 @@ retry: * because the device is busy or the cmd is not * supported) we pretend all blocks are allocated * for backwards compatibility */ + error_report("iSCSI GET_LBA_STATUS failed at lba %" PRIu64 ": %s", + lba, iTask.err_str); goto out_unlock; } =20 @@ -738,6 +745,7 @@ retry: } out_unlock: qemu_mutex_unlock(&iscsilun->mutex); + g_free(iTask.err_str); out: if (iTask.task !=3D NULL) { scsi_free_scsi_task(iTask.task); @@ -756,6 +764,7 @@ static int coroutine_fn iscsi_co_readv(BlockDriverState= *bs, struct IscsiTask iTask; uint64_t lba; uint32_t num_sectors; + int r =3D 0; =20 if (!is_sector_request_lun_aligned(sector_num, nb_sectors, iscsilun)) { return -EINVAL; @@ -853,19 +862,23 @@ retry: iTask.complete =3D 0; goto retry; } - qemu_mutex_unlock(&iscsilun->mutex); =20 if (iTask.status !=3D SCSI_STATUS_GOOD) { - return iTask.err_code; + error_report("iSCSI READ10/16 failed at lba %" PRIu64 ": %s", + lba, iTask.err_str); + r =3D iTask.err_code; } =20 - return 0; + qemu_mutex_unlock(&iscsilun->mutex); + g_free(iTask.err_str); + return r; } =20 static int coroutine_fn iscsi_co_flush(BlockDriverState *bs) { IscsiLun *iscsilun =3D bs->opaque; struct IscsiTask iTask; + int r =3D 0; =20 iscsi_co_init_iscsitask(iscsilun, &iTask); qemu_mutex_lock(&iscsilun->mutex); @@ -892,13 +905,15 @@ retry: iTask.complete =3D 0; goto retry; } - qemu_mutex_unlock(&iscsilun->mutex); =20 if (iTask.status !=3D SCSI_STATUS_GOOD) { - return iTask.err_code; + error_report("iSCSI SYNCHRONIZECACHE10 failed: %s", iTask.err_str); + r =3D iTask.err_code; } =20 - return 0; + qemu_mutex_unlock(&iscsilun->mutex); + g_free(iTask.err_str); + return r; } =20 #ifdef __linux__ @@ -1139,12 +1154,15 @@ retry: } =20 if (iTask.status !=3D SCSI_STATUS_GOOD) { + error_report("iSCSI UNMAP failed at lba %" PRIu64 ": %s", + list.lba, iTask.err_str); r =3D iTask.err_code; goto out_unlock; } =20 out_unlock: qemu_mutex_unlock(&iscsilun->mutex); + g_free(iTask.err_str); return r; } =20 @@ -1241,6 +1259,8 @@ retry: if (iTask.status !=3D SCSI_STATUS_GOOD) { iscsi_allocmap_set_invalid(iscsilun, offset >> BDRV_SECTOR_BITS, bytes >> BDRV_SECTOR_BITS); + error_report("iSCSI WRITESAME10/16 failed at lba %" PRIu64 ": %s", + lba, iTask.err_str); r =3D iTask.err_code; goto out_unlock; } @@ -1255,6 +1275,7 @@ retry: =20 out_unlock: qemu_mutex_unlock(&iscsilun->mutex); + g_free(iTask.err_str); return r; } =20 --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513792061915484.58566381338005; Wed, 20 Dec 2017 09:47:41 -0800 (PST) Received: from localhost ([::1]:60734 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRiSi-00061A-3B for importer@patchew.org; Wed, 20 Dec 2017 12:47:24 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhyU-0004mg-Qv for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyQ-0007IJ-Rj for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:10 -0500 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:41770) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyQ-0007Ht-LZ for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:06 -0500 Received: by mail-wm0-x244.google.com with SMTP id g75so11357961wme.0 for ; Wed, 20 Dec 2017 09:16:06 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.16.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:16:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=odyuUt0Aj/fq2kfpbleAvgaIgCxEoUpONkdTAR6BzQg=; b=gfLTsLXMc2aUOBOtT9BM2AkE2JGjlj9icIK7XlYQ3O9Jk89fHs51pktNNIZ2Y3xhES rcqxCA4lNpyhE8o4pD57eweGhgKxP6N3BPz0tgxZJ2Q+EVkcTTrcISGsg33GxLtqzBTr GJxXiNNB5Je5/F/yft4hlLqj9wDMEQKW64sKn4jRBtwKpTOBgD7tdthuuCQ1HumMuGsg isZJUOu0nPKicL9Xxj2+UyUZNp+VFAVdEN2/dY9zs+zQzOPOrJ8CEp9aOg2KjbJ5SeKT SrhrAekER2j3fJKZer34QVFepoDKlH38QVT2tk1+Cm7kZKzKHq1K4P6fUPtJKCZW4Ofo gJ4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=odyuUt0Aj/fq2kfpbleAvgaIgCxEoUpONkdTAR6BzQg=; b=uRtA5EaXU1WiRoAxhSN9d8VgeUvS19Vs25R7BTKhxjj5frnKMZfoW74D54N1mEnVKi V+//jWnWVSsrAjR/HCw1Z7HGSZsLVlL+PpDr16iZ+P01e2s9wDOs6LsnGuhlmobgmsrI MVq6wHtoBbGm+i8NoLNboVKlZxqKaQbGHUVYVVqfzI7Q1iSa9LueCwZFmCki53Lbv2mf 0e82trEtK+LVsN8xoN6L0SOaxKTD+MVcOPWCudYBjEBD7fqD6XOOqC7UaBOyViBhPYxZ wdWxt2zPmQn7UzEf8XRR+h7lqRnpUbxkDw9Eby5fpbOpF4EaWlYa6HKEt7YKzzjylgQR OeYg== X-Gm-Message-State: AKGB3mJi9H0Lr+aqIXeirjmtdbNwJuRR51r9oQxuIUiwnDXu6W7cqre6 PcnZUAgyVCTQdC1uEV0U87BCbTc7 X-Google-Smtp-Source: ACJfBosRRrpzzkHhWn5e84Hwek32WiAwhIEAHGgPzs4mAr1RrnByLW0mmQ3mu4p7NIqgmUWtSG2NrA== X-Received: by 10.28.149.203 with SMTP id x194mr7315535wmd.145.1513790165251; Wed, 20 Dec 2017 09:16:05 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:41 +0100 Message-Id: <1513790098-9815-30-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 29/46] exec: Don't reuse unassigned_mem_ops for io_mem_rom X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Peter Maydell We set up the io_mem_rom special memory region using the unassigned_mem_ops structure; this is then used when a guest tries to write to ROM. This is incorrect, because the behaviour of unassigned memory may be different from that of ROM for writes. In particular, on some architectures writing to unassigned memory generates a guest exception, whereas writing to ROM is generally ignored. Use a special readonly_mem_ops for this purpose instead, so writes to ROM are ignored for all guest CPUs. Signed-off-by: Peter Maydell Message-Id: <1513187549-2435-2-git-send-email-peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini --- exec.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/exec.c b/exec.c index 6b5828e..4722e52 100644 --- a/exec.c +++ b/exec.c @@ -2725,6 +2725,37 @@ static uint16_t dummy_section(PhysPageMap *map, Flat= View *fv, MemoryRegion *mr) return phys_section_add(map, §ion); } =20 +static void readonly_mem_write(void *opaque, hwaddr addr, + uint64_t val, unsigned size) +{ + /* Ignore any write to ROM. */ +} + +static bool readonly_mem_accepts(void *opaque, hwaddr addr, + unsigned size, bool is_write) +{ + return is_write; +} + +/* This will only be used for writes, because reads are special cased + * to directly access the underlying host ram. + */ +static const MemoryRegionOps readonly_mem_ops =3D { + .write =3D readonly_mem_write, + .valid.accepts =3D readonly_mem_accepts, + .endianness =3D DEVICE_NATIVE_ENDIAN, + .valid =3D { + .min_access_size =3D 1, + .max_access_size =3D 8, + .unaligned =3D false, + }, + .impl =3D { + .min_access_size =3D 1, + .max_access_size =3D 8, + .unaligned =3D false, + }, +}; + MemoryRegion *iotlb_to_region(CPUState *cpu, hwaddr index, MemTxAttrs attr= s) { int asidx =3D cpu_asidx_from_attrs(cpu, attrs); @@ -2737,7 +2768,8 @@ MemoryRegion *iotlb_to_region(CPUState *cpu, hwaddr i= ndex, MemTxAttrs attrs) =20 static void io_mem_init(void) { - memory_region_init_io(&io_mem_rom, NULL, &unassigned_mem_ops, NULL, NU= LL, UINT64_MAX); + memory_region_init_io(&io_mem_rom, NULL, &readonly_mem_ops, + NULL, NULL, UINT64_MAX); memory_region_init_io(&io_mem_unassigned, NULL, &unassigned_mem_ops, N= ULL, NULL, UINT64_MAX); =20 --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513791865174677.349724217973; Wed, 20 Dec 2017 09:44:25 -0800 (PST) Received: from localhost ([::1]:60611 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRiPh-0003TP-Og for importer@patchew.org; Wed, 20 Dec 2017 12:44:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56513) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhyT-0004mH-CT for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyS-0007Iy-Cx for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:09 -0500 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:34988) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyS-0007Ik-6f for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:08 -0500 Received: by mail-wr0-x243.google.com with SMTP id l19so10550382wrc.2 for ; Wed, 20 Dec 2017 09:16:08 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.16.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:16:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=pKpkifw8hWxEpYyeYQK8s7k+qdEtLUZUQXiL1OTSFqc=; b=Y1Q7M8AMfAQURJ8tTdX0F6yrWPpPk+nJq9I3CmJrcbis1TLtMso9UdtdpGcfPIIBoF wcglC2brR41jaJG/oOEJP+uuhn1AomNWH1T/Cr1s5hyNKGDN1b7RjkVxSu/XCTzAFtS6 dsJQrdaEZ+lmSN8WDrcz23Q4wVhHIYgXD1DEKGpGhzS1adPOOfkf4EsTwvAbrR9UCFKt AYSRCu0C0S6ld+btcz9AA0IsftIjLqYyzvP9+1TavP+2vDMoedeiBQTPFF23P7Y1y2xQ MMfTCK6qbIdbjIgUyfHcw012b8eBoUyr3AJPmh+7qH36zfrbOdEUo7ic0zEnEwPsvRSR 6Rvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=pKpkifw8hWxEpYyeYQK8s7k+qdEtLUZUQXiL1OTSFqc=; b=q39RnM4RJBjvne4bSt2U+UwfB9BaWWwUDrJTLDQaSU1HVLzMvmUejcGVywUEDNMYEb mYrq+5iOMiCyhKrHcjmy+jnISfgtCb83f5plWXGr+3796Sdll/uRD82NA01PrPtVGcns 2mRO7xcSbp0MKtYBfh2SYhf5DFwsX6kUYuqDjqXdvtpoFtZbJt7F4sdHxUtcbJAcsRaL ukwKsR5SlcVhSxdMnLQ6vxMdXZPpiVxvxq5StEEg0geeUPZEVWPx6+qDiIYTWYmbgys5 uxoHLGmH6jH+IbiMChVKtFXNj4MjlrcKWdyjuPxofBZqmoH9+umXp+LuR9KarGGFNXdU qnBg== X-Gm-Message-State: AKGB3mJkEoXYsmGiWiCJKh5NPdEz73DL3lENOHkTF9NqFKaNkVwdY6gB 1dbRKmQhSwUknrbkUYGOLPZN97U3 X-Google-Smtp-Source: ACJfBossO1dw/epr1YhEXhm3OaCi7T9N3jSHaUwN33WBgD+U11Ra5ssn3WYQkOTDw6jB15aj9ieMgg== X-Received: by 10.223.152.178 with SMTP id w47mr9755188wrb.254.1513790166953; Wed, 20 Dec 2017 09:16:06 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:42 +0100 Message-Id: <1513790098-9815-31-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::243 Subject: [Qemu-devel] [PULL 30/46] hw/mips/boston: Remove workaround for writes to ROM aborting X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Peter Maydell Now that the memory system correctly handles writes to ROM for guest CPUs that may generate exceptions for decode errors, we can remove the workaround from the boston board. Signed-off-by: Peter Maydell Message-Id: <1513187549-2435-3-git-send-email-peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini --- hw/mips/boston.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/hw/mips/boston.c b/hw/mips/boston.c index 1cb4b6a..fb23161 100644 --- a/hw/mips/boston.c +++ b/hw/mips/boston.c @@ -248,16 +248,6 @@ static const MemoryRegionOps boston_platreg_ops =3D { .endianness =3D DEVICE_NATIVE_ENDIAN, }; =20 -static void boston_flash_write(void *opaque, hwaddr addr, - uint64_t val, unsigned size) -{ -} - -static const MemoryRegionOps boston_flash_ops =3D { - .write =3D boston_flash_write, - .endianness =3D DEVICE_NATIVE_ENDIAN, -}; - static const TypeInfo boston_device =3D { .name =3D TYPE_MIPS_BOSTON, .parent =3D TYPE_SYS_BUS_DEVICE, @@ -481,8 +471,8 @@ static void boston_mach_init(MachineState *machine) sysbus_mmio_map_overlap(SYS_BUS_DEVICE(s->cps), 0, 0, 1); =20 flash =3D g_new(MemoryRegion, 1); - memory_region_init_rom_device_nomigrate(flash, NULL, &boston_flash_ops= , s, - "boston.flash", 128 * M_BYTE, &err); + memory_region_init_rom_nomigrate(flash, NULL, + "boston.flash", 128 * M_BYTE, &err); memory_region_add_subregion_overlap(sys_mem, 0x18000000, flash, 0); =20 ddr =3D g_new(MemoryRegion, 1); --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513791335861445.8736811314784; Wed, 20 Dec 2017 09:35:35 -0800 (PST) Received: from localhost ([::1]:60449 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRiH4-0004Cu-H1 for importer@patchew.org; Wed, 20 Dec 2017 12:35:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56523) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhyU-0004mU-6a for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyT-0007JO-BX for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:10 -0500 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:39003) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyT-0007J3-4e for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:09 -0500 Received: by mail-wm0-x244.google.com with SMTP id i11so11095992wmf.4 for ; Wed, 20 Dec 2017 09:16:09 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.16.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:16:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Xb3ideVOQilzPcbANaBhagw4MFAyC7x3pFpkU7CX3lE=; b=AF4KV1gnAYeK5IqLN+rdJ/roqNwi9roJj7ZCtf2kqFsugd19TkxuDd+WuGi4PJJTkM B6q5nb04n41UtZCRgAHHZdDRneTJvHY17s83hAJ5xLQLggcm67mSFss22Prp9e1YiEgO uD2gjuKENpQpkqFU9SYcKXxFOd2Nkau6ioRSeo3V61FxtPiH0lTIz53F8d9CbeICbGVp y6S2lNdk/HN448hfZSTEyoMAOTsaIk4zqdWwxJ8uxF12cZ2fTTkHTM/LF7+7St5Igtoa p2INTS6RvSHdWrOUzHuw9N1Ay9Lje3DpkY+qQOEES0hCm8ZY9JWMkUCBOUzoZb5n/dCT cWVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Xb3ideVOQilzPcbANaBhagw4MFAyC7x3pFpkU7CX3lE=; b=lKpMs0y1T9mfCdBtPFQ25nfR3qB8KTR3xdH+YjY1Xz0sqca3/16rMPWWWz5YqsC5VS zJUhgFoh6lemEEAVXJLEHieQDJneRRZejHCG2xYGtiLDvBV8K6Y2YSiBCVhuzCSe2/hP XigHuABfBIUbgQvi1ZCdivSG5pN0rWM6rVfjzkf0cj6p65iOph0VQwtqwkz5tXVuvtEr b1E1LfKF8k4R6vJM85klXQEVEtyIbHYC7sh9VbTMw25xWPPfFR7vHHDsTirG9aTJisKq botsHjLlNm6m0XZSnjKNnnX2tixkyd8DnUO/t16jUG8PRmrSqmYaIu8wrlP8o14oqXxX sKCA== X-Gm-Message-State: AKGB3mKD8mGW+RXFbiLe91XcN0D/raClRjV3vAmD4U7db7eB18BiJK7d qSWpIzJ0bn+4A7vFO3Z6f2bx8LDi X-Google-Smtp-Source: ACJfBosnJS0W4geGD4oIjmL1vJRkhQKGNzr7haqQcBTMXQtOhT3v5tXrDk8AqadOEGFx72U/pOjBJA== X-Received: by 10.28.48.4 with SMTP id w4mr7354265wmw.16.1513790167856; Wed, 20 Dec 2017 09:16:07 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:43 +0100 Message-Id: <1513790098-9815-32-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 31/46] hw/i386/vmport: replace fprintf() by trace events or LOG_UNIMP X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20171215034356.4449-2-f4bug@amsat.org> [Replace unknown command tracepoint with LOG_UNIMP, add generic tracepoint for vmport commands. - Paolo] Signed-off-by: Paolo Bonzini --- hw/i386/trace-events | 4 ++++ hw/i386/vmport.c | 14 +++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hw/i386/trace-events b/hw/i386/trace-events index d43b4b6..22d4464 100644 --- a/hw/i386/trace-events +++ b/hw/i386/trace-events @@ -113,3 +113,7 @@ amdvi_mode_invalid(uint8_t level, uint64_t addr)"error:= translation level 0x%"PR amdvi_page_fault(uint64_t addr) "error: page fault accessing guest physica= l address 0x%"PRIx64 amdvi_iotlb_hit(uint8_t bus, uint8_t slot, uint8_t func, uint64_t addr, ui= nt64_t txaddr) "hit iotlb devid %02x:%02x.%x gpa 0x%"PRIx64" hpa 0x%"PRIx64 amdvi_translation_result(uint8_t bus, uint8_t slot, uint8_t func, uint64_t= addr, uint64_t txaddr) "devid: %02x:%02x.%x gpa 0x%"PRIx64" hpa 0x%"PRIx64 + +# hw/i386/vmport.c +vmport_register(unsigned char command, void *func, void *opaque) "command:= 0x%02x func: %p opaque: %p" +vmport_command(unsigned char command) "command: 0x%02x" diff --git a/hw/i386/vmport.c b/hw/i386/vmport.c index eb880c6..9b8c688 100644 --- a/hw/i386/vmport.c +++ b/hw/i386/vmport.c @@ -27,8 +27,7 @@ #include "hw/i386/pc.h" #include "sysemu/hw_accel.h" #include "hw/qdev.h" - -/* #define VMPORT_DEBUG */ +#include "trace.h" =20 #define VMPORT_CMD_GETVERSION 0x0a #define VMPORT_CMD_GETRAMSIZE 0x14 @@ -54,6 +53,7 @@ void vmport_register(unsigned char command, VMPortReadFun= c *func, void *opaque) return; } =20 + trace_vmport_register(command, func, opaque); port_state->func[command] =3D func; port_state->opaque[command] =3D opaque; } @@ -76,13 +76,9 @@ static uint64_t vmport_ioport_read(void *opaque, hwaddr = addr, } =20 command =3D env->regs[R_ECX]; - if (command >=3D VMPORT_ENTRIES) { - return eax; - } - if (!s->func[command]) { -#ifdef VMPORT_DEBUG - fprintf(stderr, "vmport: unknown command %x\n", command); -#endif + trace_vmport_command(command); + if (command >=3D VMPORT_ENTRIES || !s->func[command]) { + qemu_log_mask(LOG_UNIMP, "vmport: unknown command %x\n", command); return eax; } =20 --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513792402866612.8480265144309; Wed, 20 Dec 2017 09:53:22 -0800 (PST) Received: from localhost ([::1]:60768 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRiYO-0002VK-CO for importer@patchew.org; Wed, 20 Dec 2017 12:53:16 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56550) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhyW-0004o9-8z for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyU-0007Jz-RY for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:12 -0500 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:40601) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyU-0007Je-GW for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:10 -0500 Received: by mail-wm0-x243.google.com with SMTP id f206so11070121wmf.5 for ; Wed, 20 Dec 2017 09:16:10 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.16.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:16:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=BQHpWvPRfo1mCA/LAkjZXKOCPOk8gcn6d+p/ZGAU/vI=; b=QqgKy2eh7bJEDnyRkYzicfgg/dWyzYqFSCdhVnxuZQcK4VHGUILu1o2l7tLfwuG/1B +1qZoWyjQvpjDnda2G74WdNoOyB7jeZYZD2ehwDAcU/rEKPb4UIN2zK8ITgzr9ZZTYyW 5/N4/vaRkXb4xTSA3y9FsqSd9a60yaTtcny1VK6Yr/TkZtdsz2nqnY42ceR0itEi5Jc/ V86d3PZdVGP29fYNyMqCKcf5fnEyGsd3AUWbHSJ9bL6HmlOckUZiKXUTC/pm/OyUXDpj B1k/Kd2mbRzl7cASLCwMHVNQfNQyJHFP8ilOjp6YBOau7HQtvcoOhkfkVUT2jU/9OSB7 ZJOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=BQHpWvPRfo1mCA/LAkjZXKOCPOk8gcn6d+p/ZGAU/vI=; b=EV4kr4ruG8ycQFuF6b68megsCATXaIziTUddGAd0fD7k7yZ7tij2YJcDtWpTCgmauc Mt1PCBG66eH56WSy1ncKyaf5jp0Bd/73aND1QYkz8kV1lr4cMdv4BDeGX2RP0ywqmYVo xwwwCWMkuE6TMJmN0oYbZgPIZ2FnqrknU8oQVM8+G9M8Wcl+VRYlu3m4ho08lsgYy6Uw qp6/h0I6rUugh6OoUkg9b+u1bOC4jACx1GKQy9+P+2HBvNeD2nNUtbboRyl9t8y0kogp Rak79oT9ZKSvci/Y6SRMMm89dWtNX4Dwn3L5a81OaJFmx2UdFFoy2jDZ6uPwLqLNoyEa wayw== X-Gm-Message-State: AKGB3mKSpqbgvQZWi6yz9QMXKDzKVWOxfyX2HqnI5GkcDsU/eCM1VoLh tG6Yd97aVx9g1kxJmIbxKTkBJ4/O X-Google-Smtp-Source: ACJfBov8XJlfjmoSNCKBizrTjEA8O10iJTtOdJe/B5lvrkgYO9CMJENP4Myp/D6q1eOgQvroGtRpgw== X-Received: by 10.28.1.14 with SMTP id 14mr7641132wmb.51.1513790169112; Wed, 20 Dec 2017 09:16:09 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:44 +0100 Message-Id: <1513790098-9815-33-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PULL 32/46] scsi: provide general-purpose functions to manage sense data X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Extract the common parts of scsi_sense_buf_to_errno, scsi_convert_sense and scsi_target_send_command's REQUEST SENSE handling into two new functions scsi_parse_sense_buf and scsi_build_sense_buf. Fix a bug in scsi_target_send_command along the way; the length was written in buf[10] rather than buf[7]. Reported-by: Dr. David Alan Gilbert Reviewed-by: Dr. David Alan Gilbert Fixes: b07fbce634 ("scsi-bus: correct responses for INQUIRY and REQUEST SEN= SE") Signed-off-by: Paolo Bonzini --- hw/scsi/scsi-bus.c | 16 +----- include/scsi/utils.h | 3 ++ scsi/utils.c | 139 +++++++++++++++++++++++++----------------------= ---- 3 files changed, 72 insertions(+), 86 deletions(-) diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 977f7bc..965becf 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -540,20 +540,8 @@ static int32_t scsi_target_send_command(SCSIRequest *r= eq, uint8_t *buf) if (req->lun !=3D 0) { const struct SCSISense sense =3D SENSE_CODE(LUN_NOT_SUPPORTED); =20 - if (fixed_sense) { - r->buf[0] =3D 0x70; - r->buf[2] =3D sense.key; - r->buf[10] =3D 10; - r->buf[12] =3D sense.asc; - r->buf[13] =3D sense.ascq; - r->len =3D MIN(req->cmd.xfer, SCSI_SENSE_LEN); - } else { - r->buf[0] =3D 0x72; - r->buf[1] =3D sense.key; - r->buf[2] =3D sense.asc; - r->buf[3] =3D sense.ascq; - r->len =3D 8; - } + r->len =3D scsi_build_sense_buf(r->buf, req->cmd.xfer, + sense, fixed_sense); } else { r->len =3D scsi_device_get_sense(r->req.dev, r->buf, MIN(req->cmd.xfer, r->buf_len), diff --git a/include/scsi/utils.h b/include/scsi/utils.h index eb07e47..4b705f5 100644 --- a/include/scsi/utils.h +++ b/include/scsi/utils.h @@ -31,6 +31,9 @@ typedef struct SCSISense { } SCSISense; =20 int scsi_build_sense(uint8_t *buf, SCSISense sense); +SCSISense scsi_parse_sense_buf(const uint8_t *in_buf, int in_len); +int scsi_build_sense_buf(uint8_t *buf, size_t max_size, SCSISense sense, + bool fixed_sense); =20 /* * Predefined sense codes diff --git a/scsi/utils.c b/scsi/utils.c index e4182a9..61bc1a8 100644 --- a/scsi/utils.c +++ b/scsi/utils.c @@ -96,15 +96,60 @@ int scsi_cdb_length(uint8_t *buf) return cdb_len; } =20 +SCSISense scsi_parse_sense_buf(const uint8_t *in_buf, int in_len) +{ + bool fixed_in; + SCSISense sense; + + assert(in_len > 0); + fixed_in =3D (in_buf[0] & 2) =3D=3D 0; + if (fixed_in) { + if (in_len < 14) { + return SENSE_CODE(IO_ERROR); + } + sense.key =3D in_buf[2]; + sense.asc =3D in_buf[12]; + sense.ascq =3D in_buf[13]; + } else { + if (in_len < 4) { + return SENSE_CODE(IO_ERROR); + } + sense.key =3D in_buf[1]; + sense.asc =3D in_buf[2]; + sense.ascq =3D in_buf[3]; + } + + return sense; +} + +int scsi_build_sense_buf(uint8_t *out_buf, size_t size, SCSISense sense, + bool fixed_sense) +{ + int len; + uint8_t buf[SCSI_SENSE_LEN] =3D { 0 }; + + if (fixed_sense) { + buf[0] =3D 0x70; + buf[2] =3D sense.key; + buf[7] =3D 10; + buf[12] =3D sense.asc; + buf[13] =3D sense.ascq; + len =3D 18; + } else { + buf[0] =3D 0x72; + buf[1] =3D sense.key; + buf[2] =3D sense.asc; + buf[3] =3D sense.ascq; + len =3D 8; + } + len =3D MIN(len, size); + memcpy(out_buf, buf, len); + return len; +} + int scsi_build_sense(uint8_t *buf, SCSISense sense) { - memset(buf, 0, 18); - buf[0] =3D 0x70; - buf[2] =3D sense.key; - buf[7] =3D 10; - buf[12] =3D sense.asc; - buf[13] =3D sense.ascq; - return 18; + return scsi_build_sense_buf(buf, SCSI_SENSE_LEN, sense, true); } =20 /* @@ -274,52 +319,21 @@ const struct SCSISense sense_code_SPACE_ALLOC_FAILED = =3D { int scsi_convert_sense(uint8_t *in_buf, int in_len, uint8_t *buf, int len, bool fixed) { - bool fixed_in; SCSISense sense; - if (!fixed && len < 8) { - return 0; - } - - if (in_len =3D=3D 0) { - sense.key =3D NO_SENSE; - sense.asc =3D 0; - sense.ascq =3D 0; - } else { - fixed_in =3D (in_buf[0] & 2) =3D=3D 0; - - if (fixed =3D=3D fixed_in) { - memcpy(buf, in_buf, MIN(len, in_len)); - return MIN(len, in_len); - } + bool fixed_in; =20 - if (fixed_in) { - sense.key =3D in_buf[2]; - sense.asc =3D in_buf[12]; - sense.ascq =3D in_buf[13]; - } else { - sense.key =3D in_buf[1]; - sense.asc =3D in_buf[2]; - sense.ascq =3D in_buf[3]; - } + fixed_in =3D (in_buf[0] & 2) =3D=3D 0; + if (in_len && fixed =3D=3D fixed_in) { + memcpy(buf, in_buf, MIN(len, in_len)); + return MIN(len, in_len); } =20 - memset(buf, 0, len); - if (fixed) { - /* Return fixed format sense buffer */ - buf[0] =3D 0x70; - buf[2] =3D sense.key; - buf[7] =3D 10; - buf[12] =3D sense.asc; - buf[13] =3D sense.ascq; - return MIN(len, SCSI_SENSE_LEN); + if (in_len =3D=3D 0) { + sense =3D SENSE_CODE(NO_SENSE); } else { - /* Return descriptor format sense buffer */ - buf[0] =3D 0x72; - buf[1] =3D sense.key; - buf[2] =3D sense.asc; - buf[3] =3D sense.ascq; - return 8; + sense =3D scsi_parse_sense_buf(in_buf, in_len); } + return scsi_build_sense_buf(buf, len, sense, fixed); } =20 int scsi_sense_to_errno(int key, int asc, int ascq) @@ -366,34 +380,15 @@ int scsi_sense_to_errno(int key, int asc, int ascq) } } =20 -int scsi_sense_buf_to_errno(const uint8_t *sense, size_t sense_size) +int scsi_sense_buf_to_errno(const uint8_t *in_buf, size_t in_len) { - int key, asc, ascq; - if (sense_size < 1) { - return EIO; - } - switch (sense[0]) { - case 0x70: /* Fixed format sense data. */ - if (sense_size < 14) { - return EIO; - } - key =3D sense[2] & 0xF; - asc =3D sense[12]; - ascq =3D sense[13]; - break; - case 0x72: /* Descriptor format sense data. */ - if (sense_size < 4) { - return EIO; - } - key =3D sense[1] & 0xF; - asc =3D sense[2]; - ascq =3D sense[3]; - break; - default: + SCSISense sense; + if (in_len < 1) { return EIO; - break; } - return scsi_sense_to_errno(key, asc, ascq); + + sense =3D scsi_parse_sense_buf(in_buf, in_len); + return scsi_sense_to_errno(sense.key, sense.asc, sense.ascq); } =20 const char *scsi_command_name(uint8_t cmd) --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513792251999826.8173524142804; Wed, 20 Dec 2017 09:50:51 -0800 (PST) Received: from localhost ([::1]:60749 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRiVi-00008v-OX for importer@patchew.org; Wed, 20 Dec 2017 12:50:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56553) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhyW-0004oR-L5 for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyV-0007KU-Rj for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:12 -0500 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:36802) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyV-0007KB-Kk for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:11 -0500 Received: by mail-wm0-x241.google.com with SMTP id b76so11199761wmg.1 for ; Wed, 20 Dec 2017 09:16:11 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.16.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:16:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UCwSjQ9njJ0bp04+5jBz9InKa+wM5UY+BhrmOYTSnn0=; b=AN5xvPCvo9Aemr1ogbiVlultwo0rNbbtlBBTaWHbZ+KQuFghc6pkv1Pst9nlNt3WMH 4uN5I0FPZPsIddZiMbm3sYGOwCjnV6ANO+TU7FwVndh/Ir7oO72Af7iIS8ExslIB5eAD F2c/ZfYVPJbBLWnVP+eeg4AEW+YHUrkA0Gmv/bHYTKE64ACZvMwFzDPGJ3hN6Q8v6gA8 GSR90Nl0Zi7Tjf62yUVdP38eSoCQta/7wBEoHuFD0HSyYdw9jRBl2TPSidgc9DTBPjC2 c8G3HsWifjBbEy5l2gVLuChohsCQiwT6BRgyl8Vra2xsUB+3Mq/vloBwpf0X8zMakOs6 mreA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=UCwSjQ9njJ0bp04+5jBz9InKa+wM5UY+BhrmOYTSnn0=; b=B9IJ0EtHDB2LbnEy/O5m03apydhVWz6Uzg3HrheIEyrx9q6rMG2GekMknKbIJMJ/Fp ZAwzKznppo9nRA2Ht4O578Z7mdqFk/OLeSfRtbk/8hvgd5cBRomhmivPGZHaBsQEN3sY BRYvaBagUlvt9lVspsZ0RmLrqUNLkdoWRnAd+06OIJVuv2RtfBhhpUziOrWVKX841PgJ CjoHMDiRAdv77fNTDqzOmt0AooyDrTlPVQXXtMg7p4JPqnI3kX8XtwlkBA73Jifs0gkl gu3lN2CjbdXs5pSryf5bZ+mU2FvGciIpvxtuxLJlw7QjEsf+YZrtUhtqzZNgPtflaQ1p OTiA== X-Gm-Message-State: AKGB3mL8bQrcDvoZWt+OAh9oSxVuC+t8bPPpzFcGbA/B896zCYmXCfB5 FtVFHO/Bta0o/lBRelbt0Kd7ZF3c X-Google-Smtp-Source: ACJfBouEJ3LX51QSPE5DPoBcpReE4oC0JUhWtEgp4Drk/Jv4j5QvAWxnzAjoKD5Pb4bItsI0iWGv6Q== X-Received: by 10.28.49.195 with SMTP id x186mr6808422wmx.116.1513790170360; Wed, 20 Dec 2017 09:16:10 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:45 +0100 Message-Id: <1513790098-9815-34-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 33/46] scsi: replace hex constants with #defines X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_6 Z_629925259 SPT_0 Sense keys have nice #defines in scsi/constants.h, use them. Reported-by: Dr. David Alan Gilbert Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Paolo Bonzini --- scsi/utils.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scsi/utils.c b/scsi/utils.c index 61bc1a8..ddae650 100644 --- a/scsi/utils.c +++ b/scsi/utils.c @@ -339,16 +339,16 @@ int scsi_convert_sense(uint8_t *in_buf, int in_len, int scsi_sense_to_errno(int key, int asc, int ascq) { switch (key) { - case 0x00: /* NO SENSE */ - case 0x01: /* RECOVERED ERROR */ - case 0x06: /* UNIT ATTENTION */ + case NO_SENSE: + case RECOVERED_ERROR: + case UNIT_ATTENTION: /* These sense keys are not errors */ return 0; - case 0x0b: /* COMMAND ABORTED */ + case ABORTED_COMMAND: /* COMMAND ABORTED */ return ECANCELED; - case 0x02: /* NOT READY */ - case 0x05: /* ILLEGAL REQUEST */ - case 0x07: /* DATA PROTECTION */ + case NOT_READY: + case ILLEGAL_REQUEST: + case DATA_PROTECT: /* Parse ASCQ */ break; default: --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513791953373861.4807694770058; Wed, 20 Dec 2017 09:45:53 -0800 (PST) Received: from localhost ([::1]:60626 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRiR8-0004ee-6y for importer@patchew.org; Wed, 20 Dec 2017 12:45:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56622) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhyc-0004uE-KM for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyX-0007L7-1l for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:18 -0500 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:42664) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyW-0007Kg-Rm for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:12 -0500 Received: by mail-wr0-x242.google.com with SMTP id s66so22903733wrc.9 for ; Wed, 20 Dec 2017 09:16:12 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.16.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:16:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=xfTY8DUtq2xdtPP2YLFfXWm3QGGYU/K+MgukPw4C85w=; b=m2xS+YKyG7Brb+quovYZL53pkqf6oCM2EGzgbTPx8L9IscqT12lJrf8fnvO2PZZRjO SE1iPqXErgCriFxk7/jIPL0VGJzdmcI2v6BSqJ9+rlUoz1+4TiBhCbalhEE4XWKqAiSz OtjWF64+34te1OWQwE/83iuxmlEr+ChIkoTU9ljLOjnnelUPkTJjzPPaQzvoRKKfsarE X0GvItFiomMOlYrowlLHVT/Xe/nPjQPmkhoXFpv4/wb87/S1g/7bITSKYXPn9FghvwML BFphzbgAFDfcwTBmJcOLiqkOS87ZMmUHNIKcTWAT79mVPkXQh9UPw1/d5fNFg3t0btE6 1lPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=xfTY8DUtq2xdtPP2YLFfXWm3QGGYU/K+MgukPw4C85w=; b=gwl2O1WGfW1Fj5NGjrH865OhXfxEvaHnHhZXluiB61HVxDVFNrPka9jj4KNnPS/SZd Ko+qYza15UHeyCTc7gA3QN2Wpqp9mHccSRnX4BbZfudwAx0jSfy1cpFdYLNM++l0bJ0J DUiL0ScVdV/nz9cUml3pUkwQgfOZpe4vErCzLI4tFzdwfvQKOcmcpQmoysJKAhM9LyJA Sm0KCmiG53X2VCtDTdHHfBK0XK25D6QYb1Le/kft1U6uGBxZeHeMrl2q6dqwlsEvQqUb 8rsNwIBoLFyTTRtwcN0KON4yybrC2JCL7KU91FFZR6HVJE86uAL5Kxg7GKKjwA3MtP7l yakg== X-Gm-Message-State: AKGB3mKGWW1aDaMWIqwtsOagACGcLdVnYDo3UcR/ennhtHQpklwJqKqL NjGeXdobO6MzndfYcjJVSY2OF9sA X-Google-Smtp-Source: ACJfBosDjxeuzI76d1HchaTlaFQ4MoKsouJ0Ykk90wOgIL+58LVyqFM2X+opcS64A5gsM6mmofUhTA== X-Received: by 10.223.131.132 with SMTP id 4mr8643886wre.217.1513790171531; Wed, 20 Dec 2017 09:16:11 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:46 +0100 Message-Id: <1513790098-9815-35-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 34/46] Remove legacy -no-kvm-pit option X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth It's only printing a warning since QEMU v1.3.0, so nobody should use this anymore today. Let's get rid of this now. Signed-off-by: Thomas Huth Message-Id: <1513619065-31722-1-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- qemu-doc.texi | 5 ----- qemu-options.hx | 3 --- vl.c | 4 ---- 3 files changed, 12 deletions(-) diff --git a/qemu-doc.texi b/qemu-doc.texi index 69e2953..90bea73 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -2612,11 +2612,6 @@ synonym for setting ``-global kvm-pit.lost_tick_poli= cy=3Ddiscard''. The ``-no-kvm-irqchip'' argument is now a synonym for setting ``-machine kernel_irqchip=3Doff''. =20 -@subsection -no-kvm-pit (since 1.3.0) - -The ``-no-kvm-pit'' argument is ignored. It is no longer -possible to disable the KVM PIT directly. - @subsection -no-kvm (since 1.3.0) =20 The ``-no-kvm'' argument is now a synonym for setting diff --git a/qemu-options.hx b/qemu-options.hx index b1e5781..94647e2 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -3927,9 +3927,6 @@ HXCOMM Deprecated by kvm-pit driver properties DEF("no-kvm-pit-reinjection", 0, QEMU_OPTION_no_kvm_pit_reinjection, "", QEMU_ARCH_I386) =20 -HXCOMM Deprecated (ignored) -DEF("no-kvm-pit", 0, QEMU_OPTION_no_kvm_pit, "", QEMU_ARCH_I386) - HXCOMM Deprecated by -machine kernel_irqchip=3Don|off property DEF("no-kvm-irqchip", 0, QEMU_OPTION_no_kvm_irqchip, "", QEMU_ARCH_I386) =20 diff --git a/vl.c b/vl.c index e9012bb..d3a5c5d 100644 --- a/vl.c +++ b/vl.c @@ -3817,10 +3817,6 @@ int main(int argc, char **argv, char **envp) olist =3D qemu_find_opts("machine"); qemu_opts_parse_noisily(olist, "accel=3Dtcg", false); break; - case QEMU_OPTION_no_kvm_pit: { - warn_report("ignoring deprecated option"); - break; - } case QEMU_OPTION_no_kvm_pit_reinjection: { static GlobalProperty kvm_pit_lost_tick_policy =3D { .driver =3D "kvm-pit", --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513792734061380.75852910319725; Wed, 20 Dec 2017 09:58:54 -0800 (PST) Received: from localhost ([::1]:60815 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRidc-0007IN-K5 for importer@patchew.org; Wed, 20 Dec 2017 12:58:40 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhya-0004s4-IQ for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyY-0007LY-DF for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:16 -0500 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:40525) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyY-0007LJ-5m for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:14 -0500 Received: by mail-wr0-x243.google.com with SMTP id q9so22926459wre.7 for ; Wed, 20 Dec 2017 09:16:14 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.16.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:16:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xcxBnR5t4WHSvd5BopuN5c2BlEQxowMdbqLGDrHBwNg=; b=XDUbRH+mPDsi9Led7xVSqMd7F5lvcxAVDGXwbrVJuQZN4H5FW0vP88qBX1pznFGbVE /H9Uq4fPEK9Wz8yHwHFAdtI7279Y2BK7IQhyhPJQ89LXdscKNV7D1CyLAxV+S3CM9RR9 3unoKNZHGYZaKcH4bKMXUNssVowyKhsrrUOABffXUr7g6+zLUJCTINl9b9sy5fHHnOrP 3MFlrp4sNRyFwc33S4k0FRyicSqE+CXxzkmFWzdAM3cS1d0+97aEH+UluMRmAJ8kICvI WUIbk1/93pkq76uEHo0oOwONYoUymBp0O8ibgvw5vMFmai2dmlqdG/IaU/opOfho5Ivi I3Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=xcxBnR5t4WHSvd5BopuN5c2BlEQxowMdbqLGDrHBwNg=; b=jGIdAByQ1yW0h6aBq9hpv/ep+MeLKsXx6e1CnPoZ7nKUBxV7PKoX6MaMfWaDyfqW/c EImX/a5ll9JFTC1Jm0MpC7Ed4miaJ0EiPp9IMUWQ6NIBex7+oHnF3DIzxom5sqpCvlgW qE2ra33o5tXu6poU7BB9OmqwRIQiYhmT6LYUmhB8U9PYwhTGMmOAQroDNwfW8ffg7Ctp uWTFh9qstnQwMsrsHYbfGLf9h59+dhoLnlZ6LmqhJNAPccvvaoP0C//vte8YESPt/8Se kW6FCxwATuN2aTpMcL5BFP6WDlB6HAgHyFmeJwW/GN9nyHxdnoid5MIv0E8N1FrB9GYm meUA== X-Gm-Message-State: AKGB3mJTmjs+Zh0lqpUq8oZAhVh5vWyMN5NLcSpaX3heEZ/Unme3xKEF OwBfow2MflmK2SrI2rnfNykMB+95 X-Google-Smtp-Source: ACJfBouF1jLDn9CTXMOe98RM7AWIsd8vBCYvaPkyqQYAFYmTpyIn+Rwq59yW3+VH9agSN8FssC0+lg== X-Received: by 10.223.139.3 with SMTP id n3mr1173184wra.44.1513790172784; Wed, 20 Dec 2017 09:16:12 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:47 +0100 Message-Id: <1513790098-9815-36-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::243 Subject: [Qemu-devel] [PULL 35/46] i8259: convert DPRINTFs into trace X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Peter Xu One thing to mention is that in pic_set_irq() I need to uncomment a few lines in the macros to make sure IRQ value calculation is correct. Signed-off-by: Peter Xu Message-Id: <20171210063819.14892-2-peterx@redhat.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Paolo Bonzini --- hw/intc/i8259.c | 26 +++++++++++--------------- hw/intc/trace-events | 7 +++++++ 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c index fe9ecd6..f12e0b2 100644 --- a/hw/intc/i8259.c +++ b/hw/intc/i8259.c @@ -30,17 +30,11 @@ #include "qemu/log.h" #include "hw/isa/i8259_internal.h" #include "hw/intc/intc.h" +#include "trace.h" =20 /* debug PIC */ //#define DEBUG_PIC =20 -#ifdef DEBUG_PIC -#define DPRINTF(fmt, ...) \ - do { printf("pic: " fmt , ## __VA_ARGS__); } while (0) -#else -#define DPRINTF(fmt, ...) -#endif - //#define DEBUG_IRQ_LATENCY //#define DEBUG_IRQ_COUNT =20 @@ -122,8 +116,7 @@ static void pic_update_irq(PICCommonState *s) =20 irq =3D pic_get_irq(s); if (irq >=3D 0) { - DPRINTF("pic%d: imr=3D%x irr=3D%x padd=3D%d\n", - s->master ? 0 : 1, s->imr, s->irr, s->priority_add); + trace_pic_update_irq(s->master, s->imr, s->irr, s->priority_add); qemu_irq_raise(s->int_out[0]); } else { qemu_irq_lower(s->int_out[0]); @@ -140,9 +133,11 @@ static void pic_set_irq(void *opaque, int irq, int lev= el) defined(DEBUG_IRQ_LATENCY) int irq_index =3D s->master ? irq : irq + 8; #endif + + trace_pic_set_irq(s->master, irq, level); + #if defined(DEBUG_PIC) || defined(DEBUG_IRQ_COUNT) if (level !=3D irq_level[irq_index]) { - DPRINTF("pic_set_irq: irq=3D%d level=3D%d\n", irq_index, level); irq_level[irq_index] =3D level; #ifdef DEBUG_IRQ_COUNT if (level =3D=3D 1) { @@ -223,18 +218,18 @@ int pic_read_irq(DeviceState *d) intno =3D s->irq_base + irq; } =20 -#if defined(DEBUG_PIC) || defined(DEBUG_IRQ_LATENCY) if (irq =3D=3D 2) { irq =3D irq2 + 8; } -#endif + #ifdef DEBUG_IRQ_LATENCY printf("IRQ%d latency=3D%0.3fus\n", irq, (double)(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) - irq_time[irq]) * 1000000.0 / NANOSECONDS_PER_SECOND); #endif - DPRINTF("pic_interrupt: irq=3D%d\n", irq); + + trace_pic_interrupt(irq, intno); return intno; } =20 @@ -289,7 +284,8 @@ static void pic_ioport_write(void *opaque, hwaddr addr6= 4, uint32_t val =3D val64; int priority, cmd, irq; =20 - DPRINTF("write: addr=3D0x%02x val=3D0x%02x\n", addr, val); + trace_pic_ioport_write(s->master, addr, val); + if (addr =3D=3D 0) { if (val & 0x10) { pic_init_reset(s); @@ -402,7 +398,7 @@ static uint64_t pic_ioport_read(void *opaque, hwaddr ad= dr, ret =3D s->imr; } } - DPRINTF("read: addr=3D0x%02" HWADDR_PRIx " val=3D0x%02x\n", addr, ret); + trace_pic_ioport_read(s->master, addr, ret); return ret; } =20 diff --git a/hw/intc/trace-events b/hw/intc/trace-events index 7077aaa..be76918 100644 --- a/hw/intc/trace-events +++ b/hw/intc/trace-events @@ -1,5 +1,12 @@ # See docs/devel/tracing.txt for syntax documentation. =20 +# hw/intc/i8259.c +pic_update_irq(bool master, uint8_t imr, uint8_t irr, uint8_t padd) "maste= r %d imr %"PRIu8" irr %"PRIu8" padd %"PRIu8 +pic_set_irq(bool master, int irq, int level) "master %d irq %d level %d" +pic_interrupt(int irq, int intno) "irq %d intno %d" +pic_ioport_write(bool master, uint64_t addr, uint64_t val) "master %d addr= 0x%"PRIx64" val 0x%"PRIx64 +pic_ioport_read(bool master, uint64_t addr, int val) "master %d addr 0x%"P= RIx64" val 0x%x" + # hw/intc/apic_common.c cpu_set_apic_base(uint64_t val) "0x%016"PRIx64 cpu_get_apic_base(uint64_t val) "0x%016"PRIx64 --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 151379257889429.685559105959214; Wed, 20 Dec 2017 09:56:18 -0800 (PST) Received: from localhost ([::1]:60802 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRib0-0004v1-Uw for importer@patchew.org; Wed, 20 Dec 2017 12:55:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56586) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhya-0004s2-G2 for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyZ-0007Ls-Gq for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:16 -0500 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:44484) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyZ-0007Lg-9d for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:15 -0500 Received: by mail-wm0-x241.google.com with SMTP id t8so11243600wmc.3 for ; Wed, 20 Dec 2017 09:16:15 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.16.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:16:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GHHhNZMzjbi0wJlxeV8JX+CEWFaBBmVpCb4Mx637cWk=; b=kc333bPD9tGYIHcXW5YX17d9nxwDgicd9G12PaUtX6cBUH+f5D049+20YCAJ2VhA8G dm/Px2OC6FhuFY7dz2I6rBuRUlrAuyfUlZUMUgtfU6HjeTo38/1WvPumsHQPaHAdW3ac jAjwVrUyPFK8hbzH01NTb84XOcfLuJ0AHP+hdlYnojnjTZBbY0hu7puZFvlNQeo7CQ1s eKtn8nG18kr0F2Q3LUMd3nLpx8oJCmKZEoD422HfgUayh3A5J+StcaJkRlQkOa9EIYIU 97jyQCXwMsQ0ngJRJLkeuJU0GVDWtA5OhpRj2LehtFm59aGcjpyg9QZRujOi4AzYbHgJ 99zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=GHHhNZMzjbi0wJlxeV8JX+CEWFaBBmVpCb4Mx637cWk=; b=lUYxDXx0TtuNXPDhu9zpkik/JZGY8LsoCqtvnjvxH1HMYEKTMxS8XM2GsABJZHOTQ4 bCIDkslVcorlF0M2CH1KjA3EJeFPOkVld+sbmULu4l1xBxLrmi1jEgMTQgDp4gdbi9ag An9wQ0AKK3TAtOACAttk6lhQsRriEhQdHKR2IYg4F/djd20DlDJEUeOy64FqpikqDX1C FkE6ip/3N8TOGx+mjI9D4J8Mm3QbAwsTlx2Hww20CH+woh9noDXqs7m+P5SqfLb4OebM yea3XP8XOoclIxYz6idc336ScL9Ttb/sICRSOeYb5PAUCtZC/qQueKVk5mVGdMjyaXBi OAaQ== X-Gm-Message-State: AKGB3mJClnsWjHXviayxVn+1z2O8gQnEfys5KCUh6Soeo1JEhlSuG5jM 6NtP5W85JAF8XwoS0br20ocC17Kg X-Google-Smtp-Source: ACJfBouodnttshoNYTdKFf07TwzuYSOZy9j4IGKrQ7tvpL0MPwD6cpyjoHX78SiCgaPzXYEEVcA/0Q== X-Received: by 10.28.102.6 with SMTP id a6mr6887717wmc.63.1513790174000; Wed, 20 Dec 2017 09:16:14 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:48 +0100 Message-Id: <1513790098-9815-37-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 36/46] i8259: use DEBUG_IRQ_COUNT always X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Peter Xu It's not really scary to even enable it forever. After all it's i8259, and it's even not the kernel one. Then we can remove quite a few of lines to make it cleaner. And "info irq" will always work for it. Signed-off-by: Peter Xu Message-Id: <20171210063819.14892-3-peterx@redhat.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Paolo Bonzini --- hw/intc/i8259.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c index f12e0b2..20c9d0a 100644 --- a/hw/intc/i8259.c +++ b/hw/intc/i8259.c @@ -36,7 +36,6 @@ //#define DEBUG_PIC =20 //#define DEBUG_IRQ_LATENCY -//#define DEBUG_IRQ_COUNT =20 #define TYPE_I8259 "isa-i8259" #define PIC_CLASS(class) OBJECT_CLASS_CHECK(PICClass, (class), TYPE_I8259) @@ -52,12 +51,8 @@ typedef struct PICClass { DeviceRealize parent_realize; } PICClass; =20 -#if defined(DEBUG_PIC) || defined(DEBUG_IRQ_COUNT) static int irq_level[16]; -#endif -#ifdef DEBUG_IRQ_COUNT static uint64_t irq_count[16]; -#endif #ifdef DEBUG_IRQ_LATENCY static int64_t irq_time[16]; #endif @@ -128,24 +123,17 @@ static void pic_set_irq(void *opaque, int irq, int le= vel) { PICCommonState *s =3D opaque; int mask =3D 1 << irq; - -#if defined(DEBUG_PIC) || defined(DEBUG_IRQ_COUNT) || \ - defined(DEBUG_IRQ_LATENCY) int irq_index =3D s->master ? irq : irq + 8; -#endif =20 trace_pic_set_irq(s->master, irq, level); =20 -#if defined(DEBUG_PIC) || defined(DEBUG_IRQ_COUNT) if (level !=3D irq_level[irq_index]) { irq_level[irq_index] =3D level; -#ifdef DEBUG_IRQ_COUNT if (level =3D=3D 1) { irq_count[irq_index]++; } -#endif } -#endif + #ifdef DEBUG_IRQ_LATENCY if (level) { irq_time[irq_index] =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); @@ -253,12 +241,8 @@ static bool pic_get_statistics(InterruptStatsProvider = *obj, PICCommonState *s =3D PIC_COMMON(obj); =20 if (s->master) { -#ifdef DEBUG_IRQ_COUNT *irq_counts =3D irq_count; *nb_irqs =3D ARRAY_SIZE(irq_count); -#else - return false; -#endif } else { *irq_counts =3D NULL; *nb_irqs =3D 0; --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513791770541347.5917902985939; Wed, 20 Dec 2017 09:42:50 -0800 (PST) Received: from localhost ([::1]:60603 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRiOE-0002AI-7f for importer@patchew.org; Wed, 20 Dec 2017 12:42:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56609) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhyb-0004tQ-Nc for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhya-0007MK-LI for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:17 -0500 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:33599) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhya-0007Lw-C2 for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:16 -0500 Received: by mail-wr0-x242.google.com with SMTP id v21so12207285wrc.0 for ; Wed, 20 Dec 2017 09:16:16 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.16.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:16:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=2ueVkr8ziMa0J22/4fyoMQZsBnGsZxhZ/mofjwRJ2Dw=; b=VF0TcRA4/zJ6J5T1FVKlPw0fHoW75lK0OI46H4U17StiJgMJW9KELd0nOhrgV9gwV/ BKyk3rKAFIFqqaW3AJQrSefs/J5GLQZunAeJ42gyMRhGLEwMar+q+cN/rk673bcxJnns DuOF8ZDqQJ3cyVUZJdnO4Dbs9ZrTtrSKz41UbnvY3Po7alveZBY7zaXK2e2VaCXEBHr7 ABv2NqtRCo+6w+3WPdlm06bIEd0khwcfsvIRJsQQ8z1BrXdxMqkZhl8pM35JAPnTErSe RM8twx/WJHnR77HLcCrZHDzuDlfHB6zkSrKCS6anAWOnxuHckMqeggXWEeQMPOB8vB8e F5qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=2ueVkr8ziMa0J22/4fyoMQZsBnGsZxhZ/mofjwRJ2Dw=; b=Z0mjmW2DwOUklJV3+BpA7ZoJvXWmHFTGwg3Yc47L/MfbWUNtRMno2sBGKXkHGFsbX8 hnbEnPCOz+LX1HfHvtaAHKiumNM7w7zgEq1fZtghizsCTbKcP5yPIoG0M1T9GLges1g6 He7on3D4dlLIOnYwYKbuo+jkL84hTsrP9tU9T+GUoQrdE6GsukqhtIXC97F1Ql8Qd0+g Hw1O1A1s+F93HF+wS3yoOPSmjSoUhtYLfZca5O71eRr4c8x0YAmOLkEmjimI0KerERkR gZfv/3ZRvDD6VMYfR0Ngl/klChguNgkEgIPv4dSdKim/Hk3/5RrsCJnmm4gw6kXiaaQ3 7twA== X-Gm-Message-State: AKGB3mK7eoggTEa5e+bCNjP75o4wz3LeFU655GPx1Sao9H5xynn2e4mK zxRJsBMnRMQIKa3w3H6X6dGGvbgY X-Google-Smtp-Source: ACJfBotMUG+6A32BiW8minANzMCJ/VdE4jLagW/Xm4N4Ua4c9MMsrFV1zTyQiZAg7YuBMjoIQ6hApw== X-Received: by 10.223.172.120 with SMTP id v111mr9381860wrc.195.1513790175070; Wed, 20 Dec 2017 09:16:15 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:49 +0100 Message-Id: <1513790098-9815-38-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 37/46] i8259: generalize statistics into common code X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Peter Xu It was only for userspace i8259. Move it to general code so that kvm-i8259 can also use it in the future. Signed-off-by: Peter Xu Message-Id: <20171210063819.14892-4-peterx@redhat.com> Signed-off-by: Paolo Bonzini --- hw/intc/i8259.c | 37 +------------------------------------ hw/intc/i8259_common.c | 41 +++++++++++++++++++++++++++++++++++++= ++++ include/hw/isa/i8259_internal.h | 7 +++++-- 3 files changed, 47 insertions(+), 38 deletions(-) diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c index 20c9d0a..d9b9666 100644 --- a/hw/intc/i8259.c +++ b/hw/intc/i8259.c @@ -25,11 +25,9 @@ #include "hw/hw.h" #include "hw/i386/pc.h" #include "hw/isa/isa.h" -#include "monitor/monitor.h" #include "qemu/timer.h" #include "qemu/log.h" #include "hw/isa/i8259_internal.h" -#include "hw/intc/intc.h" #include "trace.h" =20 /* debug PIC */ @@ -51,8 +49,6 @@ typedef struct PICClass { DeviceRealize parent_realize; } PICClass; =20 -static int irq_level[16]; -static uint64_t irq_count[16]; #ifdef DEBUG_IRQ_LATENCY static int64_t irq_time[16]; #endif @@ -126,13 +122,7 @@ static void pic_set_irq(void *opaque, int irq, int lev= el) int irq_index =3D s->master ? irq : irq + 8; =20 trace_pic_set_irq(s->master, irq, level); - - if (level !=3D irq_level[irq_index]) { - irq_level[irq_index] =3D level; - if (level =3D=3D 1) { - irq_count[irq_index]++; - } - } + pic_stat_update_irq(irq_index, level); =20 #ifdef DEBUG_IRQ_LATENCY if (level) { @@ -235,31 +225,6 @@ static void pic_reset(DeviceState *dev) pic_init_reset(s); } =20 -static bool pic_get_statistics(InterruptStatsProvider *obj, - uint64_t **irq_counts, unsigned int *nb_irq= s) -{ - PICCommonState *s =3D PIC_COMMON(obj); - - if (s->master) { - *irq_counts =3D irq_count; - *nb_irqs =3D ARRAY_SIZE(irq_count); - } else { - *irq_counts =3D NULL; - *nb_irqs =3D 0; - } - return true; -} - -static void pic_print_info(InterruptStatsProvider *obj, Monitor *mon) -{ - PICCommonState *s =3D PIC_COMMON(obj); - monitor_printf(mon, "pic%d: irr=3D%02x imr=3D%02x isr=3D%02x hprio=3D%= d " - "irq_base=3D%02x rr_sel=3D%d elcr=3D%02x fnm=3D%d\n", - s->master ? 0 : 1, s->irr, s->imr, s->isr, s->priority_= add, - s->irq_base, s->read_reg_select, s->elcr, - s->special_fully_nested_mode); -} - static void pic_ioport_write(void *opaque, hwaddr addr64, uint64_t val64, unsigned size) { diff --git a/hw/intc/i8259_common.c b/hw/intc/i8259_common.c index 18427b4..a3cadde 100644 --- a/hw/intc/i8259_common.c +++ b/hw/intc/i8259_common.c @@ -25,6 +25,10 @@ #include "qemu/osdep.h" #include "hw/i386/pc.h" #include "hw/isa/i8259_internal.h" +#include "monitor/monitor.h" + +static int irq_level[16]; +static uint64_t irq_count[16]; =20 void pic_reset_common(PICCommonState *s) { @@ -98,6 +102,43 @@ ISADevice *i8259_init_chip(const char *name, ISABus *bu= s, bool master) return isadev; } =20 +void pic_stat_update_irq(int irq, int level) +{ + if (level !=3D irq_level[irq]) { + irq_level[irq] =3D level; + if (level =3D=3D 1) { + irq_count[irq]++; + } + } +} + +bool pic_get_statistics(InterruptStatsProvider *obj, + uint64_t **irq_counts, unsigned int *nb_irqs) +{ + PICCommonState *s =3D PIC_COMMON(obj); + + if (s->master) { + *irq_counts =3D irq_count; + *nb_irqs =3D ARRAY_SIZE(irq_count); + } else { + *irq_counts =3D NULL; + *nb_irqs =3D 0; + } + + return true; +} + +void pic_print_info(InterruptStatsProvider *obj, Monitor *mon) +{ + PICCommonState *s =3D PIC_COMMON(obj); + + monitor_printf(mon, "pic%d: irr=3D%02x imr=3D%02x isr=3D%02x hprio=3D%= d " + "irq_base=3D%02x rr_sel=3D%d elcr=3D%02x fnm=3D%d\n", + s->master ? 0 : 1, s->irr, s->imr, s->isr, s->priority_= add, + s->irq_base, s->read_reg_select, s->elcr, + s->special_fully_nested_mode); +} + static const VMStateDescription vmstate_pic_common =3D { .name =3D "i8259", .version_id =3D 1, diff --git a/include/hw/isa/i8259_internal.h b/include/hw/isa/i8259_interna= l.h index 6954b6e..f742c2a 100644 --- a/include/hw/isa/i8259_internal.h +++ b/include/hw/isa/i8259_internal.h @@ -28,6 +28,7 @@ #include "hw/hw.h" #include "hw/i386/pc.h" #include "hw/isa/isa.h" +#include "hw/intc/intc.h" =20 typedef struct PICCommonState PICCommonState; =20 @@ -76,8 +77,10 @@ struct PICCommonState { }; =20 void pic_reset_common(PICCommonState *s); - ISADevice *i8259_init_chip(const char *name, ISABus *bus, bool master); - +void pic_stat_update_irq(int irq, int level); +bool pic_get_statistics(InterruptStatsProvider *obj, + uint64_t **irq_counts, unsigned int *nb_irqs); +void pic_print_info(InterruptStatsProvider *obj, Monitor *mon); =20 #endif /* QEMU_I8259_INTERNAL_H */ --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513792145072375.832016924967; Wed, 20 Dec 2017 09:49:05 -0800 (PST) Received: from localhost ([::1]:60737 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRiUE-0007Ou-1P for importer@patchew.org; Wed, 20 Dec 2017 12:48:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhyc-0004uD-KH for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyb-0007Me-Io for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:18 -0500 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:34234) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyb-0007MO-CK for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:17 -0500 Received: by mail-wr0-x244.google.com with SMTP id y21so22927336wrc.1 for ; Wed, 20 Dec 2017 09:16:17 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.16.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:16:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8HwL3i+aQoZiJvQ3LkweWqHY2ob7g9q13GN4w7JKKzU=; b=ihfPxK5AHgNkjmU2RId5FHnJr6i0K1mBBwC+ufJl9p/N4GUrBHKeZkQu+RDz1eRFOJ uybc2uxJC8i/P3yxrE9qrA3VoW6JVUMo4+1drEw+tkb46qlod4tHX3uBnE+w7cVcBfrg ONjsMhIGXXzju/MFABpTzqemfxVAABFwsvrukGy8i0v0s4tE/vMtJoOcrS+nyC29lCNj XMlePc7/BRYs37OVYLmkTPisO0RYoVwFTMVkmv+DLCtNHJhQG38iz0PbnWk2fjsf8zDU cm07ifbSG3QCrSV9F+zHgGXwT0dudFNCDv9MVNSD8bl0nAZQWykzRGtGRkRBr3YUaIMx 3UOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=8HwL3i+aQoZiJvQ3LkweWqHY2ob7g9q13GN4w7JKKzU=; b=GNDrOoPDr1XxQlSB+4UF57KEWCaNMMKeWwPj+TGyT67lisylK+kici+aJhsdP2FBqw M8L+DztVdHYKdkkgPTQUwCcAga+W5jSCeNJpXjPkudakqFEKv9ohZS2s/I2miZjeYANB XcJF8pZiFtuUWbbFRVHOIPshkYgE2lLay6vNTpWXsYeReO08P0+ziXs6ZUHip693JUEz rrdTXADI/j++tUnJBXjsOyCO5jDmPWmDVS5d4BMExTt/Z3yqWjgFIR5F3IpU+5AtzaJN 2fry6YE1CwWFoMk3Pcd72mfYQ3RQjJW4yw56zGHekTJlbtUuZkH8OqdgNen9lOmm519C Wszg== X-Gm-Message-State: AKGB3mKWxU4U8nUsZeYPF13SVaWsDUilk5gsF1+vbT/sdYYwXPPCvSHn InlaRnZ63Sqoh1+vKjMHb1M8ChdJ X-Google-Smtp-Source: ACJfBov+i/w43qVOWJ5dx8y4WAZrzbX9LogtaABBcsAb1mjjgBeSa8kUoSvV3OiurRk+3ghbL05Qkg== X-Received: by 10.223.196.243 with SMTP id o48mr9059999wrf.246.1513790176070; Wed, 20 Dec 2017 09:16:16 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:50 +0100 Message-Id: <1513790098-9815-39-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::244 Subject: [Qemu-devel] [PULL 38/46] kvm-i8259: support "info pic" and "info irq" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Peter Xu Let's leverage the i8259 common code for kvm-i8259 too. I think it's still possible that stats can lost when i8259 is in kernel and meanwhile when irqfd is used, e.g., by vfio or vhost devices. However that should be rare IMHO since they should be using MSIs mostly if they really want performance (that's why people use vhost and device assignment), and no old INTx should be used. As long as the INTx users are emulated in QEMU the stats will be correct. For "info pic", it should be always accurate since we fetch kvm regs before dump. More importantly, it's just too simple to do this now - it's only 10+ LOC to gain this feature. Signed-off-by: Peter Xu Message-Id: <20171210063819.14892-5-peterx@redhat.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Paolo Bonzini --- hw/i386/kvm/i8259.c | 8 ++++++++ hw/intc/i8259_common.c | 1 + 2 files changed, 9 insertions(+) diff --git a/hw/i386/kvm/i8259.c b/hw/i386/kvm/i8259.c index 11d1b72..57abe09 100644 --- a/hw/i386/kvm/i8259.c +++ b/hw/i386/kvm/i8259.c @@ -111,6 +111,7 @@ static void kvm_pic_set_irq(void *opaque, int irq, int = level) { int delivered; =20 + pic_stat_update_irq(irq, level); delivered =3D kvm_set_irq(kvm_state, irq, level); apic_report_irq_delivered(delivered); } @@ -139,12 +140,15 @@ static void kvm_i8259_class_init(ObjectClass *klass, = void *data) KVMPICClass *kpc =3D KVM_PIC_CLASS(klass); PICCommonClass *k =3D PIC_COMMON_CLASS(klass); DeviceClass *dc =3D DEVICE_CLASS(klass); + InterruptStatsProviderClass *ic =3D INTERRUPT_STATS_PROVIDER_CLASS(kla= ss); =20 dc->reset =3D kvm_pic_reset; kpc->parent_realize =3D dc->realize; dc->realize =3D kvm_pic_realize; k->pre_save =3D kvm_pic_get; k->post_load =3D kvm_pic_put; + ic->get_statistics =3D pic_get_statistics; + ic->print_info =3D pic_print_info; } =20 static const TypeInfo kvm_i8259_info =3D { @@ -153,6 +157,10 @@ static const TypeInfo kvm_i8259_info =3D { .instance_size =3D sizeof(PICCommonState), .class_init =3D kvm_i8259_class_init, .class_size =3D sizeof(KVMPICClass), + .interfaces =3D (InterfaceInfo[]) { + { TYPE_INTERRUPT_STATS_PROVIDER }, + { } + }, }; =20 static void kvm_pic_register_types(void) diff --git a/hw/intc/i8259_common.c b/hw/intc/i8259_common.c index a3cadde..7efd2e8 100644 --- a/hw/intc/i8259_common.c +++ b/hw/intc/i8259_common.c @@ -132,6 +132,7 @@ void pic_print_info(InterruptStatsProvider *obj, Monito= r *mon) { PICCommonState *s =3D PIC_COMMON(obj); =20 + pic_dispatch_pre_save(s); monitor_printf(mon, "pic%d: irr=3D%02x imr=3D%02x isr=3D%02x hprio=3D%= d " "irq_base=3D%02x rr_sel=3D%d elcr=3D%02x fnm=3D%d\n", s->master ? 0 : 1, s->irr, s->imr, s->isr, s->priority_= add, --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513792959585686.9921553913932; Wed, 20 Dec 2017 10:02:39 -0800 (PST) Received: from localhost ([::1]:60950 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRihQ-0002LT-Hi for importer@patchew.org; Wed, 20 Dec 2017 13:02:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56641) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhye-0004vh-2X for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyd-0007NM-2U for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:20 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:44485) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyc-0007Mu-QE for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:18 -0500 Received: by mail-wm0-x242.google.com with SMTP id t8so11244009wmc.3 for ; Wed, 20 Dec 2017 09:16:18 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.16.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:16:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vDf1QhuXXpJWzoEX9BFR92wec5y3d+xkbXbXzZzAJKY=; b=EVOwKvAb52LNhUj0r664DwSfpOmIEdjsCiPqlf/5Q5472Y3xBCo+rkR+XrmbHJAn0u fFpYi7l5JyFXYm4yUE8zuTLqGGg+CGldOVeA8r/C3QXjcTcj01GzpaPYCV+4+BQ8V1iE oCZ/DzmC1mdQucHf7wQjb182uJjpLUg3ntE0zOiU376TdoRScFLhKFYXNtJxc1lbQIjN Ar+TXQnQs926CwW4MrnYCrjFvPN1BAXWchYjuLDWP1xJWMVlkEra69tmXnIveh9F3+h9 kNvFmDZO52Vfn1Uilwa1m8LU0LhwO0SoZ+IWQxRGOxt+4dQb8torXUuUgCLT63NIr5Wm 1yBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=vDf1QhuXXpJWzoEX9BFR92wec5y3d+xkbXbXzZzAJKY=; b=k+tpbcSrneB/OmF5ow0sTEBthN9yNoCaMxPz4ytniyQgSvpA0v7AwMhs+yrMMjqP2U xJSXuaGj/D6j0VSFf2f3yQjY147S7knC8YaI9BY7tgpPgM4Dwtdd78ICx2X6kdLeacud bBIrmcRFji4v5saBMi07iaEEKQ44Fhh4fJSMsKPhq9FTT+JR//dr8HYKsIAZyQeZm+jS g555IM+lVr4lgUsytVoLekCXjRIQrfGmaW7mxw031/+FoMwmMsd1/Jds5qAlXAcFOkrG iTm2WeoXYSTYheAPh0LmOy7eSZ9aDjmCA+chajKo/wdzpGuxa3b+R4r5sHsX/F0FTvzv 0E5Q== X-Gm-Message-State: AKGB3mIlbqp3kkOu0Z8qCPVAMvQ3z6rSkrE2Ha++2jZfRngp7BTkjo04 qUHEkANAIHacnurke0WdC8kIG7iZ X-Google-Smtp-Source: ACJfBouVC/lvuoof9ckZrSi6NS8lGKiSiejDNYem3dY7nCf8WdJYculGLsAnX8FaymMNyl1zrfz+tA== X-Received: by 10.28.29.130 with SMTP id d124mr7753577wmd.73.1513790177291; Wed, 20 Dec 2017 09:16:17 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:51 +0100 Message-Id: <1513790098-9815-40-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 39/46] i8259: move TYPE_INTERRUPT_STATS_PROVIDER upper X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Xu Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Peter Xu Now both classes (i8259, i8259-kvm) support this. Move this upper to the common class code. Signed-off-by: Peter Xu Message-Id: <20171210063819.14892-6-peterx@redhat.com> Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Paolo Bonzini --- hw/i386/kvm/i8259.c | 7 ------- hw/intc/i8259.c | 7 ------- hw/intc/i8259_common.c | 7 +++++++ 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/hw/i386/kvm/i8259.c b/hw/i386/kvm/i8259.c index 57abe09..b91e980 100644 --- a/hw/i386/kvm/i8259.c +++ b/hw/i386/kvm/i8259.c @@ -140,15 +140,12 @@ static void kvm_i8259_class_init(ObjectClass *klass, = void *data) KVMPICClass *kpc =3D KVM_PIC_CLASS(klass); PICCommonClass *k =3D PIC_COMMON_CLASS(klass); DeviceClass *dc =3D DEVICE_CLASS(klass); - InterruptStatsProviderClass *ic =3D INTERRUPT_STATS_PROVIDER_CLASS(kla= ss); =20 dc->reset =3D kvm_pic_reset; kpc->parent_realize =3D dc->realize; dc->realize =3D kvm_pic_realize; k->pre_save =3D kvm_pic_get; k->post_load =3D kvm_pic_put; - ic->get_statistics =3D pic_get_statistics; - ic->print_info =3D pic_print_info; } =20 static const TypeInfo kvm_i8259_info =3D { @@ -157,10 +154,6 @@ static const TypeInfo kvm_i8259_info =3D { .instance_size =3D sizeof(PICCommonState), .class_init =3D kvm_i8259_class_init, .class_size =3D sizeof(KVMPICClass), - .interfaces =3D (InterfaceInfo[]) { - { TYPE_INTERRUPT_STATS_PROVIDER }, - { } - }, }; =20 static void kvm_pic_register_types(void) diff --git a/hw/intc/i8259.c b/hw/intc/i8259.c index d9b9666..1602255 100644 --- a/hw/intc/i8259.c +++ b/hw/intc/i8259.c @@ -442,13 +442,10 @@ static void i8259_class_init(ObjectClass *klass, void= *data) { PICClass *k =3D PIC_CLASS(klass); DeviceClass *dc =3D DEVICE_CLASS(klass); - InterruptStatsProviderClass *ic =3D INTERRUPT_STATS_PROVIDER_CLASS(kla= ss); =20 k->parent_realize =3D dc->realize; dc->realize =3D pic_realize; dc->reset =3D pic_reset; - ic->get_statistics =3D pic_get_statistics; - ic->print_info =3D pic_print_info; } =20 static const TypeInfo i8259_info =3D { @@ -457,10 +454,6 @@ static const TypeInfo i8259_info =3D { .parent =3D TYPE_PIC_COMMON, .class_init =3D i8259_class_init, .class_size =3D sizeof(PICClass), - .interfaces =3D (InterfaceInfo[]) { - { TYPE_INTERRUPT_STATS_PROVIDER }, - { } - }, }; =20 static void pic_register_types(void) diff --git a/hw/intc/i8259_common.c b/hw/intc/i8259_common.c index 7efd2e8..c75c880 100644 --- a/hw/intc/i8259_common.c +++ b/hw/intc/i8259_common.c @@ -178,6 +178,7 @@ static Property pic_properties_common[] =3D { static void pic_common_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); + InterruptStatsProviderClass *ic =3D INTERRUPT_STATS_PROVIDER_CLASS(kla= ss); =20 dc->vmsd =3D &vmstate_pic_common; dc->props =3D pic_properties_common; @@ -189,6 +190,8 @@ static void pic_common_class_init(ObjectClass *klass, v= oid *data) * code. */ dc->user_creatable =3D false; + ic->get_statistics =3D pic_get_statistics; + ic->print_info =3D pic_print_info; } =20 static const TypeInfo pic_common_type =3D { @@ -198,6 +201,10 @@ static const TypeInfo pic_common_type =3D { .class_size =3D sizeof(PICCommonClass), .class_init =3D pic_common_class_init, .abstract =3D true, + .interfaces =3D (InterfaceInfo[]) { + { TYPE_INTERRUPT_STATS_PROVIDER }, + { } + }, }; =20 static void pic_common_register_types(void) --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513791524179715.9165579206991; Wed, 20 Dec 2017 09:38:44 -0800 (PST) Received: from localhost ([::1]:60503 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRiK2-0006ra-VQ for importer@patchew.org; Wed, 20 Dec 2017 12:38:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56655) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhye-0004wW-Uu for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhye-0007Nn-0N for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:20 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:41770) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyd-0007NS-Oy for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:19 -0500 Received: by mail-wm0-x242.google.com with SMTP id g75so11359434wme.0 for ; Wed, 20 Dec 2017 09:16:19 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.16.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:16:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aFdL1TzJVew9BReY5PGjblOK0Vqr7SjxVR9xzjDH1mc=; b=LPD/MPCgR2HbF+/tyCSwtCJDeez9rywbbn9ZMbWbPWmM+XhNjDHGAUIxGoATH3ltkU VbbMezBE/ycjzgQDxazSiuvjSXYiyRGoQ9fpHe1WC3k1VATI6jVtWy9xPA3aWm4jNkny yzU6whAXLcW4P3p2KLkr8wYTQU4S59xKjjeDOz9qY/K77AWQjxEAzywr+rcotmV5xZXS nol6q/bk/hwP5wxh6Zlu7Dz4+IHRkAIxJbqqqTrOolifozm0AaKpvpQRVaRhVWnWdDJd WlyyzU65aY8c0PdbabdSVQxh2KqGy6DZHIJSYQmWiMX8F1zw60j8f3jyixfmRK4phw0X BLEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=aFdL1TzJVew9BReY5PGjblOK0Vqr7SjxVR9xzjDH1mc=; b=Pb1mjZFdo+1jm10K2GTuFzSD+ZPGDfIBsLpWwXUUXt+McJNFG76A3eScbRRvvq3aHx okPnjYPkmk7kx1PCPFvNAu64pUpK/1+x3m3oZNImRuDKEQP84bEHanG3NeejnnxYy1Qg 8vXHYugIOXaF4B5SsxLCbaSQiiMdxsFX2V+6dwcPzXnp2RHQXmsQc2A2XpVRGyC6eTaS g/taXfmOw+CcasYK/7YAnM7ipCqv8j/U7sU0tpIXyLQP/CQvjr7U96eko+0SGgUhHctg t2hw5Wvp9fpUDJbnKESiU3L6jMN35bOvE4Acq3IL+2BzfIYzkN9Fp7obp1UMDguNMiag bORA== X-Gm-Message-State: AKGB3mI5vKHLRRJdNJ8sdWnHzsysYv49M7MIYJrQIbyoGLYRvjlZhd+c /sOYL79H6P5aJjv+7cGDo1YfdK0F X-Google-Smtp-Source: ACJfBosrUhATAX3S40+EYReOHISzGC99PHLnb+s4fPeEcrYRis3udFPe0J3D7DVlyAGV1wAvg0RXpQ== X-Received: by 10.28.30.213 with SMTP id e204mr6969505wme.40.1513790178521; Wed, 20 Dec 2017 09:16:18 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:52 +0100 Message-Id: <1513790098-9815-41-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 40/46] checkpatch: volatile with a comment or sig_atomic_t is okay X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Marc-Andr=C3=A9 Lureau This assumes that the comment gives some justification; "volatile sig_atomic_t" is also self-explanatory and usually correct. Discussed in: '[Qemu-devel] [PATCH] dump-guest-memory.py: fix "You can't do that without = a process to debug"' Suggested-by: Fam Zheng Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20171215181810.4122-1-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- scripts/checkpatch.pl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 34df753..3dc27d9 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2475,8 +2475,11 @@ sub process { =20 # no volatiles please my $asm_volatile =3D qr{\b(__asm__|asm)\s+(__volatile__|volatile)\b}; - if ($line =3D~ /\bvolatile\b/ && $line !~ /$asm_volatile/) { - ERROR("Use of volatile is usually wrong: see Documentation/volatile-con= sidered-harmful.txt\n" . $herecurr); + if ($line =3D~ /\bvolatile\b/ && $line !~ /$asm_volatile/ && + $line !~ /sig_atomic_t/ && + !ctx_has_comment($first_line, $linenr)) { + my $msg =3D "Use of volatile is usually wrong, please add a comment\n" = . $herecurr; + ERROR($msg); } =20 # warn about #if 0 --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 151379169457941.76374688914075; Wed, 20 Dec 2017 09:41:34 -0800 (PST) Received: from localhost ([::1]:60566 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRiMr-0000zg-9Z for importer@patchew.org; Wed, 20 Dec 2017 12:41:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhyi-0004zy-OH for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyf-0007OT-Hq for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:24 -0500 Received: from mail-wr0-x229.google.com ([2a00:1450:400c:c0c::229]:37040) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyf-0007O3-8j for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:21 -0500 Received: by mail-wr0-x229.google.com with SMTP id f8so12143066wre.4 for ; Wed, 20 Dec 2017 09:16:21 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.16.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:16:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=8grRNcrW/ABQrc8p/l2B6IV0geJYseNbccAPYM+kZo4=; b=B+YNhjp6q6cMwMPftzRYvd3qnYq9oJJlctQwrtrLAZqYE4B5SKx/s7nxi6K1/ffn8H +EWylhHv7Yk5QlCeSmrPYb7OcrMlO6Fb7N4P3GMKpeQlKbrBfxiQcIY2TtcPRJe7Itlu zJLYh0n/J2A//SazcOR3LObgxtVxG7dCJVgHIHjskvTGHkJF0s1eHX1xzOKWO+EBeIui eklh84p/EjPUXGKg2NgJAwKDxKSD6ktgoGQDT2kuVEpp43HaWpqclrbukIEfmllppCUr geljj/dTfnDYnoC7GbHF9XjtLbpQ7i/S/YE9RThjkKbmDTwCWSzoBYyz82wAbpjRgqpk z2fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=8grRNcrW/ABQrc8p/l2B6IV0geJYseNbccAPYM+kZo4=; b=Tf6wdkkf+A3yjaSTRyByay0OsXfsqem2B7ZnwdTtLOGcEV/JSl2Vwc4ns2qrdapRsH 02LOy7Pv3RiOZ9iPaH7jPUsrwBOR11ZZgX1tPqL/7UCnEaaGtcyeXEL2b4tdzgm4YccZ xvPjSlJXLYh4ZOeNTD0yehjfXjOAsJr4C2CeyXYZ7DZkX9Ytg6aLzPozCj9lsf5gbr61 1PDWGxgnci+nmORd2egnG0bmql2PL3i7aT3UFZVIJXnvmHbt19DDKe9tessehoV1EwPR NioBq2mKlF1kA2IUNr4dTxonoPqzDtyaeenJEYAYM4LkSCXtYGc7dmvfDWRSP2bAxzQs WcGQ== X-Gm-Message-State: AKGB3mKWgD3pJtG2/qMH4zb3NrJAnmncIPWCbuWRuReQRZErBDj4XoOZ 3g87MuyhN5/CRNYmUk7ljA1CvW+s X-Google-Smtp-Source: ACJfBouGrMwsZ3CABSDIdOcB3uUBMxoYf+XCH/upR5jS1Jh4UP4/iWbOdm7vhWYHqiB/J2hR0YlFRA== X-Received: by 10.223.184.171 with SMTP id i40mr9255565wrf.124.1513790179869; Wed, 20 Dec 2017 09:16:19 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:53 +0100 Message-Id: <1513790098-9815-42-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::229 Subject: [Qemu-devel] [PULL 41/46] rcu: reduce more than 7MB heap memory by malloc_trim() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yang Zhong Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Yang Zhong Since there are some issues in memory alloc/free machenism in glibc for little chunk memory, if Qemu frequently alloc/free little chunk memory, the glibc doesn't alloc little chunk memory from free list of glibc and still allocate from OS, which make the heap size bigger and bigger. This patch introduce malloc_trim(), which will free heap memory when there is no rcu call during rcu thread loop. malloc_trim() can be enabled/disabled by --enable-malloc-trim/ --disable-malloc-trim in the Qemu configure command. The default malloc_trim() is enabled for libc. Below are test results from smaps file. (1)without patch 55f0783e1000-55f07992a000 rw-p 00000000 00:00 0 [heap] Size: 21796 kB Rss: 14260 kB Pss: 14260 kB (2)with patch 55cc5fadf000-55cc61008000 rw-p 00000000 00:00 0 [heap] Size: 21668 kB Rss: 6940 kB Pss: 6940 kB Signed-off-by: Yang Zhong Message-Id: <1513775806-19779-1-git-send-email-yang.zhong@intel.com> Signed-off-by: Paolo Bonzini --- configure | 35 +++++++++++++++++++++++++++++++++++ util/rcu.c | 6 ++++++ 2 files changed, 41 insertions(+) diff --git a/configure b/configure index 99ccc17..100309c 100755 --- a/configure +++ b/configure @@ -426,6 +426,7 @@ vxhs=3D"" supported_cpu=3D"no" supported_os=3D"no" bogus_os=3D"no" +malloc_trim=3D"" =20 # parse CC options first for opt do @@ -1047,6 +1048,10 @@ for opt do ;; --enable-tcg) tcg=3D"yes" ;; + --disable-malloc-trim) malloc_trim=3D"no" + ;; + --enable-malloc-trim) malloc_trim=3D"yes" + ;; --disable-spice) spice=3D"no" ;; --enable-spice) spice=3D"yes" @@ -1466,6 +1471,7 @@ Advanced options (experts only): Default:trace- --disable-slirp disable SLIRP userspace network connectivity --enable-tcg-interpreter enable TCG with bytecode interpreter (TCI) + --enable-malloc-trim enable libc malloc_trim() for memory optimizati= on --oss-lib path to OSS library --cpu=3DCPU Build for host CPU [$cpu] --with-coroutine=3DBACKEND coroutine backend. Supported options: @@ -3860,6 +3866,30 @@ if test "$tcmalloc" =3D "yes" && test "$jemalloc" = =3D "yes" ; then exit 1 fi =20 +# Even if malloc_trim() is available, these non-libc memory allocators +# do not support it. +if test "$tcmalloc" =3D "yes" || test "$jemalloc" =3D "yes" ; then + if test "$malloc_trim" =3D "yes" ; then + echo "Disabling malloc_trim with non-libc memory allocator" + fi + malloc_trim=3D"no" +fi + +####################################### +# malloc_trim + +if test "$malloc_trim" !=3D "no" ; then + cat > $TMPC << EOF +#include +int main(void) { malloc_trim(0); return 0; } +EOF + if compile_prog "" "" ; then + malloc_trim=3D"yes" + else + malloc_trim=3D"no" + fi +fi + ########################################## # tcmalloc probe =20 @@ -5505,6 +5535,7 @@ if test "$tcg" =3D "yes" ; then echo "TCG debug enabled $debug_tcg" echo "TCG interpreter $tcg_interpreter" fi +echo "malloc trim support $malloc_trim" echo "RDMA support $rdma" echo "fdt support $fdt" echo "preadv support $preadv" @@ -6015,6 +6046,10 @@ if test "$opengl" =3D "yes" ; then fi fi =20 +if test "$malloc_trim" =3D "yes" ; then + echo "CONFIG_MALLOC_TRIM=3Dy" >> $config_host_mak +fi + if test "$avx2_opt" =3D "yes" ; then echo "CONFIG_AVX2_OPT=3Dy" >> $config_host_mak fi diff --git a/util/rcu.c b/util/rcu.c index ca5a63e..f4d09c8 100644 --- a/util/rcu.c +++ b/util/rcu.c @@ -32,6 +32,9 @@ #include "qemu/atomic.h" #include "qemu/thread.h" #include "qemu/main-loop.h" +#if defined(CONFIG_MALLOC_TRIM) +#include +#endif =20 /* * Global grace period counter. Bit 0 is always one in rcu_gp_ctr. @@ -246,6 +249,9 @@ static void *call_rcu_thread(void *opaque) qemu_event_reset(&rcu_call_ready_event); n =3D atomic_read(&rcu_call_count); if (n =3D=3D 0) { +#if defined(CONFIG_MALLOC_TRIM) + malloc_trim(4 * 1024 * 1024); +#endif qemu_event_wait(&rcu_call_ready_event); } } --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513792490983774.167813601863; Wed, 20 Dec 2017 09:54:50 -0800 (PST) Received: from localhost ([::1]:60783 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRiZj-0003i3-S7 for importer@patchew.org; Wed, 20 Dec 2017 12:54:39 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56718) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhyi-0004zx-OH for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyg-0007Os-9d for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:24 -0500 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:45035) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyg-0007OP-3F for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:22 -0500 Received: by mail-wr0-x242.google.com with SMTP id l41so10725220wre.11 for ; Wed, 20 Dec 2017 09:16:22 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.16.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:16:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DftxP2l6vdsxBPkAjUjMHWx4TI81gAzjybfLFkf56hA=; b=RbJsa7OlmbdeMziq872q833vwKAXbGPMFPw94cFrSA47rHOG8QPcyaFViGc+M9AjEe YTIbNp1rM9m3C6gvA1MiW3ghWTDZeccWr79qCui1Eu190N7Ogtmif8ixO5QnaqeS7xfl CqVBBcepsEo9qBk0ZKPUwW8DXNLHlW/yFBjBu9e/YJeHEqAdwsE7LvXtNKOY0I27drQ3 usJu6Ix23JszorY3V19SZCtXXECQj4JGN9XZZmuEaKhqGhKDw4TM2nq7R4o2HRqRi+zJ 65hnbVJ77nyME/uio46LaJWIGSVmpkoAlSw4qcz7hO7xt4R2PIs0fxhVzTnH6zlhwkRE RdpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=DftxP2l6vdsxBPkAjUjMHWx4TI81gAzjybfLFkf56hA=; b=Ls0G471aF5hofDoHcePwv6wxRFbbzLXlLrwiKbAoBRN2IWTQrN/r3U7tYRtgBtCkH9 HmJh6hRDuJ8hGOaXbfpFDCrMtkff+vTIPEAHTDFAK5izYpLq9jDor3InU91auhdFnScZ 0fFNTnaW3KvMKbofpwFrMOHlgHoFPGT3D8nTMxpTH0oU5ws1PA7+UDfwr/8COLhE4ZGS EVz7wBre1KK2pHYeNimkRRPUzVMU9Om2JszjptJj9H2BEYvxJxz5jlY0v5HYv9Lvj7Fd mxbw77i5PTE+kmewe7e4r8l6lqfhNrjs5mHKH8j+RpeiTDtGLOWnNWAxOvfbOTeCcZ9l 0utg== X-Gm-Message-State: AKGB3mI8r+QzHREtQj4r7FedyrG/7+a1UMQiR9CYrTRWwTDWOnKDZs9N ldWIVRE3/WhRgS3brnBqM7zZPkuD X-Google-Smtp-Source: ACJfBosogGv/kLuDyxBa1d0b1IyBbkMDusF6a5s/3lAxdEkvQCEHqQPqRe+lvNh3nyJQZOH5yYaCZA== X-Received: by 10.223.159.15 with SMTP id l15mr10094639wrf.155.1513790180806; Wed, 20 Dec 2017 09:16:20 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:54 +0100 Message-Id: <1513790098-9815-43-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 42/46] chardev: fix backend events regression with mux chardev X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Marc-Andr=C3=A9 Lureau Kirill noticied that on recent versions on QEMU he was not able to trigger SysRq to invoke debug capabilites of Linux Kernel. He tracked it down to qemu_chr_be_event() ignoring CHR_EVENT_BREAK due s->be being NULL. The bug was introduced in 2.8, commit a4afa548fc6d ("char: move front end handlers in CharBackend"). Since the commit, the qemu_chr_be_event() failed to deliver CHR_EVENT_BREAK due to qemu_chr_fe_init() does not set s->be in case of mux. Let's fix this by teaching mux to send an event to the frontend with the focus. Reported-by: Kirill A. Shutemov Signed-off-by: Marc-Andr=C3=A9 Lureau Fixes: a4afa548fc6d ("char: move front end handlers in CharBackend") Message-Id: <20171103152824.21948-2-marcandre.lureau@redhat.com> Tested-by: Kirill A. Shutemov Signed-off-by: Paolo Bonzini --- chardev/char-mux.c | 8 ++++++++ chardev/char.c | 18 ++++++++++++------ include/chardev/char.h | 1 + 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/chardev/char-mux.c b/chardev/char-mux.c index 4cda5e7..0553b48 100644 --- a/chardev/char-mux.c +++ b/chardev/char-mux.c @@ -123,6 +123,13 @@ static void mux_chr_send_event(MuxChardev *d, int mux_= nr, int event) } } =20 +static void mux_chr_be_event(Chardev *chr, int event) +{ + MuxChardev *d =3D MUX_CHARDEV(chr); + + mux_chr_send_event(d, d->focus, event); +} + static int mux_proc_byte(Chardev *chr, MuxChardev *d, int ch) { if (d->term_got_escape) { @@ -346,6 +353,7 @@ static void char_mux_class_init(ObjectClass *oc, void *= data) cc->chr_write =3D mux_chr_write; cc->chr_accept_input =3D mux_chr_accept_input; cc->chr_add_watch =3D mux_chr_add_watch; + cc->chr_be_event =3D mux_chr_be_event; } =20 static const TypeInfo char_mux_type_info =3D { diff --git a/chardev/char.c b/chardev/char.c index 2ae4f46..8c3765e 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -43,10 +43,19 @@ static Object *get_chardevs_root(void) return container_get(object_get_root(), "/chardevs"); } =20 -void qemu_chr_be_event(Chardev *s, int event) +static void chr_be_event(Chardev *s, int event) { CharBackend *be =3D s->be; =20 + if (!be || !be->chr_event) { + return; + } + + be->chr_event(be->opaque, event); +} + +void qemu_chr_be_event(Chardev *s, int event) +{ /* Keep track if the char device is open */ switch (event) { case CHR_EVENT_OPENED: @@ -57,11 +66,7 @@ void qemu_chr_be_event(Chardev *s, int event) break; } =20 - if (!be || !be->chr_event) { - return; - } - - be->chr_event(be->opaque, event); + CHARDEV_GET_CLASS(s)->chr_be_event(s, event); } =20 /* Not reporting errors from writing to logfile, as logs are @@ -244,6 +249,7 @@ static void char_class_init(ObjectClass *oc, void *data) ChardevClass *cc =3D CHARDEV_CLASS(oc); =20 cc->chr_write =3D null_chr_write; + cc->chr_be_event =3D chr_be_event; } =20 static void char_finalize(Object *obj) diff --git a/include/chardev/char.h b/include/chardev/char.h index 43aabcc..778d610 100644 --- a/include/chardev/char.h +++ b/include/chardev/char.h @@ -248,6 +248,7 @@ typedef struct ChardevClass { void (*chr_accept_input)(Chardev *chr); void (*chr_set_echo)(Chardev *chr, bool echo); void (*chr_set_fe_open)(Chardev *chr, int fe_open); + void (*chr_be_event)(Chardev *s, int event); } ChardevClass; =20 Chardev *qemu_chardev_new(const char *id, const char *typename, --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513792334313470.48858315218854; Wed, 20 Dec 2017 09:52:14 -0800 (PST) Received: from localhost ([::1]:60760 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRiX8-0001OI-ET for importer@patchew.org; Wed, 20 Dec 2017 12:51:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56717) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhyi-0004zw-O5 for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyh-0007Pm-Fg for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:24 -0500 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:38542) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyh-0007PG-7r for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:23 -0500 Received: by mail-wr0-x242.google.com with SMTP id o2so22901923wro.5 for ; Wed, 20 Dec 2017 09:16:23 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.16.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:16:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xH2Q0t5mFAe1F4cZ2cF+q+LMca//tw9wIiKvwr3QC4g=; b=NisTw7jx35Kprhoj10IkiroJDO7pqgPPvuUpxsn8Cvey0EhSQzP6+xSEceHJq2duGc yNkA0lkoli6BbzNerpN3aROyLLq1m7UiG6Qk9s6dv7l66tsvAAGF+POyWsWkJBAPih3c hvI6GQFOdDrQtghcGnYAwYdzrc+zpfBI4sIi60uhCi60sPZFlwhmOOm0pf2tebTF7dX2 ldfs2oRPOLrF5oUsrLLrs7bU6ltZAUSKBlF0pf1Cv1I0wSYgpNnmsderVKFSUx0f6jPw oaxtRb206bSjU1/ecZCK1F8c6oa7Y/ueu6nozmrNyVsj5M6vUcWcQO4FQ1ieLv0GIU7i lPzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=xH2Q0t5mFAe1F4cZ2cF+q+LMca//tw9wIiKvwr3QC4g=; b=k1XQxn9yZ47apgOTXOp6uFWNiqiEY79cM936Ntk0rdB9fTg9gR7zgCxa4maQBmn76B fH8xTIgRPR5SNfkwmsFnsdmhnTEjYBU8/yjrltwfqmOx7lZp1ydoj7ZqV6gXhKK613xg KYtgy6AZe683ptPbvCEGPZZcFXchJ72iqK+34ljLsMuPejo581hQcNt9dKj+dvN3K6Sc Tm/AG2NS1AHVndxFbn1sP+35OxzzPjFb7KDSUuSDMzPkYPfodRIz0kg+0q/YLZIkmGyc ZgIsdAG6x42nEC8prMrBo6g0zUBm0GKVMhWFsr+CIDpTLCFljrywQgcb/wH/wtw6qb66 vlHQ== X-Gm-Message-State: AKGB3mISeBjA5j/bqXCm8L3D4wgO9ZdUNMezoNOTB9syao7KSWIwFE58 Q/0fmMfqaYBDw+ZSmec4Wd9wLllf X-Google-Smtp-Source: ACJfBovdxoovuujYqu5XIBpNnT+e7aCKrkjzwmEqWK2g9TQB2ksA1OiQz7fI9O2cTWxEZk6mWCI8uw== X-Received: by 10.223.152.178 with SMTP id w47mr9755907wrb.254.1513790181932; Wed, 20 Dec 2017 09:16:21 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:55 +0100 Message-Id: <1513790098-9815-44-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 43/46] test: add some chardev mux event tests X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Marc-Andr=C3=A9 Lureau Check the expected behaviour of qemu_chr_be_event() on a mux chardev. For some reason, sending the event on the base chardev broadcast to all frontends, while sending it on the mux chardev itself should trigger the event on the currently focused chardev frontend. Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20171103152824.21948-3-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- tests/test-char.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/test-char.c b/tests/test-char.c index 7ac25ff..911e3f6 100644 --- a/tests/test-char.c +++ b/tests/test-char.c @@ -5,6 +5,7 @@ #include "qemu/config-file.h" #include "qemu/sockets.h" #include "chardev/char-fe.h" +#include "chardev/char-mux.h" #include "sysemu/sysemu.h" #include "qapi/error.h" #include "qom/qom-qobject.h" @@ -164,6 +165,7 @@ static void char_mux_test(void) FeHandler h1 =3D { 0, }, h2 =3D { 0, }; CharBackend chr_be1, chr_be2; =20 + muxes_realized =3D true; /* done after machine init */ opts =3D qemu_opts_create(qemu_find_opts("chardev"), "mux-label", 1, &error_abort); qemu_opt_set(opts, "backend", "ringbuf", &error_abort); @@ -201,8 +203,23 @@ static void char_mux_test(void) g_assert_cmpstr(h2.read_buf, =3D=3D, "hello"); h2.read_count =3D 0; =20 + g_assert_cmpint(h1.last_event, !=3D, 42); /* should be MUX_OUT or OPEN= ED */ + g_assert_cmpint(h2.last_event, !=3D, 42); /* should be MUX_IN or OPENE= D */ + /* sending event on the base broadcast to all fe, historical reasons? = */ + qemu_chr_be_event(base, 42); + g_assert_cmpint(h1.last_event, =3D=3D, 42); + g_assert_cmpint(h2.last_event, =3D=3D, 42); + qemu_chr_be_event(chr, -1); + g_assert_cmpint(h1.last_event, =3D=3D, 42); + g_assert_cmpint(h2.last_event, =3D=3D, -1); + /* switch focus */ qemu_chr_be_write(base, (void *)"\1c", 2); + g_assert_cmpint(h1.last_event, =3D=3D, CHR_EVENT_MUX_IN); + g_assert_cmpint(h2.last_event, =3D=3D, CHR_EVENT_MUX_OUT); + qemu_chr_be_event(chr, -1); + g_assert_cmpint(h1.last_event, =3D=3D, -1); + g_assert_cmpint(h2.last_event, =3D=3D, CHR_EVENT_MUX_OUT); =20 qemu_chr_be_write(base, (void *)"hello", 6); g_assert_cmpint(h2.read_count, =3D=3D, 0); --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513792656986423.13764314742514; Wed, 20 Dec 2017 09:57:36 -0800 (PST) Received: from localhost ([::1]:60810 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRicM-00069c-Sc for importer@patchew.org; Wed, 20 Dec 2017 12:57:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56809) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhym-00054j-RH for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyi-0007Qf-K4 for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:28 -0500 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:43969) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyi-0007QA-DM for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:24 -0500 Received: by mail-wr0-x241.google.com with SMTP id w68so10470396wrc.10 for ; Wed, 20 Dec 2017 09:16:24 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.16.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:16:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=yWFRA+uTgz+LzZWwFbc94DTUFKZn+fqlQC6vq0jh09Q=; b=eiJEMdErIbiy/ZzTmIdOAhUCEk9XEfMUt0AGjPRriXl+bYA40jyzrnxSNdgcCn8lKr wxQY3NSCOAIOBdrCGPti+10VK7LxL8zWCL9LiZXEL39ZOkObuiOOfK/v+841xXdSbCXx tupdiS0DN58YeOpg8Is3ooy+JnIRXcdeZgJ+WYQ8QXkye/7A7OoM0UrVR3ubBMK1s5Vl lgEzp5+LEGAtbX4PF4NcoWi1L77+MI98JWFlYV8QreYSXcWDDgf6N6FNdIEGl1e9GDF0 MjfhILDSWudfyw0/xFvo/kvWWOVTMuNL8NvgK4DrsjtPpcrtQw4oF76y/RAnJ7RqjvAX stFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=yWFRA+uTgz+LzZWwFbc94DTUFKZn+fqlQC6vq0jh09Q=; b=d+viFA3e8CI6Vj0OD7S7sOfUZ9m/POuwG0LOnu4/QjAVZyKMs0a2lzCRX4rZxAfM4D pNpheZoqxKTwdDE0gOUjqxbW5djMMb9HFzGzLc6C2E55zb5pEnQuV+yBRW+DD5fe9FON +YLhtefW/79mWMqCvMZH9I+IzRUXT+0wgq57TV8FAYz7CbWai0EQEjKTVQcz4hMeU9Vf cam3UJoxFzL2ehetPjJ4WWF495IV0SRZYbGDgcLrK7XwOm2+h6c7Qi4XD7TlsVGLV8A0 N9KV/74xXL602+3PFgHkLhNmWtLpAmoFOmUiJqJ6K18blnXfIyo6j9249WUcsatbrbS7 923A== X-Gm-Message-State: AKGB3mImBTTv6iHr/mGl/AlyKRpotJBk9r6iRvEUHr0nA15wXU6kMKas W8Dp4s54GI3XJMg3SDP7VxGSmS/M X-Google-Smtp-Source: ACJfBotPsU6PMi+1muTYJm/ZgjXsUEwXg6ZNQIgYK1GIVVMVqB3GeGM2jFQEneIWg9QGRve1LOLYyg== X-Received: by 10.223.131.132 with SMTP id 4mr8644393wre.217.1513790183093; Wed, 20 Dec 2017 09:16:23 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:56 +0100 Message-Id: <1513790098-9815-45-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PULL 44/46] blockdev: convert internal NBD server to QIONetListener X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Daniel P. Berrange" Instead of creating a QIOChannelSocket directly for the NBD server socket, use a QIONetListener. This provides the ability to listen on multiple sockets at the same time, so enables full support for IPv4/IPv6 dual stack. Reviewed-by: Eric Blake Signed-off-by: Daniel P. Berrange Message-Id: <20171218101643.20360-2-berrange@redhat.com> Signed-off-by: Paolo Bonzini --- blockdev-nbd.c | 50 ++++++++++++++++---------------------------------- 1 file changed, 16 insertions(+), 34 deletions(-) diff --git a/blockdev-nbd.c b/blockdev-nbd.c index 28f551a..9e3c221 100644 --- a/blockdev-nbd.c +++ b/blockdev-nbd.c @@ -18,10 +18,10 @@ #include "qmp-commands.h" #include "block/nbd.h" #include "io/channel-socket.h" +#include "io/net-listener.h" =20 typedef struct NBDServerData { - QIOChannelSocket *listen_ioc; - int watch; + QIONetListener *listener; QCryptoTLSCreds *tlscreds; } NBDServerData; =20 @@ -32,27 +32,13 @@ static void nbd_blockdev_client_closed(NBDClient *clien= t, bool ignored) nbd_client_put(client); } =20 -static gboolean nbd_accept(QIOChannel *ioc, GIOCondition condition, - gpointer opaque) +static void nbd_accept(QIONetListener *listener, QIOChannelSocket *cioc, + gpointer opaque) { - QIOChannelSocket *cioc; - - if (!nbd_server) { - return FALSE; - } - - cioc =3D qio_channel_socket_accept(QIO_CHANNEL_SOCKET(ioc), - NULL); - if (!cioc) { - return TRUE; - } - qio_channel_set_name(QIO_CHANNEL(cioc), "nbd-server"); nbd_client_new(NULL, cioc, nbd_server->tlscreds, NULL, nbd_blockdev_client_closed); - object_unref(OBJECT(cioc)); - return TRUE; } =20 =20 @@ -62,10 +48,8 @@ static void nbd_server_free(NBDServerData *server) return; } =20 - if (server->watch !=3D -1) { - g_source_remove(server->watch); - } - object_unref(OBJECT(server->listen_ioc)); + qio_net_listener_disconnect(server->listener); + object_unref(OBJECT(server->listener)); if (server->tlscreds) { object_unref(OBJECT(server->tlscreds)); } @@ -112,12 +96,12 @@ void nbd_server_start(SocketAddress *addr, const char = *tls_creds, } =20 nbd_server =3D g_new0(NBDServerData, 1); - nbd_server->watch =3D -1; - nbd_server->listen_ioc =3D qio_channel_socket_new(); - qio_channel_set_name(QIO_CHANNEL(nbd_server->listen_ioc), - "nbd-listener"); - if (qio_channel_socket_listen_sync( - nbd_server->listen_ioc, addr, errp) < 0) { + nbd_server->listener =3D qio_net_listener_new(); + + qio_net_listener_set_name(nbd_server->listener, + "nbd-listener"); + + if (qio_net_listener_open_sync(nbd_server->listener, addr, errp) < 0) { goto error; } =20 @@ -134,12 +118,10 @@ void nbd_server_start(SocketAddress *addr, const char= *tls_creds, } } =20 - nbd_server->watch =3D qio_channel_add_watch( - QIO_CHANNEL(nbd_server->listen_ioc), - G_IO_IN, - nbd_accept, - NULL, - NULL); + qio_net_listener_set_client_func(nbd_server->listener, + nbd_accept, + NULL, + NULL); =20 return; =20 --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513793152973730.5934478193575; Wed, 20 Dec 2017 10:05:52 -0800 (PST) Received: from localhost ([::1]:32954 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRikU-00059i-OA for importer@patchew.org; Wed, 20 Dec 2017 13:05:46 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56794) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhyl-000537-Em for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyk-0007S6-Bb for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:27 -0500 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:42664) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyj-0007RF-W6 for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:26 -0500 Received: by mail-wr0-x241.google.com with SMTP id s66so22904283wrc.9 for ; Wed, 20 Dec 2017 09:16:25 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.16.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:16:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=tQ2WQa+U2P93tVZaW9XHplSVtZdkuBiiRzvHJHNXM60=; b=EEC90W+AA7hIeasUA0MU1ve9s33l9t9hW5NgbhkmFw2spKQiwaapOKeB92ZaZDlN8z 8TOkp23ANG7EiBdmjkW+8PTTugNoslZyl484jk2WbrTzpWFIl9W9rHp2IU/dbo0ztIb3 /94icPF+OtXA6Y+qoJ4PFTkM8fIFRX0/PUbIVhWbJaesX8hJAhqPvEDECl1kUzu7I8a5 QCI1gUif2lihLldCIbEHleTxcCcnhUXZEHqeeYIiUvmCY/xSZPCFgMV/UulTj9rFQrrk B6wM7pAquZQLNvEqPFTclHNsPMDZhZ0ubSqAonIoiIhX4Y22AfmbaRKGr1OPIICaDR7v MbOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=tQ2WQa+U2P93tVZaW9XHplSVtZdkuBiiRzvHJHNXM60=; b=PgIdnf+MgZHd+v+uR0cWiowdF1hYtyR7L+3IRgVJZTg8ePd+Gac1b50HG0c63U01Ky cZHWTf+WpSam0nmcuBbTiJ9Z/gfnJ5NehjLHz25bTfxZ3VQFpH1wuP6MrYFGHco4Y9g7 SngIeaB5TZizc6DmZHjfKZywHT/Xqmai0HKiAfZC1CalI5TTgm8pvCKQ3nmFj6Tago8s bIj+QC4gqSYXT7KF3z7tpXYa/mZ6d39u0C+gTULRZxmtDV73SO/q3KXumoZ8n7COaxOS qCMEGibynzQVyxJchs+25MZlzrcJfUaWuHApdLTJPe1o6M1bbHByQLiN9JJndUIFqJ1N AD5A== X-Gm-Message-State: AKGB3mLqNvcT9lj2esVAgsiTrmDOKN7KNOkC0IGN0yAPR/PbAkzWoDj5 i6wW98DVa2jSu9FbWKk6TfngL/Wj X-Google-Smtp-Source: ACJfBoszF/QFmoCK0ioXMRBXy3VeXkU8Kr0X9wecmoSrUFDO8gr/fmSxpkusnNsqKHbbD1zV5lIR0w== X-Received: by 10.223.136.56 with SMTP id d53mr9297748wrd.36.1513790184717; Wed, 20 Dec 2017 09:16:24 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:57 +0100 Message-Id: <1513790098-9815-46-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PULL 45/46] blockdev: convert qemu-nbd server to QIONetListener X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Daniel P. Berrange" Instead of creating a QIOChannelSocket directly for the NBD server socket, use a QIONetListener. This provides the ability to listen on multiple sockets at the same time, so enables full support for IPv4/IPv6 dual stack. This also means we can honour multiple FDs received during socket activation. Reviewed-by: Eric Blake Signed-off-by: Daniel P. Berrange Message-Id: <20171218101643.20360-3-berrange@redhat.com> Signed-off-by: Paolo Bonzini --- qemu-nbd.c | 61 ++++++++++++++++++++++++----------------------------------= --- 1 file changed, 24 insertions(+), 37 deletions(-) diff --git a/qemu-nbd.c b/qemu-nbd.c index d75ca51..3723493 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -37,6 +37,7 @@ #include "qapi/qmp/qstring.h" #include "qom/object_interfaces.h" #include "io/channel-socket.h" +#include "io/net-listener.h" #include "crypto/init.h" #include "trace/control.h" #include "qemu-version.h" @@ -62,8 +63,7 @@ static int persistent =3D 0; static enum { RUNNING, TERMINATE, TERMINATING, TERMINATED } state; static int shared =3D 1; static int nb_fds; -static QIOChannelSocket *server_ioc; -static int server_watch =3D -1; +static QIONetListener *server; static QCryptoTLSCreds *tlscreds; =20 static void usage(const char *name) @@ -344,44 +344,25 @@ static void nbd_client_closed(NBDClient *client, bool= negotiated) nbd_client_put(client); } =20 -static gboolean nbd_accept(QIOChannel *ioc, GIOCondition cond, gpointer op= aque) +static void nbd_accept(QIONetListener *listener, QIOChannelSocket *cioc, + gpointer opaque) { - QIOChannelSocket *cioc; - - cioc =3D qio_channel_socket_accept(QIO_CHANNEL_SOCKET(ioc), - NULL); - if (!cioc) { - return TRUE; - } - if (state >=3D TERMINATE) { - object_unref(OBJECT(cioc)); - return TRUE; + return; } =20 nb_fds++; nbd_update_server_watch(); nbd_client_new(newproto ? NULL : exp, cioc, tlscreds, NULL, nbd_client_closed); - object_unref(OBJECT(cioc)); - - return TRUE; } =20 static void nbd_update_server_watch(void) { if (nbd_can_accept()) { - if (server_watch =3D=3D -1) { - server_watch =3D qio_channel_add_watch(QIO_CHANNEL(server_ioc), - G_IO_IN, - nbd_accept, - NULL, NULL); - } + qio_net_listener_set_client_func(server, nbd_accept, NULL, NULL); } else { - if (server_watch !=3D -1) { - g_source_remove(server_watch); - server_watch =3D -1; - } + qio_net_listener_set_client_func(server, NULL, NULL, NULL); } } =20 @@ -915,23 +896,29 @@ int main(int argc, char **argv) snprintf(sockpath, 128, SOCKET_PATH, basename(device)); } =20 + server =3D qio_net_listener_new(); if (socket_activation =3D=3D 0) { - server_ioc =3D qio_channel_socket_new(); saddr =3D nbd_build_socket_address(sockpath, bindto, port); - if (qio_channel_socket_listen_sync(server_ioc, saddr, &local_err) = < 0) { - object_unref(OBJECT(server_ioc)); + if (qio_net_listener_open_sync(server, saddr, &local_err) < 0) { + object_unref(OBJECT(server)); error_report_err(local_err); - return 1; + exit(EXIT_FAILURE); } } else { + size_t i; /* See comment in check_socket_activation above. */ - assert(socket_activation =3D=3D 1); - server_ioc =3D qio_channel_socket_new_fd(FIRST_SOCKET_ACTIVATION_F= D, - &local_err); - if (server_ioc =3D=3D NULL) { - error_report("Failed to use socket activation: %s", - error_get_pretty(local_err)); - exit(EXIT_FAILURE); + for (i =3D 0; i < socket_activation; i++) { + QIOChannelSocket *sioc; + sioc =3D qio_channel_socket_new_fd(FIRST_SOCKET_ACTIVATION_FD = + i, + &local_err); + if (sioc =3D=3D NULL) { + object_unref(OBJECT(server)); + error_report("Failed to use socket activation: %s", + error_get_pretty(local_err)); + exit(EXIT_FAILURE); + } + qio_net_listener_add(server, sioc); + object_unref(OBJECT(sioc)); } } =20 --=20 1.8.3.1 From nobody Sat May 4 18:05:34 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1513791875186210.9375095036802; Wed, 20 Dec 2017 09:44:35 -0800 (PST) Received: from localhost ([::1]:60612 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRiPk-0003W5-LN for importer@patchew.org; Wed, 20 Dec 2017 12:44:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56807) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRhym-00054X-Lg for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRhyl-0007Sg-GD for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:28 -0500 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:42665) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eRhyl-0007SF-6x for qemu-devel@nongnu.org; Wed, 20 Dec 2017 12:16:27 -0500 Received: by mail-wr0-x242.google.com with SMTP id s66so22904335wrc.9 for ; Wed, 20 Dec 2017 09:16:27 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-251-125.clienti.tiscali.it. [78.12.251.125]) by smtp.gmail.com with ESMTPSA id f125sm2751101wme.45.2017.12.20.09.16.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Dec 2017 09:16:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=aFG6D6P4M1R7N0hAqbYuvmnBjKPqUQWli+JGQOoEf4Q=; b=f3mtIjPvvYHaBcTBfhYXVhbAP+rYtBtwmprZd80aLuxVViV8E84dq2ndBJKNtJULUT MRDsMV2KpRQqieEKvyJwU0Emji5h+xLZIy2zH7IeiuUKeK8abhQtrK3canekrNQtrEjh 8xaGp67Li+Ts09QSlBdrzQztIJ3Ouj+1DCzWX16nGABAd/W9Qd8dv8sLO3kWgjbXuYnO UAnqk5H/NCD4PL578KnpJh9L6roTtCf4kZyUy3jvg5ZZJ//AA/fV/YSy5AygD4ns5CKQ LK5szy0y6mbkXUU0GwlxI0CYWVMQwwpkEUMzIaBNSZjLytqHbyQlH872no8hUNPv79aV TIdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=aFG6D6P4M1R7N0hAqbYuvmnBjKPqUQWli+JGQOoEf4Q=; b=lQCB4g2xX+JRIjms+ydK82D1Rm9qhNm61ylxDe5GHVC244cka4lTN6zan+gRgEaXab evVjQPd3KTHbD8ZYpDQVl/IGupUeLWQPJALOTyoC5StXeZfrAbu83eR1vLINPyXg6YY3 vlwAZyzIjhPjFBE1pFT7Jsqnxoj7LSWQnfWK4Norp56g6Z+15Q9wfM7bGo/0GXQ6Lxbr qPfA9Wr4cbPL+EsJ3R8mNOOt548RffXPvlToF9HdBe9p+u49XDKvbptK08+ld/Yvovb2 3oaa5icaUU/FVrh5VoP6AAhEtSGugMa7WqfEbVaZgjFHA36wek0Z8XmYkhegCsaNaspW A8Gw== X-Gm-Message-State: AKGB3mLvxXpbq569o5e2Qra8fT4jKNoRqXyHUShpSGiqa4lNDY7sreEt QMXM9ono1h3oEPupNLKLcoRVwSW5 X-Google-Smtp-Source: ACJfBou4VWaAUkKB09BirU8oYhvcct5eBY2AlHVx6wxfoCuEpr8FVOLvXEvw6FxwFSJi5eB3cupp7A== X-Received: by 10.223.166.205 with SMTP id t71mr8925650wrc.64.1513790185861; Wed, 20 Dec 2017 09:16:25 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 18:14:58 +0100 Message-Id: <1513790098-9815-47-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> References: <1513790098-9815-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 46/46] chardev: convert the socket server to QIONetListener X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 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" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Daniel P. Berrange" Instead of creating a QIOChannelSocket directly for the chardev server socket, use a QIONetListener. This provides the ability to listen on multiple sockets at the same time, so enables full support for IPv4/IPv6 dual stack. Signed-off-by: Daniel P. Berrange Message-Id: <20171218135417.28301-2-berrange@redhat.com> Signed-off-by: Paolo Bonzini --- chardev/char-socket.c | 73 +++++++++++++++++++++--------------------------= ---- 1 file changed, 30 insertions(+), 43 deletions(-) diff --git a/chardev/char-socket.c b/chardev/char-socket.c index 53eda8e..630a7f2 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -25,6 +25,7 @@ #include "chardev/char.h" #include "io/channel-socket.h" #include "io/channel-tls.h" +#include "io/net-listener.h" #include "qemu/error-report.h" #include "qapi/error.h" #include "qapi/clone-visitor.h" @@ -40,8 +41,7 @@ typedef struct { Chardev parent; QIOChannel *ioc; /* Client I/O channel */ QIOChannelSocket *sioc; /* Client master channel */ - QIOChannelSocket *listen_ioc; - guint listen_tag; + QIONetListener *listener; QCryptoTLSCreds *tls_creds; int connected; int max_size; @@ -93,9 +93,9 @@ static void check_report_connect_error(Chardev *chr, qemu_chr_socket_restart_timer(chr); } =20 -static gboolean tcp_chr_accept(QIOChannel *chan, - GIOCondition cond, - void *opaque); +static void tcp_chr_accept(QIONetListener *listener, + QIOChannelSocket *cioc, + void *opaque); =20 static int tcp_chr_read_poll(void *opaque); static void tcp_chr_disconnect(Chardev *chr); @@ -401,9 +401,9 @@ static void tcp_chr_disconnect(Chardev *chr) =20 tcp_chr_free_connection(chr); =20 - if (s->listen_ioc && s->listen_tag =3D=3D 0) { - s->listen_tag =3D qio_channel_add_watch( - QIO_CHANNEL(s->listen_ioc), G_IO_IN, tcp_chr_accept, chr, NULL= ); + if (s->listener) { + qio_net_listener_set_client_func(s->listener, tcp_chr_accept, + chr, NULL); } update_disconnected_filename(s); if (emit_close) { @@ -702,9 +702,8 @@ static int tcp_chr_new_client(Chardev *chr, QIOChannelS= ocket *sioc) if (s->do_nodelay) { qio_channel_set_delay(s->ioc, false); } - if (s->listen_tag) { - g_source_remove(s->listen_tag); - s->listen_tag =3D 0; + if (s->listener) { + qio_net_listener_set_client_func(s->listener, NULL, NULL, NULL); } =20 if (s->tls_creds) { @@ -736,24 +735,14 @@ static int tcp_chr_add_client(Chardev *chr, int fd) return ret; } =20 -static gboolean tcp_chr_accept(QIOChannel *channel, - GIOCondition cond, - void *opaque) +static void tcp_chr_accept(QIONetListener *listener, + QIOChannelSocket *cioc, + void *opaque) { Chardev *chr =3D CHARDEV(opaque); - QIOChannelSocket *sioc; - - sioc =3D qio_channel_socket_accept(QIO_CHANNEL_SOCKET(channel), - NULL); - if (!sioc) { - return TRUE; - } - - tcp_chr_new_client(chr, sioc); =20 - object_unref(OBJECT(sioc)); - - return TRUE; + tcp_chr_set_client_ioc_name(chr, cioc); + tcp_chr_new_client(chr, cioc); } =20 static int tcp_chr_wait_connected(Chardev *chr, Error **errp) @@ -767,9 +756,10 @@ static int tcp_chr_wait_connected(Chardev *chr, Error = **errp) if (s->is_listen) { info_report("QEMU waiting for connection on: %s", chr->filename); - qio_channel_set_blocking(QIO_CHANNEL(s->listen_ioc), true, NUL= L); - tcp_chr_accept(QIO_CHANNEL(s->listen_ioc), G_IO_IN, chr); - qio_channel_set_blocking(QIO_CHANNEL(s->listen_ioc), false, NU= LL); + sioc =3D qio_net_listener_wait_client(s->listener); + tcp_chr_set_client_ioc_name(chr, sioc); + tcp_chr_new_client(chr, sioc); + object_unref(OBJECT(sioc)); } else { sioc =3D qio_channel_socket_new(); tcp_chr_set_client_ioc_name(chr, sioc); @@ -797,12 +787,9 @@ static void char_socket_finalize(Object *obj) s->reconnect_timer =3D 0; } qapi_free_SocketAddress(s->addr); - if (s->listen_tag) { - g_source_remove(s->listen_tag); - s->listen_tag =3D 0; - } - if (s->listen_ioc) { - object_unref(OBJECT(s->listen_ioc)); + if (s->listener) { + qio_net_listener_set_client_func(s->listener, NULL, NULL, NULL); + object_unref(OBJECT(s->listener)); } if (s->tls_creds) { object_unref(OBJECT(s->tls_creds)); @@ -935,29 +922,29 @@ static void qmp_chardev_open_socket(Chardev *chr, } else { if (s->is_listen) { char *name; - sioc =3D qio_channel_socket_new(); + s->listener =3D qio_net_listener_new(); =20 name =3D g_strdup_printf("chardev-tcp-listener-%s", chr->label= ); - qio_channel_set_name(QIO_CHANNEL(sioc), name); + qio_net_listener_set_name(s->listener, name); g_free(name); =20 - if (qio_channel_socket_listen_sync(sioc, s->addr, errp) < 0) { + if (qio_net_listener_open_sync(s->listener, s->addr, errp) < 0= ) { + object_unref(OBJECT(s->listener)); + s->listener =3D NULL; goto error; } =20 qapi_free_SocketAddress(s->addr); - s->addr =3D socket_local_address(sioc->fd, errp); + s->addr =3D socket_local_address(s->listener->sioc[0]->fd, err= p); update_disconnected_filename(s); =20 - s->listen_ioc =3D sioc; if (is_waitconnect && qemu_chr_wait_connected(chr, errp) < 0) { return; } if (!s->ioc) { - s->listen_tag =3D qio_channel_add_watch( - QIO_CHANNEL(s->listen_ioc), G_IO_IN, - tcp_chr_accept, chr, NULL); + qio_net_listener_set_client_func(s->listener, tcp_chr_acce= pt, + chr, NULL); } } else if (qemu_chr_wait_connected(chr, errp) < 0) { goto error; --=20 1.8.3.1