From nobody Thu May 2 16:04:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1501604371687117.42914091604689; Tue, 1 Aug 2017 09:19:31 -0700 (PDT) Received: from localhost ([::1]:43587 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZtH-0005ZR-5j for importer@patchew.org; Tue, 01 Aug 2017 12:19:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59531) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZrT-0004Iz-Q0 for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcZrR-00079p-Rt for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:35 -0400 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:35344) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dcZrR-00078v-LB for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:33 -0400 Received: by mail-wr0-x242.google.com with SMTP id c24so1805028wra.2 for ; Tue, 01 Aug 2017 09:17:32 -0700 (PDT) Received: from 640k.lan (94-39-192-75.adsl-ull.clienti.tiscali.it. [94.39.192.75]) by smtp.gmail.com with ESMTPSA id u187sm1724160wmd.26.2017.08.01.09.17.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 09:17: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=ITo/nAbKvDXMxYoIZBD/d0edgNSNoev5N1DIxuuUfOA=; b=ANf76w5aMgyL7vAMP7bg/AbkUAJXft0d8hJER27CuuVMgpar6uwo/Q/Yu5B6yshp/n wYhmE2FNQSsTepw3d+uVtbYjW6/5Bpv4gaB1TPsxbmP0m2dLKUFpOFyQOEsaPARCTeSV CT5/Fa3EtJ+jmPpNL5H0I6DcBepQAcujhgsQUtSQf0kNujLX9AVLxd/IzP1HPazCukaN F6Rq3ogcf7UD+BkK0MJrLTRvK2HzMeHe1F07sMBpUSqDGr4EeDkpw/jPJglFrnTQsoBj GHR+4Ru9cFjo3BX0jQc/d1q/eaWlJ0418eN1t/RUjmIW2jDjfCtX+MjjLfLP78LR9P3t lUTg== 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=ITo/nAbKvDXMxYoIZBD/d0edgNSNoev5N1DIxuuUfOA=; b=eoryVW8ekwksRJStu5OTk0AXZ3zdOVamh2mz6Ry77+jrZfmW5ss9SRN/in/rxi9xw2 V0mcKmM7QwFleil+5BELT7OZbzI3LGfAwlxuo9ASLNz+BuVzTTosVZdQNwQLP0b3Puue mcFQyNMKOHvtzYZkyrHsprcc4lLIVLTxYBoqrmLOaXJXqGqKitZYZLh6KMy/UIgrV/f9 Vebg+QIt43c/GwIe4szEelaLAPU25AzoB+Q/RZ0MlKA38jjYWBZBLF3PfRCIq0s2Dclp m+nbZHUmDWM6zIXhsyMv3XVZh8HHXdP7CbRIPxSno2godmvzXRtpvyqgwo2fYV1Z+B9E /JZg== X-Gm-Message-State: AIVw1127ozkc1bLvnjUA5vQgmmQqs3R0Rv1XZjmekbDSoePMReC7/9na oi543OEWjqtitMJT7Lk= X-Received: by 10.223.171.200 with SMTP id s66mr17217176wrc.38.1501604250521; Tue, 01 Aug 2017 09:17:30 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 1 Aug 2017 18:17:09 +0200 Message-Id: <1501604245-33460-2-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> References: <1501604245-33460-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/17] vl.c/exit: pause cpus before closing block devices 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-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" There's a rare exit seg if the guest is accessing IO during exit. It's always hitting the atomic_inc(&bs->in_flight) with a NULL bs. This was added recently in 99723548 but I don't see it as the cause. Flip vl.c around so we pause the cpus before closing the block devices, that way we shouldn't have anything trying to access them when they're gone. This was originally Red Hat bz https://bugzilla.redhat.com/show_bug.cgi?id= =3D1451015 Signed-off-by: Dr. David Alan Gilbert Reported-by: Cong Li -- This is a very rare race, I'll leave it running in a loop to see if we hit anything else and to check this really fixes it. I do worry if there are other cases that can trigger this - e.g. hot-unplug or ejecting a CD. Message-Id: <20170713190116.21608-1-dgilbert@redhat.com> Signed-off-by: Paolo Bonzini --- vl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vl.c b/vl.c index fb6b2ef..dd803fc 100644 --- a/vl.c +++ b/vl.c @@ -4787,8 +4787,8 @@ int main(int argc, char **argv, char **envp) replay_disable_events(); iothread_stop_all(); =20 - bdrv_close_all(); pause_all_vcpus(); + bdrv_close_all(); res_free(); =20 /* vhost-user must be cleaned up before chardevs. */ --=20 1.8.3.1 From nobody Thu May 2 16:04:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150160437139748.56211135743797; Tue, 1 Aug 2017 09:19:31 -0700 (PDT) Received: from localhost ([::1]:43588 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZtH-0005a5-SF for importer@patchew.org; Tue, 01 Aug 2017 12:19:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59532) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZrT-0004J0-QT for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcZrR-00079e-IE for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:35 -0400 Received: from mail-wr0-x230.google.com ([2a00:1450:400c:c0c::230]:35210) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dcZrR-00079O-BL for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:33 -0400 Received: by mail-wr0-x230.google.com with SMTP id k71so8875502wrc.2 for ; Tue, 01 Aug 2017 09:17:33 -0700 (PDT) Received: from 640k.lan (94-39-192-75.adsl-ull.clienti.tiscali.it. [94.39.192.75]) by smtp.gmail.com with ESMTPSA id u187sm1724160wmd.26.2017.08.01.09.17.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 09:17: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 :mime-version:content-transfer-encoding; bh=3phhBElh5R06fCTw2OQSxTgJjC7ZmvLYm7oJQm2q2RA=; b=bs28dFTNYEPVRyZkaYVZP/u5PG4OE6SNNar11NySBSjOmVM6Iq3mXlAee+OV6uw2i1 jUMWUITFDL6KlxCz+2BZru/pjLH1PgVPSrNLm8+LcurrvAsl7KiIHpydCDhn0FN+3QjF IzWzWq9Sa9muf06LcaiM2ml3doTvpzKrNZhP86Al+zB2V5Gkz7DWPSpzTfD1cRI4BmIg LBeciuGedAhCJaejg50+U5Mio/1uh2TuEPPaHW3ew+X6austMZxLIuH1qwBNAqzB6Ds5 tpf8wOkJuZWTmJAmLMdUdnfmVxtYbSta9rtiTquSslSGcwvOcHfI8tIM70GphvzSYAWl 8/Rw== 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=3phhBElh5R06fCTw2OQSxTgJjC7ZmvLYm7oJQm2q2RA=; b=UnItUuooME37TYXUl7q0fdJrXVK4wOFR0p7/oM8MugqhAxRqLXW2fT4G6KwOZqfXoY 8GJm8EDKVlOVTCDFrltTNMgrN7/Kfoebuf0fa1VVOP8JlHnnzwg/V+z0+/MmWaY4LxPf WH2esuRtb357Q5AFssoSN16fZNI4t6saoHaBDOdf9Mm2CK79Ois74KaDTl+2RNx1CH4E oWa0SPdgKHzPlXL6PArejO5pzFQJVSTDPGMzo0M0qUL0mNMAhYabURAatNaZOJhX0QqF Dvr34QXHiYtKv32T47ZEe93XAdbtVhdJ71dXR9cqp+JQXMJF2WfZaoZvTAWxh3Xpq3Ew 3xcg== X-Gm-Message-State: AIVw1104oSTHzO17kVzuFzZM+YIpzHIYC8Kgh6e+slqJ9WyIPFJUryTu bZWz3aGFq26yEO2xrZA= X-Received: by 10.223.179.211 with SMTP id x19mr1937441wrd.7.1501604252051; Tue, 01 Aug 2017 09:17:32 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 1 Aug 2017 18:17:10 +0200 Message-Id: <1501604245-33460-3-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> References: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::230 Subject: [Qemu-devel] [PULL 02/17] cpu_physical_memory_sync_dirty_bitmap: Fix alignment 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: , Cc: "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: "Dr. David Alan Gilbert" This code has an optimised, word aligned version, and a boring unaligned version. Recently 084140bd498909 fixed a missing offset addition from the core of both versions. However, the offset isn't necessarily aligned and thus the choice between the two versions needs fixing up to also include the offset. Symptom: A few stuck unsent pages during migration; not normally noticed unless under very low bandwidth in which case the migration may get stuck never ending and never performing a 2nd sync; noticed by a hanging postcopy-test on a very heavily loaded system. Fixes: 084140bd498909 Signed-off-by: Dr. David Alan Gilbert Reported-by: Alex Benne=C3=83=C2=A9 Tested-by: Alex Benne=C3=83=C2=A9 -- v2 Move 'page' inside the if (Comment from Paolo) Message-Id: <20170724165125.29887-1-dgilbert@redhat.com> Signed-off-by: Paolo Bonzini --- include/exec/ram_addr.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h index c04f4f6..d017639 100644 --- a/include/exec/ram_addr.h +++ b/include/exec/ram_addr.h @@ -377,19 +377,20 @@ uint64_t cpu_physical_memory_sync_dirty_bitmap(RAMBlo= ck *rb, uint64_t *real_dirty_pages) { ram_addr_t addr; - unsigned long page =3D BIT_WORD(start >> TARGET_PAGE_BITS); + unsigned long word =3D BIT_WORD((start + rb->offset) >> TARGET_PAGE_BI= TS); uint64_t num_dirty =3D 0; unsigned long *dest =3D rb->bmap; =20 /* start address is aligned at the start of a word? */ - if (((page * BITS_PER_LONG) << TARGET_PAGE_BITS) =3D=3D start) { + if (((word * BITS_PER_LONG) << TARGET_PAGE_BITS) =3D=3D + (start + rb->offset)) { int k; int nr =3D BITS_TO_LONGS(length >> TARGET_PAGE_BITS); unsigned long * const *src; - unsigned long word =3D BIT_WORD((start + rb->offset) >> TARGET_PAG= E_BITS); unsigned long idx =3D (word * BITS_PER_LONG) / DIRTY_MEMORY_BLOCK_= SIZE; unsigned long offset =3D BIT_WORD((word * BITS_PER_LONG) % DIRTY_MEMORY_BLOCK_SIZE); + unsigned long page =3D BIT_WORD(start >> TARGET_PAGE_BITS); =20 rcu_read_lock(); =20 --=20 1.8.3.1 From nobody Thu May 2 16:04:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1501604527377465.15442153931565; Tue, 1 Aug 2017 09:22:07 -0700 (PDT) Received: from localhost ([::1]:43601 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZvo-0007tg-Of for importer@patchew.org; Tue, 01 Aug 2017 12:22:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59539) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZrV-0004J3-6s for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcZrT-0007AH-1y for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:36 -0400 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]:33364) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dcZrS-0007A0-R5 for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:34 -0400 Received: by mail-wr0-x241.google.com with SMTP id y43so1805099wrd.0 for ; Tue, 01 Aug 2017 09:17:34 -0700 (PDT) Received: from 640k.lan (94-39-192-75.adsl-ull.clienti.tiscali.it. [94.39.192.75]) by smtp.gmail.com with ESMTPSA id u187sm1724160wmd.26.2017.08.01.09.17.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 09:17: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=RVXO7VKcCVBpWgqa+2unzBNUVdKujFIsu997c0qpmT4=; b=Znev7Cjxv1gAbAR411H+WY9Lxcp/cpJOJwdryIwRP7iEEKO8zJZCpgPlFs+WH7N3sU W0yYRP49ozo+MY/57Cy3BLPu5nytU9kwVaT8pwR/Vy5UDvcBT9UXU0JiLdfQx40RVunP iYzSx+1OXMCVZHchDuEBvaIctYTA04im1QRqgaY/Kv7TofAitcZOqEzDRa4l7Fb7aaAv FkqHFBC6V6OYsPLbsM4k2c/nuCWxsMOT2yCEjIyzMaPdo8/Tf+JY4ffcd9tKMpqnWSZI aQ+6XoffR5XW/nPe1aPMbOjd5Fdcpwj7P1SuL8y/sct4vZev7kzqd87MVNeSoNM7jfaJ O/JA== 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=RVXO7VKcCVBpWgqa+2unzBNUVdKujFIsu997c0qpmT4=; b=htW9JdlNOQomzhhG3nd3lBi4GO0gNnBNCSn2onmU2ycEWg60pMnaJaZ805zppApJ6Z o7fvoOYsr+LfPhNCqUDzjXmwu29+2YNT4FlNkQQzG2964FI7hUwnd/STkog/D6Kil9s6 B70U9jyo3QWtZNvpr396BhaBptzrqMPIQU7xlbV+h0tywmAdTuTaCe+Jyg8zrPmH7yd6 dts9dUqEfdoZ3tHB5SKQruJTpe9JlX2FZrVfXrjJd+2V8TEa2U6nxcKEqaswnb1oHx+Z oqr82RGlu5WuJ1yUu0n/an2VsFQd7gsgdhvX62XyAR4JWjkUy883bIrmjN/7OPwkJKul o08Q== X-Gm-Message-State: AIVw111ZGTWRUY7yZehjblDdoMHhV3TN+7t6JuPHDxKcPIX8oBhwcf1o a0hDDnY5xqkAxCvQv/A= X-Received: by 10.223.183.15 with SMTP id l15mr18928736wre.260.1501604253492; Tue, 01 Aug 2017 09:17:33 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 1 Aug 2017 18:17:11 +0200 Message-Id: <1501604245-33460-4-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> References: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::241 Subject: [Qemu-devel] [PULL 03/17] accel: cleanup error output 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: Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Laurent Vivier Only emit "XXX accelerator not found", if there are not further accelerators listed. eg accel=3Dkvm:tcg doesn't print a "KVM accelerator not found" warning when it falls back to tcg, but a accel=3Dkvm prints a warning, since no fallback is given. Suggested-by: Daniel P. Berrange Suggested-by: Paolo Bonzini Signed-off-by: Laurent Vivier Message-Id: <20170717144527.24534-1-lvivier@redhat.com> Signed-off-by: Paolo Bonzini --- accel/accel.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/accel/accel.c b/accel/accel.c index fa85844..8ae40e1 100644 --- a/accel/accel.c +++ b/accel/accel.c @@ -33,6 +33,7 @@ #include "sysemu/qtest.h" #include "hw/xen/xen.h" #include "qom/object.h" +#include "qemu/error-report.h" =20 static const TypeInfo accel_type =3D { .name =3D TYPE_ACCEL, @@ -69,19 +70,20 @@ static int accel_init_machine(AccelClass *acc, MachineS= tate *ms) =20 void configure_accelerator(MachineState *ms) { - const char *p; + const char *accel, *p; char buf[10]; int ret; bool accel_initialised =3D false; bool init_failed =3D false; AccelClass *acc =3D NULL; =20 - p =3D qemu_opt_get(qemu_get_machine_opts(), "accel"); - if (p =3D=3D NULL) { + accel =3D qemu_opt_get(qemu_get_machine_opts(), "accel"); + if (accel =3D=3D NULL) { /* Use the default "accelerator", tcg */ - p =3D "tcg"; + accel =3D "tcg"; } =20 + p =3D accel; while (!accel_initialised && *p !=3D '\0') { if (*p =3D=3D ':') { p++; @@ -89,7 +91,6 @@ void configure_accelerator(MachineState *ms) p =3D get_opt_name(buf, sizeof(buf), p, ':'); acc =3D accel_find(buf); if (!acc) { - fprintf(stderr, "\"%s\" accelerator not found.\n", buf); continue; } if (acc->available && !acc->available()) { @@ -100,9 +101,8 @@ void configure_accelerator(MachineState *ms) ret =3D accel_init_machine(acc, ms); if (ret < 0) { init_failed =3D true; - fprintf(stderr, "failed to initialize %s: %s\n", - acc->name, - strerror(-ret)); + error_report("failed to initialize %s: %s", + acc->name, strerror(-ret)); } else { accel_initialised =3D true; } @@ -110,13 +110,13 @@ void configure_accelerator(MachineState *ms) =20 if (!accel_initialised) { if (!init_failed) { - fprintf(stderr, "No accelerator found!\n"); + error_report("-machine accel=3D%s: No accelerator found", acce= l); } exit(1); } =20 if (init_failed) { - fprintf(stderr, "Back to %s accelerator.\n", acc->name); + error_report("Back to %s accelerator", acc->name); } } =20 --=20 1.8.3.1 From nobody Thu May 2 16:04:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1501604527297964.158738350676; Tue, 1 Aug 2017 09:22:07 -0700 (PDT) Received: from localhost ([::1]:43602 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZvo-0007uD-LH for importer@patchew.org; Tue, 01 Aug 2017 12:22:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59556) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZrV-0004J5-6u for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcZrU-0007Aq-4F for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:36 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:36415) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dcZrT-0007AN-Th for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:36 -0400 Received: by mail-wm0-x243.google.com with SMTP id d40so3781576wma.3 for ; Tue, 01 Aug 2017 09:17:35 -0700 (PDT) Received: from 640k.lan (94-39-192-75.adsl-ull.clienti.tiscali.it. [94.39.192.75]) by smtp.gmail.com with ESMTPSA id u187sm1724160wmd.26.2017.08.01.09.17.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 09:17: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 :mime-version:content-transfer-encoding; bh=JzISVgl6Y2myrhMXijGdXCUSQYWboT1ZfEsQEyd8MMs=; b=HmhLDlUa/kTbg4iqw6i+wSEuj83aifkatXESdr+7w6LXbDhNQOLBdDk7eEhyb25RJF YnlHNvRDLljf4eMQqd8FxLFtRLx3BbH0fqLSMxF+wQihbj/h6e/VT7+NNw6vcixV4am1 JDHCkHaBrwDdtO5yGF5JzbrUVhqL2YZLU/J2D3qz44y9ilh9WQWCpWiiTEV4RDviBBbe 6jnRA+5hxkagBHIl0US9+dAKv13FHuzRcVaBt+q1TBZ7Kdu9qeQT9e5D9TPwEtHf0JLO bV7AeyyJEep7VfvhRTdItB/pH++TvearTKG302xE4LUdXQQYFY9wv10aAu/33mclDzCd KwyA== 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=JzISVgl6Y2myrhMXijGdXCUSQYWboT1ZfEsQEyd8MMs=; b=hz5zaQZp5xGvSnbbwF+Dny/s9htESDGXRlWqkULz5lk21jL7p/7kQTYuAViHDco47q QnY3EbcF8NBXXS+ApmF1zF7b+Fx84B72fxyeuAiMYdheksh009vhk5aJCWkpD+596mOy GdL1rjUJ571goj5LIo14av1O/IIQTreLq/ETnOUq5VGtAWJX0Tm2PkLpWr17uL/dMJXP EMqHxcIbiOpzLhpwNuUD4tbS2g13jpEQYsUHIHRmNoH2zb2Za0wCnDwTZurpwuw3pA3T 2Sdx7gK3/RDR+0KbfV6LZ6YcYzGDu/ynHglSSBbQlvPYf++71WCEs37sUuQQlBEHo+xF g2Ww== X-Gm-Message-State: AIVw111NRUPg0OZCC5ZWbF62W1exfSMw3H48NPCAJmWx4wQNhaCDQWEO JQ+KiojcnBWqBsmCsK8= X-Received: by 10.28.234.18 with SMTP id i18mr1897565wmh.89.1501604254544; Tue, 01 Aug 2017 09:17:34 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 1 Aug 2017 18:17:12 +0200 Message-Id: <1501604245-33460-5-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> References: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PULL 04/17] char-fd: remove useless chr pointer X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Marc-Andr=C3=A9 Lureau Apparently unused since it was introduced in commit a29753f8aa79a34a324afebe340182a51a5aef11. Now, it can be trivially accessed by CHARDEV() of self. Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20170720100046.4424-1-marcandre.lureau@redhat.com> Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- chardev/char-fd.c | 1 - include/chardev/char-fd.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/chardev/char-fd.c b/chardev/char-fd.c index 1584a3d..6a62a54 100644 --- a/chardev/char-fd.c +++ b/chardev/char-fd.c @@ -141,7 +141,6 @@ void qemu_chr_open_fd(Chardev *chr, qio_channel_set_name(QIO_CHANNEL(s->ioc_out), name); g_free(name); qemu_set_nonblock(fd_out); - s->chr =3D chr; } =20 static void char_fd_class_init(ObjectClass *oc, void *data) diff --git a/include/chardev/char-fd.h b/include/chardev/char-fd.h index 55ae5b4..e7c2b17 100644 --- a/include/chardev/char-fd.h +++ b/include/chardev/char-fd.h @@ -29,7 +29,7 @@ =20 typedef struct FDChardev { Chardev parent; - Chardev *chr; + QIOChannel *ioc_in, *ioc_out; int max_size; } FDChardev; --=20 1.8.3.1 From nobody Thu May 2 16:04:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1501604651420638.9359049819168; Tue, 1 Aug 2017 09:24:11 -0700 (PDT) Received: from localhost ([::1]:43610 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZxp-0001Ud-NI for importer@patchew.org; Tue, 01 Aug 2017 12:24:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZrW-0004Jc-2B for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcZrV-0007Bt-2U for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:38 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:36419) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dcZrU-0007Av-SE for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:36 -0400 Received: by mail-wm0-x242.google.com with SMTP id d40so3781765wma.3 for ; Tue, 01 Aug 2017 09:17:36 -0700 (PDT) Received: from 640k.lan (94-39-192-75.adsl-ull.clienti.tiscali.it. [94.39.192.75]) by smtp.gmail.com with ESMTPSA id u187sm1724160wmd.26.2017.08.01.09.17.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 09:17:34 -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=mKOXHS+KiRiYMc85jXGlAXR4i3BnOffGifp8rX/796A=; b=hg1udR+8CKpmUha4WYlNqMXw/hNAwVfoiaDB49YI14cU+0sN94btJWqf3qm2kJ9zrO afr+FrBH+XfCdQ3Crx1odYhbE6YvVHIt44k8clfp0ZEX+63kwdKEDXN83GuMN/KBBnrf 6QTajtU21+Fq59oKWD1lsaQcHjMoz6SCNR8MPAKhn2K9cjlPZ3XSn5d3pXZKfn2IbpLD CbkFOVue8gsHzMB5+bVWfb4mQF/2KpK6Wk29loXUw2S0JSJ4vh+/K4AgEeImVNDS6KJt ZBSJV4Xc/X2hxZTTc/ZPfx8XhIZcjysDtCOYWC1pJIB22DY4rCHzV0j57s+vDe2QwAkY 5IOg== 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=mKOXHS+KiRiYMc85jXGlAXR4i3BnOffGifp8rX/796A=; b=DUwqXgP3UVWesPpYfygZSLGJr6coBYPHwP8tLrMP4IWoNO8ZiDMlRjB/GnlVSPPtI5 rhTg1WMunNqMkfBZVtUxX6/ZtYtDikAjq/DeREUTyYoHkd2R8WgD7pEMMBbpIb4BnOhC k9RhuZV66iOPdurUlPzePA9wNV5BXYzW6AAOODnlDyYcfkniLBxzilve7ClIGEx+ZSqk 0uzYzEtorifAVI4CMgeJTtHVpjdWiYcDZtOBtie2ERlVTpD2Pq09i3/F4X7DGOCAEoqM m7yRMGcxrO98nWEvLG2BJJcCl6WGceY+1ji9l1IoC4X3Ysci/W+f1KM0URG0OgxVdUmo j8zQ== X-Gm-Message-State: AIVw113nEQmLWcdw0UAxhOe9T7Afmw2LRhAESA0KzDoP7JM6DuonEYsp e6HfjHNUWis+HGDt75Y= X-Received: by 10.28.27.23 with SMTP id b23mr1734964wmb.108.1501604255579; Tue, 01 Aug 2017 09:17:35 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 1 Aug 2017 18:17:13 +0200 Message-Id: <1501604245-33460-6-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> References: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 05/17] char: don't exit on hmp 'chardev-add help' 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: Anton Nefedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Anton Nefedov qemu_chr_new_from_opts() is used from both vl.c and hmp, and it is quite confusing to see qemu suddenly exit after receiving a help option in hmp. Do exit(0) from vl.c instead. Signed-off-by: Anton Nefedov Message-Id: <1500977081-120929-1-git-send-email-anton.nefedov@virtuozzo.com> Signed-off-by: Paolo Bonzini --- chardev/char.c | 2 +- include/chardev/char.h | 4 +++- vl.c | 10 ++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/chardev/char.c b/chardev/char.c index c34b44a..5d283b9 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -620,7 +620,7 @@ Chardev *qemu_chr_new_from_opts(QemuOpts *opts, Error *= *errp) =20 error_report("Available chardev backend types: %s", str->str); g_string_free(str, true); - exit(0); + return NULL; } =20 if (id =3D=3D NULL) { diff --git a/include/chardev/char.h b/include/chardev/char.h index 1604ea9..66dde46 100644 --- a/include/chardev/char.h +++ b/include/chardev/char.h @@ -65,7 +65,9 @@ struct Chardev { * * @opts see qemu-config.c for a list of valid options * - * Returns: a new character backend + * Returns: on success: a new character backend + * otherwise: NULL; @errp specifies the error + * or left untouched in case of help option */ Chardev *qemu_chr_new_from_opts(QemuOpts *opts, Error **errp); diff --git a/vl.c b/vl.c index dd803fc..99fcfa0 100644 --- a/vl.c +++ b/vl.c @@ -2344,10 +2344,12 @@ static int chardev_init_func(void *opaque, QemuOpts= *opts, Error **errp) { Error *local_err =3D NULL; =20 - qemu_chr_new_from_opts(opts, &local_err); - if (local_err) { - error_report_err(local_err); - return -1; + if (!qemu_chr_new_from_opts(opts, &local_err)) { + if (local_err) { + error_report_err(local_err); + return -1; + } + exit(0); } return 0; } --=20 1.8.3.1 From nobody Thu May 2 16:04:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1501604527508574.826528316294; Tue, 1 Aug 2017 09:22:07 -0700 (PDT) Received: from localhost ([::1]:43603 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZvq-0007ul-4E for importer@patchew.org; Tue, 01 Aug 2017 12:22:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59583) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZrY-0004La-8a for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcZrW-0007D0-PQ for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:40 -0400 Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]:37947) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dcZrW-0007CR-FQ for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:38 -0400 Received: by mail-wm0-x22d.google.com with SMTP id m85so19435526wma.1 for ; Tue, 01 Aug 2017 09:17:38 -0700 (PDT) Received: from 640k.lan (94-39-192-75.adsl-ull.clienti.tiscali.it. [94.39.192.75]) by smtp.gmail.com with ESMTPSA id u187sm1724160wmd.26.2017.08.01.09.17.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 09:17:36 -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=LJZKQyPPgJQfR0t3TcR2ICXvyDzrutO5IlwY/WZIvrg=; b=dCz9OZZ2wcNpxa7GV27xCxUQwfNbVzyW98bKvsBCwjKvkRmqI8jQcB3bWIEEIyi6ae grT2Xx82785JfiOiKCFgTuZDtJwoD+TD8CPdacn9ESDh/CgwVovAtHuP4tlfWnIZZJ+z qI9nBHZYF068O9SdvnOWiOvZVg/jXqkMMk9CU+1NBMEIAn98oUTFNXWa18kawD2h+pWr aBa+vuHPFqpZvXix3NcYwAR7gFhj7M/j5ucWa7VLofzJIwkjd318Wmf1tMH5ar8nCNxs FS4uJhkDjszLWqp2nM+rA258v3LpCyQlsBB2C2K+aq1VDmpvYLGlZEVYtOzjZ7KmVyS1 m/Jg== 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=LJZKQyPPgJQfR0t3TcR2ICXvyDzrutO5IlwY/WZIvrg=; b=OfJFsUe5IXMUDYlk4kNxX/SJ2LoaWEwys7FIO+34u9ay9w0kN4RJau/4xXwQb0/pVZ a8PqnLz7WKhe+HNKwErpq4V5uXj4AJwCYF+898O5vYIWMeWSX03SRtEbJO+4EEHLL3jF IFnExNzKCsZwwyuKd1S6e8/KFmj8dK83EDP5PXXX/iqDXjerx0/HQJxW01yfl93lbsaW Jac8ek5bS3odBBxAWvRcS6qdHdbyXJ66f+7z/JZRZm88skkioCcsLfU0qVjje1C+FyGj PLDh7HKREb2cQXv7UHW3yyZtiZxLwmKEjiRGWKUQ6oHd48Pg3GdU8WXDjXXk8iZ2ziTq AvmQ== X-Gm-Message-State: AIVw110woYGMajrw5YPvHnH3CsQXpzIURwcah0oVh10RLYzMWMEPgqsk C7+TJW6bXvxsqfVB+AM= X-Received: by 10.28.186.198 with SMTP id k189mr1951119wmf.181.1501604256931; Tue, 01 Aug 2017 09:17:36 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 1 Aug 2017 18:17:14 +0200 Message-Id: <1501604245-33460-7-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> References: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::22d Subject: [Qemu-devel] [PULL 06/17] docs: document deprecation policy & deprecated features in appendix X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Daniel P. Berrange" The deprecation of features in QEMU is totally adhoc currently, with no way for the user to get a list of what is deprecated in each release. This adds an appendix to the doc that records when each deprecation was made and provides text explaining what to use instead, if anything. Since there has been no formal policy around removal of deprecated features in the past, any deprecations prior to 2.10.0 are to be treated as if they had been made at the 2.10.0 release. Thus the earliest that existing deprecations will be deleted is the start of the 2.12.0 cycle. Signed-off-by: Daniel P. Berrange Message-Id: <20170725113638.7019-1-berrange@redhat.com> Reviewed-by: Thomas Huth Reviewed-by: Stefan Hajnoczi Signed-off-by: Paolo Bonzini --- qemu-doc.texi | 175 ++++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 175 insertions(+) diff --git a/qemu-doc.texi b/qemu-doc.texi index 48af515..aeb7bc5 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -38,6 +38,7 @@ * QEMU Guest Agent:: * QEMU User space emulator:: * Implementation notes:: +* Deprecated features:: * License:: * Index:: @end menu @@ -3128,6 +3129,180 @@ Run the emulation in single step mode. =20 @include qemu-tech.texi =20 +@node Deprecated features +@appendix Deprecated features + +In general features are intended to be supported indefinitely once +introduced into QEMU. In the event that a feature needs to be removed, +it will be listed in this appendix. The feature will remain functional +for 2 releases prior to actual removal. Deprecated features may also +generate warnings on the console when QEMU starts up, or if activated +via a monitor command, however, this is not a mandatory requirement. + +Prior to the 2.10.0 release there was no official policy on how +long features would be deprecated prior to their removal, nor +any documented list of which features were deprecated. Thus +any features deprecated prior to 2.10.0 will be treated as if +they were first deprecated in the 2.10.0 release. + +What follows is a list of all features currently marked as +deprecated. + +@section System emulator command line arguments + +@subsection -drive boot=3Don|off (since 1.3.0) + +The ``boot=3Don|off'' option to the ``-drive'' argument is +ignored. Applications should use the ``bootindex=3DN'' parameter +to set an absolute ordering between devices instead. + +@subsection -tdf (since 1.3.0) + +The ``-tdf'' argument is ignored. The behaviour implemented +by this argument is now the default when using the KVM PIT, +but can be requested explicitly using +``-global kvm-pit.lost_tick_policy=3Dslew''. + +@subsection -no-kvm-pit-reinjection (since 1.3.0) + +The ``-no-kvm-pit-reinjection'' argument is now a +synonym for setting ``-global kvm-pit.lost_tick_policy=3Ddiscard''. + +@subsection -no-kvm-irqchip (since 1.3.0) + +The ``-no-kvm-irqchip'' argument is now a synonym for +setting ``-machine kernel_irqchip=3Doff''. + +@subsection -no-kvm-pit (since 1.3.0) + +The ``-no-kvm-pit'' argument is ignored. It is no longer +possible to disable the KVM PIT directly. + +@subsection -no-kvm (since 1.3.0) + +The ``-no-kvm'' argument is now a synonym for setting +``-machine accel=3Dtcg''. + +@subsection -mon default=3Don (since 2.4.0) + +The ``default'' option to the ``-mon'' argument is +now ignored. When multiple monitors were enabled, it +indicated which monitor would receive log messages +from the various subsystems. This feature is no longer +required as messages are now only sent to the monitor +in response to explicitly monitor commands. + +@subsection -vnc tls (since 2.5.0) + +The ``-vnc tls'' argument is now a synonym for setting +``-object tls-creds-anon,id=3Dtls0'' combined with +``-vnc tls-creds=3Dtls0' + +@subsection -vnc x509 (since 2.5.0) + +The ``-vnc x509=3D/path/to/certs'' argument is now a +synonym for setting +``-object tls-creds-x509,dir=3D/path/to/certs,id=3Dtls0,verify-peer=3Dno'' +combined with ``-vnc tls-creds=3Dtls0' + +@subsection -vnc x509verify (since 2.5.0) + +The ``-vnc x509verify=3D/path/to/certs'' argument is now a +synonym for setting +``-object tls-creds-x509,dir=3D/path/to/certs,id=3Dtls0,verify-peer=3Dyes'' +combined with ``-vnc tls-creds=3Dtls0' + +@subsection -tftp (since 2.6.0) + +The ``-tftp /some/dir'' argument is now a synonym for setting +the ``-netdev user,tftp=3D/some/dir' argument. The new syntax +allows different settings to be provided per NIC. + +@subsection -bootp (since 2.6.0) + +The ``-bootp /some/file'' argument is now a synonym for setting +the ``-netdev user,bootp=3D/some/file' argument. The new syntax +allows different settings to be provided per NIC. + +@subsection -redir (since 2.6.0) + +The ``-redir ARGS'' argument is now a synonym for setting +the ``-netdev user,hostfwd=3DARGS'' argument instead. The new +syntax allows different settings to be provided per NIC. + +@subsection -smb (since 2.6.0) + +The ``-smb /some/dir'' argument is now a synonym for setting +the ``-netdev user,smb=3D/some/dir'' argument instead. The new +syntax allows different settings to be provided per NIC. + +@subsection -net channel (since 2.6.0) + +The ``--net channel,ARGS'' argument is now a synonym for setting +the ``-netdev user,guestfwd=3DARGS'' argument instead. + +@subsection -net vlan (since 2.9.0) + +The ``-net van=3DNN'' argument is partially replaced with the +new ``-netdev'' argument. The remaining use cases will no +longer be directly supported in QEMU. + +@subsection -drive if=3Dscsi (since 2.9.0) + +The ``-drive if=3Dscsi'' argument is replaced by the the +``-device BUS-TYPE'' argument combined with ``-drive if=3Dnone''. + +@subsection -net dump (since 2.10.0) + +The ``--net dump'' argument is now replaced with the +``-object filter-dump'' argument which works in combination +with the modern ``-netdev`` backends instead. + +@subsection -hdachs (since 2.10.0) + +The ``-hdachs'' argument is now a synonym for setting +the ``cyls'', ``heads'', ``secs'', and ``trans'' properties +on the ``ide-hd'' device using the ``-device'' argument. +The new syntax allows different settings to be provided +per disk. + +@subsection -usbdevice (since 2.10.0) + +The ``-usbdevice DEV'' argument is now a synonym for setting +the ``-device usb-DEV'' argument instead. The deprecated syntax +would automatically enable USB support on the machine type. +If using the new syntax, USB support must be explicitly +enabled via the ``-machine usb=3Don'' argument. + +@section qemu-img command line arguments + +@subsection convert -s (since 2.0.0) + +The ``convert -s snapshot_id_or_name'' argument is obsoleted +by the ``convert -l snapshot_param'' argument instead. + +@section System emulator human monitor commands + +@subsection usb_add (since 2.10.0) + +The ``usb_add'' command is replaced by the ``device_add'' command. + +@subsection usb_del (since 2.10.0) + +The ``usb_del'' command is replaced by the ``device_del'' command. + +@section System emulator devices + +@subsection ivshmem (since 2.6.0) + +The ``ivshmem'' device type is replaced by either the ``ivshmem-plain'' +or ``ivshmem-doorbell`` device types. + +@subsection spapr-pci-vfio-host-bridge (since 2.6.0) + +The ``spapr-pci-vfio-host-bridge'' device type is replaced by +the ``spapr-pci-host-bridge'' device type. + @node License @appendix License =20 --=20 1.8.3.1 From nobody Thu May 2 16:04:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1501604929691574.991735984191; Tue, 1 Aug 2017 09:28:49 -0700 (PDT) Received: from localhost ([::1]:43636 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dca2K-0005e2-CY for importer@patchew.org; Tue, 01 Aug 2017 12:28:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35378) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZzM-0003FK-A7 for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:25:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcZzI-0004HN-V7 for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:25:44 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:35081) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dcZzI-0004GQ-ML for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:25:40 -0400 Received: by mail-wm0-x241.google.com with SMTP id r77so3808820wmd.2 for ; Tue, 01 Aug 2017 09:25:40 -0700 (PDT) Received: from 640k.lan (94-39-192-75.adsl-ull.clienti.tiscali.it. [94.39.192.75]) by smtp.gmail.com with ESMTPSA id u187sm1724160wmd.26.2017.08.01.09.17.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 09:17:37 -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=2qxCinGnt7la5b2e6fvF3+VgtWa79W8K3b79XPpvA2k=; b=ZC/p3Mq3rksVZJqSPkMEPpsd3L+UmDZPDQ5//nZx1QHFNfZaRqCo3jI1ReEvM4wktE UVt+Vm1PdeFSwHdo/XlpYyyTYrdYbJObxVrvwFaruGMSjyxSV3lFAl52e35EikyH8a26 O1LHDiFO07I3qg9cwZ3Aq8cTrlt6J/KRIFcalbnB7tGXVgui4QxGnpB6v1KWipxm4LLA /P3gO8KTPMmwGIlj919oI9y0jxc3lnHNRZ/dOONF0017F0gcxnQuWpHgjET28NFiArQu X0zsLsBMnlbGeZ8ALeY1Z0zkAYskdAhBFW157g2z5hqQSBrYKVCay9XATRrv3qD0+w/f LvAg== 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=2qxCinGnt7la5b2e6fvF3+VgtWa79W8K3b79XPpvA2k=; b=NS+ohGU7JB3Zc52flwLr31p2VLC3m7n3Qn2180hkBFcuKGjorSjrLlPtzPTgT6eHNo mIpmei1qCvGBybUW1fGqu043R6Zn1EekuGbL2+g9k6QgL6PzY3K7J0TFk1Wo6vFVi0DA dz+ZLazvqVtT2lIn1I2wxZU4T5Hl8syeKKEx0gsRsuOED5u4RJdtyu1DtH8x/D99J2yR VFw66NfFrNmhUhnYFiFeLqoP879tRlOAH/9bpQbrH1sSmQbZX3PVbnmoK6xm5NanXHSZ 0giofQP0hQ5hikknl7PqdCISEepQXLj70AcF+m1JZTzWRkE0s2gjeFcxrQO6Nd7+vDWz doCw== X-Gm-Message-State: AIVw112rva62krXbvHvEv4N3IfHtxBxBMUvlX7P9+ms63CchWry+T5h7 Ay/odmM+/+m0yBo+2fA= X-Received: by 10.28.87.193 with SMTP id l184mr1750152wmb.121.1501604258158; Tue, 01 Aug 2017 09:17:38 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 1 Aug 2017 18:17:15 +0200 Message-Id: <1501604245-33460-8-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> References: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 07/17] target-i386: kvm_get/put_vcpu_events don't handle sipi_vector 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: Peng Hao Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Peng Hao qemu call kvm_get_vcpu_events, and kernel return sipi_vector always 0, never valid when reporting to user space. But when qemu calls kvm_put_vcpu_events will make sipi_vector in kernel be 0. This will accidently modify sipi_vector when sipi_vector in kernel is not 0. Signed-off-by: Peng Hao Reviewed-by: Liu Yi Message-Id: <1500047256-8911-1-git-send-email-peng.hao2@zte.com.cn> Signed-off-by: Paolo Bonzini --- target/i386/kvm.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/target/i386/kvm.c b/target/i386/kvm.c index a6613e1..6db7783 100644 --- a/target/i386/kvm.c +++ b/target/i386/kvm.c @@ -2444,8 +2444,10 @@ static int kvm_put_vcpu_events(X86CPU *cpu, int leve= l) } =20 if (level >=3D KVM_PUT_RESET_STATE) { - events.flags |=3D - KVM_VCPUEVENT_VALID_NMI_PENDING | KVM_VCPUEVENT_VALID_SIPI_VEC= TOR; + events.flags |=3D KVM_VCPUEVENT_VALID_NMI_PENDING; + if (env->mp_state =3D=3D KVM_MP_STATE_SIPI_RECEIVED) { + events.flags |=3D KVM_VCPUEVENT_VALID_SIPI_VECTOR; + } } =20 return kvm_vcpu_ioctl(CPU(cpu), KVM_SET_VCPU_EVENTS, &events); @@ -2633,6 +2635,10 @@ int kvm_arch_put_registers(CPUState *cpu, int level) if (ret < 0) { return ret; } + ret =3D kvm_put_vcpu_events(x86_cpu, level); + if (ret < 0) { + return ret; + } if (level >=3D KVM_PUT_RESET_STATE) { ret =3D kvm_put_mp_state(x86_cpu); if (ret < 0) { @@ -2644,11 +2650,6 @@ int kvm_arch_put_registers(CPUState *cpu, int level) if (ret < 0) { return ret; } - - ret =3D kvm_put_vcpu_events(x86_cpu, level); - if (ret < 0) { - return ret; - } ret =3D kvm_put_debugregs(x86_cpu); if (ret < 0) { return ret; @@ -2668,35 +2669,39 @@ int kvm_arch_get_registers(CPUState *cs) =20 assert(cpu_is_stopped(cs) || qemu_cpu_is_self(cs)); =20 - ret =3D kvm_getput_regs(cpu, 0); + ret =3D kvm_get_vcpu_events(cpu); if (ret < 0) { goto out; } - ret =3D kvm_get_xsave(cpu); + /* + * KVM_GET_MPSTATE can modify CS and RIP, call it before + * KVM_GET_REGS and KVM_GET_SREGS. + */ + ret =3D kvm_get_mp_state(cpu); if (ret < 0) { goto out; } - ret =3D kvm_get_xcrs(cpu); + ret =3D kvm_getput_regs(cpu, 0); if (ret < 0) { goto out; } - ret =3D kvm_get_sregs(cpu); + ret =3D kvm_get_xsave(cpu); if (ret < 0) { goto out; } - ret =3D kvm_get_msrs(cpu); + ret =3D kvm_get_xcrs(cpu); if (ret < 0) { goto out; } - ret =3D kvm_get_mp_state(cpu); + ret =3D kvm_get_sregs(cpu); if (ret < 0) { goto out; } - ret =3D kvm_get_apic(cpu); + ret =3D kvm_get_msrs(cpu); if (ret < 0) { goto out; } - ret =3D kvm_get_vcpu_events(cpu); + ret =3D kvm_get_apic(cpu); if (ret < 0) { goto out; } --=20 1.8.3.1 From nobody Thu May 2 16:04:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1501604791919933.928435494181; Tue, 1 Aug 2017 09:26:31 -0700 (PDT) Received: from localhost ([::1]:43623 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dca03-0003XF-20 for importer@patchew.org; Tue, 01 Aug 2017 12:26:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59609) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZrc-0004Q8-7m for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcZrZ-0007EO-0e for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:44 -0400 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:35886) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dcZrY-0007Dm-Pp for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:40 -0400 Received: by mail-wr0-x243.google.com with SMTP id y67so1805045wrb.3 for ; Tue, 01 Aug 2017 09:17:40 -0700 (PDT) Received: from 640k.lan (94-39-192-75.adsl-ull.clienti.tiscali.it. [94.39.192.75]) by smtp.gmail.com with ESMTPSA id u187sm1724160wmd.26.2017.08.01.09.17.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 09:17:38 -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=5y8GqD8hUQJYEKWx+xjpCmGF8ViKUgWCtwfbxEhBSc0=; b=PiW9P3D5bQWheFt74J3lyYDkchNEp3pC4ru/SZD2z2a1w7gRO2RAj3yEjo9iaECf34 tvRIX51AHkJ0+XUNgt818zNyNwHz4+1muicKTq6d7/vxPsMkdXT1psCpSu++heHI/SgI EwGwGiHl90JhKftasCx5P9Tcli7+qxEesAHPzYxs1+o2kyVmPu0K3/ojqz0NtIp6I/jP bTyz5ArHvGyBbpt4JAqVzIgOIALAuWVovTXL+3m/XipW/yuLPUu8CjgXTrcYllYdw70I DQxCTmr7dVGis02dH0I0scKcGu9SQRvCePkWcl8CIJ6D6OZurT3hCyfx5ry/P8hTf2nX GuzA== 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=5y8GqD8hUQJYEKWx+xjpCmGF8ViKUgWCtwfbxEhBSc0=; b=BlTuDCLV0AzI7bx1qPHLXCMEmXV/+OFSjQM1o9v4Xy2qTKcdGWOtego6HFpVVBNQrL FFf4XjUgoVIVcMDH2uoU5OoUipI7HRVhiQeOXs6Uw99oj9rmvPIcAj9eANEhBSZO0TFF WfnjMzrgv5hJwwSTaU6v+GWNN4afjUGWC2MNnKyZUFRFEfZhEHyC+vLY9FaZdUmm331H +Z7wjR8L1zyDSUuu/uLmGZauzPheByN5XEshpHqRBMC1zjWZjHZbEvNi/+x3n109npz4 tVGWIORlMnqd3niqtxcVcpcXwY34uaJ2MpQGBdhuCYtOPVNFC71cAv5dvZ32uOl+9vFV jFBA== X-Gm-Message-State: AIVw1111F45L2HJT2CLrRXj+RU8xscta1IO5AUwGO4M8sBMI+ZefwxhA 8zIXXRSFuJjwF4W7spE= X-Received: by 10.223.136.178 with SMTP id f47mr17935543wrf.250.1501604259446; Tue, 01 Aug 2017 09:17:39 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 1 Aug 2017 18:17:16 +0200 Message-Id: <1501604245-33460-9-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> References: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::243 Subject: [Qemu-devel] [PULL 08/17] exec: Add lock parameter to qemu_ram_ptr_length 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: Anthony PERARD Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Anthony PERARD Commit 04bf2526ce87f21b32c9acba1c5518708c243ad0 (exec: use qemu_ram_ptr_length to access guest ram) start using qemu_ram_ptr_length instead of qemu_map_ram_ptr, but when used with Xen, the behavior of both function is different. They both call xen_map_cache, but one with "lock", meaning the mapping of guest memory is never released implicitly, and the second one without, which means, mapping can be release later, when needed. In the context of address_space_{read,write}_continue, the ptr to those mapping should not be locked because it is used immediatly and never used again. The lock parameter make it explicit in which context qemu_ram_ptr_length is called. Signed-off-by: Anthony PERARD Message-Id: <20170726165326.10327-1-anthony.perard@citrix.com> Reviewed-by: Stefano Stabellini Signed-off-by: Paolo Bonzini --- exec.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/exec.c b/exec.c index 01ac21e..d20c34c 100644 --- a/exec.c +++ b/exec.c @@ -2203,7 +2203,7 @@ void *qemu_map_ram_ptr(RAMBlock *ram_block, ram_addr_= t addr) * Called within RCU critical section. */ static void *qemu_ram_ptr_length(RAMBlock *ram_block, ram_addr_t addr, - hwaddr *size) + hwaddr *size, bool lock) { RAMBlock *block =3D ram_block; if (*size =3D=3D 0) { @@ -2222,10 +2222,10 @@ static void *qemu_ram_ptr_length(RAMBlock *ram_bloc= k, ram_addr_t addr, * In that case just map the requested area. */ if (block->offset =3D=3D 0) { - return xen_map_cache(addr, *size, 1, true); + return xen_map_cache(addr, *size, lock, lock); } =20 - block->host =3D xen_map_cache(block->offset, block->max_length, 1,= true); + block->host =3D xen_map_cache(block->offset, block->max_length, 1,= lock); } =20 return ramblock_ptr(block, addr); @@ -2947,7 +2947,7 @@ static MemTxResult address_space_write_continue(Addre= ssSpace *as, hwaddr addr, } } else { /* RAM case */ - ptr =3D qemu_ram_ptr_length(mr->ram_block, addr1, &l); + ptr =3D qemu_ram_ptr_length(mr->ram_block, addr1, &l, false); memcpy(ptr, buf, l); invalidate_and_set_dirty(mr, addr1, l); } @@ -3038,7 +3038,7 @@ MemTxResult address_space_read_continue(AddressSpace = *as, hwaddr addr, } } else { /* RAM case */ - ptr =3D qemu_ram_ptr_length(mr->ram_block, addr1, &l); + ptr =3D qemu_ram_ptr_length(mr->ram_block, addr1, &l, false); memcpy(buf, ptr, l); } =20 @@ -3349,7 +3349,7 @@ void *address_space_map(AddressSpace *as, =20 memory_region_ref(mr); *plen =3D address_space_extend_translation(as, addr, len, mr, xlat, l,= is_write); - ptr =3D qemu_ram_ptr_length(mr->ram_block, xlat, plen); + ptr =3D qemu_ram_ptr_length(mr->ram_block, xlat, plen, true); rcu_read_unlock(); =20 return ptr; --=20 1.8.3.1 From nobody Thu May 2 16:04:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1501604923641104.61598379564919; Tue, 1 Aug 2017 09:28:43 -0700 (PDT) Received: from localhost ([::1]:43635 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dca2E-0005Xt-4d for importer@patchew.org; Tue, 01 Aug 2017 12:28:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59610) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZrc-0004Q9-7p for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcZra-0007FK-8Q for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:44 -0400 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:34473) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dcZra-0007Er-1p for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:42 -0400 Received: by mail-wr0-x243.google.com with SMTP id o33so1802788wrb.1 for ; Tue, 01 Aug 2017 09:17:41 -0700 (PDT) Received: from 640k.lan (94-39-192-75.adsl-ull.clienti.tiscali.it. [94.39.192.75]) by smtp.gmail.com with ESMTPSA id u187sm1724160wmd.26.2017.08.01.09.17.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 09:17: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=59/UlrjSwPDIvi21QLD/UIIi0affS4iV7lP8xcl9lQM=; b=qdnEmiqHwbGjZ+3oDfAd3oQrEAZnngFbzbgShACXUi1LpR5Q59I2FupRVUcuUlAfu9 TfhheU7+/8puUakj7psxuIB6Uyl33MH9u7RW3nHuN/jsmXk/mZYrF2DiY7qVRHesFdAz /VUSDcLhsQuBLdH/eoQ++N6pe96BIlqvdFOiaAoLDPev07F1KaMkXsE/Q5LSJzwTMioJ mUohqymnPjVun0k5rgseRUZEh1l6f93CtjxvLa57TWcCazeXYgiRG2Ylhry8ESDoUp2N 9KOFGHNNUZa3xd6AQSVhiCME7aaMiDqbbGdfiWkX019Z58+WAr7+nfUMLQWSpEE+9cW4 yfWw== 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=59/UlrjSwPDIvi21QLD/UIIi0affS4iV7lP8xcl9lQM=; b=egLvP1r0rDNmL5FkzYdGLlhtx+7UAFhHplcyFipxzTzPDPWo4GUlD/JCw2GWArnzxy ujR8G83qBPaqx+JriELmNVzuuQSKYq6uEBJ+nv7tbnP/31T7aUCWqalRbJ9cbiLwnyt0 XUi/KCHF9kbNvfCAuOJ4TKPQ95YA/AVrl4v8rpajJMBNZFZKSFAhtwuOLEhtr8AgRzQl oBu4pGaguqtgbZwANsZbY0hK8nKuok9GcW88TX8MQWMYLEPKdP9dor2CCMxQPJUOZuCZ v1cGp5qEwPGTSc+IqdDuBG9bl61FZ64gYraaN4pGyO5H5tmWcYT+z9M8/dAh2dizNFPP jcpA== X-Gm-Message-State: AIVw111hPLHgXIqDP4sgWvvSi4vKXgip/rfv0xIgap3F4MmVljJ//kzO TPzThzaLpSvwkkZblmA= X-Received: by 10.223.163.16 with SMTP id c16mr17074695wrb.173.1501604260748; Tue, 01 Aug 2017 09:17:40 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 1 Aug 2017 18:17:17 +0200 Message-Id: <1501604245-33460-10-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> References: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::243 Subject: [Qemu-devel] [PULL 09/17] bt: stop the sdp memory allocation craziness X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Clang static analyzer reports a memory leak. Actually, the allocated memory escapes here: record->attribute_list[record->attributes].pair =3D data; but clang is correct that the memory might leak if len is zero. We know it isn't; assert that it is the case. The craziness doesn't end there. The memory is freed by bt_l2cap_sdp_close_ch: g_free(sdp->service_list[i].attribute_list->pair); which actually should have been written like this: g_free(sdp->service_list[i].attribute_list[0].pair); The attribute_list is sorted with qsort; but indeed the first entry of attribute_list should point to "data" even after the qsort, because the first record has id SDP_ATTR_RECORD_HANDLE, whose numeric value is zero. But hang on. The qsort function is static int sdp_attributeid_compare( const struct sdp_service_attribute_s *a, const struct sdp_service_attribute_s *b) { return (int) b->attribute_id - a->attribute_id; } but no one ever writes attribute_id. So it only works if qsort is stable, and who knows what else is broken, but we can fix it by setting attribute_id in the while loop. Signed-off-by: Paolo Bonzini --- hw/bt/sdp.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/hw/bt/sdp.c b/hw/bt/sdp.c index f67b3b8..3cb60b9 100644 --- a/hw/bt/sdp.c +++ b/hw/bt/sdp.c @@ -580,7 +580,7 @@ static void bt_l2cap_sdp_close_ch(void *opaque) int i; =20 for (i =3D 0; i < sdp->services; i ++) { - g_free(sdp->service_list[i].attribute_list->pair); + g_free(sdp->service_list[i].attribute_list[0].pair); g_free(sdp->service_list[i].attribute_list); g_free(sdp->service_list[i].uuid); } @@ -720,6 +720,8 @@ static void sdp_service_record_build(struct sdp_service= _record_s *record, len +=3D sdp_attr_max_size(&def->attributes[record->attributes ++]= .data, &record->uuids); } + + assert(len > 0); record->uuids =3D pow2ceil(record->uuids); record->attribute_list =3D g_malloc0(record->attributes * sizeof(*record->attribute_list)= ); @@ -730,12 +732,14 @@ static void sdp_service_record_build(struct sdp_servi= ce_record_s *record, record->attributes =3D 0; uuid =3D record->uuid; while (def->attributes[record->attributes].data.type) { + int attribute_id =3D def->attributes[record->attributes].id; record->attribute_list[record->attributes].pair =3D data; + record->attribute_list[record->attributes].attribute_id =3D attrib= ute_id; =20 len =3D 0; data[len ++] =3D SDP_DTYPE_UINT | SDP_DSIZE_2; - data[len ++] =3D def->attributes[record->attributes].id >> 8; - data[len ++] =3D def->attributes[record->attributes].id & 0xff; + data[len ++] =3D attribute_id >> 8; + data[len ++] =3D attribute_id & 0xff; len +=3D sdp_attr_write(data + len, &def->attributes[record->attributes].data, &uuid); =20 @@ -749,10 +753,15 @@ static void sdp_service_record_build(struct sdp_servi= ce_record_s *record, data +=3D len; } =20 - /* Sort the attribute list by the AttributeID */ + /* Sort the attribute list by the AttributeID. The first must be + * SDP_ATTR_RECORD_HANDLE so that bt_l2cap_sdp_close_ch can free + * the buffer. + */ qsort(record->attribute_list, record->attributes, sizeof(*record->attribute_list), (void *) sdp_attributeid_compare); + assert(record->attribute_list[0].pair =3D=3D data); + /* Sort the searchable UUIDs list for bisection */ qsort(record->uuid, record->uuids, sizeof(*record->uuid), --=20 1.8.3.1 From nobody Thu May 2 16:04:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1501604653031279.63115817530695; Tue, 1 Aug 2017 09:24:13 -0700 (PDT) Received: from localhost ([::1]:43612 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZxr-0001Wv-KW for importer@patchew.org; Tue, 01 Aug 2017 12:24:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59612) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZrc-0004QD-8L for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcZrb-0007GU-Bg for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:44 -0400 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:37804) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dcZrb-0007Fs-4b for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:43 -0400 Received: by mail-wr0-x242.google.com with SMTP id 12so1794868wrb.4 for ; Tue, 01 Aug 2017 09:17:43 -0700 (PDT) Received: from 640k.lan (94-39-192-75.adsl-ull.clienti.tiscali.it. [94.39.192.75]) by smtp.gmail.com with ESMTPSA id u187sm1724160wmd.26.2017.08.01.09.17.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 09:17: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; bh=MtdHiU8geOQFxOZLkHrDQLXBVvsr1uAhLZzYJdNDTSE=; b=HCB00QA75mWqxhQsI84rA4Gy6OMiNE9U2HVTBSn96cuNRA3aJaFTmgaAeIjUm7ZlWk p4YZRCiteesi1l8rjrlKiZItp1F+c+qBaMnpeftgkpR3IU4ge95nlSQTmxFU515+TFSz xiDDuBCFZ2hJU3dm3j2M/zc8RIWc+bX6LH/0aN+bvXn3zXfl+8SM4QKJdedFjlwgOH5V 6wIJxdENbESi++FO82JwO8fkPaJ5Y1tcVrKd2JxeFX+0MJiEha89SlW84cRurMbErSrk RSqJjPBUeZdu0If5Fzsp5js86c13BxWagHoAgFHn4NpkQ+DPorQx8jNRiY6tMAY2VPOp Qg2g== 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=MtdHiU8geOQFxOZLkHrDQLXBVvsr1uAhLZzYJdNDTSE=; b=b5ERTzSS2g6aW/HXvNMFMXpuOQo7kQYf1TRoHxJtuZWF5OmAHSaMpW7tmE3LLzyWIg HzTdUpkJDldLmxiSWszeIgFP3pnFn7PWNCC+V86RFUWNTvDsrj19jqkZ/xcTWenTbrnG HMME7NdtqkuTeoLzNqZW7lhFuHIUfzWLzbEBHxmk0TgEOllyJ8hAKALcil0GW/ILIcLl 4WI9TZ9a2bXWbghFGaES5P/dYNcQQruFWY00JbaA76Fiex8ZQWL4/8bch0W5+/e2FWLQ NZWb8Zmocc/xIwhiUb9OvLgys9Ay8YtLSkHs0qjeTbXNE1e6NBPHHGwzLKXNVy/zKyAY u5FA== X-Gm-Message-State: AIVw110brEyZKthkmGdJVI3FS30rPbHnyUQiDXOeLvPAb7wnl27sb9Yq 4XTRis/1159TYgcGjWY= X-Received: by 10.223.150.200 with SMTP id u66mr18148607wrb.216.1501604261929; Tue, 01 Aug 2017 09:17:41 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 1 Aug 2017 18:17:18 +0200 Message-Id: <1501604245-33460-11-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> References: <1501604245-33460-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 10/17] qemu-options: document existance of versioned machine types X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Daniel P. Berrange" The -machine docs did not explain what the versioned machine types are for, nor that they'll be maintained across releases. Signed-off-by: Daniel P. Berrange Message-Id: <20170725141041.1195-1-berrange@redhat.com> Signed-off-by: Paolo Bonzini --- qemu-options.hx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/qemu-options.hx b/qemu-options.hx index 746b5fa..9f6e2ad 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -49,7 +49,20 @@ STEXI @item -machine [type=3D]@var{name}[,prop=3D@var{value}[,...]] @findex -machine Select the emulated machine by @var{name}. Use @code{-machine help} to list -available machines. Supported machine properties are: +available machines. + +For architectures which aim to support live migration compatibility +across releases, each release will introduce a new versioned machine +type. For example, the 2.8.0 release introduced machine types +``pc-i440fx-2.8'' and ``pc-q35-2.8'' for the x86_64/i686 architectures. + +To allow live migration of guests from QEMU version 2.8.0, to QEMU +version 2.9.0, the 2.9.0 version must support the ``pc-i440fx-2.8'' +and ``pc-q35-2.8'' machines too. To allow users live migrating VMs +to skip multiple intermediate releases when upgrading, new releases +of QEMU will support machine types from many previous versions. + +Supported machine properties are: @table @option @item accel=3D@var{accels1}[:@var{accels2}[:...]] This is used to enable an accelerator. Depending on the target architectur= e, --=20 1.8.3.1 From nobody Thu May 2 16:04:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150160479293083.50544655069496; Tue, 1 Aug 2017 09:26:32 -0700 (PDT) Received: from localhost ([::1]:43625 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dca07-0003aW-II for importer@patchew.org; Tue, 01 Aug 2017 12:26:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59639) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZrd-0004Sz-UR for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcZrc-0007IH-Lf for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:45 -0400 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:35353) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dcZrc-0007Gl-Fn for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:44 -0400 Received: by mail-wr0-x242.google.com with SMTP id c24so1805612wra.2 for ; Tue, 01 Aug 2017 09:17:44 -0700 (PDT) Received: from 640k.lan (94-39-192-75.adsl-ull.clienti.tiscali.it. [94.39.192.75]) by smtp.gmail.com with ESMTPSA id u187sm1724160wmd.26.2017.08.01.09.17.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 09:17:42 -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=vgAzdq7IWZBORShAk29kkI+jvV51b+38Jx1OEpVS+SA=; b=iktT1gxKeV/i7Iem5RTUP15cS2WEN/bEdYdQGTq/hvbgYHxeET/s/04nRSVGZYvRKu oNFVNJndE0LZ7JO0/hE3ayscN6hy511kkoRVw925iT9QvLM3/oabJULVP1yDa3yEoAP3 cjKMpQpgDZPXK7i9vo/VriGonVWRNE//In7QRWHy0JaYnZmlJ4Ou3n14DzXTlTVP7gUG 6VJBYv5k5iR/D/DZnR0RrfvbF4WtbABDk24Qy8seFwnOmKnftFWRsoXnZJkFT1CZxZOA qTdp5hJY2l+K/wy/wCOr7kAKjLpmUXjN1U3B5qiLXMY+eUmn+R1VlSGXtRDugkdrk6Iq UUZg== 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=vgAzdq7IWZBORShAk29kkI+jvV51b+38Jx1OEpVS+SA=; b=mkoc1TFphsoweFgGRgnAQgOCt9CDgoK4qizAjyAYV4ytD26u1ifs/2VeHMTBv0Crsx 5hHi8Py6aI3e9b0vrt06fdmj70a0qaYAvMIQVpWbIYxfvWtj+ORZ64CsK8+8RQ8kkTz8 ft43VUBygwY88DW3t0YCOLyGYmW0nhcuP/jHBapFnisUA6shu+IHWHIVF83x6FDxcY4k tHi6LH9Fkqul3T50agbuHtr0NHusrVIVSogYwU6Ifa8eQh5IIa/LGPKWgmXF8OpZpX1r UNS67TzIJ9tMbKm4727SbAH2TcE15saNTTc7dz6UZNoxMg6hiOZ8riN8uvVurDhFnM4r aUrg== X-Gm-Message-State: AIVw1120w4P6ythj46yw7uDGhOUJj7qSdB75yUnWcLRwlx5M23jD2FVl JtXAE3LdOYemSpNLCVo= X-Received: by 10.223.171.200 with SMTP id s66mr17217738wrc.38.1501604263317; Tue, 01 Aug 2017 09:17:43 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 1 Aug 2017 18:17:19 +0200 Message-Id: <1501604245-33460-12-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> References: <1501604245-33460-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/17] migration: optimize the downtime 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: Jay Zhou Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Jay Zhou Qemu_savevm_state_cleanup takes about 300ms in my ram migration tests with a 8U24G vm(20G is really occupied), the main cost comes from KVM_SET_USER_MEMORY_REGION ioctl when mem.memory_size =3D 0 in kvm_set_user_memory_region. In kmod, the main cost is kvm_zap_obsolete_pages, which traverses the active_mmu_pages list to zap the unsync sptes. It can be optimized by delaying memory_global_dirty_log_stop to the next vm_start. Changes v2->v3: - NULL VMChangeStateHandler if it is deleted and protect the scenario of nested invocations of memory_global_dirty_log_start/stop [Paolo] Changes v1->v2: - create a VMChangeStateHandler in memory.c to reduce the coupling [Paolo] Signed-off-by: Jay Zhou Message-Id: <1501237733-2736-1-git-send-email-jianjay.zhou@huawei.com> Signed-off-by: Paolo Bonzini --- memory.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/memory.c b/memory.c index a7bc70a..c0adc35 100644 --- a/memory.c +++ b/memory.c @@ -2357,8 +2357,15 @@ void memory_global_dirty_log_sync(void) } } =20 +static VMChangeStateEntry *vmstate_change; + void memory_global_dirty_log_start(void) { + if (vmstate_change) { + qemu_del_vm_change_state_handler(vmstate_change); + vmstate_change =3D NULL; + } + global_dirty_log =3D true; =20 MEMORY_LISTENER_CALL_GLOBAL(log_global_start, Forward); @@ -2369,7 +2376,7 @@ void memory_global_dirty_log_start(void) memory_region_transaction_commit(); } =20 -void memory_global_dirty_log_stop(void) +static void memory_global_dirty_log_do_stop(void) { global_dirty_log =3D false; =20 @@ -2381,6 +2388,33 @@ void memory_global_dirty_log_stop(void) MEMORY_LISTENER_CALL_GLOBAL(log_global_stop, Reverse); } =20 +static void memory_vm_change_state_handler(void *opaque, int running, + RunState state) +{ + if (running) { + memory_global_dirty_log_do_stop(); + + if (vmstate_change) { + qemu_del_vm_change_state_handler(vmstate_change); + vmstate_change =3D NULL; + } + } +} + +void memory_global_dirty_log_stop(void) +{ + if (!runstate_is_running()) { + if (vmstate_change) { + return; + } + vmstate_change =3D qemu_add_vm_change_state_handler( + memory_vm_change_state_handler, NULL); + return; + } + + memory_global_dirty_log_do_stop(); +} + static void listener_add_address_space(MemoryListener *listener, AddressSpace *as) { --=20 1.8.3.1 From nobody Thu May 2 16:04:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1501605043936574.5825637624881; Tue, 1 Aug 2017 09:30:43 -0700 (PDT) Received: from localhost ([::1]:43650 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dca4A-0007Ju-AH for importer@patchew.org; Tue, 01 Aug 2017 12:30:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59655) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZrf-0004UZ-1d for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcZre-0007K2-01 for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:47 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:33950) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dcZrd-0007JB-Pl for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:45 -0400 Received: by mail-wm0-x241.google.com with SMTP id x64so3782691wmg.1 for ; Tue, 01 Aug 2017 09:17:45 -0700 (PDT) Received: from 640k.lan (94-39-192-75.adsl-ull.clienti.tiscali.it. [94.39.192.75]) by smtp.gmail.com with ESMTPSA id u187sm1724160wmd.26.2017.08.01.09.17.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 09:17:43 -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=D+G5kwza7ZEG03lCxk84J/for1MoU4SBk2DTOkU74v8=; b=S7XWBukCYXpPUY7fCb/9RrGttqHQf3s1zVAmBsdFaU4FGRDmyN+2bGYFF6oevHqLdd 4vxvCQ864GqUMObPDnRuV8vi8zK24e8TxQDYSBg21BEC1DYHRqH7I0LIWXjQWcWwhK68 4OiRIlk+4V5JvoOVFTzTO6lU5lwrTh75/hImeUczWJTjRnwzj3ER3ywBCsTiW9uduGqw zLVe9d0/8/0AADzGdvkImKNGf03MgzFUQV+sg5PVXyLNCnuRbIBVXPNm8jqGFCSENPHc 7BtzvoYNyIjgSaxEvACYcEN4DCpXLEf8/w4ej7PxMWdbjrXBNAyI8x5XzZvoUR86RaPf tJTg== 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=D+G5kwza7ZEG03lCxk84J/for1MoU4SBk2DTOkU74v8=; b=SmgffkYfeRC21+rxPwj1qZ/gRMT31Ulv5s+C4V+zTJXv4wxM2SL3zvCf33CpqkJC+9 Sx5tlXWAbBgSAQaZUIYTLn+kZ/g9mvn4ijb1XubWb4cj5hbMC0NQWV0zhbqG66Mb0rCP 9WJbfdcXFxOSyqoky4Qvbki4RRvj08bdL7xdDM6u18etp8U/W5kO1QAEvg75cJNnzdoE A8VV4HO0iye0gA+IgiNjRGfykEYlPoDGb1XixlnoZFjOpxvsqOcLViyb2N2kgT8HdR3R FMHhuHz5yVJ5MRusXZFn4G6x5tOcaGrnOPrZBfAzrgHb1LibMzrKGiM2rY8MYq7Rs8mm 44Ng== X-Gm-Message-State: AIVw1137jspqRqIF7EbuWa5Q2FfMsGzcZGie3nNnodJfqeyYNNNXPzUO zT23JrM0aP18aot0qwk= X-Received: by 10.28.230.199 with SMTP id e68mr1898818wmi.179.1501604264529; Tue, 01 Aug 2017 09:17:44 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 1 Aug 2017 18:17:20 +0200 Message-Id: <1501604245-33460-13-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> References: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 12/17] hw/scsi/vmw_pvscsi: Remove the dead error handling 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: Mao Zhongyi , Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Mao Zhongyi qemu_bh_new() is a wrapper around aio_bh_new(), which returns null only when g_new() does. It doesn't. So remove the dead error handling. Reviewed-by: Dmitry Fleytman Cc: Paolo Bonzini Cc: Markus Armbruster Signed-off-by: Mao Zhongyi Message-Id: <20170726084153.10121-1-maozy.fnst@cn.fujitsu.com> Signed-off-by: Paolo Bonzini --- hw/scsi/vmw_pvscsi.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c index 4a106da..d92973e 100644 --- a/hw/scsi/vmw_pvscsi.c +++ b/hw/scsi/vmw_pvscsi.c @@ -1138,10 +1138,6 @@ pvscsi_init(PCIDevice *pci_dev) } =20 s->completion_worker =3D qemu_bh_new(pvscsi_process_completion_queue, = s); - if (!s->completion_worker) { - pvscsi_cleanup_msi(s); - return -ENOMEM; - } =20 scsi_bus_new(&s->bus, sizeof(s->bus), DEVICE(pci_dev), &pvscsi_scsi_info, NULL); --=20 1.8.3.1 From nobody Thu May 2 16:04:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1501604652097771.2138582917497; Tue, 1 Aug 2017 09:24:12 -0700 (PDT) Received: from localhost ([::1]:43611 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZxq-0001VS-Mb for importer@patchew.org; Tue, 01 Aug 2017 12:24:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZrf-0004Vi-UX for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcZrf-0007Ku-1r for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:47 -0400 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:38110) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dcZre-0007KJ-Rd for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:46 -0400 Received: by mail-wr0-x242.google.com with SMTP id g32so1795886wrd.5 for ; Tue, 01 Aug 2017 09:17:46 -0700 (PDT) Received: from 640k.lan (94-39-192-75.adsl-ull.clienti.tiscali.it. [94.39.192.75]) by smtp.gmail.com with ESMTPSA id u187sm1724160wmd.26.2017.08.01.09.17.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 09:17:45 -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=kwTYugsOtXBA1z7GXGdLajOiiFquJkpfb3q8FbH/wPM=; b=rmxw5xxfAIzLN8kbUeDSGeFpE+jyBltc6EFNjxFzsZXo3pgv7IqOC9ZOqk0FRKGlwJ ZyP3ck3eTF2OLt7gPIrVwvaXJwi8MRSeF6dxe+dwgVBGTUAcPLXKguP55hlTlUX/pWqz pB8bpTHo5CK/Vjn+ypNH9b1FGp903f3QEb+l3xalfLtEECgPWrVCcQNyR1Ojpv00yx2x mlsjAHsdCVwHlEG2JGvY2jZ6ep/8k7OA7KKgOKzCYwhmVKep4coYTCfjgAmeR+fVQyKP cpWjp4KWmeblOTcRTY6MXDT9axAMLkxM6ZtnB0TLu5DmmMHqRN9W5r2Rrx45hJMZMhwN kJSA== 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=kwTYugsOtXBA1z7GXGdLajOiiFquJkpfb3q8FbH/wPM=; b=hw1WRRtlKMRxVHl+AmwHdmeKHA7kzUtkxk7nCwwMudEyTMXCf5ySRjs3rg3c2zewQ3 yV3RH5HA89UzKVHseR4810/sph2JIuRKH/uTFDUznwFqJDQa8pXRrUcOFlIQ/sdCqeBB C4S6G0GTMkLIT8/DClJ3is9OMil1Itp/H4GEbfpeeih1gvLmAsKnU0nWxMyBRl0DGrMN RAqSw2xffJpI4KCQcVwHICQlepUPwlDXgqyRi/0WMIY6ct8Xt7FiBlpDIU80Kc2/slnQ uK+MKbcFE1eXvY1yh8QozBRBDiagsHnX4FWUXCOO8/KmNYsFNuFb0N1qSUJKyb9Oxjan DLlw== X-Gm-Message-State: AIVw112plKh70xpe2LN5gNlzkyI8l2yurc/iFoOFssbdyB8PeZ0Z69l4 2piAjXeBQQ+IZbohhzk= X-Received: by 10.223.188.17 with SMTP id s17mr14227308wrg.201.1501604265721; Tue, 01 Aug 2017 09:17:45 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 1 Aug 2017 18:17:21 +0200 Message-Id: <1501604245-33460-14-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> References: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 13/17] hw/scsi/vmw_pvscsi: Convert to realize 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: Mao Zhongyi , Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Mao Zhongyi Convert a device model where initialization obviously can't fail, make it implement realize() rather than init(). Reviewed-by: Dmitry Fleytman Cc: Paolo Bonzini Cc: Markus Armbruster Signed-off-by: Mao Zhongyi Message-Id: <20170726084153.10121-2-maozy.fnst@cn.fujitsu.com> Signed-off-by: Paolo Bonzini --- hw/scsi/vmw_pvscsi.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c index d92973e..77d8b6f 100644 --- a/hw/scsi/vmw_pvscsi.c +++ b/hw/scsi/vmw_pvscsi.c @@ -1103,8 +1103,8 @@ static const struct SCSIBusInfo pvscsi_scsi_info =3D { .cancel =3D pvscsi_request_cancelled, }; =20 -static int -pvscsi_init(PCIDevice *pci_dev) +static void +pvscsi_realizefn(PCIDevice *pci_dev, Error **errp) { PVSCSIState *s =3D PVSCSI(pci_dev); =20 @@ -1144,8 +1144,6 @@ pvscsi_init(PCIDevice *pci_dev) /* override default SCSI bus hotplug-handler, with pvscsi's one */ qbus_set_hotplug_handler(BUS(&s->bus), DEVICE(s), &error_abort); pvscsi_reset_state(s); - - return 0; } =20 static void @@ -1278,7 +1276,7 @@ static void pvscsi_class_init(ObjectClass *klass, voi= d *data) PVSCSIClass *pvs_k =3D PVSCSI_DEVICE_CLASS(klass); HotplugHandlerClass *hc =3D HOTPLUG_HANDLER_CLASS(klass); =20 - k->init =3D pvscsi_init; + k->realize =3D pvscsi_realizefn; k->exit =3D pvscsi_uninit; k->vendor_id =3D PCI_VENDOR_ID_VMWARE; k->device_id =3D PCI_DEVICE_ID_VMWARE_PVSCSI; --=20 1.8.3.1 From nobody Thu May 2 16:04:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1501604420783818.3942425116112; Tue, 1 Aug 2017 09:20:20 -0700 (PDT) Received: from localhost ([::1]:43590 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZu7-0006J6-5K for importer@patchew.org; Tue, 01 Aug 2017 12:20:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZrh-0004XU-BE for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcZrg-0007LX-Bd for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:49 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:35315) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dcZrg-0007LD-2S for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:48 -0400 Received: by mail-wm0-x244.google.com with SMTP id r77so3776511wmd.2 for ; Tue, 01 Aug 2017 09:17:48 -0700 (PDT) Received: from 640k.lan (94-39-192-75.adsl-ull.clienti.tiscali.it. [94.39.192.75]) by smtp.gmail.com with ESMTPSA id u187sm1724160wmd.26.2017.08.01.09.17.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 09:17:46 -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=yqoicxmgLD445rd6NIXHz3OKqLHMRZw+FF+lpctuUcE=; b=jXefNlx99H30fyTDKt8Dcuvc9F71+UDu4EUZfjtOW/QqvanMTk9lsMsJbVAghylD7F xV+RC5g4C6R9OnNdjx75/BgXFWiKWvkMbxgOOUGqXGewxYZGEVYNcjYaKnRxYsqhBFXP 7zb0bk7c8m92HW2iYFnsgFCv4z7xqyqG3c4R8aTs0tgd514MbTPxmpcVhBEttla9O3WB GivG7Wnj95h9ahunT/MMPiLMaJn/GFdbYcPPo2/O9gp1AoOSYZHfrJebPp8OcrYm47Lr I+wdZBFuQ87YaOvzKcslmytsjzSJtqabeCl588p1YzV+bZ8DmwexMult+CMLflQfSCCH jkEw== 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=yqoicxmgLD445rd6NIXHz3OKqLHMRZw+FF+lpctuUcE=; b=WqYgop+BNEj4XzGqtQLAmYYGB97LkS/aUfs/URUyvZSWw5LsGxnw9Rf83ApluZCLSO oJ6207iZJco5S/WBIkXcnmTMj41e/18jsGVe/sk2a4eU+k3svJW1UWCGYP6dWNIfrw4R O1CzsN8sng+jJEidifw8MMol7S+FCYgcX8J+/B0qWt+ys72ioLYCWQ8Xp4T1PL+EVP1W 1Ive3ywyIT/OJBzWtk/jdo6+AhEEz52MPwGUaMpYybe2ZHWcLLC3aqQqhAUESy7gOmpY B2CbzmuE5kk+aekkdhP8hHZT//VJDhUPu6s3Y0/gSj9syT0qnaGn6FTs4tUfPRwf6B2R u9cw== X-Gm-Message-State: AIVw111a5QP0c7byzz3nV3frJYLmiXfKQc5d0Vcj2kHVjzSyOkNohLOO ydlN9oA9Pc8Z0pKWyow= X-Received: by 10.28.49.134 with SMTP id x128mr1796023wmx.111.1501604266743; Tue, 01 Aug 2017 09:17:46 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 1 Aug 2017 18:17:22 +0200 Message-Id: <1501604245-33460-15-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> References: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 14/17] rtc-test: cleanup register_b_set_flag test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Introduce set_datetime_bcd/assert_datetime_bcd, and handle UIP correctly. Signed-off-by: Paolo Bonzini --- tests/rtc-test.c | 76 ++++++++++++++++++++++++++++++++++------------------= ---- 1 file changed, 46 insertions(+), 30 deletions(-) diff --git a/tests/rtc-test.c b/tests/rtc-test.c index e78f701..798cf5e 100644 --- a/tests/rtc-test.c +++ b/tests/rtc-test.c @@ -17,6 +17,8 @@ #include "qemu/timer.h" #include "hw/timer/mc146818rtc_regs.h" =20 +#define UIP_HOLD_LENGTH (8 * NANOSECONDS_PER_SECOND / 32768) + static uint8_t base =3D 0x70; =20 static int bcd2dec(int value) @@ -297,16 +299,30 @@ static void alarm_time(void) g_assert(cmos_read(RTC_REG_C) =3D=3D 0); } =20 +static void set_time_regs(int h, int m, int s) +{ + cmos_write(RTC_HOURS, h); + cmos_write(RTC_MINUTES, m); + cmos_write(RTC_SECONDS, s); +} + static void set_time(int mode, int h, int m, int s) { - /* set BCD 12 hour mode */ cmos_write(RTC_REG_B, mode); - cmos_write(RTC_REG_A, 0x76); + set_time_regs(h, m, s); + cmos_write(RTC_REG_A, 0x26); +} + +static void set_datetime_bcd(int h, int min, int s, int d, int m, int y) +{ cmos_write(RTC_HOURS, h); - cmos_write(RTC_MINUTES, m); + cmos_write(RTC_MINUTES, min); cmos_write(RTC_SECONDS, s); - cmos_write(RTC_REG_A, 0x26); + cmos_write(RTC_YEAR, y & 0xFF); + cmos_write(RTC_CENTURY, y >> 8); + cmos_write(RTC_MONTH, m); + cmos_write(RTC_DAY_OF_MONTH, d); } =20 #define assert_time(h, m, s) \ @@ -316,6 +332,17 @@ static void set_time(int mode, int h, int m, int s) g_assert_cmpint(cmos_read(RTC_SECONDS), =3D=3D, s); \ } while(0) =20 +#define assert_datetime_bcd(h, min, s, d, m, y) \ + do { \ + g_assert_cmpint(cmos_read(RTC_HOURS), =3D=3D, h); \ + g_assert_cmpint(cmos_read(RTC_MINUTES), =3D=3D, min); \ + g_assert_cmpint(cmos_read(RTC_SECONDS), =3D=3D, s); \ + g_assert_cmpint(cmos_read(RTC_DAY_OF_MONTH), =3D=3D, d); \ + g_assert_cmpint(cmos_read(RTC_MONTH), =3D=3D, m); \ + g_assert_cmpint(cmos_read(RTC_YEAR), =3D=3D, (y & 0xFF)); \ + g_assert_cmpint(cmos_read(RTC_CENTURY), =3D=3D, (y >> 8)); \ + } while(0) + static void basic_12h_bcd(void) { /* set BCD 12 hour mode */ @@ -506,41 +533,30 @@ static void fuzz_registers(void) =20 static void register_b_set_flag(void) { + if (cmos_read(RTC_REG_A) & REG_A_UIP) { + clock_step(UIP_HOLD_LENGTH + NANOSECONDS_PER_SECOND / 5); + } + g_assert_cmpint(cmos_read(RTC_REG_A) & REG_A_UIP, =3D=3D, 0); + /* Enable binary-coded decimal (BCD) mode and SET flag in Register B*/ cmos_write(RTC_REG_B, REG_B_24H | REG_B_SET); =20 - cmos_write(RTC_REG_A, 0x76); - cmos_write(RTC_YEAR, 0x11); - cmos_write(RTC_CENTURY, 0x20); - cmos_write(RTC_MONTH, 0x02); - cmos_write(RTC_DAY_OF_MONTH, 0x02); - cmos_write(RTC_HOURS, 0x02); - cmos_write(RTC_MINUTES, 0x04); - cmos_write(RTC_SECONDS, 0x58); - cmos_write(RTC_REG_A, 0x26); + set_datetime_bcd(0x02, 0x04, 0x58, 0x02, 0x02, 0x2011); =20 - /* Since SET flag is still enabled, these are equality checks. */ - g_assert_cmpint(cmos_read(RTC_HOURS), =3D=3D, 0x02); - g_assert_cmpint(cmos_read(RTC_MINUTES), =3D=3D, 0x04); - g_assert_cmpint(cmos_read(RTC_SECONDS), =3D=3D, 0x58); - g_assert_cmpint(cmos_read(RTC_DAY_OF_MONTH), =3D=3D, 0x02); - g_assert_cmpint(cmos_read(RTC_MONTH), =3D=3D, 0x02); - g_assert_cmpint(cmos_read(RTC_YEAR), =3D=3D, 0x11); - g_assert_cmpint(cmos_read(RTC_CENTURY), =3D=3D, 0x20); + assert_datetime_bcd(0x02, 0x04, 0x58, 0x02, 0x02, 0x2011); + + /* Since SET flag is still enabled, time does not advance. */ + clock_step(1000000000LL); + assert_datetime_bcd(0x02, 0x04, 0x58, 0x02, 0x02, 0x2011); =20 /* Disable SET flag in Register B */ cmos_write(RTC_REG_B, cmos_read(RTC_REG_B) & ~REG_B_SET); =20 - g_assert_cmpint(cmos_read(RTC_HOURS), =3D=3D, 0x02); - g_assert_cmpint(cmos_read(RTC_MINUTES), =3D=3D, 0x04); + assert_datetime_bcd(0x02, 0x04, 0x58, 0x02, 0x02, 0x2011); =20 - /* Since SET flag is disabled, this is an inequality check. - * We (reasonably) assume that no (sexagesimal) overflow occurs. */ - g_assert_cmpint(cmos_read(RTC_SECONDS), >=3D, 0x58); - g_assert_cmpint(cmos_read(RTC_DAY_OF_MONTH), =3D=3D, 0x02); - g_assert_cmpint(cmos_read(RTC_MONTH), =3D=3D, 0x02); - g_assert_cmpint(cmos_read(RTC_YEAR), =3D=3D, 0x11); - g_assert_cmpint(cmos_read(RTC_CENTURY), =3D=3D, 0x20); + /* Since SET flag is disabled, the clock now advances. */ + clock_step(1000000000LL); + assert_datetime_bcd(0x02, 0x04, 0x59, 0x02, 0x02, 0x2011); } =20 #define RTC_PERIOD_CODE1 13 /* 8 Hz */ --=20 1.8.3.1 From nobody Thu May 2 16:04:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1501604791789110.22547805866884; Tue, 1 Aug 2017 09:26:31 -0700 (PDT) Received: from localhost ([::1]:43624 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dca05-0003Xu-1p for importer@patchew.org; Tue, 01 Aug 2017 12:26:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZri-0004Yj-O9 for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcZrh-0007M2-DI for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:50 -0400 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:33372) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dcZrh-0007Lj-5q for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:49 -0400 Received: by mail-wr0-x243.google.com with SMTP id y43so1805761wrd.0 for ; Tue, 01 Aug 2017 09:17:49 -0700 (PDT) Received: from 640k.lan (94-39-192-75.adsl-ull.clienti.tiscali.it. [94.39.192.75]) by smtp.gmail.com with ESMTPSA id u187sm1724160wmd.26.2017.08.01.09.17.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 09:17:47 -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=338HV9i/rlAOELeU1l4LLN5teHeFWgGTnm19OcoP+Oc=; b=d29NFNubt8F/nm+a3AssQlNQMHOAzencuXHth3YRiBeNSUbuLA8vbwNjYvJTtraL2j /UDbNu9bLrUsZNZQdqeri6FbXhT/Ad7CUzy1h146USta2p9QANl2rItwfWsGfQ+Wxy2K 3kDjHq5lERuLy3tKMOXCiDHyTdD2WBQg64kboXAdJPPZc11UPIGpBHHmF08tQDQZHXn/ V7alOZhZWptC6QEIHfYWPmp26Qpuk3D6jNOes7W2AhcCMCgMYGfezL5VuYienTkjvn5Z o6MChBqAYVjqoglmu0mOx69ASt/KkCIswq7H9UcA3sQ7/F2XuuQQxzH1Jas3eNA82YjJ S+9g== 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=338HV9i/rlAOELeU1l4LLN5teHeFWgGTnm19OcoP+Oc=; b=P2kdikx8fJsGErcVHRGuP8dCSNH7iWnISrgf9zsveqiov9C3ILgjr9AiuEvVO1f0pc Hkx8hnS2oIMxxd29gsFhu6uOPejnEF9TEVb7x3rpDi8YZ3k7QtJJhklLBCswxV18CUnc EMkcX1aP69w35z9JTkLWwINA43W5C6/x/9mWrvBzN4A5+FTARtjyZR65nlH/LD2x2qBV OxTcHzdwSv0hjQIjQJPpdsQLWwScnLKrTIVinQk2E+NspZpM1csl7aFwNHfkPF8KS/bN ZhY5n04aHApI23cT3j9PNukfG9iisr+vvfHFDUyTgi0TgDn/Mz+xDIXXSrSKntS7m8g7 ljzQ== X-Gm-Message-State: AIVw113vndX6xXrDy+YpVyvWw2dk2WrZvZ3ZX1w2hMG9oRGYikkj+r8n asojxHExReHJgwsEDVQ= X-Received: by 10.223.169.131 with SMTP id b3mr17213941wrd.126.1501604267807; Tue, 01 Aug 2017 09:17:47 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 1 Aug 2017 18:17:23 +0200 Message-Id: <1501604245-33460-16-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> References: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::243 Subject: [Qemu-devel] [PULL 15/17] rtc-test: introduce more update tests X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Test divider reset and UIP behavior. Signed-off-by: Paolo Bonzini --- tests/rtc-test.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++= +++- 1 file changed, 81 insertions(+), 1 deletion(-) diff --git a/tests/rtc-test.c b/tests/rtc-test.c index 798cf5e..d7a96cb 100644 --- a/tests/rtc-test.c +++ b/tests/rtc-test.c @@ -325,6 +325,30 @@ static void set_datetime_bcd(int h, int min, int s, in= t d, int m, int y) cmos_write(RTC_DAY_OF_MONTH, d); } =20 +static void set_datetime_dec(int h, int min, int s, int d, int m, int y) +{ + cmos_write(RTC_HOURS, h); + cmos_write(RTC_MINUTES, min); + cmos_write(RTC_SECONDS, s); + cmos_write(RTC_YEAR, y % 100); + cmos_write(RTC_CENTURY, y / 100); + cmos_write(RTC_MONTH, m); + cmos_write(RTC_DAY_OF_MONTH, d); +} + +static void set_datetime(int mode, int h, int min, int s, int d, int m, in= t y) +{ + cmos_write(RTC_REG_B, mode); + + cmos_write(RTC_REG_A, 0x76); + if (mode & REG_B_DM) { + set_datetime_dec(h, min, s, d, m, y); + } else { + set_datetime_bcd(h, min, s, d, m, y); + } + cmos_write(RTC_REG_A, 0x26); +} + #define assert_time(h, m, s) \ do { \ g_assert_cmpint(cmos_read(RTC_HOURS), =3D=3D, h); \ @@ -559,6 +583,60 @@ static void register_b_set_flag(void) assert_datetime_bcd(0x02, 0x04, 0x59, 0x02, 0x02, 0x2011); } =20 +static void divider_reset(void) +{ + /* Enable binary-coded decimal (BCD) mode in Register B*/ + cmos_write(RTC_REG_B, REG_B_24H); + + /* Enter divider reset */ + cmos_write(RTC_REG_A, 0x76); + set_datetime_bcd(0x02, 0x04, 0x58, 0x02, 0x02, 0x2011); + + assert_datetime_bcd(0x02, 0x04, 0x58, 0x02, 0x02, 0x2011); + + /* Since divider reset flag is still enabled, these are equality check= s. */ + clock_step(1000000000LL); + assert_datetime_bcd(0x02, 0x04, 0x58, 0x02, 0x02, 0x2011); + + /* The first update ends 500 ms after divider reset */ + cmos_write(RTC_REG_A, 0x26); + clock_step(500000000LL - UIP_HOLD_LENGTH - 1); + g_assert_cmpint(cmos_read(RTC_REG_A) & REG_A_UIP, =3D=3D, 0); + assert_datetime_bcd(0x02, 0x04, 0x58, 0x02, 0x02, 0x2011); + + clock_step(1); + g_assert_cmpint(cmos_read(RTC_REG_A) & REG_A_UIP, !=3D, 0); + clock_step(UIP_HOLD_LENGTH); + g_assert_cmpint(cmos_read(RTC_REG_A) & REG_A_UIP, =3D=3D, 0); + + assert_datetime_bcd(0x02, 0x04, 0x59, 0x02, 0x02, 0x2011); +} + +static void uip_stuck(void) +{ + set_datetime(REG_B_24H, 0x02, 0x04, 0x58, 0x02, 0x02, 0x2011); + + /* The first update ends 500 ms after divider reset */ + (void)cmos_read(RTC_REG_C); + clock_step(500000000LL); + g_assert_cmpint(cmos_read(RTC_REG_A) & REG_A_UIP, =3D=3D, 0); + assert_datetime_bcd(0x02, 0x04, 0x59, 0x02, 0x02, 0x2011); + + /* UF is now set. */ + cmos_write(RTC_HOURS_ALARM, 0x02); + cmos_write(RTC_MINUTES_ALARM, 0xC0); + cmos_write(RTC_SECONDS_ALARM, 0xC0); + + /* Because the alarm will fire soon, reading register A will latch UIP= . */ + clock_step(1000000000LL - UIP_HOLD_LENGTH / 2); + g_assert_cmpint(cmos_read(RTC_REG_A) & REG_A_UIP, !=3D, 0); + + /* Move the alarm far away. This must not cause UIP to remain stuck! = */ + cmos_write(RTC_HOURS_ALARM, 0x03); + clock_step(UIP_HOLD_LENGTH); + g_assert_cmpint(cmos_read(RTC_REG_A) & REG_A_UIP, =3D=3D, 0); +} + #define RTC_PERIOD_CODE1 13 /* 8 Hz */ #define RTC_PERIOD_CODE2 15 /* 2 Hz */ =20 @@ -625,7 +703,9 @@ int main(int argc, char **argv) qtest_add_func("/rtc/basic/bcd-12h", basic_12h_bcd); qtest_add_func("/rtc/set-year/20xx", set_year_20xx); qtest_add_func("/rtc/set-year/1980", set_year_1980); - qtest_add_func("/rtc/misc/register_b_set_flag", register_b_set_flag); + qtest_add_func("/rtc/update/register_b_set_flag", register_b_set_flag); + qtest_add_func("/rtc/update/divider-reset", divider_reset); + qtest_add_func("/rtc/update/uip-stuck", uip_stuck); qtest_add_func("/rtc/misc/fuzz-registers", fuzz_registers); qtest_add_func("/rtc/periodic/interrupt", periodic_timer); =20 --=20 1.8.3.1 From nobody Thu May 2 16:04:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1501604974364974.8682916580855; Tue, 1 Aug 2017 09:29:34 -0700 (PDT) Received: from localhost ([::1]:43638 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dca32-0006FN-Gs for importer@patchew.org; Tue, 01 Aug 2017 12:29:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59718) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZrm-0004c2-0u for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcZrj-0007Mr-3k for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:54 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:36435) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dcZri-0007MU-Tk for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:51 -0400 Received: by mail-wm0-x243.google.com with SMTP id d40so3782835wma.3 for ; Tue, 01 Aug 2017 09:17:50 -0700 (PDT) Received: from 640k.lan (94-39-192-75.adsl-ull.clienti.tiscali.it. [94.39.192.75]) by smtp.gmail.com with ESMTPSA id u187sm1724160wmd.26.2017.08.01.09.17.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 09:17:48 -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=A+EkfFCSfdNfM9Ldn8zeF9xnHgd0dZ/SiFSL/OuxUF8=; b=OIeBE2CTHmPizbFdAqbr/jhXL8R6IHOT6esdC3xTYbSocP7xFwdLKfw6D3MaOtL9TQ b+20B52rEsfUb0AlEQVETzw1wc7NWmv3YAGWhQcfwz7aJxGGyfC7ugt6Zdn778MLwmcn hWz8M9W3HKsL1+3SubIL+4HK82TdWw8NstRpmSb8Ifqzu3bSC4CGy1p4rCkEW57n7xVc VeUl4ZT8CXvCiJCRsOCgq2bzET3W/IanbpuD14FCuQDCqvvj8czSOKeWXf59OcWl59bB crYpwhmvg6ezRo95UJM3mvXmxSG0uwKgku1zu64WU1GwBR1h1aR553mIQS9xlOu9H9SI FvJg== 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=A+EkfFCSfdNfM9Ldn8zeF9xnHgd0dZ/SiFSL/OuxUF8=; b=KikbELK9fIDR2C72CcMyOE+AfQufcoHwM1Tmzc5Gi4eQqO3EkNVuVRUX53ht+No2nV r5BL1q+HMwbnshyWmvEJBJCUeA/YV92wqKYB9pSz/Imi719fJSDt5XVOhpm8rc3n5b8p hPAOdjkTX7dZNcnYPPZC5/0DX4kYll5Hyldd2ttsR/CrVdXNzUcATM2fUuBY9En1i37B FPAUkI3Lm63EPRQHCuu5nJst1iAQWIVBwL8M0DmSKRp2Uj9Yg3H2tUSaoAS7tK35yuha Uw3RhWoIAeIpH7qOuLrdc+xTrdorshZPpMDTCTy/1JXk+P+nRDzcKIA2ItRWJif/ASs4 eA9A== X-Gm-Message-State: AIVw1138iuPbnKHTPdxcaRmo3vm39sq869TFGjxfKiZJEfMrhnX19hFa FCM0d/kTDbL6fsHBpKc= X-Received: by 10.28.169.82 with SMTP id s79mr1995697wme.123.1501604269666; Tue, 01 Aug 2017 09:17:49 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 1 Aug 2017 18:17:24 +0200 Message-Id: <1501604245-33460-17-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> References: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PULL 16/17] mc146818rtc: simplify check_update_timer X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Move all the optimized cases together, since they all have UF=3D1 in common. Signed-off-by: Paolo Bonzini --- hw/timer/mc146818rtc.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c index 1b8d3d7..ffb2c6a 100644 --- a/hw/timer/mc146818rtc.c +++ b/hw/timer/mc146818rtc.c @@ -291,26 +291,14 @@ static void check_update_timer(RTCState *s) =20 /* From the data sheet: "Holding the dividers in reset prevents * interrupts from operating, while setting the SET bit allows" - * them to occur. However, it will prevent an alarm interrupt - * from occurring, because the time of day is not updated. + * them to occur. */ if ((s->cmos_data[RTC_REG_A] & 0x60) =3D=3D 0x60) { timer_del(s->update_timer); return; } - if ((s->cmos_data[RTC_REG_C] & REG_C_UF) && - (s->cmos_data[RTC_REG_B] & REG_B_SET)) { - timer_del(s->update_timer); - return; - } - if ((s->cmos_data[RTC_REG_C] & REG_C_UF) && - (s->cmos_data[RTC_REG_C] & REG_C_AF)) { - timer_del(s->update_timer); - return; - } =20 guest_nsec =3D get_guest_rtc_ns(s) % NANOSECONDS_PER_SECOND; - /* if UF is clear, reprogram to next second */ next_update_time =3D qemu_clock_get_ns(rtc_clock) + NANOSECONDS_PER_SECOND - guest_nsec; =20 @@ -321,7 +309,17 @@ static void check_update_timer(RTCState *s) s->next_alarm_time =3D next_update_time + (next_alarm_sec - 1) * NANOSECONDS_PER_SECOND; =20 + /* If UF is already set, we might be able to optimize. */ if (s->cmos_data[RTC_REG_C] & REG_C_UF) { + /* If AF cannot change (i.e. either it is set already, or + * SET=3D1 and then the time is not updated), nothing to do. + */ + if ((s->cmos_data[RTC_REG_B] & REG_B_SET) || + (s->cmos_data[RTC_REG_C] & REG_C_AF)) { + timer_del(s->update_timer); + return; + } + /* UF is set, but AF is clear. Program the timer to target * the alarm time. */ next_update_time =3D s->next_alarm_time; --=20 1.8.3.1 From nobody Thu May 2 16:04:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1501605093080498.4585660965528; Tue, 1 Aug 2017 09:31:33 -0700 (PDT) Received: from localhost ([::1]:43653 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dca4x-0008GL-59 for importer@patchew.org; Tue, 01 Aug 2017 12:31:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZrm-0004c3-0w for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcZrk-0007NU-5n for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:54 -0400 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:38113) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dcZrj-0007N2-Vk for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:52 -0400 Received: by mail-wr0-x243.google.com with SMTP id g32so1796165wrd.5 for ; Tue, 01 Aug 2017 09:17:51 -0700 (PDT) Received: from 640k.lan (94-39-192-75.adsl-ull.clienti.tiscali.it. [94.39.192.75]) by smtp.gmail.com with ESMTPSA id u187sm1724160wmd.26.2017.08.01.09.17.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 09:17:50 -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=Jvhu/AyUAjnVXZVb5M4T1VLYvsBib2KQM4mfTZZX738=; b=qR0zuOl7d01FNFcSSOGbhN9mIr9hWrlc3Ajf/7C60DgkjdIIeaAnCgEZf0t2yAK+Cm H6LoRXnxdTTOS2yAuBQAUH1+bjqM09a5zxSMZ35jWbh8nAIZfGbq2v0fJPlVWQ19802i vICRqyZg18rYDCNaE6oeo63qpyLImDul9ltExTmHkceThXI8qUZC4/qOyMGkn1PlJ5qh hmAyvAyEHd/L98nxmNZkwkN8zZf0KKFVsilP4LDvIzANE/Ehih1m+gENUZLCZXh6yjip KbqonCp80Rf3Po47W6HSOVhaAfEQ+Wj1CiU4eOy/m4mQZ8hAYBc6xEj2O7X6/PAetXF5 wZoQ== 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=Jvhu/AyUAjnVXZVb5M4T1VLYvsBib2KQM4mfTZZX738=; b=CSXv0E0IOSgv6YuSRhi4vu7Ys10PfXwXNvbMtgZ018mGrfL5QoOVC6qFc1AFHgo5oW zlSZbVi930YHOavQZqPj+4lT8//v5dyPeC33QI3KU5VIKvuBE1dIdmXrW+XQZUtrkVJw ckkVd0sicGbgLXN6UV5oLlTrpsrXey2rKhPbZ57bg0tOzATpZ9XfU52p14VugL+45DXx g5O4oigpJ+CodJZxNQ35CgM2w5liXBgOdIBfexcGs5AST90r0V6VCV21iJIre6fiRSWz IN3nmm/2gZCY0mpuZdebv1HU9aYXFT9uOCO/afInePBtsWjULVN7HnhahCFvO9IQC9Xg VSYQ== X-Gm-Message-State: AIVw110VRvYJSFBWN9JlGL1IOm/zozw6vgchE5hkkTp+8vBbhbiJOSKM 4/o5qriI3NTjbNGsoc0= X-Received: by 10.223.163.16 with SMTP id c16mr17075098wrb.173.1501604270751; Tue, 01 Aug 2017 09:17:50 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 1 Aug 2017 18:17:25 +0200 Message-Id: <1501604245-33460-18-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> References: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::243 Subject: [Qemu-devel] [PULL 17/17] mc146818rtc: implement UIP latching as intended X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" In some cases, the guest can observe the wrong ordering of UIP and interrupts. This can happen if the VCPU exit is timed like this: iothread VCPU ... wait for interrupt ... t-100ns read register A t wake up, take BQL t+100ns update_in_progress return false return UIP=3D0 trigger interrupt The interrupt is late; the VCPU expected the falling edge of UIP to happen after the interrupt. update_in_progress is already trying to cover this case by latching UIP if the timer is going to fire soon, and the fix is documented in the commit message for commit 56038ef623 ("RTC: Update the RTC clock only when reading it", 2012-09-10). It cannot be tested with qtest, because its timing of interrupts vs. reads is exact. However, the implementation was incorrect because UIP cmos_ioport_read cleared register A instead of leaving that to rtc_update_timer. Fixing the implementation of cmos_ioport_read to match the commit message, however, breaks the "uip-stuck" test case from the previous patch. To fix it, skip update timer optimizations if UIP has been latched. Signed-off-by: Paolo Bonzini --- hw/timer/mc146818rtc.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c index ffb2c6a..82843ed 100644 --- a/hw/timer/mc146818rtc.c +++ b/hw/timer/mc146818rtc.c @@ -294,6 +294,7 @@ static void check_update_timer(RTCState *s) * them to occur. */ if ((s->cmos_data[RTC_REG_A] & 0x60) =3D=3D 0x60) { + assert((s->cmos_data[RTC_REG_A] & REG_A_UIP) =3D=3D 0); timer_del(s->update_timer); return; } @@ -309,8 +310,12 @@ static void check_update_timer(RTCState *s) s->next_alarm_time =3D next_update_time + (next_alarm_sec - 1) * NANOSECONDS_PER_SECOND; =20 - /* If UF is already set, we might be able to optimize. */ - if (s->cmos_data[RTC_REG_C] & REG_C_UF) { + /* If update_in_progress latched the UIP bit, we must keep the timer + * programmed to the next second, so that UIP is cleared. Otherwise, + * if UF is already set, we might be able to optimize. + */ + if (!(s->cmos_data[RTC_REG_A] & REG_A_UIP) && + (s->cmos_data[RTC_REG_C] & REG_C_UF)) { /* If AF cannot change (i.e. either it is set already, or * SET=3D1 and then the time is not updated), nothing to do. */ @@ -725,12 +730,10 @@ static uint64_t cmos_ioport_read(void *opaque, hwaddr= addr, ret =3D s->cmos_data[s->cmos_index]; break; case RTC_REG_A: + ret =3D s->cmos_data[s->cmos_index]; if (update_in_progress(s)) { - s->cmos_data[s->cmos_index] |=3D REG_A_UIP; - } else { - s->cmos_data[s->cmos_index] &=3D ~REG_A_UIP; + ret |=3D REG_A_UIP; } - ret =3D s->cmos_data[s->cmos_index]; break; case RTC_REG_C: ret =3D s->cmos_data[s->cmos_index]; --=20 1.8.3.1