From nobody Sat Apr 5 20:49:10 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=oracle.com); dmarc=fail(p=reject dis=none) header.from=oracle.com ARC-Seal: i=2; a=rsa-sha256; t=1738013519; cv=pass; d=zohomail.com; s=zohoarc; b=ZdRMbuJtGZWvUFvdXfxb++bfU63pCqKtdyG3Yr88py0Qmh0/ubbHUMfHLNOlLWN420EhLT/+waMACKJ5ELJfBta43cMGzUqqvFCpl4/P084OdleL5V6/ibmLfnsfHBUm89AlDvdCIow2/wNUa7v+hlx7nsV5PXnfeApuRbiCSfY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1738013519; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=5anNKywY+1Gwgr8+RChwjIgkuGE9CFcg28ydEzK5lgs=; b=QXJRR3Ot8mCRCEmlIajY7Gf5oZm/BN/hlL0jJrDXDmQclnIRnAaOUXNQLiL49XTAKuYT4ua0lcaVpjvYZt7bgr7WgCbBjzj3m90DPF4Cdz7R7DPd7PGQkT/4pvt1feDjZ/ChuUZVLrV2Xs5K6FjjZCuqS9dFHACDV49Zj89A+Bo= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=oracle.com); dmarc=fail header.from= (p=reject dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1738013519251999.2438674568946; Mon, 27 Jan 2025 13:31:59 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tcWhm-0006yn-Je; Mon, 27 Jan 2025 16:31:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tcWhk-0006y8-Tn; Mon, 27 Jan 2025 16:31:36 -0500 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tcWhj-0003sT-24; Mon, 27 Jan 2025 16:31:36 -0500 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50RL0r9Q024672; Mon, 27 Jan 2025 21:31:26 GMT Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 44ehpc825n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Jan 2025 21:31:26 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 50RLFbju003407; Mon, 27 Jan 2025 21:31:25 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2049.outbound.protection.outlook.com [104.47.66.49]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 44cpd7k1b1-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Jan 2025 21:31:25 +0000 Received: from CH3PR10MB7329.namprd10.prod.outlook.com (2603:10b6:610:12c::16) by PH0PR10MB4614.namprd10.prod.outlook.com (2603:10b6:510:42::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8377.23; Mon, 27 Jan 2025 21:31:24 +0000 Received: from CH3PR10MB7329.namprd10.prod.outlook.com ([fe80::f238:6143:104c:da23]) by CH3PR10MB7329.namprd10.prod.outlook.com ([fe80::f238:6143:104c:da23%6]) with mapi id 15.20.8377.021; Mon, 27 Jan 2025 21:31:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=5anNKywY+1Gwgr8+RChwjIgkuGE9CFcg28ydEzK5lgs=; b= CPkc/2Dx8q6+x06LWretT4c606hLZvUjc5x6sLHUHcGotZeYFL/48CPzSxYtcm9r wdZFMPnWKs1QlduEVVCCtmn583rOrzWqcJEC2GqsKiy4GQDP3xU0+G3J81r/N6CO 8LgDeEhIUl1/M71is9wvR8wA3hSXIYH+yGdmvhLTeRkDfIcy2Jyw9Fnpq4Jr29eV yFqxM0ctvEdfuQ93zr8Iay6ojCkvJ/j5R3rq365yowPwssk5jMdOSUai+/rAy8cp ZugagCe039G4nszmgZpaiC2i/+1qPKK8IGIkHJMQokKuXIvFD0orQzJRd4zm9Dz8 IrxZP9XBhFlFhMeSJj9sig== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=T+RtGgo8hXD6P64IJw5tcVvScfGlq8OZmPCKoP05/V3+dHf62965X33PhALzsueHFD7n3RLvFFKrmBHrTtVnaD3Fx0m2iw06Bk0H3tV6A2bj64Icnf1psPK6qbX0In5Pi5fgmwL2G88AyOwOM37PHxvrey53iugztg0TNMy+WcBJmGcnd2eUOFqu2j8y5lcR/E3Q6sdM2AkrUcZ+2DY6v/tFuSJ/INz5AJ6mZPfKTQ1V/IGr5xmOdILSHfC2a45tdHLMNZxTSedhBWLWnTM7phX8D/j/AzWsMhDLPdpxSqHhZ1bWPY+hxp0MK3QZtyd6pGTtlOaHYyO7aHq21QIfcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5anNKywY+1Gwgr8+RChwjIgkuGE9CFcg28ydEzK5lgs=; b=bTDLCARcLzWuREu6In1mJAu8/GbVayKpNZfl+qrCXilXlVnRsmFpikOHeMyjL3xTtGzGuvMJPKae52b92BqgAfqDbcdWoKGd3U3XF04r2fMWf05yqqhTMI6N2X/I39eZc5MV0aXKX9t1XEQwarRJACkgPfAgYKZ/TAXrse7N8zLFvoD05mGmOSeSCaFhcei25QWua8mt8rtcResKeJ7/0OAu336KhzF13Hy/hkumKWR6MpSIFUHpq7uc16metsQtZEVOULKhKhuWr/r1qbER1FF5aRCzYfL3Lt8WJJ1tWSEoF3ca1surIACR6+aXbnI4PrHloUXdABpQS+CIRHRIMA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5anNKywY+1Gwgr8+RChwjIgkuGE9CFcg28ydEzK5lgs=; b=EoGLkqIEiU71IlfxmVEoUkkqnx4kLAqMwv9wUNDWyKS0VaI+x7evkAzaFLn/ycHf97zm+AivCBaoTNQPrKaxlpoZdG8Ix/vK1Ysp8ORGVnjsxVIgxo9CAZEmq3298cFJJ1w3Knn6XPdZdjaktKyaz/mKIxhHxvSbFLUZtZ1AMb0= From: =?UTF-8?q?=E2=80=9CWilliam=20Roche?= To: david@redhat.com, kvm@vger.kernel.org, qemu-devel@nongnu.org, qemu-arm@nongnu.org Cc: william.roche@oracle.com, peterx@redhat.com, pbonzini@redhat.com, richard.henderson@linaro.org, philmd@linaro.org, peter.maydell@linaro.org, mtosatti@redhat.com, imammedo@redhat.com, eduardo@habkost.net, marcel.apfelbaum@gmail.com, wangyanan55@huawei.com, zhao1.liu@intel.com, joao.m.martins@oracle.com Subject: [PATCH v6 1/6] system/physmem: handle hugetlb correctly in qemu_ram_remap() Date: Mon, 27 Jan 2025 21:31:02 +0000 Message-ID: <20250127213107.3454680-2-william.roche@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20250127213107.3454680-1-william.roche@oracle.com> References: <20250127213107.3454680-1-william.roche@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: LO4P123CA0288.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:195::23) To CH3PR10MB7329.namprd10.prod.outlook.com (2603:10b6:610:12c::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PR10MB7329:EE_|PH0PR10MB4614:EE_ X-MS-Office365-Filtering-Correlation-Id: b1aef843-d5c1-408f-0508-08dd3f19f2c6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|7416014|376014|7053199007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?GfZ+jz71KpmWy/IycgJ+5i8ybRU/a/XnWOsZsa93Ufw4u0LFRZmZhzno4YwB?= =?us-ascii?Q?KRrrhdrWJWiZiKrUKWqbbotjLlA6neZpY0jebA9Yfs/EImHGyemj0ZuOzYM7?= =?us-ascii?Q?y7w9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BbHLWqVWD1+S?= =?us-ascii?Q?m3H0GOo+ukPC2vCqE3XkGU/65KtBvSz6P5mxggLg0n7qYkoYiFz/HHGAStip?= =?us-ascii?Q?xIh03kxx3ZbGvXNfI0CnhIHUZtV9ppUwdgb3KX0UOCZ9BasDumrbM4mMLkPN?= =?us-ascii?Q?iNrZddAUEaeHvFkDRTnIL3xHQYlUyAzZVWG3vQUPV/rEMYxEd2Tx7EgWdshM?= =?us-ascii?Q?BpGsAYW477ZMfti7+CD1xvCwHva+T+BFaUa7ScfXpbrO0qUei3MXIQ5STGt3?= =?us-ascii?Q?qPL3bqhRdvXO+ZUAfWr1xdsS03pw5xiiVT7hvrLQpFZPlJiAzcoqwn9ge8rf?= =?us-ascii?Q?cFli2wd5ThIdzwj0abDPKtPB3Zv9PG+a5hX1CkRlLUY/OiOnAz8nTeWjV0Tq?= =?us-ascii?Q?id5yGpmjo51074iJEyK3QxZbFJQX?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH3PR10MB7329.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(7416014)(376014)(7053199007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?cUzIJ9b+Lq+LL8UQn8Od3R/4T7YqX7AocawBPFWs2Jeza5VTnDa6NDanntyM?= =?us-ascii?Q?Xaqra4+7wE0HVW2wesB9NxWtKxc92j4H2wx4Pr1+z5Tzx8SJ4KPCNfesYq4f?= =?us-ascii?Q?luc6Iy6oBv18vPSkRD7xgWsn4gx0xTRVidy1gHxC2JECeioPtvDjqgydx35q?= =?us-ascii?Q?Gjkl7wu6tQ2OjYA3Qw++ZFR/LVlGLAR/zCMMyXWLZVHSM6gKJs5Z1s3TANrE?= =?us-ascii?Q?pE0XWmvvunE7QC7qgNsc5AD7436+QJtpztkkquovv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Grv8SJlDAHhaeQukkz7dg1Ccptlt/8g8pwCyXzz7oXRYR6/mKUK?= =?us-ascii?Q?CZs0LXX6cGzAKjGAhcgt4Ssp2FEm6svVWJF/pLOv2cH7HGu00E9J7u5yqQ/e?= =?us-ascii?Q?+8i+nHAE4OaliNjZVBoHxwNnCeo4s6VRAF/m/YMLTBIotbo1m3wiDdImTdEh?= =?us-ascii?Q?XanSC2uJkkHRrG+pL4Il5KetJ78TGCHcxRGq8oOZktTw8fXRQkt1jrqDstnF?= =?us-ascii?Q?pjkBuH/2Y88xgosYZyZqQFPe5BoWhTZWeYxlJviJYBvAQLk3ajLotafxTWIA?= =?us-ascii?Q?PO270s3ZifBIurcXK8K6n+/mfKnueVN+ki0h6socoei7YljNIXGBDY5q/lDQ?= =?us-ascii?Q?OYfmPtvHfCtH6olalW2s3AElPHb59UZxhaNZJYBIdbqV6IIePqMCZFhr31zn?= =?us-ascii?Q?8M+i4AwoYp6N03nyqGHhnlM+rmU1s/cSKDqxpC8PCbH0rIM07Lh/7nRGOvuL?= =?us-ascii?Q?+g=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: g8baaf1dtdhIpQXzR4Krua4szPVKSzd9MpDo0CaT/cIUwRbvtwJfyPpg/4ugxDjtUtm/Me96r2ujwS08EFQcgTZEHap+0PCpRV4NtkzpRjyKdJRtoij+Boadfhz7YqMUnsf++9L/fFJ2g76OP8BZNMonAyEsYuUnOx2Q5vIQYOUKZOc6GxUgVxh6Bpq5s4zpLl8KdIAkcl8febn7xLCz+93UIOoqnhGCPA4P8dtZ6sfqvaRSsjiR53ZgpnN8V9bFpLWqjCUKsN9NSxlgJzJaex4dQxiL6PwRr4uJFprWLbEZ2FI789G9Lqr2Nkt4VB+6J542PMcQyqUTN/AraZvKRnwbC6recCpmRwohwL+Su66LoNi3+hLhJzmq7LisyR5cO/HnFgtcIlsLmovx9uot/xPjlYRPuKGjoeu94tXqbQmHHs6Fj1689hZg8Zyw8RTF/Kji8BUA7gt7q3lLaNziH/H/dpQL2Vl7knFgOfmu2B1D8uvQ9kE97LQxHdqLgsSXhM9qK0oL7Kdxzl3Ci1QrvL91qOnZPm3BYQ9b1IGF6BxXIH2ZfAc2qeI1VO5tLErdLx5lycWlcrvvYB9aG+qsulIlCn2b+Qx7qQPs2Ti3xGY= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b1aef843-d5c1-408f-0508-08dd3f19f2c6 X-MS-Exchange-CrossTenant-AuthSource: CH3PR10MB7329.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2025 21:31:23.9219 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: WcNpoXz2MW0+d4+VM4E1HxubSL/s9LpIYBRlMKpNs3q5CrECK2vSa0A6v9FLX7BXcu9D26cG/y/drp96CPLUN8Th97mJ7/GbQsQAgeFMCHY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB4614 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-27_10,2025-01-27_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 adultscore=0 malwarescore=0 spamscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2411120000 definitions=main-2501270169 X-Proofpoint-GUID: 2Z7u03felJD2kOJCTn3WAIuPWhhvlwqG X-Proofpoint-ORIG-GUID: 2Z7u03felJD2kOJCTn3WAIuPWhhvlwqG Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.177.32; envelope-from=william.roche@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @oracle.onmicrosoft.com) X-ZM-MESSAGEID: 1738013521408019000 Content-Type: text/plain; charset="utf-8" From: William Roche The list of hwpoison pages used to remap the memory on reset is based on the backend real page size. To correctly handle hugetlb, we must mmap(MAP_FIXED) a complete hugetlb page; hugetlb pages cannot be partially mapped. Co-developed-by: David Hildenbrand Signed-off-by: William Roche Acked-by: David Hildenbrand --- accel/kvm/kvm-all.c | 2 +- include/exec/cpu-common.h | 2 +- system/physmem.c | 38 +++++++++++++++++++++++++++++--------- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index c65b790433..f89568bfa3 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -1288,7 +1288,7 @@ static void kvm_unpoison_all(void *param) =20 QLIST_FOREACH_SAFE(page, &hwpoison_page_list, list, next_page) { QLIST_REMOVE(page, list); - qemu_ram_remap(page->ram_addr, TARGET_PAGE_SIZE); + qemu_ram_remap(page->ram_addr); g_free(page); } } diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index b1d76d6985..3771b2130c 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -67,7 +67,7 @@ typedef uintptr_t ram_addr_t; =20 /* memory API */ =20 -void qemu_ram_remap(ram_addr_t addr, ram_addr_t length); +void qemu_ram_remap(ram_addr_t addr); /* This should not be used by devices. */ ram_addr_t qemu_ram_addr_from_host(void *ptr); ram_addr_t qemu_ram_addr_from_host_nofail(void *ptr); diff --git a/system/physmem.c b/system/physmem.c index c76503aea8..3dd2adde73 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -2167,17 +2167,35 @@ void qemu_ram_free(RAMBlock *block) } =20 #ifndef _WIN32 -void qemu_ram_remap(ram_addr_t addr, ram_addr_t length) +/* + * qemu_ram_remap - remap a single RAM page + * + * @addr: address in ram_addr_t address space. + * + * This function will try remapping a single page of guest RAM identified = by + * @addr, essentially discarding memory to recover from previously poisoned + * memory (MCE). The page size depends on the RAMBlock (i.e., hugetlb). @a= ddr + * does not have to point at the start of the page. + * + * This function is only to be used during system resets; it will kill the + * VM if remapping failed. + */ +void qemu_ram_remap(ram_addr_t addr) { RAMBlock *block; - ram_addr_t offset; + uint64_t offset; int flags; void *area, *vaddr; int prot; + size_t page_size; =20 RAMBLOCK_FOREACH(block) { offset =3D addr - block->offset; if (offset < block->max_length) { + /* Respect the pagesize of our RAMBlock */ + page_size =3D qemu_ram_pagesize(block); + offset =3D QEMU_ALIGN_DOWN(offset, page_size); + vaddr =3D ramblock_ptr(block, offset); if (block->flags & RAM_PREALLOC) { ; @@ -2191,21 +2209,23 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t len= gth) prot =3D PROT_READ; prot |=3D block->flags & RAM_READONLY ? 0 : PROT_WRITE; if (block->fd >=3D 0) { - area =3D mmap(vaddr, length, prot, flags, block->fd, + area =3D mmap(vaddr, page_size, prot, flags, block->fd, offset + block->fd_offset); } else { flags |=3D MAP_ANONYMOUS; - area =3D mmap(vaddr, length, prot, flags, -1, 0); + area =3D mmap(vaddr, page_size, prot, flags, -1, 0); } if (area !=3D vaddr) { - error_report("Could not remap addr: " - RAM_ADDR_FMT "@" RAM_ADDR_FMT "", - length, addr); + error_report("Could not remap RAM %s:%" PRIx64 "+%" PR= Ix64 + " +%zx", block->idstr, offset, + block->fd_offset, page_size); exit(1); } - memory_try_enable_merging(vaddr, length); - qemu_ram_setup_dump(vaddr, length); + memory_try_enable_merging(vaddr, page_size); + qemu_ram_setup_dump(vaddr, page_size); } + + break; } } } --=20 2.43.5