From nobody Sat Apr 5 02:13:56 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=1739309320; cv=pass; d=zohomail.com; s=zohoarc; b=a1uO6WnPoA7IOyII87IU7WNoMSYPBCWlQxvDfZmxbh1BkxNE58VV/4qk9uD4ijE60Yx+nuDtmPJXAsH3jJCmpPJK09NGFCWPbArAvx6AdkUDOLN0fnmBo3aOZ0bvgRfEhqcpzAsLglFXgIteTX160EU/QcOoixCqUG+IJtz7FJo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1739309320; 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=dOJyRPV8dlR5jnFzjW42MurMFkaJRKQWdQLmnpULjLg=; b=c5cqBv+MaDlT5O/2nAoZPOxjMpJAGQkS3tYsr20RWswI7ddH9Cj3ZrHL0YnJrd2DUXq/Et1w8dEKoHf9sM5trW5gOtExCHqXYnELvJO0z905cmfcbeAT5e3u5uF+nhqUCr/2W6DtM+R4DQkWwnpO3MgGVNG2xfOISdz2PUjkXBk= 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 1739309320314169.83804787223096; Tue, 11 Feb 2025 13:28:40 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1thxmy-0002kO-I2; Tue, 11 Feb 2025 16:27:28 -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 1thxmq-0002i9-0P; Tue, 11 Feb 2025 16:27:22 -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 1thxmo-0002HK-2z; Tue, 11 Feb 2025 16:27:19 -0500 Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51BLMTpS012928; Tue, 11 Feb 2025 21:27:16 GMT Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 44p0sq68m8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Feb 2025 21:27:15 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 51BKRe59027138; Tue, 11 Feb 2025 21:27:14 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2168.outbound.protection.outlook.com [104.47.59.168]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 44nwq9cdqc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 11 Feb 2025 21:27:14 +0000 Received: from CH3PR10MB7329.namprd10.prod.outlook.com (2603:10b6:610:12c::16) by DS0PR10MB8126.namprd10.prod.outlook.com (2603:10b6:8:1fb::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8422.18; Tue, 11 Feb 2025 21:27:12 +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.8422.015; Tue, 11 Feb 2025 21:27:11 +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=dOJyRPV8dlR5jnFzjW42MurMFkaJRKQWdQLmnpULjLg=; b= SKET2DposKuX8cwyQiZl1A1DTmN6lPdnt/IxjboPKPEmczhz3yIlUMt52stw1bFg hXWviinbamZ0KtTqCNNl5qH6mX290jnsF7evmFYG+4e3UW285+c1NrQMSCYJ0Zyt A5XCwPR2p45GVFAqlqXvVfuUK04sc2WCso0WIpUnutW8OF5PqwoH7UlAjhxsKwH7 v+o6IB6gQ0vo3TzBcfZwK+MNK0Gyq078U8HBzDk6znmA+BYoG7LV7z8w3Gmt3tg4 zeg6yq69GuaeRzsLyQYZoQc2oZJNPPjLDcc10ixEbEFchZa5v3ufJdDoyrrtk/P8 L+ajzG00W6a5OHEV6BxlAg== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eNvXr7LnzGo7h2K0LVnrTEmlRUXCgLo0KsGMTI9+rh8KiGosUrZ7JwDAysvMoun/LNlitW0yyjfwnv2uhSl8pQNrxZRRiiURcJgJNH0Z3VTNtJDLZxZ1EGvV9oqE8nNOIsraGePg8fy7OU8qIQsui4lRVFJ0GejJ505gwVuHFz0urIngk++R1dR65x+fQPkFVM9b8sT111rsdledTTVwY98LECARW52nl5TIQebmZuwcmwDhHrO6+jLRObpH8FTALtdxa8EbhzBLvWfYOdHYfw5m7jjvWFcookQJZCoJD2bLNG7fpKYlp6KC17tCICJXe3XViuiyrN1q9IcG0VS86Q== 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=dOJyRPV8dlR5jnFzjW42MurMFkaJRKQWdQLmnpULjLg=; b=S2vcETr1pyv3uLyizbeDoL+ZZcJhQtBzl75T9i4SkuonPKXFRbFo408gFeuS2sjl+uXD6+mFiBH/dVijbBh2Q8j4wgrK/ALry4QtWbg57WUXVcIcQ1NdpI+uOvQ0TM+ReXa4KFc99X/SFScA0Fn/bCkDG1QXVr3sr6U8V9nbg/H3Xe/DhY4emvHSpCFs0hrKlTdmKOGVvY4v32GW2tih5zoDryHz+Ji8SnGHCR5G6c6fPVjaqEQA9iltzpVN8fgxMQ60HfviH08xXdPBqUSE+c8Yz4TOjRYOwlqBXSjcfJlF5w26Y09kL3ugrN5L8oOM5dpcGKzSmLUyxbPo389XIA== 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=dOJyRPV8dlR5jnFzjW42MurMFkaJRKQWdQLmnpULjLg=; b=MK3H0v+z9FfguyURlmLwyM0CbaQ95mjBWhpI5tTAoDEnww2O3+B3Cykew4xxsV7c7DjZVFF+4O8uH29Df1VO85fI2V4QoLyX8ZaigcT6Urm6bDQheU+UEtfs8DTcsfanw3vEXQQOUeqO80GpBOf6jRjDVVqOSEyP3T99fjhSbV0= From: =?UTF-8?q?=E2=80=9CWilliam=20Roche?= To: peterx@redhat.com, david@redhat.com, kvm@vger.kernel.org, qemu-devel@nongnu.org, qemu-arm@nongnu.org Cc: william.roche@oracle.com, pbonzini@redhat.com, richard.henderson@linaro.org, philmd@linaro.org, peter.maydell@linaro.org, joao.m.martins@oracle.com Subject: [PATCH v8 1/3] system/physmem: handle hugetlb correctly in qemu_ram_remap() Date: Tue, 11 Feb 2025 21:27:05 +0000 Message-ID: <20250211212707.302391-2-william.roche@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20250211212707.302391-1-william.roche@oracle.com> References: <20250211212707.302391-1-william.roche@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BYAPR11CA0047.namprd11.prod.outlook.com (2603:10b6:a03:80::24) To CH3PR10MB7329.namprd10.prod.outlook.com (2603:10b6:610:12c::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PR10MB7329:EE_|DS0PR10MB8126:EE_ X-MS-Office365-Filtering-Correlation-Id: c0d4e38d-72fe-4ab4-95a2-08dd4ae2d8b4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016|7053199007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?nk7QLqL2EL/+vrw5PfAVGiQ+MAZjQbOCAubZZS9WgW2CwKf5Lz7nC1y7xfmW?= =?us-ascii?Q?POLmp1HQmlNZCUdYuCeJLd+W6eQjQHZMYpSXMxQqGr/45XYD5A/u5hLrzSsl?= =?us-ascii?Q?1aGHetkmbrRRM+WW22gFewoWtbx+vAM+cLFdCITLhBApq9NUfrsQ64GG3kUu?= =?us-ascii?Q?Kj7HkS0hyFXct+FAmPRki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b?= =?us-ascii?Q?8wCACAESGeUj7RYp9PKVk4XVqOwhsFbyfdULowyJtzck4w41wOJVoY30vPIV?= =?us-ascii?Q?pb7kOMEJxRrmWBrkS60w0/8sBuLUji16A7SttUl0ZD5h1K7NkxBkt5GsHRvp?= =?us-ascii?Q?mhWXrTBUjTFz6mYI9NgRzabFgJdXccNIBdw5MTXHC2PzALPltloX15oxuiPH?= =?us-ascii?Q?QQUn02n+SlY7biEOs/Aqg41uItV8wLbUWCp8QpZ9W1gXZwHZ11vE9Un8sF/n?= =?us-ascii?Q?jTptIWUI7rh8cC6a7Af0uh8h5NcI//nc+YKZY96QHR7hOWKJxmGNAnJYTUyc?= =?us-ascii?Q?1nptAwNbX8lKzGqr2/i4izGPAJYS?= 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)(376014)(366016)(7053199007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?R06QPvl31b/d9CI/oCIG15IlotMJyZ77q3MbuRNSv9sgDI+brQQ8VRLmLQyB?= =?us-ascii?Q?3gNYFseiAl2r7BgqV7Ex9YalPGionX+yuH9AP4Xl9UNZeGQMD4lreB1DL7Ot?= =?us-ascii?Q?7bD+4YeG5xrHO7cICIwO0P+mDwweDUrZ19GNXhg9Xxy5ehgOz0YoNiCR64Jr?= =?us-ascii?Q?LT2k19Ff3rpuQdZaEEnK6LfM3oZVOHTutYKt9Q6Wh0EyoreDkwdR30zvqs2N?= =?us-ascii?Q?wKoopkzkhnQujkzqHy48j/meQs/a2mZsDY3V2Q9muOt4IWCxldSDOXoEe4ST?= =?us-ascii?Q?oaxU5eAqPbUaDjLWsCVXumosH/geygWWI6Gbi7WcaArVer6u4uZP9pl0Ll9e?= =?us-ascii?Q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iPaMsKLVpZuBFQ+qWg8mBB?= =?us-ascii?Q?Rs+i5qQ2DORGg6ZRkr4uobjSAPQuu0BL4w3G8WOcN2yFcn+GWyXyOP4BWT2U?= =?us-ascii?Q?K/TeBvbbbTNpby3d+v1UZy6kxIJzZmhkp4KPCo65csDXIWCD1zLMInz8imGI?= =?us-ascii?Q?4P5gGAylcxEn9mxTklSotqZUaX/vHGips9e62Fgv6MuypGb5Efx6E1V6iIUm?= =?us-ascii?Q?wAdzNN6/gUUJwjE23AjE6/4GkBIP79TW88+27r61Vv31/e0u9bBaFNh2W0lW?= =?us-ascii?Q?cK6amMMHFLEomrQoIBFqteuFqw0R5MD20Lgn5QlbynKTeLb1Ofc8iQHmOZWT?= =?us-ascii?Q?d2W6qXiko72h5Yk/TtlNGcZrX+qBdzfJG7orsU75txwRimEsPtayOadDas5R?= =?us-ascii?Q?ww=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: uMn/A6tedaBxS2ZFfool8z+X6eCV9ZbOn6gbyeAPlj70kcpDHy6UR7ct+88WCkyVnjzZ9e57b2MAlagMd6BIGR7PbAsJ3S22ZJ1LQxy51iTJG/Aw4sacAlzxYfcKiM9CgFGbae77IepQd6dSnete2VjMNLGQjQgARtF9X9QF5bTvbCW71aXxqaKc1iOjH7dG2kL9FBiCs47grZL5Gqfu1HFd44vhhkvNvXnWZpU4UeAOcx/E/jICYbRngzvOeWNClNXEw5eq2m6Hi/t1LGUyOOi/7h9aRq0lJFBVnEspq8w4aIb9oRWY7FZZaA0PkGXXRs1UmK4z5b5ua+k4cGmUj0HoCxTbTRDNM2vH/Re9ZEmYCYmBwdUMSVA2ufIAJAXd8okIFGY9H4OHW87jPSNsnIddO3jZmW+hlROwk+6NRlj5LsbUbcnO3UCsMXNd6uRJ790wclFKXdt7EtRgVlF7v07i6S4cIFHdnjP2+O2UmTcaM7YW0pFpjHxWkyDymGzTglDedtmBRK2CHZ/praA5OkWOcqikYN9A8ad2Qx4fL+sRb/xsH5axO40s6UaCvSMGwfC7Dtm8nCZiZgcX/vpTgyL6nBPqUoqpw36B1Dd0SEY= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c0d4e38d-72fe-4ab4-95a2-08dd4ae2d8b4 X-MS-Exchange-CrossTenant-AuthSource: CH3PR10MB7329.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2025 21:27:11.6917 (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: FxqHSg2Sbuo9oIDggf+AYHN7nw2vBIN7WLT1eQjt5HwRZWjSA75fQD+AEmzEoDEzQDPGAZXwGejvrpR/NfwTv2/F5pWjbvwznTX6Gri0SbE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB8126 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-02-11_09,2025-02-11_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 malwarescore=0 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2501170000 definitions=main-2502110141 X-Proofpoint-ORIG-GUID: cAHKBiKqQ1UCuZZWBQj7oXShtKg3xGsM X-Proofpoint-GUID: cAHKBiKqQ1UCuZZWBQj7oXShtKg3xGsM 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_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: 1739309322502019000 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. Signed-off-by: William Roche Co-developed-by: David Hildenbrand Acked-by: David Hildenbrand Reviewed-by: Peter Xu --- 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 67c9db9daa..a5d848b350 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -2275,17 +2275,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) { ; @@ -2299,21 +2317,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