From nobody Sun Apr 28 12:44:05 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; 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 1501575166772627.121013143689; Tue, 1 Aug 2017 01:12:46 -0700 (PDT) Received: from localhost ([::1]:35041 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcSIF-0003pX-An for importer@patchew.org; Tue, 01 Aug 2017 04:12:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39836) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcSGw-0003D8-F7 for qemu-devel@nongnu.org; Tue, 01 Aug 2017 04:11:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcSGt-0008Hu-Bg for qemu-devel@nongnu.org; Tue, 01 Aug 2017 04:11:22 -0400 Received: from mel.act-europe.fr ([194.98.77.210]:44525 helo=smtp.eu.adacore.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dcSGt-0008HF-62 for qemu-devel@nongnu.org; Tue, 01 Aug 2017 04:11:19 -0400 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 2A4BD8139D; Tue, 1 Aug 2017 10:11:18 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IQZq3AH-3JaX; Tue, 1 Aug 2017 10:11:18 +0200 (CEST) Received: from localhost.localdomain.localdomain (unknown [IPv6:2a01:e35:87f0:3180:2b18:7e65:c33:7f62]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 7514C813D3; Tue, 1 Aug 2017 10:11:17 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at eu.adacore.com From: KONRAD Frederic To: peter.maydell@linaro.org Date: Tue, 1 Aug 2017 10:10:47 +0200 Message-Id: <1501575048-13485-2-git-send-email-frederic.konrad@adacore.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1501575048-13485-1-git-send-email-frederic.konrad@adacore.com> References: <1501575048-13485-1-git-send-email-frederic.konrad@adacore.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 194.98.77.210 Subject: [Qemu-devel] [PATCH for-2.10 1/2] mmio-execution: warn the potential developer about migration 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: quintela@redhat.com, qemu-devel@nongnu.org, dgilbert@redhat.com, frederic.konrad@adacore.com, edgar.iglesias@gmail.com, alistair.francis@xilinx.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" There are two potential corner cases with mmio-execution: * It adds a mmio-interface device which will be migrated. * It modifies the RAMBlock list during live migration which odd side effects. Signed-off-by: KONRAD Frederic --- include/exec/memory.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/exec/memory.h b/include/exec/memory.h index 400dd44..4ded02c 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -154,6 +154,10 @@ struct MemoryRegionOps { * @offset is the location of the pointer inside @mr. * * Returns a pointer to a location which contains guest code. + * + * Warning: This breaks migration if used before or during migration + * because mmio-interface device will be migrated and because + * RAMBlock list _must_ be static during migration. */ void *(*request_ptr)(void *opaque, hwaddr addr, unsigned *size, unsigned *offset); --=20 1.8.3.1 From nobody Sun Apr 28 12:44:05 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; 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 1501575167707920.2746105674186; Tue, 1 Aug 2017 01:12:47 -0700 (PDT) Received: from localhost ([::1]:35042 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcSII-0003rJ-3f for importer@patchew.org; Tue, 01 Aug 2017 04:12:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39837) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcSGw-0003D9-FO for qemu-devel@nongnu.org; Tue, 01 Aug 2017 04:11:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcSGu-0008In-BF for qemu-devel@nongnu.org; Tue, 01 Aug 2017 04:11:22 -0400 Received: from mel.act-europe.fr ([194.98.77.210]:44533 helo=smtp.eu.adacore.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dcSGu-0008I0-5C for qemu-devel@nongnu.org; Tue, 01 Aug 2017 04:11:20 -0400 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 62921813D5; Tue, 1 Aug 2017 10:11:19 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ay1LO7q3yGmX; Tue, 1 Aug 2017 10:11:19 +0200 (CEST) Received: from localhost.localdomain.localdomain (unknown [IPv6:2a01:e35:87f0:3180:2b18:7e65:c33:7f62]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 38CFC813D3; Tue, 1 Aug 2017 10:11:18 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at eu.adacore.com From: KONRAD Frederic To: peter.maydell@linaro.org Date: Tue, 1 Aug 2017 10:10:48 +0200 Message-Id: <1501575048-13485-3-git-send-email-frederic.konrad@adacore.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1501575048-13485-1-git-send-email-frederic.konrad@adacore.com> References: <1501575048-13485-1-git-send-email-frederic.konrad@adacore.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 194.98.77.210 Subject: [Qemu-devel] [PATCH for-2.10 2/2] xilinx-spips: add a migration blocker when using mmio_execution 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: quintela@redhat.com, qemu-devel@nongnu.org, dgilbert@redhat.com, frederic.konrad@adacore.com, edgar.iglesias@gmail.com, alistair.francis@xilinx.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This adds a migration blocker when mmio_execution has been used. Signed-off-by: KONRAD Frederic --- hw/ssi/xilinx_spips.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/ssi/xilinx_spips.c b/hw/ssi/xilinx_spips.c index e833028..d46491f 100644 --- a/hw/ssi/xilinx_spips.c +++ b/hw/ssi/xilinx_spips.c @@ -31,6 +31,8 @@ #include "hw/ssi/ssi.h" #include "qemu/bitops.h" #include "hw/ssi/xilinx_spips.h" +#include "qapi/error.h" +#include "migration/blocker.h" =20 #ifndef XILINX_SPIPS_ERR_DEBUG #define XILINX_SPIPS_ERR_DEBUG 0 @@ -139,6 +141,7 @@ typedef struct { =20 uint8_t lqspi_buf[LQSPI_CACHE_SIZE]; hwaddr lqspi_cached_addr; + Error *migration_blocker; } XilinxQSPIPS; =20 typedef struct XilinxSPIPSClass { @@ -603,6 +606,14 @@ static void *lqspi_request_mmio_ptr(void *opaque, hwad= dr addr, unsigned *size, XilinxQSPIPS *q =3D opaque; hwaddr offset_within_the_region =3D addr & ~(LQSPI_CACHE_SIZE - 1); =20 + /* mmio_execution breaks migration better aborting than having strange + * bugs. + */ + if (!q->migration_blocker) { + error_setg(&q->migration_blocker, "booting from SPI breaks migrati= on"); + migrate_add_blocker(q->migration_blocker, &error_fatal); + } + lqspi_load_cache(opaque, offset_within_the_region); *size =3D LQSPI_CACHE_SIZE; *offset =3D offset_within_the_region; --=20 1.8.3.1