From nobody Mon May 6 14:03:42 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.zoho.com; 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 1489508560856233.77287505764377; Tue, 14 Mar 2017 09:22:40 -0700 (PDT) Received: from localhost ([::1]:60575 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnpDU-0005zq-DC for importer@patchew.org; Tue, 14 Mar 2017 12:22:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36560) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnp9Z-0003OI-Ad for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnp9X-0006We-4i for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:29 -0400 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:35924) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cnp9W-0006WE-Ug for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:27 -0400 Received: by mail-wr0-x242.google.com with SMTP id l37so24466327wrc.3 for ; Tue, 14 Mar 2017 09:18:26 -0700 (PDT) Received: from 640k.lan (94-39-132-181.adsl-ull.clienti.tiscali.it. [94.39.132.181]) by smtp.gmail.com with ESMTPSA id k195sm408197wmd.7.2017.03.14.09.18.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2017 09:18:24 -0700 (PDT) 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=74oU2jhPEktc8v0XSQE2NLXxdmKAv7iV4+CMwMrKXVY=; b=gu8MZ12Ax035YZ23F+ZjPigDy0gi/7OkA45abDeiMZ+HfEmgvDTSWkuOpvWNztkUiN /VJGp8uew1Vab5HXU7/pJ1GVPJGfI/RYGFMGbdaKa+qWKd4FBZ6RfhRFWeDPinjzWb5c yhNJsio9goBZN4myS0nEGCrgEFcQqL1XYblcTmqjCE0e8pYnOTwH5lsc7JqpzL0+kCqK IZgiImnsCTagSVfnoOPgVShlt2ZMwFkYhoNLeQVjbCYFdMOfu54xRyGv8wwHtq8NQ34i x0pB5tshOXpRLI6u018FTEU2wOfG+u+DNAIAga07e6D1gBmWMr2xUSwI5HjNRlSyaAv2 3sGg== 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=74oU2jhPEktc8v0XSQE2NLXxdmKAv7iV4+CMwMrKXVY=; b=AWNLX571LKT5WAE77IXkpqwyBpExYM9J39wtWpa5EWLKcEpIO3KszEJ/gVPsuTPvA5 vCN8jkI5RgsbtuWpCuXIUMcfap3bhHWE6XBFu+tSN8tzjsuNWxVMH1/Fuf6PMzH5BPsa wSknfAViv+O2r8eCmklXAkeKRX4O9XIZcNCgG9PwjUJ9uf/4yPrOVP+ZjU1rdK4A3Jgy jukDUqisizXEWJwS1SdnqtobcqJlCzr6pi9L2odZgs32ZKNYWOLv7pGoTY6IWJyAdYLL ihBL8MNS2bWFTgz5v9FfPBA4VynG8bHHdZSlyGfXofpNyH4SPsRhXL3v9CAIU1xXdCfa T/uw== X-Gm-Message-State: AMke39l0Kf3tGHalIo13eTouyM8qErEjH8sVtA3/sS+qKhzlbj6dkyVWel9BrL/iFlhLQA== X-Received: by 10.223.145.227 with SMTP id 90mr35099705wri.156.1489508305634; Tue, 14 Mar 2017 09:18:25 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 14 Mar 2017 17:18:03 +0100 Message-Id: <1489508300-48184-2-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> References: <1489508300-48184-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 01/18] memory_region: Fix name comments 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: "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" The 'name' parameter to memory_region_init_* had been marked as debug only, however vmstate_region_ram uses it as a parameter to qemu_ram_set_idstr to set RAMBlock names and these form part of the migration stream. Signed-off-by: Dr. David Alan Gilbert Message-Id: <20170309152708.30635-1-dgilbert@redhat.com> Signed-off-by: Paolo Bonzini --- include/exec/memory.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/include/exec/memory.h b/include/exec/memory.h index 6911023..e39256a 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -371,7 +371,8 @@ void memory_region_init_io(MemoryRegion *mr, * * @mr: the #MemoryRegion to be initialized. * @owner: the object that tracks the region's reference count - * @name: the name of the region. + * @name: Region name, becomes part of RAMBlock name used in migration str= eam + * must be unique within any device * @size: size of the region. * @errp: pointer to Error*, to store an error if it happens. */ @@ -390,7 +391,8 @@ void memory_region_init_ram(MemoryRegion *mr, * * @mr: the #MemoryRegion to be initialized. * @owner: the object that tracks the region's reference count - * @name: the name of the region. + * @name: Region name, becomes part of RAMBlock name used in migration str= eam + * must be unique within any device * @size: used size of the region. * @max_size: max size of the region. * @resized: callback to notify owner about used size change. @@ -412,7 +414,8 @@ void memory_region_init_resizeable_ram(MemoryRegion *mr, * * @mr: the #MemoryRegion to be initialized. * @owner: the object that tracks the region's reference count - * @name: the name of the region. + * @name: Region name, becomes part of RAMBlock name used in migration str= eam + * must be unique within any device * @size: size of the region. * @share: %true if memory must be mmaped with the MAP_SHARED flag * @path: the path in which to allocate the RAM. @@ -434,7 +437,8 @@ void memory_region_init_ram_from_file(MemoryRegion *mr, * * @mr: the #MemoryRegion to be initialized. * @owner: the object that tracks the region's reference count - * @name: the name of the region. + * @name: Region name, becomes part of RAMBlock name used in migration str= eam + * must be unique within any device * @size: size of the region. * @ptr: memory to be mapped; must contain at least @size bytes. */ @@ -496,7 +500,8 @@ void memory_region_init_alias(MemoryRegion *mr, * * @mr: the #MemoryRegion to be initialized. * @owner: the object that tracks the region's reference count - * @name: the name of the region. + * @name: Region name, becomes part of RAMBlock name used in migration str= eam + * must be unique within any device * @size: size of the region. * @errp: pointer to Error*, to store an error if it happens. */ @@ -513,7 +518,8 @@ void memory_region_init_rom(MemoryRegion *mr, * @mr: the #MemoryRegion to be initialized. * @owner: the object that tracks the region's reference count * @ops: callbacks for write access handling (must not be NULL). - * @name: the name of the region. + * @name: Region name, becomes part of RAMBlock name used in migration str= eam + * must be unique within any device * @size: size of the region. * @errp: pointer to Error*, to store an error if it happens. */ --=20 1.8.3.1 From nobody Mon May 6 14:03:42 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.zoho.com; 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 1489508524839162.40221036641753; Tue, 14 Mar 2017 09:22:04 -0700 (PDT) Received: from localhost ([::1]:60570 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnpCx-0005We-GK for importer@patchew.org; Tue, 14 Mar 2017 12:21:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36561) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnp9Z-0003OJ-Ar for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnp9X-0006XE-Tc for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:29 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:36125) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cnp9X-0006Wb-Mn for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:27 -0400 Received: by mail-wm0-x242.google.com with SMTP id v190so582762wme.3 for ; Tue, 14 Mar 2017 09:18:27 -0700 (PDT) Received: from 640k.lan (94-39-132-181.adsl-ull.clienti.tiscali.it. [94.39.132.181]) by smtp.gmail.com with ESMTPSA id k195sm408197wmd.7.2017.03.14.09.18.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2017 09:18:26 -0700 (PDT) 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=r/PEAKOC44AoQ0DY0vimW/x2F3mtfUk84+JzdDf8JkM=; b=G6mHrxzsQ9S/8iZXE41hn1OsGMurlVystsFJHiRWoRzXmrR6bRFCQdOgQ1vQ9PbqtS VX8hTbvNCT9MUCOwuYfyEz2XtzkX3hRzQ87CA2sT38VweQhqImxdfHQhyhqusDNdU80l rwiv/edSsBl07LsH5BgRLFqANAfrO0EpVmXooeFmiiBy9Gsxfk2sAos/23heC905gSXT 3zKb0ZXixxRnEpZ7Yfjs6W9lesrvPmMjtdk1gp4JyX0UbQy77N2sWla8uBR85+0WldzR ZrS3P5U/n9FPBxjnqa7R8OFiuz/Ypg6/71dfKAYU36p/OFbbT+d5Ih2vMmfYgbtE9iXz fjuQ== 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=r/PEAKOC44AoQ0DY0vimW/x2F3mtfUk84+JzdDf8JkM=; b=YHJMSu/iXsuTpg0qCvrZSts1xfi+52RVoxwM5N5I2aBuuWzn0sFxQh5QdPPYTY8zsH rZQI2xRNS54AxvQUFIC2Zrcg4m0EhyIoCF6wwr0TI9Wni4iyPI+xWesOQ7QegzOQimkt EYqRF3Up7E3M1BdkTlvTZFopb3I3DW+LiQqL6nPrfOxY6MuAmRQavXsmK4MdbLjz1ngI LYB1+94PbNojk/nTs+5eC9G6G1bKx85LoPmUmH+ZZfsT99q9jhpoffi+E9FKQ7YSrnJ3 HdLLgN2n5qxzIj/Op6GFQDs6+kKNOh6ohu8BAbxoOWEoT/Ztyb2Py9E6ZNm/GMNzYll9 uIyg== X-Gm-Message-State: AFeK/H0ROQZTzBrkTpFI18fnk0qRJXJJF2nwkavVcrqbPsi51K/oShNcbhzTPiQh82L24Q== X-Received: by 10.28.187.213 with SMTP id l204mr14912025wmf.104.1489508306646; Tue, 14 Mar 2017 09:18:26 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 14 Mar 2017 17:18:04 +0100 Message-Id: <1489508300-48184-3-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> References: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 02/18] docs: Add a note about mixing bootindex with "-boot order" 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: 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 Occasionally the users try to mix the bootindex properties with the "-boot order" parameter - and this likely does not give the expected results. So let's add a proper statement that these two concepts should not be used together. Signed-off-by: Thomas Huth Message-Id: <1488303601-23741-1-git-send-email-thuth@redhat.com> Reviewed-by: Eric Blake Reviewed-by: Laszlo Ersek Signed-off-by: Paolo Bonzini --- docs/bootindex.txt | 9 +++++++++ qemu-options.hx | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/bootindex.txt b/docs/bootindex.txt index f84fac7..b9a8ba1 100644 --- a/docs/bootindex.txt +++ b/docs/bootindex.txt @@ -41,3 +41,12 @@ has three bootable devices target1, target3, target5 con= nected to it, the option ROM will have a boot method for each of them, but it is not possible to map from boot method back to a specific target. This is a shortcoming of the PC BIOS boot specification. + +=3D=3D Mixing bootindex and boot order parameters =3D=3D + +Note that it does not make sense to use the bootindex property together +with the "-boot order=3D..." (or "-boot once=3D...") parameter. The guest +firmware implementations normally either support the one or the other, +but not both parameters at the same time. Mixing them will result in +undefined behavior, and thus the guest firmware will likely not boot +from the expected devices. diff --git a/qemu-options.hx b/qemu-options.hx index 8dd8ee3..99af8ed 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -252,7 +252,10 @@ drive letters depend on the target architecture. The x= 86 PC uses: a, b (floppy 1 and 2), c (first hard disk), d (first CD-ROM), n-p (Etherboot from network adapter 1-4), hard disk boot is the default. To apply a particular boot order only on the first startup, specify it via -@option{once}. +@option{once}. Note that the @option{order} or @option{once} parameter +should not be used together with the @option{bootindex} property of +devices, since the firmware implementations normally do not support both +at the same time. =20 Interactive boot menus/prompts can be enabled via @option{menu=3Don} as far as firmware/BIOS supports them. The default is non-interactive boot. --=20 1.8.3.1 From nobody Mon May 6 14:03:42 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.zoho.com; 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 1489508385948386.34210039904906; Tue, 14 Mar 2017 09:19:45 -0700 (PDT) Received: from localhost ([::1]:60557 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnpAj-0003SD-3e for importer@patchew.org; Tue, 14 Mar 2017 12:19:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36593) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnp9a-0003PQ-VD for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnp9Z-0006YC-Dj for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:30 -0400 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:35926) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cnp9Z-0006XZ-2u for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:29 -0400 Received: by mail-wr0-x244.google.com with SMTP id l37so24466485wrc.3 for ; Tue, 14 Mar 2017 09:18:29 -0700 (PDT) Received: from 640k.lan (94-39-132-181.adsl-ull.clienti.tiscali.it. [94.39.132.181]) by smtp.gmail.com with ESMTPSA id k195sm408197wmd.7.2017.03.14.09.18.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2017 09:18:27 -0700 (PDT) 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=DOEdHi8x1llQ7MmlXTDwM8Acbs9z/3chZ7yTd9K0XJ4=; b=mJM+vJS7sh7dEFCI7YpMUthtybjdiEcTTbEdf8LkCjAIbR9UFDPibrxOa6Fmc79nCE N3zDCpKhlRsnteYEMay4ceGUQd8Qfi4+OPcNho7eh9bGk/9YTIjl9+IQ9zIwDZCJe/xL o8dl+V+/MC06M5HJgtWbR52Qy51IRq4wNIx4xDBzTSLiIx7V6PKbCwFgd7CfpyMfvWn8 iLHEOMSgCc3FfTQEnw/1IgssKhVKo7zVEBb1ROfB8rlM8E53NbEod5L7g5W9Urw3X5mU fKZWBE0s3OJUK/3Qvlqi3H9vfkKmCZH5wK4XBFc+6w1aBhzyjyRsTfegUAf8682bE/55 LZFg== 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=DOEdHi8x1llQ7MmlXTDwM8Acbs9z/3chZ7yTd9K0XJ4=; b=aVj5zM75HKTV5hIYBvtkligQfssV4HNfB1ad228TEXuhOGD9O4t0KSjENBS0gS7TSm MZAYBcmfgm6WzdVtkaopD2yP/GcbZbEW5P7WDLs18v3Ed1ronBlXziJH/OC4e28f1y/E UiiR0Yv8H6E/tjI2ofELAeEKtodA5vrqXXLUUIfYHWCDB5fAdpc0rLN/BZsf1pSGe+4D Xrf3EEjXgmkIgqPjqXNVEWDk0Jm3Z07FN2RyQPtnS8IXthiQE+gWeIs8lXaRE+qH3/jT QDuRA/g3l+/TQp9a2WlAuxcKFv3kP2yF0i7v369O4Jlch80cJbdn2/GHTK2768X+mt3p BJkA== X-Gm-Message-State: AMke39lqsclBTCcTT0NYOHZvOMW9LRaFA72pIscxoRG5Vx2dv7WdY83qO8F7AthRsfnbZw== X-Received: by 10.223.169.161 with SMTP id b30mr34558402wrd.196.1489508307718; Tue, 14 Mar 2017 09:18:27 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 14 Mar 2017 17:18:05 +0100 Message-Id: <1489508300-48184-4-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> References: <1489508300-48184-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/18] mem-prealloc: reduce large guest start-up and migration time. 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: Jitendra Kolhe Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Jitendra Kolhe Using "-mem-prealloc" option for a large guest leads to higher guest start-up and migration time. This is because with "-mem-prealloc" option qemu tries to map every guest page (create address translations), and make sure the pages are available during runtime. virsh/libvirt by default, seems to use "-mem-prealloc" option in case the guest is configured to use huge pages. The patch tries to map all guest pages simultaneously by spawning multiple threads. Currently limiting the change to QEMU library functions on POSIX compliant host only, as we are not sure if the problem exists on win32. Below are some stats with "-mem-prealloc" option for guest configured to use huge pages. ------------------------------------------------------------------------ Idle Guest | Start-up time | Migration time ------------------------------------------------------------------------ Guest stats with 2M HugePage usage - single threaded (existing code) ------------------------------------------------------------------------ 64 Core - 4TB | 54m11.796s | 75m43.843s 64 Core - 1TB | 8m56.576s | 14m29.049s 64 Core - 256GB | 2m11.245s | 3m26.598s ------------------------------------------------------------------------ Guest stats with 2M HugePage usage - map guest pages using 8 threads ------------------------------------------------------------------------ 64 Core - 4TB | 5m1.027s | 34m10.565s 64 Core - 1TB | 1m10.366s | 8m28.188s 64 Core - 256GB | 0m19.040s | 2m10.148s ----------------------------------------------------------------------- Guest stats with 2M HugePage usage - map guest pages using 16 threads ----------------------------------------------------------------------- 64 Core - 4TB | 1m58.970s | 31m43.400s 64 Core - 1TB | 0m39.885s | 7m55.289s 64 Core - 256GB | 0m11.960s | 2m0.135s ----------------------------------------------------------------------- Changed in v2: - modify number of memset threads spawned to min(smp_cpus, 16). - removed 64GB memory restriction for spawning memset threads. Changed in v3: - limit number of threads spawned based on min(sysconf(_SC_NPROCESSORS_ONLN), 16, smp_cpus) - implement memset thread specific siglongjmp in SIGBUS signal_handler. Changed in v4 - remove sigsetjmp/siglongjmp and SIGBUS unblock/block for main thread as main thread no longer touches any pages. - simplify code my returning memset_thread_failed status from touch_all_pages. Signed-off-by: Jitendra Kolhe Message-Id: <1487907103-32350-1-git-send-email-jitendra.kolhe@hpe.com> Signed-off-by: Paolo Bonzini --- backends/hostmem.c | 4 +- exec.c | 2 +- include/qemu/osdep.h | 3 +- util/oslib-posix.c | 108 +++++++++++++++++++++++++++++++++++++++++------= ---- util/oslib-win32.c | 3 +- 5 files changed, 94 insertions(+), 26 deletions(-) diff --git a/backends/hostmem.c b/backends/hostmem.c index 7f5de70..162c218 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -224,7 +224,7 @@ static void host_memory_backend_set_prealloc(Object *ob= j, bool value, void *ptr =3D memory_region_get_ram_ptr(&backend->mr); uint64_t sz =3D memory_region_size(&backend->mr); =20 - os_mem_prealloc(fd, ptr, sz, &local_err); + os_mem_prealloc(fd, ptr, sz, smp_cpus, &local_err); if (local_err) { error_propagate(errp, local_err); return; @@ -328,7 +328,7 @@ host_memory_backend_memory_complete(UserCreatable *uc, = Error **errp) */ if (backend->prealloc) { os_mem_prealloc(memory_region_get_fd(&backend->mr), ptr, sz, - &local_err); + smp_cpus, &local_err); if (local_err) { goto out; } diff --git a/exec.c b/exec.c index aabb035..68135a9 100644 --- a/exec.c +++ b/exec.c @@ -1467,7 +1467,7 @@ static void *file_ram_alloc(RAMBlock *block, } =20 if (mem_prealloc) { - os_mem_prealloc(fd, area, memory, errp); + os_mem_prealloc(fd, area, memory, smp_cpus, errp); if (errp && *errp) { goto error; } diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index af37195..122ff06 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -438,7 +438,8 @@ unsigned long qemu_getauxval(unsigned long type); =20 void qemu_set_tty_echo(int fd, bool echo); =20 -void os_mem_prealloc(int fd, char *area, size_t sz, Error **errp); +void os_mem_prealloc(int fd, char *area, size_t sz, int smp_cpus, + Error **errp); =20 int qemu_read_password(char *buf, int buf_size); =20 diff --git a/util/oslib-posix.c b/util/oslib-posix.c index cd686aa..956f66a 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -55,6 +55,21 @@ #include "qemu/error-report.h" #endif =20 +#define MAX_MEM_PREALLOC_THREAD_COUNT (MIN(sysconf(_SC_NPROCESSORS_ONLN), = 16)) + +struct MemsetThread { + char *addr; + uint64_t numpages; + uint64_t hpagesize; + QemuThread pgthread; + sigjmp_buf env; +}; +typedef struct MemsetThread MemsetThread; + +static MemsetThread *memset_thread; +static int memset_num_threads; +static bool memset_thread_failed; + int qemu_get_thread_id(void) { #if defined(__linux__) @@ -316,18 +331,83 @@ char *qemu_get_exec_dir(void) return g_strdup(exec_dir); } =20 -static sigjmp_buf sigjump; - static void sigbus_handler(int signal) { - siglongjmp(sigjump, 1); + int i; + if (memset_thread) { + for (i =3D 0; i < memset_num_threads; i++) { + if (qemu_thread_is_self(&memset_thread[i].pgthread)) { + siglongjmp(memset_thread[i].env, 1); + } + } + } +} + +static void *do_touch_pages(void *arg) +{ + MemsetThread *memset_args =3D (MemsetThread *)arg; + char *addr =3D memset_args->addr; + uint64_t numpages =3D memset_args->numpages; + uint64_t hpagesize =3D memset_args->hpagesize; + sigset_t set, oldset; + int i =3D 0; + + /* unblock SIGBUS */ + sigemptyset(&set); + sigaddset(&set, SIGBUS); + pthread_sigmask(SIG_UNBLOCK, &set, &oldset); + + if (sigsetjmp(memset_args->env, 1)) { + memset_thread_failed =3D true; + } else { + for (i =3D 0; i < numpages; i++) { + memset(addr, 0, 1); + addr +=3D hpagesize; + } + } + pthread_sigmask(SIG_SETMASK, &oldset, NULL); + return NULL; +} + +static bool touch_all_pages(char *area, size_t hpagesize, size_t numpages, + int smp_cpus) +{ + uint64_t numpages_per_thread, size_per_thread; + char *addr =3D area; + int i =3D 0; + + memset_thread_failed =3D false; + memset_num_threads =3D MIN(smp_cpus, MAX_MEM_PREALLOC_THREAD_COUNT); + memset_thread =3D g_new0(MemsetThread, memset_num_threads); + numpages_per_thread =3D (numpages / memset_num_threads); + size_per_thread =3D (hpagesize * numpages_per_thread); + for (i =3D 0; i < memset_num_threads; i++) { + memset_thread[i].addr =3D addr; + memset_thread[i].numpages =3D (i =3D=3D (memset_num_threads - 1)) ? + numpages : numpages_per_thread; + memset_thread[i].hpagesize =3D hpagesize; + qemu_thread_create(&memset_thread[i].pgthread, "touch_pages", + do_touch_pages, &memset_thread[i], + QEMU_THREAD_JOINABLE); + addr +=3D size_per_thread; + numpages -=3D numpages_per_thread; + } + for (i =3D 0; i < memset_num_threads; i++) { + qemu_thread_join(&memset_thread[i].pgthread); + } + g_free(memset_thread); + memset_thread =3D NULL; + + return memset_thread_failed; } =20 -void os_mem_prealloc(int fd, char *area, size_t memory, Error **errp) +void os_mem_prealloc(int fd, char *area, size_t memory, int smp_cpus, + Error **errp) { int ret; struct sigaction act, oldact; - sigset_t set, oldset; + size_t hpagesize =3D qemu_fd_getpagesize(fd); + size_t numpages =3D DIV_ROUND_UP(memory, hpagesize); =20 memset(&act, 0, sizeof(act)); act.sa_handler =3D &sigbus_handler; @@ -340,23 +420,10 @@ void os_mem_prealloc(int fd, char *area, size_t memor= y, Error **errp) return; } =20 - /* unblock SIGBUS */ - sigemptyset(&set); - sigaddset(&set, SIGBUS); - pthread_sigmask(SIG_UNBLOCK, &set, &oldset); - - if (sigsetjmp(sigjump, 1)) { + /* touch pages simultaneously */ + if (touch_all_pages(area, hpagesize, numpages, smp_cpus)) { error_setg(errp, "os_mem_prealloc: Insufficient free host memory " "pages available to allocate guest RAM\n"); - } else { - int i; - size_t hpagesize =3D qemu_fd_getpagesize(fd); - size_t numpages =3D DIV_ROUND_UP(memory, hpagesize); - - /* MAP_POPULATE silently ignores failures */ - for (i =3D 0; i < numpages; i++) { - memset(area + (hpagesize * i), 0, 1); - } } =20 ret =3D sigaction(SIGBUS, &oldact, NULL); @@ -365,7 +432,6 @@ void os_mem_prealloc(int fd, char *area, size_t memory,= Error **errp) perror("os_mem_prealloc: failed to reinstall signal handler"); exit(1); } - pthread_sigmask(SIG_SETMASK, &oldset, NULL); } =20 =20 diff --git a/util/oslib-win32.c b/util/oslib-win32.c index 0b1890f..80e4668 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -541,7 +541,8 @@ int getpagesize(void) return system_info.dwPageSize; } =20 -void os_mem_prealloc(int fd, char *area, size_t memory, Error **errp) +void os_mem_prealloc(int fd, char *area, size_t memory, int smp_cpus, + Error **errp) { int i; size_t pagesize =3D getpagesize(); --=20 1.8.3.1 From nobody Mon May 6 14:03:42 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.zoho.com; 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 1489508415612205.5989536331639; Tue, 14 Mar 2017 09:20:15 -0700 (PDT) Received: from localhost ([::1]:60560 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnpB8-0003qc-8N for importer@patchew.org; Tue, 14 Mar 2017 12:20:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36592) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnp9a-0003PP-V4 for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnp9a-0006Yf-4n for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:30 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:34710) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cnp9Z-0006Xw-UJ for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:30 -0400 Received: by mail-wm0-x243.google.com with SMTP id u132so610113wmg.1 for ; Tue, 14 Mar 2017 09:18:29 -0700 (PDT) Received: from 640k.lan (94-39-132-181.adsl-ull.clienti.tiscali.it. [94.39.132.181]) by smtp.gmail.com with ESMTPSA id k195sm408197wmd.7.2017.03.14.09.18.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2017 09:18:28 -0700 (PDT) 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=OqJsYwHfAKWTtOiZOBAcJz8fm37T6jBqBKxiVRdNDq8=; b=ZC8XJ/PZxZYrlwYEOwaOvB+Qx+JilgvcvYbx/I79KoAUCOZG4xW8QOD+nJBg7a5Y2L jf7su5PQSHLeqSOTbSIPthvxN3Rr8yYA1Mff9rXjfiz4JVWwaK4rq3x9bJ8yhu4fGEYi 3Vw4DgQCWPy6QxAwhyDMS8CRg5HMxpwDfgsfGDapY/gYHX6I9Sn4SztqFb6wf0qGcZbm WaZtIf1yLz20CekNGTAR3HRiJHq4nv/Ne+Wim4VPbU6J3Cmv1S8hdRoh0E5AeDJ1qqfh JL/+F+PdnD8H1xyejZdv5pG/pSyQD44Fh2KEXygJbmuHk85MhdqSQxG7sv7YcrZqfwxg sRJw== 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=OqJsYwHfAKWTtOiZOBAcJz8fm37T6jBqBKxiVRdNDq8=; b=Km/u15O6CO6glmy+fvI30HZfZca+R+GmoZNK/8iFTYiBVTgvJej3rX0dcBxGKU8aeU y2wnqXBnUC2lURsHVhq2P45Er+U22t6094KzCbJJ5OtXApphLFsjMF713J6mV2oIDQwe NhGuoaja2Wz0lvL3nQIcHj2A6e5Fy42ZrMrDJNkEfYrwznrYpZSqYI0Lo3mzXcSaGso+ MhqTWOfVMQc4XoL03zZ6xl6VtMeD0HoiHG/DB0ELithIQwhdfJ/mkDglk1+v5b/sGd+D c1GbW18TciaIlCXhQX5xon2n18AwOATs3Dm6SIX+cEyZ+3OQjUsZmJfBLq1Pto86Nyqi 0S2g== X-Gm-Message-State: AFeK/H2iwCbxpKQFdsxKkeaTSpmzuyF0oLJniB4n3xO3VfxFTRGTspqRmVr+P1ECvouAcQ== X-Received: by 10.28.7.20 with SMTP id 20mr471449wmh.115.1489508308686; Tue, 14 Mar 2017 09:18:28 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 14 Mar 2017 17:18:06 +0100 Message-Id: <1489508300-48184-5-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> References: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PULL 04/18] exec: add cpu_synchronize_state to cpu_memory_rw_debug 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: Christian Borntraeger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Christian Borntraeger I sometimes got "Cannot access memory" when using the x command on the monitor. Turns out that the cpu env did contain stale data (e.g. wrong control register content for page table origin). We must synchronize the state of the CPU before walking the page tables. A similar issues happens for a remote gdb, so lets do the cpu_synchronize_state in cpu_memory_rw_debug. Signed-off-by: Christian Borntraeger Message-Id: <1488896348-13560-1-git-send-email-borntraeger@de.ibm.com> Signed-off-by: Paolo Bonzini --- exec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/exec.c b/exec.c index 68135a9..a22f5a0 100644 --- a/exec.c +++ b/exec.c @@ -43,6 +43,7 @@ #include "exec/ioport.h" #include "sysemu/dma.h" #include "sysemu/numa.h" +#include "sysemu/hw_accel.h" #include "exec/address-spaces.h" #include "sysemu/xen-mapcache.h" #include "trace-root.h" @@ -3309,6 +3310,7 @@ int cpu_memory_rw_debug(CPUState *cpu, target_ulong a= ddr, hwaddr phys_addr; target_ulong page; =20 + cpu_synchronize_state(cpu); while (len > 0) { int asidx; MemTxAttrs attrs; --=20 1.8.3.1 From nobody Mon May 6 14:03:42 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.zoho.com; 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 148950853171728.734817882916673; Tue, 14 Mar 2017 09:22:11 -0700 (PDT) Received: from localhost ([::1]:60573 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnpD5-0005ea-Ed for importer@patchew.org; Tue, 14 Mar 2017 12:22:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36607) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnp9b-0003Py-NY for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnp9a-0006ZG-NR for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:31 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:33424) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cnp9a-0006YY-Hp for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:30 -0400 Received: by mail-wm0-x242.google.com with SMTP id n11so609809wma.0 for ; Tue, 14 Mar 2017 09:18:30 -0700 (PDT) Received: from 640k.lan (94-39-132-181.adsl-ull.clienti.tiscali.it. [94.39.132.181]) by smtp.gmail.com with ESMTPSA id k195sm408197wmd.7.2017.03.14.09.18.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2017 09:18:29 -0700 (PDT) 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=cN2B9jW59t6EtHH9070os1kv/DQDE9vln9amoMWvOrg=; b=JadAapbi4X0gYp2vAiiDA09I3DlsPehRUGPMTaPCKCo2bL3S4C/Kfua49yjs43QDwQ mSFr/NgyDTjymOSH6J+OqRva8B1KPD2C8uvhYgOFdPZ+tonnfIi1Y0MpRf0rLr+uaAW5 jRjHwx5MtYO0OhHFbILmq2r9dUNTtG7fphQ8TAXfz1ZyVxKvfR7xciSYTi/4aJohfr7l /SYVaAqAFwztBqv/Twil7EL9AP2IjhJXCJO1oBW6PxDtkkeI1yiRIcOgAzr+SQw8tOjS 3heRiJExxyZ+Sna+v1ZiKDJsaoc8P+SZ3BIKmeD479uXoCBsbV1cU/Rwe8lHywOJPaoD jy+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:cc:subject:date:message-id :in-reply-to:references; bh=cN2B9jW59t6EtHH9070os1kv/DQDE9vln9amoMWvOrg=; b=Wzqm/Nxp7aSTVAO8FTaqtlKhnXrs8HBEzh6en0YNdsp4DTKdpw4vGtobXbYEFEd7c3 pCHeTIwYbsQqfbzCxZnpUa6kK357geath1ICHFJ7+iimmZslkusQr2ty0HKQdCmPLqu+ b8ELU92GRLOqqS3Uc62Zn4JaG+Zn51PHLyxKI1lORGZyGEtQsj4UhpAflTrT+dtNBKlO wKrT/wGvT1au0EsOxZ/g16FkfCxgWAa6pz8ojMXa5/VG34XiWrJLGujDaNXisJRmCwZi k+pKWIhgcmC4UQJjbXEex4GTuMwgIyMaIcXMjQHOzEfWidnL5rHT2nCoHfNm3amkNwSj kblQ== X-Gm-Message-State: AFeK/H0oc9NUzh0HomGcfI92eor4/zp/+BNqLnJfy1P48Gs3TGw4C7LFlWKP1PbQ0QcqyA== X-Received: by 10.28.15.202 with SMTP id 193mr461010wmp.99.1489508309632; Tue, 14 Mar 2017 09:18:29 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 14 Mar 2017 17:18:07 +0100 Message-Id: <1489508300-48184-6-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> References: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 05/18] kvm: Print MSR information if KVM_{GET, SET}_MSRS failed 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: Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Eduardo Habkost When a KVM_{GET,SET}_MSRS ioctl() fails, it is difficult to find out which MSR caused the problem. Print an error message for debugging, before we trigger the (ret =3D=3D cpu->kvm_msr_buf->nmsrs) assert. Suggested-by: Dr. David Alan Gilbert Signed-off-by: Eduardo Habkost Message-Id: <20170309194634.28457-1-ehabkost@redhat.com> Signed-off-by: Paolo Bonzini --- target/i386/kvm.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index 472399f..55865db 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -1824,6 +1824,12 @@ static int kvm_put_msrs(X86CPU *cpu, int level) return ret; } =20 + if (ret < cpu->kvm_msr_buf->nmsrs) { + struct kvm_msr_entry *e =3D &cpu->kvm_msr_buf->entries[ret]; + error_report("error: failed to set MSR 0x%" PRIx32 " to 0x%" PRIx6= 4, + (uint32_t)e->index, (uint64_t)e->data); + } + assert(ret =3D=3D cpu->kvm_msr_buf->nmsrs); return 0; } @@ -2189,6 +2195,12 @@ static int kvm_get_msrs(X86CPU *cpu) return ret; } =20 + if (ret < cpu->kvm_msr_buf->nmsrs) { + struct kvm_msr_entry *e =3D &cpu->kvm_msr_buf->entries[ret]; + error_report("error: failed to get MSR 0x%" PRIx32, + (uint32_t)e->index); + } + assert(ret =3D=3D cpu->kvm_msr_buf->nmsrs); /* * MTRR masks: Each mask consists of 5 parts --=20 1.8.3.1 From nobody Mon May 6 14:03:42 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.zoho.com; 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 1489508694784861.5291197718582; Tue, 14 Mar 2017 09:24:54 -0700 (PDT) Received: from localhost ([::1]:60584 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnpFk-0008G0-4A for importer@patchew.org; Tue, 14 Mar 2017 12:24:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36626) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnp9c-0003RF-QS for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnp9b-0006as-UA for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:32 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:36130) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cnp9b-0006Zp-Nx for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:31 -0400 Received: by mail-wm0-x242.google.com with SMTP id v190so583018wme.3 for ; Tue, 14 Mar 2017 09:18:31 -0700 (PDT) Received: from 640k.lan (94-39-132-181.adsl-ull.clienti.tiscali.it. [94.39.132.181]) by smtp.gmail.com with ESMTPSA id k195sm408197wmd.7.2017.03.14.09.18.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2017 09:18:29 -0700 (PDT) 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=BtzzJncUfGBJ06quNs0C9Jbyj2g16+0dD7H9es1iXUI=; b=E/hUX7DYW7I2ue8KgnJ4ZLwqkJ7tGJlM9/Jp1XtxLUFRRugEgmxaVTinQSQ5/k5UpX OT0aPj6AFaz3SkA43HkLeg7PSvAnlFZgJK1Z0mgxLwcQX4a/9duhxYCzCj4iWASpR4ui n+4JEeqPVWEnZALpsmICnKoFj7B1SR9KYLdbfLUbxCbdAUnYC3CjZyJUBTS2vBDMgDjk TgoXuwz11pguAiFEXLqC7Aoe/1F6x3G6fxCzOJPXfZuNEi2tfxg5Mb8yVX8tIo5FDfAV /3K6btLw5awmom/kmG8UE6hVxGk9JKuYOPjQ4TghAtoi5uNdZ+WfJy4Oa4drzq3FeVlk N3jQ== 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=BtzzJncUfGBJ06quNs0C9Jbyj2g16+0dD7H9es1iXUI=; b=W+gUUdaRJlIqAudlPgEXpYLyopBJwx/7K4AnZXrHAXXFRjv2mm0C5jvPimdR6viUx7 W686IP72g0ahoIvizynN8iB0gT11DDswZnYa6iLFIz68AfsNoMVu4h/vfJJMsksi2jCp Y6AMiHq818Dj+kKVKfR9x/+KpxOmredNTKxZ4kDiKbOkgfQyWyHVDJnF7m9h/o6Yt47C G8y9g4R27kJh5UBPKE2pNYYEj09ixF70LReKFxSErMhV02PyUIfFjqaawA7rc+YyA/rx PTmuXfbFQkH+v1Wg6nG5dAW2I1DM1RXuZtnRCYRixLYiyNwSfNGLkNE0jrhrN067XNid sIVg== X-Gm-Message-State: AFeK/H38u+s+Q01O8fUhIWtUYzbKCCyLvd7yhtmbBsnlWIGOc0QU8qObDRP6YxrndnWEJA== X-Received: by 10.28.51.140 with SMTP id z134mr538989wmz.55.1489508310594; Tue, 14 Mar 2017 09:18:30 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 14 Mar 2017 17:18:08 +0100 Message-Id: <1489508300-48184-7-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> References: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 06/18] kvmclock: Don't crash QEMU if KVM is disabled 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: Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Eduardo Habkost Most machines don't allow sysbus devices like "kvmclock" to be created from the command-line, but some of them do (the ones with has_dynamic_sysbus=3Dtrue). In those cases, it's possible to manually create a kvmclock device without KVM being enabled, making QEMU crash: $ qemu-system-x86_64 -machine q35,accel=3Dtcg -device kvmclock Segmentation fault (core dumped) This changes kvmclock's realize method to return an error if KVM is disabled, to ensure it won't crash QEMU. Signed-off-by: Eduardo Habkost Message-Id: <20170309185046.17555-1-ehabkost@redhat.com> Signed-off-by: Paolo Bonzini --- hw/i386/kvm/clock.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c index ef9d560..13eca37 100644 --- a/hw/i386/kvm/clock.c +++ b/hw/i386/kvm/clock.c @@ -22,6 +22,7 @@ #include "kvm_i386.h" #include "hw/sysbus.h" #include "hw/kvm/clock.h" +#include "qapi/error.h" =20 #include #include @@ -208,6 +209,11 @@ static void kvmclock_realize(DeviceState *dev, Error *= *errp) { KVMClockState *s =3D KVM_CLOCK(dev); =20 + if (!kvm_enabled()) { + error_setg(errp, "kvmclock device requires KVM"); + return; + } + kvm_update_clock(s); =20 qemu_add_vm_change_state_handler(kvmclock_vm_state_change, s); --=20 1.8.3.1 From nobody Mon May 6 14:03:42 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.zoho.com; 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 1489508832718660.0903465286988; Tue, 14 Mar 2017 09:27:12 -0700 (PDT) Received: from localhost ([::1]:60598 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnpHw-0001qo-Fb for importer@patchew.org; Tue, 14 Mar 2017 12:27:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36646) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnp9d-0003SB-Pd for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnp9c-0006bY-Qp for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:33 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:35653) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cnp9c-0006b0-KV for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:32 -0400 Received: by mail-wm0-x243.google.com with SMTP id z63so594445wmg.2 for ; Tue, 14 Mar 2017 09:18:32 -0700 (PDT) Received: from 640k.lan (94-39-132-181.adsl-ull.clienti.tiscali.it. [94.39.132.181]) by smtp.gmail.com with ESMTPSA id k195sm408197wmd.7.2017.03.14.09.18.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2017 09:18:30 -0700 (PDT) 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=6w+tFMJ10QVlzxANyl3g5zk528BWJD7+iY1kw/+p9cY=; b=QfESc9MjNnkrH07C7tOcB2GBVYf5SWajzxjQPDzICWaBTPBWkRMzH9OvOIh2KQLV6P 61MUVS1xBlhOVS4SHNbruZb8XEqxsu2R2welTlNadmaOdX+X9XntmHVUPqWTvnWc/oz9 mAxVbBRaerfMcEK8B390dVava38d+DyN7UiGIyL29PWVoWWspAhK+iu1AvHiv+VHuKo8 mOhsRTZWReKdZaFsGFfZg8+Pyot8M0xSFulIOSEIaULcG7ojMLZ7klvD7OVLc0dYiJum MCCBcGumI9zlA4f4FHt/AfoyUYApk0IGuuO4Joj67jfgUYFiTAxEJnHeIxlI7pX6LGMV 57RA== 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=6w+tFMJ10QVlzxANyl3g5zk528BWJD7+iY1kw/+p9cY=; b=ptp+ifJl7CYzjGwng4bv0rmc7bT3HU4zIF80rEJeWvYpDT1i197w+HmvKybGj4i3XQ 5wT0deugSxEIKx7AEcA9uYlkCBMcpjPlN1OtTK/JWTfLHAdUTJwTsnn4+M8JWGiDusVe uHCRZtLlne+9TCHscf8/QGtbIvhNFSi/h1BYDygtreDx91FHskTF8P/eOZGe7kdu8+xB llCyn5y+pSwVBWEAANCRIphXyPqWTRn+sDo/nGO4PDi+95/aYEwkg8J+zK1K1GBeTP4J 7rVECyH+Kaf8vA9QpWHP6sP1YBi7rkx+vjBNyc98zKWVxtUjayLswFPFiRP7k2tFvB0x rWrA== X-Gm-Message-State: AFeK/H3XLaGhpXNnq9boHBN1i3FsM49MsG6yWX9ScDTi48UYf/MdOWH9dOm8zWrKRXT8hg== X-Received: by 10.28.45.197 with SMTP id t188mr541520wmt.15.1489508311460; Tue, 14 Mar 2017 09:18:31 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 14 Mar 2017 17:18:09 +0100 Message-Id: <1489508300-48184-8-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> References: <1489508300-48184-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PULL 07/18] scripts/dump-guest-memory.py: fix int128_get64 on recent gcc 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: RSF_0 Z_629925259 SPT_0 From: Marc-Andr=C3=A9 Lureau The Int128 is no longer a struct, reaching a python exception: Python Exception Attempt to extract a component of a va= lue that is not a (null).: Replace struct access with a cast to uint64[] instead. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=3D1427466 Signed-off-by: Marc-Andr=C3=83=C2=A9 Lureau Message-Id: <20170310112819.16760-1-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- scripts/dump-guest-memory.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/dump-guest-memory.py b/scripts/dump-guest-memory.py index 9956fc0..f7c6635 100644 --- a/scripts/dump-guest-memory.py +++ b/scripts/dump-guest-memory.py @@ -314,8 +314,18 @@ def get_arch_phdr(endianness, elfclass): def int128_get64(val): """Returns low 64bit part of Int128 struct.""" =20 - assert val["hi"] =3D=3D 0 - return val["lo"] + try: + assert val["hi"] =3D=3D 0 + return val["lo"] + except gdb.error: + u64t =3D gdb.lookup_type('uint64_t').array(2) + u64 =3D val.cast(u64t) + if sys.byteorder =3D=3D 'little': + assert u64[1] =3D=3D 0 + return u64[0] + else: + assert u64[0] =3D=3D 0 + return u64[1] =20 =20 def qlist_foreach(head, field_str): --=20 1.8.3.1 From nobody Mon May 6 14:03:42 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.zoho.com; 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 148950880511959.79257428257347; Tue, 14 Mar 2017 09:26:45 -0700 (PDT) Received: from localhost ([::1]:60595 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnpHS-0001Qc-Pl for importer@patchew.org; Tue, 14 Mar 2017 12:26:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36660) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnp9e-0003Sx-Qn for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnp9d-0006cc-TR for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:34 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:35656) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cnp9d-0006bp-Ni for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:33 -0400 Received: by mail-wm0-x241.google.com with SMTP id z63so594514wmg.2 for ; Tue, 14 Mar 2017 09:18:33 -0700 (PDT) Received: from 640k.lan (94-39-132-181.adsl-ull.clienti.tiscali.it. [94.39.132.181]) by smtp.gmail.com with ESMTPSA id k195sm408197wmd.7.2017.03.14.09.18.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2017 09:18:31 -0700 (PDT) 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=9qPAmuza11ZzfAfDMBmoR2btkPTvzzmENFONzMEGpho=; b=UJGjAZ0DNHlo7KViaH/7f1BQpANHFIPvWt+Q5e8jn4IqEEege9+9pL99OrgxBT5aa8 EuivNSX1tsi2dd/IWTdr/VYvwiRkFVD4+TZ5bAcFpzza11oDUZlwGJOC+lejmyaUkHgf OQFqP017fWdl5Rprlz2gCcfL4rmsQyLQDaJm8mMVf2tmv3MjFrLuzhKZasPEV1+BhsNN FU1Byv4CYADftKVwiz3RhrfvTXhtt0+UuOVIXQpCTs96Drb1dWCcNgkGDuHnxjUB9ZjO itlQgOC6q+yXDI6+YQ4OCMBdQtYOrKd9e500Z6lEInWBrH9PTJA7y3y2/xhk8KpXx4Lg 645w== 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=9qPAmuza11ZzfAfDMBmoR2btkPTvzzmENFONzMEGpho=; b=f4UQjOkS5yYdy7/nxsQyr+iuY8+rtTK60SR9E1BORju77rl/B/USMH+OEUExeFCKgw CX+wWm0zbVKp4BN+wUaHo4Wk1AqjQA71qTuHDISCwUygHIzAY2QdUqkGvCMJqTveZsjW BmnmRP3ioxvmVlGopuN2wGncJtuJVgZx898/mCd3mPcGo9YVE+pMKt6/CWB7eYy+/97y oihtyYymVsjDQzDdhCk9fzrym7clD4DqBp4IBK+UKaFdXQGthVUWPqOEGfEuebotR7YJ OMm8jPBYP+jc2lG78Ur3nyyvnznjkAgW+MILbt188rPAcpxtaq8JgyGy33dFBwDf97ct GpWg== X-Gm-Message-State: AFeK/H0UnGVFZdlIf+92V98iOIECyLUQ2xQBCe1zWSMhkUlaiQ+a7K2CWDW2xGpIPTCvsg== X-Received: by 10.28.238.66 with SMTP id m63mr491890wmh.121.1489508312518; Tue, 14 Mar 2017 09:18:32 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 14 Mar 2017 17:18:10 +0100 Message-Id: <1489508300-48184-9-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> References: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 08/18] configure: add the missing help output for optional 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: Lin Ma Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Lin Ma Signed-off-by: Lin Ma Message-Id: <20170310101405.26974-1-lma@suse.com> Signed-off-by: Paolo Bonzini --- configure | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/configure b/configure index 75c7c35..99d8bec 100755 --- a/configure +++ b/configure @@ -1330,6 +1330,12 @@ Advanced options (experts only): --with-vss-sdk=3DSDK-path enable Windows VSS support in QEMU Guest Agent --with-win-sdk=3DSDK-path path to Windows Platform SDK (to build VSS .t= lb) --tls-priority default TLS protocol/cipher priority string + --enable-gprof QEMU profiling with gprof + --enable-profiler profiler support + --enable-xen-pv-domain-build + xen pv domain builder + --enable-debug-stack-usage + track the maximum stack usage of stacks created= by qemu_alloc_stack =20 Optional features, enabled with --enable-FEATURE and disabled with --disable-FEATURE, default is enabled if available: @@ -1397,6 +1403,12 @@ disabled with --disable-FEATURE, default is enabled = if available: tcmalloc tcmalloc support jemalloc jemalloc support replication replication support + vhost-vsock virtio sockets device support + opengl opengl support + virglrenderer virgl rendering support + xfsctl xfsctl support + qom-cast-debug cast debugging support + tools build qemu-io, qemu-nbd and qemu-image tools =20 NOTE: The object files are built at the place where configure is launched EOF --=20 1.8.3.1 From nobody Mon May 6 14:03:42 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.zoho.com; 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 1489508389961491.79532527795027; Tue, 14 Mar 2017 09:19:49 -0700 (PDT) Received: from localhost ([::1]:60558 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnpAp-0003Z5-GV for importer@patchew.org; Tue, 14 Mar 2017 12:19:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36677) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnp9f-0003Te-Ja for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnp9e-0006dP-Pp for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:35 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:35658) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cnp9e-0006cs-Jk for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:34 -0400 Received: by mail-wm0-x242.google.com with SMTP id z63so594581wmg.2 for ; Tue, 14 Mar 2017 09:18:34 -0700 (PDT) Received: from 640k.lan (94-39-132-181.adsl-ull.clienti.tiscali.it. [94.39.132.181]) by smtp.gmail.com with ESMTPSA id k195sm408197wmd.7.2017.03.14.09.18.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2017 09:18:32 -0700 (PDT) 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=Q2JHsdwAFOwhkx60r6d38pB3EKWaLVR8buCNSB2wTYw=; b=XCeMdYgjFdDGWvV+4cCb+wLl8brnq8nRm1Ezf52+7XKBrCNNy09B5RFklJ0xRR/eVB t325rMq/qZjvb3cGM0hmwbc60A/xMD+ihLXROoImFp7PViNQke5QBo7txmv4ymMzA4nj lcMmDHQrgXjoRjnTL+DHwPRqWYui0vqO/w3SGYHbbobhLhHbSGsHf/0we0vX8/M+eum5 pk9uA+zy3+gSp7Be0ierHX1iy/ABcalfSa3A0Mzwe4f2vwhfKGeb8Lnnl+sMfgddMYtg oV3u34eTZ8IjjbMOdYY8hFtpCVrj3bKssN6DoeqA9JkAwgFc0ALE2B5U8Zzz5sIRmKtk W1XA== 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=Q2JHsdwAFOwhkx60r6d38pB3EKWaLVR8buCNSB2wTYw=; b=uYJtAiBYJr8P6SoeDWpKkE7Uh22JQ7l2COCgPVfU359626WSLZVCLYe/8gDSE8Uet6 KN0xIN4JF8eaYeEcDR4VeXZ8+i4mf6ENdaBzdkc0Nd70d/ru7MjvdSw7C0+XlwOQZY9i Ln1lAuiIgg6iRCwYJUoOFi3FjlWuZ+TNfsDHcCNypiyS4J96f8jBjY36YAFVTT9ZwaXC 6gbqlcGvYd7qxo2L26D38aqu1xu+KoT2GNN/YmfDmBxEvWeCqfF8miFM8uT5jNPLwS33 7VEpMLyfYAJtGHEYD0EudmTkrE4kMRxCfcW6Od+AIopL1MoxJJxQiH+T3nnZ6wBwsI3T bZ8A== X-Gm-Message-State: AFeK/H2rhEDk5p4/xYDvAXWXazqDdXWTkm6na98YGTAWRFe5TLawTan6sfI2kVn3Ze68wQ== X-Received: by 10.28.1.209 with SMTP id 200mr16054322wmb.74.1489508313390; Tue, 14 Mar 2017 09:18:33 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 14 Mar 2017 17:18:11 +0100 Message-Id: <1489508300-48184-10-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> References: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 09/18] util: Removed unneeded header from path.c 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: Suramya Shah Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Suramya Shah Signed-off-by: Suramya Shah Reviewed-by: Eric Blake Message-Id: <20170310163948.7567-1-shah.suramya@gmail.com> Signed-off-by: Paolo Bonzini --- util/path.c | 1 - 1 file changed, 1 deletion(-) diff --git a/util/path.c b/util/path.c index 5479f76..7f9fc27 100644 --- a/util/path.c +++ b/util/path.c @@ -6,7 +6,6 @@ #include "qemu/osdep.h" #include #include -#include "qemu-common.h" #include "qemu/cutils.h" #include "qemu/path.h" =20 --=20 1.8.3.1 From nobody Mon May 6 14:03:42 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.zoho.com; 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 1489508965279812.8359084908487; Tue, 14 Mar 2017 09:29:25 -0700 (PDT) Received: from localhost ([::1]:60607 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnpK7-0003vk-RC for importer@patchew.org; Tue, 14 Mar 2017 12:29:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36732) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnp9i-0003XX-Rf for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnp9f-0006e0-L1 for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:38 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:35659) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cnp9f-0006dX-El; Tue, 14 Mar 2017 12:18:35 -0400 Received: by mail-wm0-x243.google.com with SMTP id z63so594616wmg.2; Tue, 14 Mar 2017 09:18:35 -0700 (PDT) Received: from 640k.lan (94-39-132-181.adsl-ull.clienti.tiscali.it. [94.39.132.181]) by smtp.gmail.com with ESMTPSA id k195sm408197wmd.7.2017.03.14.09.18.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2017 09:18:33 -0700 (PDT) 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=FaOFUuUJPTTFES6IoT+VdGN7mVm4dR8JcDuTtmTvfmY=; b=ApmUcmQkNmE0EEhqaV107iTu43kg4ccqGsHl95bHjezDueBBrTKnVmZGipwPOBwxzt gNVphCDJxy9AnH74FUnN45N2Xsa2ROr7+xAxBIKL36uJQVsZxobCPxk4cHq+bz4xkRyR 6R78wYIC93HECwG1je+sltuq9fylNpSDOxCM2LK2e2UXSv/adS254+TS41ewVo6yvKOw /t7F9HjS6fz9Ob86C3B7Of7kGYvox1MJiDRDhw0pD2NdbPs7Uc5sejtYfk6swGYqIVjx I1lTSbBQcqmbmCAxTZeuJlTN+I15Ycv4mXzHq4Upn4Cb10vdbfHFbn59I9dC/tTpmQvO bLrQ== 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=FaOFUuUJPTTFES6IoT+VdGN7mVm4dR8JcDuTtmTvfmY=; b=bHSeJ4PQRkXr3JI9tSGy2C/Dx7O0H7YzifQcJjccfSAm1BpM16EhtH1z3ensI/Dp2n D5UP53aPaQFGRXxBbN39irokT1h1g2ZR5zuTSj5g31v1ox47Fo0vubczlaLk2tYVqOml e/jNYYSmh9eHdarRJUX5mE4J+0QFdSEZN9WGT4H+bArFv24mXadV5APcCEUJjuKaa6Y+ FH6edSpdZhYRWLMyBkCLGoAEgLvfTTLYhliZ2f0VIDVDJf1ipJ+4T3nmMv7A1/pQfqu7 AvEPWJR4sHYI0Og5k/KAMENsfrhzxn8g2KeogEhROyFHKcEKDLKXVAnPltmPabtkhbKk JDaQ== X-Gm-Message-State: AFeK/H0KHqxVCjfaKuGqWWEekRlQYmeds97J5eNPnSGL94IubFK06z1tRD7Q6QCgrQzCSQ== X-Received: by 10.28.66.207 with SMTP id k76mr15867411wmi.121.1489508314500; Tue, 14 Mar 2017 09:18:34 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 14 Mar 2017 17:18:12 +0100 Message-Id: <1489508300-48184-11-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> References: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PULL 10/18] scsi: mptsas: fix the wrong reading size in fetch request 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: Li Qiang , Li Qiang , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Li Qiang When fetching request, it should read sizeof(*hdr), not the pointer hdr. Signed-off-by: Li Qiang Message-Id: <1489488980-130668-1-git-send-email-liqiang6-s@360.cn> Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini --- hw/scsi/mptsas.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/scsi/mptsas.c b/hw/scsi/mptsas.c index 2e091c0..765ab53 100644 --- a/hw/scsi/mptsas.c +++ b/hw/scsi/mptsas.c @@ -756,7 +756,7 @@ static void mptsas_fetch_request(MPTSASState *s) =20 /* Read the message header from the guest first. */ addr =3D s->host_mfa_high_addr | MPTSAS_FIFO_GET(s, request_post); - pci_dma_read(pci, addr, req, sizeof(hdr)); + pci_dma_read(pci, addr, req, sizeof(*hdr)); =20 if (hdr->Function < ARRAY_SIZE(mpi_request_sizes) && mpi_request_sizes[hdr->Function]) { @@ -766,8 +766,8 @@ static void mptsas_fetch_request(MPTSASState *s) */ size =3D mpi_request_sizes[hdr->Function]; assert(size <=3D MPTSAS_MAX_REQUEST_SIZE); - pci_dma_read(pci, addr + sizeof(hdr), &req[sizeof(hdr)], - size - sizeof(hdr)); + pci_dma_read(pci, addr + sizeof(*hdr), &req[sizeof(*hdr)], + size - sizeof(*hdr)); } =20 if (hdr->Function =3D=3D MPI_FUNCTION_SCSI_IO_REQUEST) { --=20 1.8.3.1 From nobody Mon May 6 14:03:42 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.zoho.com; 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 1489508680126600.9409100678007; Tue, 14 Mar 2017 09:24:40 -0700 (PDT) Received: from localhost ([::1]:60583 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnpFR-00080U-QS for importer@patchew.org; Tue, 14 Mar 2017 12:24:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36731) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnp9i-0003XW-RP for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnp9g-0006en-Jq for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:38 -0400 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:34819) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cnp9g-0006eC-Cs for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:36 -0400 Received: by mail-wr0-x242.google.com with SMTP id u108so24540470wrb.2 for ; Tue, 14 Mar 2017 09:18:36 -0700 (PDT) Received: from 640k.lan (94-39-132-181.adsl-ull.clienti.tiscali.it. [94.39.132.181]) by smtp.gmail.com with ESMTPSA id k195sm408197wmd.7.2017.03.14.09.18.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2017 09:18:34 -0700 (PDT) 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=PoqgYNHAJhsOTJvFYIovx5jb8+Nq/KLcpTVQFHTVK3k=; b=Xky7Ve9/Hb5OGTG3Ta2igbBzkWTGHmAevpXei/o7GIju3syfEgbKub5xJh5Vx3Ijqo IAIRNY24jRiq9+foTXjR4o1jkEHpu6rTnRO22n66YGahDC38nWkcVjdLPjdmFNe/7ZOB lZEKaGTCi+1f4T0XgPeKOuAz0+B/QS5hj+CK3IU0lZ0+pxfmw0dfHMyvVG89KMHokjZB qChLKKuVpShw96I3RBZBK3555gqXvDN9SRERJFV7Pn1mxtLPxyw1CJRbBD7dAvfqO4zC WSNWQ0ASnp++cES0+1P58o45RDKa6DQDOdzZsoMr+7h7pnQHXv3Qm1jL6kD7Nz2QAktN iwBQ== 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=PoqgYNHAJhsOTJvFYIovx5jb8+Nq/KLcpTVQFHTVK3k=; b=ak/zVnyBZtDAAOZxYwda8kNaXx1GooEKi9yt9Y9+KyQoHq4bd7bwVhhPlnGTAezQbX Ig5ZSUSSaOoZmOgKDN00ScOOjYPxaZ4sq0jk8VZ4CjUNhXlRnkUWD8gckPn/hjexYVgC MtARGQ/m2eG+uCH2aZTGq5pJBtvDmvlVxqZLFYNBausXqD9v8v4/BC7izJ+aECG5l32M VzY7LLDUaKOzx4lG8p+/x6Gzy1Dwjrn8YJnwnAzB4XW2wBGPdYkX9nR5+L/lSgAoKpif lNhiKZfCUpceS/dEJOibTnLJAg6SIIebp4wnuZ5c/FUpKij/+32yFmrz419TyyampnE5 LRUA== X-Gm-Message-State: AMke39lovQCwN5f/IV9x3z81qsC9canfS/q9u3tx9MvpbehUODnhZbdkb/e0tglBYVdR8g== X-Received: by 10.223.169.161 with SMTP id b30mr34558885wrd.196.1489508315303; Tue, 14 Mar 2017 09:18:35 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 14 Mar 2017 17:18:13 +0100 Message-Id: <1489508300-48184-12-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> References: <1489508300-48184-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 11/18] target/nios2: take BQL around interrupt check 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: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The interrupt controller does not have its own locking. Signed-off-by: Paolo Bonzini --- target/nios2/op_helper.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/nios2/op_helper.c b/target/nios2/op_helper.c index 538853c..efb1c48 100644 --- a/target/nios2/op_helper.c +++ b/target/nios2/op_helper.c @@ -21,6 +21,7 @@ #include "cpu.h" #include "exec/helper-proto.h" #include "exec/cpu_ldst.h" +#include "qemu/main-loop.h" =20 #if !defined(CONFIG_USER_ONLY) void helper_mmu_read_debug(CPUNios2State *env, uint32_t rn) @@ -35,7 +36,9 @@ void helper_mmu_write(CPUNios2State *env, uint32_t rn, ui= nt32_t v) =20 void helper_check_interrupts(CPUNios2State *env) { + qemu_mutex_lock_iothread(); nios2_check_interrupts(env); + qemu_mutex_unlock_iothread(); } #endif /* !CONFIG_USER_ONLY */ =20 --=20 1.8.3.1 From nobody Mon May 6 14:03:42 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.zoho.com; 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 1489508542018989.5946504917326; Tue, 14 Mar 2017 09:22:22 -0700 (PDT) Received: from localhost ([::1]:60574 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnpDC-0005jV-Ki for importer@patchew.org; Tue, 14 Mar 2017 12:22:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnp9i-0003XY-RR for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnp9h-0006fm-FN for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:38 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:36136) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cnp9h-0006es-84 for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:37 -0400 Received: by mail-wm0-x243.google.com with SMTP id v190so583324wme.3 for ; Tue, 14 Mar 2017 09:18:37 -0700 (PDT) Received: from 640k.lan (94-39-132-181.adsl-ull.clienti.tiscali.it. [94.39.132.181]) by smtp.gmail.com with ESMTPSA id k195sm408197wmd.7.2017.03.14.09.18.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2017 09:18:35 -0700 (PDT) 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=x2YiLPvlct4lKtZehtyRnOoVtOlQPImtOorsSH0q/is=; b=OODQBIcBHw9rYKEMXofsNONrGmde97vKHBWnsxGUpjdXbMZ34OGIbOUGkHpfD+2iIq MMPn4zGdjGU0YYVxIjlTsNHuLqioikt2/M8V2rqKRDdEBbm3/9HNsXcavUd3Ny41DCQF G6Uw448n6W8g8TaKhtgNvLZz5HN7HIiXxBH5rP53DuDKARSqMaRF0+4KHH94/tI9RYt0 mI5+bOdW4IqnFyRXCeaBAbVNeqbm2p5fd68c/Ra6jFljeYTxQEtC92SGiJQ3SaZY38r6 8geixZY42le9TfMQCp46HEaQ0FAADmRd8SdvkxYyEMQ45mGhh5hV8/STZSrpfNWMEUnj 63GQ== 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=x2YiLPvlct4lKtZehtyRnOoVtOlQPImtOorsSH0q/is=; b=OEuJ9IMkt5101CAU07BT95CQC5TmhlHeV6kAkc3TFRsQqPApQjt6wSkQUKeW2DGTmF oExVoSOebR4Jgr+YgNf/IsHHvSq+SefHKYK3VG+4fQ81+yslp/GvHLEZFvAkdPeC6kRG iVHDm7au4XR0DYCdvcHqQfMeDsvBIMLGX8db3vbUzKthk1TkEb+CbGRMviwNJof6o44h HaI2JVhqmeQq7qX/ail7D4Icef2wx3GKk3viwj6flJfyZNw3qzYWY/a8NUg5Es0Pmw0o PS3WK6q4C3syZ5OkMlufGbC3VqG7qpfaXGn3pDy2KLATnvS9JpkrdxuXrC56lKgB0QQF aSlg== X-Gm-Message-State: AFeK/H1BLKBQ76P69VzHF0jy9tYxOkPnPUHy/F0fUlTcep8+lHWxPWMRmBBby2Z7I5IB6g== X-Received: by 10.28.17.11 with SMTP id 11mr15531221wmr.32.1489508316144; Tue, 14 Mar 2017 09:18:36 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 14 Mar 2017 17:18:14 +0100 Message-Id: <1489508300-48184-13-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> References: <1489508300-48184-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PULL 12/18] qemu-timer: fix off-by-one 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: RSF_0 Z_629925259 SPT_0 If the first timer is exactly at the current value of the clock, the deadline is met and the timer should fire. This fixes itself on the next iteration of the loop without icount; with icount, however, execution of instructions will stop exactly at the deadline and won't proceed. Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Edgar E. Iglesias Signed-off-by: Paolo Bonzini --- util/qemu-timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/qemu-timer.c b/util/qemu-timer.c index 6cf70b9..2f20151 100644 --- a/util/qemu-timer.c +++ b/util/qemu-timer.c @@ -199,7 +199,7 @@ bool timerlist_expired(QEMUTimerList *timer_list) expire_time =3D timer_list->active_timers->expire_time; qemu_mutex_unlock(&timer_list->active_timers_lock); =20 - return expire_time < qemu_clock_get_ns(timer_list->clock->type); + return expire_time <=3D qemu_clock_get_ns(timer_list->clock->type); } =20 bool qemu_clock_expired(QEMUClockType type) --=20 1.8.3.1 From nobody Mon May 6 14:03:42 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.zoho.com; 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 1489508813942868.6235617311131; Tue, 14 Mar 2017 09:26:53 -0700 (PDT) Received: from localhost ([::1]:60597 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnpHe-0001as-LR for importer@patchew.org; Tue, 14 Mar 2017 12:26:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnp9j-0003YQ-No for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnp9i-0006gS-Fp for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:39 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:33434) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cnp9i-0006fw-73 for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:38 -0400 Received: by mail-wm0-x242.google.com with SMTP id n11so610229wma.0 for ; Tue, 14 Mar 2017 09:18:38 -0700 (PDT) Received: from 640k.lan (94-39-132-181.adsl-ull.clienti.tiscali.it. [94.39.132.181]) by smtp.gmail.com with ESMTPSA id k195sm408197wmd.7.2017.03.14.09.18.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2017 09:18:36 -0700 (PDT) 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=3kQqjdCdQZNGHExjbPhul+Ktpnp2d+xyJtaYDtVUHCM=; b=ShF+FV/ZdZYg0Nis2SwP+686BiTEFDIGZxEuP/q3quW2EW7PfvF0McgY6UaYpeTDjf BcnCeqMZK5C3bHnXi1xSO2ezfsWinTSL0bJnNN2FlDJUznB5QjytZyuSfB8hElZuzpyw OepvReWxQg8Pe/YiojaXDFSIs6I4d9xi0IGCm1PIZ1sXifzqkdv66EzLIGtqy78tg3EH kiOY5LXsbNm7MyWYFW58klaZni0qsT0mdfDUxUdWOgypoalO1d0kFmNmf7H1LuZgQIoW /0DcXPtqpmY5umsLZR86nwpoWpZwCxoVm0UF5MwHNh32LztYUxMQrGK44w8fhLEeMt4f DpLg== 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=3kQqjdCdQZNGHExjbPhul+Ktpnp2d+xyJtaYDtVUHCM=; b=Z/UTgX+b/WnZmGzpj6A4ub9o4u2+dz1Da70Ma1cB6vIoNet9/IR0Sc+jNNFD5EnOVF uBFProZVbYFVL7jySkX1Nc0uTGeMkrxeihRNF8014Fd0m03ObBJfw+/by4T+b9DkZQbo TVO/K3uvF85UOrJd9C+v8AfUYYxPGk5JexRsn6OMWTui+OrWyu0IQl+VtxSFTjSgWli7 HcHn5a8pzp/I293IMZN8lJpkoKRQN6VJBgkUZP5nI1oIRb7aEaX/iBDNjkEgRo+s4nfc YEnEpXfGT2q+5OmSYOAcFjSY0cclVbDSQnUbS1272JwkWlttpJ9p54KW32OP0fXxXAMX pM9g== X-Gm-Message-State: AFeK/H0oQJlSyDsl6C2YCHXYNNBiCxmb8LjulgszOata6/iGiHVHudINehJh6i3l84UMOA== X-Received: by 10.28.8.213 with SMTP id 204mr529247wmi.100.1489508317021; Tue, 14 Mar 2017 09:18:37 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 14 Mar 2017 17:18:15 +0100 Message-Id: <1489508300-48184-14-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> References: <1489508300-48184-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 13/18] qemu-timer: do not include sysemu/cpus.h from util/qemu-timer.h 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: RSF_0 Z_629925259 SPT_0 This dependency is the wrong way, and we will need util/qemu-timer.h from sysemu/cpus.h in the next patch. Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Edgar E. Iglesias Signed-off-by: Paolo Bonzini --- cpu-exec.c | 1 + hw/core/ptimer.c | 1 + hw/ppc/pnv.c | 1 + include/qemu/timer.h | 1 - include/sysemu/cpus.h | 2 ++ kvm-all.c | 1 + monitor.c | 1 + replay/replay.c | 1 + target/alpha/translate.c | 1 + translate-all.c | 1 + util/main-loop.c | 1 + util/qemu-timer.c | 1 + 12 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cpu-exec.c b/cpu-exec.c index d04dd91..748cb66 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -33,6 +33,7 @@ #if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY) #include "hw/i386/apic.h" #endif +#include "sysemu/cpus.h" #include "sysemu/replay.h" =20 /* -icount align implementation. */ diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c index 59ccb00..7221c68 100644 --- a/hw/core/ptimer.c +++ b/hw/core/ptimer.c @@ -13,6 +13,7 @@ #include "sysemu/replay.h" #include "sysemu/qtest.h" #include "block/aio.h" +#include "sysemu/cpus.h" =20 #define DELTA_ADJUST 1 #define DELTA_NO_ADJUST -1 diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 09f0d22..3fa722a 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -21,6 +21,7 @@ #include "qapi/error.h" #include "sysemu/sysemu.h" #include "sysemu/numa.h" +#include "sysemu/cpus.h" #include "hw/hw.h" #include "target/ppc/cpu.h" #include "qemu/log.h" diff --git a/include/qemu/timer.h b/include/qemu/timer.h index 26e6285..91cd8c8 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -4,7 +4,6 @@ #include "qemu-common.h" #include "qemu/notify.h" #include "qemu/host-utils.h" -#include "sysemu/cpus.h" =20 #define NANOSECONDS_PER_SECOND 1000000000LL =20 diff --git a/include/sysemu/cpus.h b/include/sysemu/cpus.h index a73b5d4..e521a91 100644 --- a/include/sysemu/cpus.h +++ b/include/sysemu/cpus.h @@ -1,6 +1,8 @@ #ifndef QEMU_CPUS_H #define QEMU_CPUS_H =20 +#include "qemu/timer.h" + /* cpus.c */ bool qemu_in_vcpu_thread(void); void qemu_init_cpu_loop(void); diff --git a/kvm-all.c b/kvm-all.c index 9040bd5..90b8573 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -29,6 +29,7 @@ #include "hw/s390x/adapter.h" #include "exec/gdbstub.h" #include "sysemu/kvm_int.h" +#include "sysemu/cpus.h" #include "qemu/bswap.h" #include "exec/memory.h" #include "exec/ram_addr.h" diff --git a/monitor.c b/monitor.c index f11893e..be282ec 100644 --- a/monitor.c +++ b/monitor.c @@ -77,6 +77,7 @@ #include "qapi-event.h" #include "qmp-introspect.h" #include "sysemu/qtest.h" +#include "sysemu/cpus.h" #include "qemu/cutils.h" #include "qapi/qmp/dispatch.h" =20 diff --git a/replay/replay.c b/replay/replay.c index 1835b99..78e2a7e 100644 --- a/replay/replay.c +++ b/replay/replay.c @@ -16,6 +16,7 @@ #include "replay-internal.h" #include "qemu/timer.h" #include "qemu/main-loop.h" +#include "sysemu/cpus.h" #include "sysemu/sysemu.h" #include "qemu/error-report.h" =20 diff --git a/target/alpha/translate.c b/target/alpha/translate.c index 055286a..df5d695 100644 --- a/target/alpha/translate.c +++ b/target/alpha/translate.c @@ -19,6 +19,7 @@ =20 #include "qemu/osdep.h" #include "cpu.h" +#include "sysemu/cpus.h" #include "disas/disas.h" #include "qemu/host-utils.h" #include "exec/exec-all.h" diff --git a/translate-all.c b/translate-all.c index 34480ae..b3ee876 100644 --- a/translate-all.c +++ b/translate-all.c @@ -57,6 +57,7 @@ #include "qemu/timer.h" #include "qemu/main-loop.h" #include "exec/log.h" +#include "sysemu/cpus.h" =20 /* #define DEBUG_TB_INVALIDATE */ /* #define DEBUG_TB_FLUSH */ diff --git a/util/main-loop.c b/util/main-loop.c index ca7bb07..7efc229 100644 --- a/util/main-loop.c +++ b/util/main-loop.c @@ -28,6 +28,7 @@ #include "qemu/timer.h" #include "qemu/sockets.h" // struct in_addr needed for libslirp.h #include "sysemu/qtest.h" +#include "sysemu/cpus.h" #include "slirp/libslirp.h" #include "qemu/main-loop.h" #include "block/aio.h" diff --git a/util/qemu-timer.c b/util/qemu-timer.c index 2f20151..ac99340 100644 --- a/util/qemu-timer.c +++ b/util/qemu-timer.c @@ -27,6 +27,7 @@ #include "qemu/timer.h" #include "sysemu/replay.h" #include "sysemu/sysemu.h" +#include "sysemu/cpus.h" =20 #ifdef CONFIG_POSIX #include --=20 1.8.3.1 From nobody Mon May 6 14:03:42 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.zoho.com; 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 1489508939579875.9574846374467; Tue, 14 Mar 2017 09:28:59 -0700 (PDT) Received: from localhost ([::1]:60605 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnpJh-0003Vi-8O for importer@patchew.org; Tue, 14 Mar 2017 12:28:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36779) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnp9k-0003ZN-OF for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnp9j-0006hb-H5 for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:40 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:34720) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cnp9j-0006gW-7F for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:39 -0400 Received: by mail-wm0-x244.google.com with SMTP id u132so610686wmg.1 for ; Tue, 14 Mar 2017 09:18:39 -0700 (PDT) Received: from 640k.lan (94-39-132-181.adsl-ull.clienti.tiscali.it. [94.39.132.181]) by smtp.gmail.com with ESMTPSA id k195sm408197wmd.7.2017.03.14.09.18.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2017 09:18:37 -0700 (PDT) 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=rsoT7eMp7mDKimg6oNufifgS+UmKe20eQZhOkSHNvDc=; b=TT/6iaOtV6TMYXlQGTzpNP5jwJdU22MOfNZhino/bs/AYTTemliljEVRGnpsOunLB3 a+Hn5oPkb62AkgYjaTaXcPjD/sBUv1MIX/2xOTIlerut6E0/DJB2ti7iylBjvoQXakHc vSi/TBZMqATgBp2bkSyXWXvOLiJh0ur4OYDqdTk6vmzDz0LgwZxVjy+jf7PIz4OzkkEk KizRjq8py1UzfpPd1N09oBWqJVYj9HHn1WnUURW+emXrR+mBXNmxZ5d4RJDcCl6ImP2r ufmJqXKQayCDeVOo3At+MF0MaL7oHGWnUT+k1c3gdQSfRK/j6ixHxXXpM+cqcAojyYPi BTYQ== 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=rsoT7eMp7mDKimg6oNufifgS+UmKe20eQZhOkSHNvDc=; b=e19kYNlSuooYQrZ6/ZeHtz4FUYqHvUyCydDOO5wL4w75jEJG7C4qK30bzMkoZoKrZH f2vt8d1rIMK3EPRu0YSmHVH2WA7JTHKPBKPOc42/1xjnQf65DYs3iaLltJNVBdrf3Z8A 3ztcrIP/dnMzj4Z6vMvu6hVSHYwDeDKG+tYEXZVw+JvO1UXzLW5L0jSKdeiTSkvNxwzT j6Ydffns4bLxPR/dpeAUidb+Wapqiaqr7vQW6Z8rYUSXvvUajy8lBKhvmeb3Yf9fIDTl ex/BWAVwdPxrPcZ0hhvFD7xPnCEMppa36H8OYm9AlLzkGkFaOd0Xcd9KXEka3AvJuaYt GXUQ== X-Gm-Message-State: AFeK/H3Ut5gr4zZAMvBdhtH/wWHtCLDhaFFZTcMN1ktxC785grJ+924l9wH6Ie1ckM+2lw== X-Received: by 10.28.159.73 with SMTP id i70mr533698wme.78.1489508317947; Tue, 14 Mar 2017 09:18:37 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 14 Mar 2017 17:18:16 +0100 Message-Id: <1489508300-48184-15-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> References: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 14/18] cpus: define QEMUTimerListNotifyCB for QEMU system emulation 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: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" There is no change for now, because the callback just invokes qemu_notify_event. Reviewed-by: Edgar E. Iglesias Signed-off-by: Paolo Bonzini --- cpus.c | 5 +++++ include/qemu/timer.h | 4 ++-- include/sysemu/cpus.h | 1 + stubs/cpu-get-icount.c | 6 ++++++ tests/test-aio-multithread.c | 2 +- tests/test-aio.c | 2 +- util/async.c | 2 +- util/main-loop.c | 2 +- util/qemu-timer.c | 10 +++++----- 9 files changed, 23 insertions(+), 11 deletions(-) diff --git a/cpus.c b/cpus.c index 69e2185..e9da3bc 100644 --- a/cpus.c +++ b/cpus.c @@ -800,6 +800,11 @@ static void qemu_cpu_kick_rr_cpu(void) } while (cpu !=3D atomic_mb_read(&tcg_current_rr_cpu)); } =20 +void qemu_timer_notify_cb(void *opaque, QEMUClockType type) +{ + qemu_notify_event(); +} + static void kick_tcg_thread(void *opaque) { timer_mod(tcg_kick_vcpu_timer, qemu_tcg_next_kick()); diff --git a/include/qemu/timer.h b/include/qemu/timer.h index 91cd8c8..1441b42 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -59,7 +59,7 @@ struct QEMUTimerListGroup { }; =20 typedef void QEMUTimerCB(void *opaque); -typedef void QEMUTimerListNotifyCB(void *opaque); +typedef void QEMUTimerListNotifyCB(void *opaque, QEMUClockType type); =20 struct QEMUTimer { int64_t expire_time; /* in nanoseconds */ @@ -776,7 +776,7 @@ static inline int64_t qemu_soonest_timeout(int64_t time= out1, int64_t timeout2) * * Initialise the clock & timer infrastructure */ -void init_clocks(void); +void init_clocks(QEMUTimerListNotifyCB *notify_cb); =20 int64_t cpu_get_ticks(void); /* Caller must hold BQL */ diff --git a/include/sysemu/cpus.h b/include/sysemu/cpus.h index e521a91..a8053f1 100644 --- a/include/sysemu/cpus.h +++ b/include/sysemu/cpus.h @@ -22,6 +22,7 @@ void dump_drift_info(FILE *f, fprintf_function cpu_fprint= f); =20 /* Unblock cpu */ void qemu_cpu_kick_self(void); +void qemu_timer_notify_cb(void *opaque, QEMUClockType type); =20 void cpu_synchronize_all_states(void); void cpu_synchronize_all_post_reset(void); diff --git a/stubs/cpu-get-icount.c b/stubs/cpu-get-icount.c index 2e8b63b..0b7239d 100644 --- a/stubs/cpu-get-icount.c +++ b/stubs/cpu-get-icount.c @@ -2,6 +2,7 @@ #include "qemu-common.h" #include "qemu/timer.h" #include "sysemu/cpus.h" +#include "qemu/main-loop.h" =20 int use_icount; =20 @@ -9,3 +10,8 @@ int64_t cpu_get_icount(void) { abort(); } + +void qemu_timer_notify_cb(void *opaque, QEMUClockType type) +{ + qemu_notify_event(); +} diff --git a/tests/test-aio-multithread.c b/tests/test-aio-multithread.c index 8b0b40e..549d784 100644 --- a/tests/test-aio-multithread.c +++ b/tests/test-aio-multithread.c @@ -438,7 +438,7 @@ static void test_multi_mutex_10(void) =20 int main(int argc, char **argv) { - init_clocks(); + init_clocks(NULL); =20 g_test_init(&argc, &argv, NULL); g_test_add_func("/aio/multi/lifecycle", test_lifecycle); diff --git a/tests/test-aio.c b/tests/test-aio.c index 2754f15..54e20d6 100644 --- a/tests/test-aio.c +++ b/tests/test-aio.c @@ -835,7 +835,7 @@ int main(int argc, char **argv) Error *local_error =3D NULL; GSource *src; =20 - init_clocks(); + init_clocks(NULL); =20 ctx =3D aio_context_new(&local_error); if (!ctx) { diff --git a/util/async.c b/util/async.c index 7d469eb..663e297 100644 --- a/util/async.c +++ b/util/async.c @@ -351,7 +351,7 @@ void aio_notify_accept(AioContext *ctx) } } =20 -static void aio_timerlist_notify(void *opaque) +static void aio_timerlist_notify(void *opaque, QEMUClockType type) { aio_notify(opaque); } diff --git a/util/main-loop.c b/util/main-loop.c index 7efc229..4534c89 100644 --- a/util/main-loop.c +++ b/util/main-loop.c @@ -144,7 +144,7 @@ int qemu_init_main_loop(Error **errp) GSource *src; Error *local_error =3D NULL; =20 - init_clocks(); + init_clocks(qemu_timer_notify_cb); =20 ret =3D qemu_signal_init(); if (ret) { diff --git a/util/qemu-timer.c b/util/qemu-timer.c index ac99340..dc3181e 100644 --- a/util/qemu-timer.c +++ b/util/qemu-timer.c @@ -122,7 +122,7 @@ void timerlist_free(QEMUTimerList *timer_list) g_free(timer_list); } =20 -static void qemu_clock_init(QEMUClockType type) +static void qemu_clock_init(QEMUClockType type, QEMUTimerListNotifyCB *not= ify_cb) { QEMUClock *clock =3D qemu_clock_ptr(type); =20 @@ -134,7 +134,7 @@ static void qemu_clock_init(QEMUClockType type) clock->last =3D INT64_MIN; QLIST_INIT(&clock->timerlists); notifier_list_init(&clock->reset_notifiers); - main_loop_tlg.tl[type] =3D timerlist_new(type, NULL, NULL); + main_loop_tlg.tl[type] =3D timerlist_new(type, notify_cb, NULL); } =20 bool qemu_clock_use_for_deadline(QEMUClockType type) @@ -278,7 +278,7 @@ QEMUTimerList *qemu_clock_get_main_loop_timerlist(QEMUC= lockType type) void timerlist_notify(QEMUTimerList *timer_list) { if (timer_list->notify_cb) { - timer_list->notify_cb(timer_list->notify_opaque); + timer_list->notify_cb(timer_list->notify_opaque, timer_list->clock= ->type); } else { qemu_notify_event(); } @@ -635,11 +635,11 @@ void qemu_clock_unregister_reset_notifier(QEMUClockTy= pe type, notifier_remove(notifier); } =20 -void init_clocks(void) +void init_clocks(QEMUTimerListNotifyCB *notify_cb) { QEMUClockType type; for (type =3D 0; type < QEMU_CLOCK_MAX; type++) { - qemu_clock_init(type); + qemu_clock_init(type, notify_cb); } =20 #ifdef CONFIG_PRCTL_PR_SET_TIMERSLACK --=20 1.8.3.1 From nobody Mon May 6 14:03:42 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.zoho.com; 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 148950886087119.723908316209418; Tue, 14 Mar 2017 09:27:40 -0700 (PDT) Received: from localhost ([::1]:60599 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnpIQ-0002Kz-LW for importer@patchew.org; Tue, 14 Mar 2017 12:27:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36858) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnp9p-0003dL-LZ for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnp9k-0006iH-3Z for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:45 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:36138) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cnp9j-0006hR-SS for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:39 -0400 Received: by mail-wm0-x243.google.com with SMTP id v190so583484wme.3 for ; Tue, 14 Mar 2017 09:18:39 -0700 (PDT) Received: from 640k.lan (94-39-132-181.adsl-ull.clienti.tiscali.it. [94.39.132.181]) by smtp.gmail.com with ESMTPSA id k195sm408197wmd.7.2017.03.14.09.18.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2017 09:18:38 -0700 (PDT) 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=3IeO20HPyhSdEdk5uN9iXWDpwvGeI78K1uQMrh49nNE=; b=hSqt/kCYs4X8mB0q5xUL1qg4n+/u8jXS1C35w4ejL49JBliEgnxI6jtUhro3HYK2Yl 6f4GeQcfOb4vhgs4vyy/fEXnmEYLoj7au5uH65qo8YZnlit4Sgx7ulwWEOaw6vUmFXPr /rCrci7wkrnhAxX8FROQqgkYeBPMcS4NiCvPoGuudNa2UEdbYRetxr+O20aLsZo9l30W hCMHsbDibqMa8dzvEn4snZM1My/sx5Zpb85AY9DIWM+2rm4k9EQfmWkPuOvCeDQDP2gF mZsNaYujPZBFVgQrQqsKVf3U0RiB3U1qAANX412MVhzwoTO1OWbStFVA+YKD9eMDxNUH TD0A== 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=3IeO20HPyhSdEdk5uN9iXWDpwvGeI78K1uQMrh49nNE=; b=RIjKohBRV2JZmZLSYfkE1/mhfMpBBymhVhKTiT98TJ2mQguKkprdgMzHKd7ME4ZzrV Ox8/G72q1SCTCRQlA9/rZeCqVn/8DwtaJj8s0t5QHDK5ZKNwDUNCihttRqoSGLj8zW3S f9BM7tmzLGUMIQik0SZCYmJOkWdmbBKIixE3d/nRJZBbG/D0gFgxltU77iZs4rPOcfT3 wraQOKQSbtyH6UD9XrdcZZhh1NdUCr4p7aGrwkVEeyXHVrzGfQWlsz1lxajpSjBNSlUV 7ELp+wRSv2u2S5K6kpCbTzn6mV6blu0suGNNhFGEODxd6wziszVvWpHnveU4ulOLslTj cnhg== X-Gm-Message-State: AFeK/H0YxNMB3qS4tIAuzejXW/ldPNUbhbX7zu3Z0Kr45uDzlDotzG0V/k+R4gJReBpf9A== X-Received: by 10.28.154.7 with SMTP id c7mr512127wme.119.1489508318751; Tue, 14 Mar 2017 09:18:38 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 14 Mar 2017 17:18:17 +0100 Message-Id: <1489508300-48184-16-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> References: <1489508300-48184-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PULL 15/18] main-loop: remove now unnecessary optimization 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: RSF_0 Z_629925259 SPT_0 This optimization is not necessary anymore, because the vCPU now drops the I/O thread lock even with TCG. Drop it to simplify the code and avoid the "I/O thread spun for 1000 iterations" warning. Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Edgar E. Iglesias Signed-off-by: Paolo Bonzini --- vl.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/vl.c b/vl.c index 1a95500..0b4ed52 100644 --- a/vl.c +++ b/vl.c @@ -1888,17 +1888,14 @@ static bool main_loop_should_exit(void) =20 static void main_loop(void) { - bool nonblocking; - int last_io =3D 0; #ifdef CONFIG_PROFILER int64_t ti; #endif do { - nonblocking =3D tcg_enabled() && last_io > 0; #ifdef CONFIG_PROFILER ti =3D profile_getclock(); #endif - last_io =3D main_loop_wait(nonblocking); + main_loop_wait(false); #ifdef CONFIG_PROFILER dev_time +=3D profile_getclock() - ti; #endif --=20 1.8.3.1 From nobody Mon May 6 14:03:42 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.zoho.com; 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 1489508728009950.0771585088141; Tue, 14 Mar 2017 09:25:28 -0700 (PDT) Received: from localhost ([::1]:60586 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnpGF-0000H8-JB for importer@patchew.org; Tue, 14 Mar 2017 12:25:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36820) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnp9m-0003bY-Ra for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnp9l-0006kE-Ao for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:42 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:36139) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cnp9l-0006iT-1p for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:41 -0400 Received: by mail-wm0-x244.google.com with SMTP id v190so583538wme.3 for ; Tue, 14 Mar 2017 09:18:40 -0700 (PDT) Received: from 640k.lan (94-39-132-181.adsl-ull.clienti.tiscali.it. [94.39.132.181]) by smtp.gmail.com with ESMTPSA id k195sm408197wmd.7.2017.03.14.09.18.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2017 09:18:39 -0700 (PDT) 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=DthqsKZ6YHamxaMsbtAoMSB6QfoHSaFkkXV64JyyFeM=; b=RqUIiWMraAZX1loc15PYDkiJ69yOBFtWmNSqzT2fzk/tWIeoS0Wx3uwhFLe+FGLB65 E5Gby8AeueBqIqnbZs3dt8f0RtpF3gLF2ujNrcqBzY1UiYgPaaJjoHl0cUEyGhdZyPWJ l76hzLwgBqZpp72zWdhoOOpuOrH/jGMlydJFSknkZtz3a27SwZSpunuwFUbkNx/ghxfp +VIzVepMhoML6S7o69gzbAk0koNqq89IBGn9qT3KyadVi8QDlSDaoUTlw3hicSlN7EpC fpiXuCRXcR8q54hf0YUtjfPngq/7G26KrxwCk8NntMuBbBSl460o4AQitUzr/cFAkHv0 o8fQ== 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=DthqsKZ6YHamxaMsbtAoMSB6QfoHSaFkkXV64JyyFeM=; b=DqcxOHZOASqczCDNBGpFH0soRsOiGKIf5HpMatp7ExcYwqd25u2nAfpEBe38YWHLri H4WKnyg0RGaY+MarvuqAcdZVRGQ996EU5+k2cs2ul0HuGJHOAad+9ibb12UouV8tG7Za 9Us003FP6LAA/d+1IBEz13dB2AwvHBix0iXu7sH/1O9ccUBsLqYyWzbHNxKlputvYO35 Nkn6XS7sr7G/cTQAuyjUT0NFzh958rpLspDjLGoi8t8/7ZiXUfpS2RvzYeQf3QXUTt3e zTQ56asqzdtpxyPv4IuP0t6W5GO5AoHZ2C2zSjSETpCKj9UuK+nTVTEwfASQ02W5ORWt TZsA== X-Gm-Message-State: AFeK/H1Xv8zHYzxDRdCHPrJurdVYoifOQOwFMy7Ava7Q6PyWrGgZcL6Y+XE2+xrMU3hQ7g== X-Received: by 10.28.7.20 with SMTP id 20mr472100wmh.115.1489508319703; Tue, 14 Mar 2017 09:18:39 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 14 Mar 2017 17:18:18 +0100 Message-Id: <1489508300-48184-17-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> References: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 16/18] icount: process QEMU_CLOCK_VIRTUAL timers in vCPU thread 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: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" icount has become much slower after tcg_cpu_exec has stopped using the BQL. There is also a latent bug that is masked by the slowness. The slowness happens because every occurrence of a QEMU_CLOCK_VIRTUAL timer now has to wake up the I/O thread and wait for it. The rendez-vous is mediated by the BQL QemuMutex: - handle_icount_deadline wakes up the I/O thread with BQL taken - the I/O thread wakes up and waits on the BQL - the VCPU thread releases the BQL a little later - the I/O thread raises an interrupt, which calls qemu_cpu_kick - the VCPU thread notices the interrupt, takes the BQL to process it and waits on it All this back and forth is extremely expensive, causing a 6 to 8-fold slowdown when icount is turned on. One may think that the issue is that the VCPU thread is too dependent on the BQL, but then the latent bug comes in. I first tried removing the BQL completely from the x86 cpu_exec, only to see everything break. The only way to fix it (and make everything slow again) was to add a dummy BQL lock/unlock pair. This is because in -icount mode you really have to process the events before the CPU restarts executing the next instruction. Therefore, this series moves the processing of QEMU_CLOCK_VIRTUAL timers straight in the vCPU thread when running in icount mode. The required changes include: - make the timer notification callback wake up TCG's single vCPU thread when run from another thread. By using async_run_on_cpu, the callback can override all_cpu_threads_idle() when the CPU is halted. - move handle_icount_deadline after qemu_tcg_wait_io_event, so that the timer notification callback is invoked after the dummy work item wakes up the vCPU thread - make handle_icount_deadline run the timers instead of just waking the I/O thread. - stop processing the timers in the main loop Signed-off-by: Paolo Bonzini --- cpus.c | 28 +++++++++++++++++++++++++--- include/qemu/timer.h | 24 ++++++++++++++++++++++++ util/qemu-timer.c | 4 +++- 3 files changed, 52 insertions(+), 4 deletions(-) diff --git a/cpus.c b/cpus.c index e9da3bc..b84a392 100644 --- a/cpus.c +++ b/cpus.c @@ -800,9 +800,25 @@ static void qemu_cpu_kick_rr_cpu(void) } while (cpu !=3D atomic_mb_read(&tcg_current_rr_cpu)); } =20 +static void do_nothing(CPUState *cpu, run_on_cpu_data unused) +{ +} + void qemu_timer_notify_cb(void *opaque, QEMUClockType type) { - qemu_notify_event(); + if (!use_icount || type !=3D QEMU_CLOCK_VIRTUAL) { + qemu_notify_event(); + return; + } + + if (!qemu_in_vcpu_thread() && first_cpu) { + /* qemu_cpu_kick is not enough to kick a halted CPU out of + * qemu_tcg_wait_io_event. async_run_on_cpu, instead, + * causes cpu_thread_is_idle to return false. This way, + * handle_icount_deadline can run. + */ + async_run_on_cpu(first_cpu, do_nothing, RUN_ON_CPU_NULL); + } } =20 static void kick_tcg_thread(void *opaque) @@ -1150,12 +1166,15 @@ static int64_t tcg_get_icount_limit(void) =20 static void handle_icount_deadline(void) { + assert(qemu_in_vcpu_thread()); if (use_icount) { int64_t deadline =3D qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL); =20 if (deadline =3D=3D 0) { + /* Wake up other AioContexts. */ qemu_clock_notify(QEMU_CLOCK_VIRTUAL); + qemu_clock_run_timers(QEMU_CLOCK_VIRTUAL); } } } @@ -1268,6 +1287,11 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg) /* Account partial waits to QEMU_CLOCK_VIRTUAL. */ qemu_account_warp_timer(); =20 + /* Run the timers here. This is much more efficient than + * waking up the I/O thread and waiting for completion. + */ + handle_icount_deadline(); + if (!cpu) { cpu =3D first_cpu; } @@ -1309,8 +1333,6 @@ static void *qemu_tcg_rr_cpu_thread_fn(void *arg) atomic_mb_set(&cpu->exit_request, 0); } =20 - handle_icount_deadline(); - qemu_tcg_wait_io_event(cpu ? cpu : QTAILQ_FIRST(&cpus)); deal_with_unplugged_cpus(); } diff --git a/include/qemu/timer.h b/include/qemu/timer.h index 1441b42..e1742f2 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -533,6 +533,12 @@ static inline QEMUTimer *timer_new_tl(QEMUTimerList *t= imer_list, * Create a new timer and associate it with the default * timer list for the clock type @type. * + * The default timer list has one special feature: in icount mode, + * %QEMU_CLOCK_VIRTUAL timers are run in the vCPU thread. This is + * not true of other timer lists, which are typically associated + * with an AioContext---each of them runs its timer callbacks in its own + * AioContext thread. + * * Returns: a pointer to the timer */ static inline QEMUTimer *timer_new(QEMUClockType type, int scale, @@ -550,6 +556,12 @@ static inline QEMUTimer *timer_new(QEMUClockType type,= int scale, * Create a new timer with nanosecond scale on the default timer list * associated with the clock. * + * The default timer list has one special feature: in icount mode, + * %QEMU_CLOCK_VIRTUAL timers are run in the vCPU thread. This is + * not true of other timer lists, which are typically associated + * with an AioContext---each of them runs its timer callbacks in its own + * AioContext thread. + * * Returns: a pointer to the newly created timer */ static inline QEMUTimer *timer_new_ns(QEMUClockType type, QEMUTimerCB *cb, @@ -564,6 +576,12 @@ static inline QEMUTimer *timer_new_ns(QEMUClockType ty= pe, QEMUTimerCB *cb, * @cb: the callback to call when the timer expires * @opaque: the opaque pointer to pass to the callback * + * The default timer list has one special feature: in icount mode, + * %QEMU_CLOCK_VIRTUAL timers are run in the vCPU thread. This is + * not true of other timer lists, which are typically associated + * with an AioContext---each of them runs its timer callbacks in its own + * AioContext thread. + * * Create a new timer with microsecond scale on the default timer list * associated with the clock. * @@ -581,6 +599,12 @@ static inline QEMUTimer *timer_new_us(QEMUClockType ty= pe, QEMUTimerCB *cb, * @cb: the callback to call when the timer expires * @opaque: the opaque pointer to pass to the callback * + * The default timer list has one special feature: in icount mode, + * %QEMU_CLOCK_VIRTUAL timers are run in the vCPU thread. This is + * not true of other timer lists, which are typically associated + * with an AioContext---each of them runs its timer callbacks in its own + * AioContext thread. + * * Create a new timer with millisecond scale on the default timer list * associated with the clock. * diff --git a/util/qemu-timer.c b/util/qemu-timer.c index dc3181e..82d5650 100644 --- a/util/qemu-timer.c +++ b/util/qemu-timer.c @@ -658,7 +658,9 @@ bool qemu_clock_run_all_timers(void) QEMUClockType type; =20 for (type =3D 0; type < QEMU_CLOCK_MAX; type++) { - progress |=3D qemu_clock_run_timers(type); + if (qemu_clock_use_for_deadline(type)) { + progress |=3D qemu_clock_run_timers(type); + } } =20 return progress; --=20 1.8.3.1 From nobody Mon May 6 14:03:42 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.zoho.com; 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 14895089513781.1395758840774306; Tue, 14 Mar 2017 09:29:11 -0700 (PDT) Received: from localhost ([::1]:60606 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnpJr-0003es-4F for importer@patchew.org; Tue, 14 Mar 2017 12:29:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36822) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnp9n-0003bn-0T for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnp9l-0006kY-Rb for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:42 -0400 Received: from mail-wm0-x22a.google.com ([2a00:1450:400c:c09::22a]:38311) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cnp9l-0006ir-LB for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:41 -0400 Received: by mail-wm0-x22a.google.com with SMTP id t189so3146347wmt.1 for ; Tue, 14 Mar 2017 09:18:41 -0700 (PDT) Received: from 640k.lan (94-39-132-181.adsl-ull.clienti.tiscali.it. [94.39.132.181]) by smtp.gmail.com with ESMTPSA id k195sm408197wmd.7.2017.03.14.09.18.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2017 09:18:40 -0700 (PDT) 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=U7YXP33FVf0GOET9QJfucN/xFFlCmLwQZX1IpkaiFFc=; b=YoLklRmCY5Ja9nMJeJa5zXGRe2EkvUtMpwwEZ5p5A5UctQuLfXQJcUEdBhlpHhahc2 G9wRivoQZBy+tJsyOJGFFPCmQZi4DPJpspHZM+XfH2IydFfJeNqxejEAenRyqF0fOahs QUlKd2MrOzAXfgaOYSQYv3U02Kei9IHqWF4lUY4zQ1PgVtMDzz7cQEOdFIrapEctW0XP S0YmFVvQvYgT2ZAhh1CXklINIj0JicSzgSjAw2BSoSg/ONE6me5vXhFHwEnn5DYbfwbd A7kiffcPk9peBN072EK56sJ6yESwhrOxoQq3pIHwJZ60lpJ18qRHdwpU30S5ZJzUMQk5 tHtw== 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=U7YXP33FVf0GOET9QJfucN/xFFlCmLwQZX1IpkaiFFc=; b=jR/2unTimmHpRf0WyBcmoo8lPylCS257736Ut68NjxG1I2jcTwypwVOO4lcfES+r9C b0NSr7oXbknkX37rUVlicfNhlQqF+EeB1/VFMeQGDzNMW6iFPRn4ev6PtNHBP0VPwv0B JOVY4jbGCIWZs1OCJLkdhFwDu02/4hKLScbvWMDGjhrbSzAGEzSDZTyERTDt7yG8cWvK U4H2fsU2I/u3x5HzwIzKZqxN+sim9a7Yom8AA2zD/bxLOx3HPo+eR3pB1PS1eRppNnH3 qIRPwPVLhjoJ3VFefD+vLzIa8r++hLaMZljN86Bze1++YnuKNmNGbJ7KUi6ELWfGlfXy XsIg== X-Gm-Message-State: AFeK/H3Mw0nMkbtdrMv141N6uAxz01WeGzsY50TiITBruAP/QTbeBLtXtb8p+tMpEuB2iw== X-Received: by 10.28.125.20 with SMTP id y20mr498304wmc.123.1489508320635; Tue, 14 Mar 2017 09:18:40 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 14 Mar 2017 17:18:19 +0100 Message-Id: <1489508300-48184-18-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> References: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::22a Subject: [Qemu-devel] [PULL 17/18] memory: info mtree check mr range overflow 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: 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 The address of memory regions might overflow when something wrong happened, like reported in: https://lists.gnu.org/archive/html/qemu-devel/2017-03/msg02043.html For easier debugging, let's try to detect it. Reported-by: Mark Cave-Ayland Signed-off-by: Peter Xu Message-Id: <1489496187-624-1-git-send-email-peterx@redhat.com> Signed-off-by: Paolo Bonzini --- memory.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/memory.c b/memory.c index 284894b..64b0a60 100644 --- a/memory.c +++ b/memory.c @@ -2494,6 +2494,7 @@ static void mtree_print_mr(fprintf_function mon_print= f, void *f, MemoryRegionListHead submr_print_queue; const MemoryRegion *submr; unsigned int i; + hwaddr cur_start, cur_end; =20 if (!mr) { return; @@ -2503,6 +2504,18 @@ static void mtree_print_mr(fprintf_function mon_prin= tf, void *f, mon_printf(f, MTREE_INDENT); } =20 + cur_start =3D base + mr->addr; + cur_end =3D cur_start + MR_SIZE(mr->size); + + /* + * Try to detect overflow of memory region. This should never + * happen normally. When it happens, we dump something to warn the + * user who is observing this. + */ + if (cur_start < base || cur_end < cur_start) { + mon_printf(f, "[DETECTED OVERFLOW!] "); + } + if (mr->alias) { MemoryRegionList *ml; bool found =3D false; @@ -2522,8 +2535,7 @@ static void mtree_print_mr(fprintf_function mon_print= f, void *f, mon_printf(f, TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d, %s): alias %s @%s " TARGET_FMT_plx "-" TARGET_FMT_plx "%s\n", - base + mr->addr, - base + mr->addr + MR_SIZE(mr->size), + cur_start, cur_end, mr->priority, memory_region_type((MemoryRegion *)mr), memory_region_name(mr), @@ -2534,8 +2546,7 @@ static void mtree_print_mr(fprintf_function mon_print= f, void *f, } else { mon_printf(f, TARGET_FMT_plx "-" TARGET_FMT_plx " (prio %d, %s): %s%s= \n", - base + mr->addr, - base + mr->addr + MR_SIZE(mr->size), + cur_start, cur_end, mr->priority, memory_region_type((MemoryRegion *)mr), memory_region_name(mr), @@ -2562,7 +2573,7 @@ static void mtree_print_mr(fprintf_function mon_print= f, void *f, } =20 QTAILQ_FOREACH(ml, &submr_print_queue, queue) { - mtree_print_mr(mon_printf, f, ml->mr, level + 1, base + mr->addr, + mtree_print_mr(mon_printf, f, ml->mr, level + 1, cur_start, alias_print_queue); } =20 --=20 1.8.3.1 From nobody Mon May 6 14:03:42 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.zoho.com; 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 1489509087268286.02121370060945; Tue, 14 Mar 2017 09:31:27 -0700 (PDT) Received: from localhost ([::1]:60620 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnpM4-0005vT-3i for importer@patchew.org; Tue, 14 Mar 2017 12:31:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36838) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnp9n-0003cj-NS for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnp9m-0006lV-Pv for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:43 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:33438) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cnp9m-0006kn-Jp for qemu-devel@nongnu.org; Tue, 14 Mar 2017 12:18:42 -0400 Received: by mail-wm0-x241.google.com with SMTP id n11so610589wma.0 for ; Tue, 14 Mar 2017 09:18:42 -0700 (PDT) Received: from 640k.lan (94-39-132-181.adsl-ull.clienti.tiscali.it. [94.39.132.181]) by smtp.gmail.com with ESMTPSA id k195sm408197wmd.7.2017.03.14.09.18.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Mar 2017 09:18:41 -0700 (PDT) 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=JEKQMdVT0a++5lnseDMXMxZhv7AeignVRkDJoaDTQqw=; b=MRuSirhyR7wK7/VJ04WWHJgxJ3nW9DobPtA0AKB1CRv//Z6nvkeFwLQ4jFYa8TZ1Bm 2Pqt/IVmU7I2Mb7SQIL6J7c19tRIh5cdfsx22wlRwqo3i9Gp4zxi0J7tkHLjVlrb+v19 +UCO9t4sh2peXceoEJNOpkXjQKlhCHf+dAcTjkSYaVqq9kliV9VEpYx9LSCSVA07eDKS kCNlXFP7pPTl8IRpNvuuvOO6n2LFEPTsKj3OgUGbEGOnGqnDtSj7Amu5/1DZeUPRcDv/ xnW5hJJSZGfYlCBEFozG7MU9Bl3xeSjpq+QVdjj8ccqKr4ZS3tGRSiv4SdWqp7/9Ql89 ZTcQ== 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=JEKQMdVT0a++5lnseDMXMxZhv7AeignVRkDJoaDTQqw=; b=gG/UWVqRANZLUCFV/pKuU89TPoYL4Qy9fzom81J/w+aIS6/Ql6Ol/7To6oLZDWx1q3 fpElkh6mtBKvYDdMNjeQNXwzFJKrh4H4v64uj3YGb2BGyJSEkKIhwFCHsYD0rkelk22r 3mwGoGiLE0q4PIy3E+2o+LlCTDOMp3Wm3h2PPCo7HWiMSn9YoBhZqAvKLeQK4u8o0KXi Xf6aGlqH7rymgxjWKL1udRJqRsrZBpBoM4yvTYWkl8RzuoKkkYnKH2SDsLLl17h1HAW7 c/TZTtW2TLz8aTpSr3Q4xVjTAybAZCn33Pm9EqewxFrQiBuBjGDVf+kRUzX7SNPPSiY1 lqLw== X-Gm-Message-State: AFeK/H1z/dDGtGrkUAVlc1+gjbeqvkQNbnz8U6IL9efXmJDKRtwh2kehohZO8VL19QWupQ== X-Received: by 10.28.88.129 with SMTP id m123mr573644wmb.28.1489508321669; Tue, 14 Mar 2017 09:18:41 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 14 Mar 2017 17:18:20 +0100 Message-Id: <1489508300-48184-19-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1489508300-48184-1-git-send-email-pbonzini@redhat.com> References: <1489508300-48184-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: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 18/18] nbd/client: fix drop_sync [CVE-2017-2630] 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: Vladimir Sementsov-Ogievskiy Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 From: Vladimir Sementsov-Ogievskiy Comparison symbol is misused. It may lead to memory corruption. Introduced in commit 7d3123e. Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20170203154757.36140-6-vsementsov@virtuozzo.com> [eblake: add CVE details, update conditional] Signed-off-by: Eric Blake Reviewed-by: Marc-Andr=C3=83=C2=A9 Lureau Message-Id: <20170307151627.27212-1-eblake@redhat.com> Signed-off-by: Paolo Bonzini --- nbd/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nbd/client.c b/nbd/client.c index 5c9dee3..3dc2564 100644 --- a/nbd/client.c +++ b/nbd/client.c @@ -94,7 +94,7 @@ static ssize_t drop_sync(QIOChannel *ioc, size_t size) char small[1024]; char *buffer; =20 - buffer =3D sizeof(small) < size ? small : g_malloc(MIN(65536, size)); + buffer =3D sizeof(small) >=3D size ? small : g_malloc(MIN(65536, size)= ); while (size > 0) { ssize_t count =3D read_sync(ioc, buffer, MIN(65536, size)); =20 --=20 1.8.3.1