From nobody Sat Nov 23 19:35:36 2024 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=1730974922; cv=pass; d=zohomail.com; s=zohoarc; b=CT+qN5yhuAVlVQ1UNIk5FqbmKyxinKSV4ccHlN8+673PYa5s6f5Vj9B+HD/Rb4uY/0MpKNc7Wh0Es4PBnTeaui9cgRrXS1SWWsWw5KyA7+H6AYt4t1gGOr+e8YxxDcE6Z5MKxzWYw+Xr1Z5xQ9ModvcWbD20/Y9mtkM6Y8fXe20= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730974922; 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=MBAG7MhQBBCzJSZ6lPEp7h0EoZeK3PNMqygbk4HHkbM=; b=Daat9mevCQoDZXWQC6/NyGqbbUyErSRNsayuXd3pfzT2pCEVxhfy5hQyPsRP/cF9L1E6OuykrJFu96lz4qhrgZjBsDwxVTR7fnTSBQWVdszm8H3FfjBBR2pqDyoV72A7z1eQV4XK6eIk2/T0iyI5SL5kiFl6XVY/wx3cQ79j3+g= 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 1730974922555366.8842817022978; Thu, 7 Nov 2024 02:22:02 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t8ze9-0008LU-NC; Thu, 07 Nov 2024 05:21:50 -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 1t8ze6-0008Kf-H8; Thu, 07 Nov 2024 05:21:46 -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 1t8ze4-0001xh-EK; Thu, 07 Nov 2024 05:21:46 -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 4A71fYMm000760; Thu, 7 Nov 2024 10:21:34 GMT Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42nc4c27ky-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 10:21:34 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4A78oADI009824; Thu, 7 Nov 2024 10:21:33 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2041.outbound.protection.outlook.com [104.47.55.41]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 42nahg538a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 10:21:33 +0000 Received: from CH3PR10MB7329.namprd10.prod.outlook.com (2603:10b6:610:12c::16) by DM6PR10MB4187.namprd10.prod.outlook.com (2603:10b6:5:210::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.19; Thu, 7 Nov 2024 10:21:31 +0000 Received: from CH3PR10MB7329.namprd10.prod.outlook.com ([fe80::f238:6143:104c:da23]) by CH3PR10MB7329.namprd10.prod.outlook.com ([fe80::f238:6143:104c:da23%3]) with mapi id 15.20.8137.018; Thu, 7 Nov 2024 10:21:31 +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=MBAG7MhQBBCzJSZ6lPEp7h0EoZeK3PNMqygbk4HHkbM=; b= YEIWWSD6vyXuXSyhTLeUS6pKB7+pKwNU0Q1b+FxSfmF3CV8kkc5sLqwPUcUA5UqY ZWWIv+utL2V8YmGDXv8JFF0Wvtud562OY0UuiDqrWom3sp6bmLMGyqnm7KVpg1Kd IhUXsbd5A9VfVBVtXKHrYayuT3BrbMw3tP9u2sCSbdImLX749nFjzYJXpNXMhAcs zuoHKRLkPhGira15XGZRHhVealG1uvCs+qUQ/caVjovb9jZ7YHGjdRb6eL6e4t8U LK6ANRBf6sp6Eqcu7OFEBvFfI/QnxfVlVM8Z9ICWiHkx7vwmznVn5xt4v4xuNEdG lnaIxOA4BQ2iQFXzqnEtAA== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HHajgneSUkhH7r93kTq4DDwvYplFpOwV1PIwMZCTKcT+lQwOjmzAQQGaANlmdgk8B2lkGyeB0cPPpylDLMP1X6DH/Kwb1fRKovRL1yrl3cU5TfJRJNIpP2r2ywykFjQfqeIL1d6XV2pM9Gb3PwjLeB7J/hYTImP6H4ISQwCYS/oA7CDZ+nelSfBUg0hkCqI18wsU86HLUeraoyLfoo6AVWcj6FSGrOxP0HbJwnb74sCLFe62CCduLsWu/UBTKCi2B2/bbG+jcCxNR5c1IedaJJvPiHCUA/vmWB5OFhJH7/zjVehI8+S2VeNeTfoso6IHhC8kKCJtsBLnznUBTkJ8Tw== 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=MBAG7MhQBBCzJSZ6lPEp7h0EoZeK3PNMqygbk4HHkbM=; b=mkxNJ1rKNKbyeGtWaccvT1ied8TgS9NrbTrTyafR5/6e48ysG60V9CqkialDYcYoNRA38THW52sD5oQMSW0JT/JA8Vf3iX4wi2iyrkD5KWa/ipNJ03epFe4VtEOUiAOEDxkDPwO+5qhq/1F79p3j+748ilpDUbJ9fYTkpqhVgvGfUVCJgGqdZMQsbUawM9AaL4wAHTT07IqzPJkkpGdMJB0wpseu2LKJuDk/H5asvrj1Lt0heOEK9fHEh5zJzWsbd8X2S9qhZ0RkHFTCuBVT6VIdBOuG562ZMgwpS6H6Q0rcGsPvL0Ys9tGSNvhqaxcRKMtDoqV0Nc+yLHp2lg8Wtg== 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=MBAG7MhQBBCzJSZ6lPEp7h0EoZeK3PNMqygbk4HHkbM=; b=X3rck6jgzLQVeW3NVa3r9gcOAqKmLvdrCRVIZI/Ok/n+SeMHmrdcyJmJqZWFUo/6QTAWK3YiH+QBfJOU0fSX+5aMBuJacFG8mq/ZfADtY8b4n2e9MZK8ZiuVk0NUU0OzSX4iAs6SL4PlJZA+p5cYAXhQeetXrxnXKKa7fcYtT2c= 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 v2 1/7] accel/kvm: Keep track of the HWPoisonPage page_size Date: Thu, 7 Nov 2024 10:21:20 +0000 Message-ID: <20241107102126.2183152-2-william.roche@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241107102126.2183152-1-william.roche@oracle.com> References: <20241107102126.2183152-1-william.roche@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SJ0PR13CA0142.namprd13.prod.outlook.com (2603:10b6:a03:2c6::27) To CH3PR10MB7329.namprd10.prod.outlook.com (2603:10b6:610:12c::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PR10MB7329:EE_|DM6PR10MB4187:EE_ X-MS-Office365-Filtering-Correlation-Id: d34a29b5-9ce7-44b2-150d-08dcff15f277 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|366016|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ODqAlK0lOQKENbJ0TKITwTlPxUZC3sp4WiVxt2R5fXAbytbRsto4M4d9IU66?= =?us-ascii?Q?5Rn7YTpx/Pop3olf7P+wA1iUUyWm0ImBekx1nQEY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4+WbCf/coM+tebATT3qmguQzV1dD4Bac1I04KzCafQMBlD2abbz?= =?us-ascii?Q?+serDuEQIz8MSVn0dOu8SnSxFTTUz25Voq9iRD6aCq3/JiKltUolJSNk4yLU?= =?us-ascii?Q?V43O6Zsob/R7hAu02hwXKY/tUs/jZ+S+GI60vEvgunB2xP0lWU4WHwRo53bk?= =?us-ascii?Q?9YoqH9+Z/MVp53uewTe9jWd7l5giQhqXEckvlUe0it4NP/Unvc2bI7COajt0?= =?us-ascii?Q?jZO/tjzbS23coJ6b1sn9kYeB+JKA64vlyUj0IJm5l34noGFeednjt4F2C82Q?= =?us-ascii?Q?ktcbv8c/y3VaOgj5KLkUL5EUKiyVPOeOc0IrOQRUU9eLrGEsgtBvQUabvLsm?= =?us-ascii?Q?Xr/bRfEH16wS2DfBjSQzEvYT?= 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)(7416014)(366016)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?HIb3W/FP2kyGqBKfyZdd9USidV/Ey+3C6ZGS6TYdkAlAIHumOSsSJRU2dF23?= =?us-ascii?Q?viM0dm4QoIm+d02C70HlNrbt1x2lehb54USKcn1FlBSXDXaZpNfGUYVNQLes?= =?us-ascii?Q?Bh/z/Kerj4/NfPtrSVYFlpITTGuhQhWof3ccP7pgBX+xnoqRIu6+n1NAIuAu?= =?us-ascii?Q?eGNsZOUlGk89RzWdpPRP3HHsXrtpCjZLIL6q7ayELIME5iLaBECsVoqGtnSO?= =?us-ascii?Q?IQCe7/EKi8maUXs7MEXY7W3fZAjIH5T3oxlrs/+Bx0THZruEVQDZ6UHiio6Y?= =?us-ascii?Q?pf/ZiIEB7TRQvNK1XVPihieGIaVHE+neB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9TYYV7hcqihhKZPYGxejJagSSBfSxt33+CVr4mH7l30?= =?us-ascii?Q?88LsT9c9S2gy4G43HBFrYh8qJg2YcEiXAaU2tXfUbVCfJ44MuU3hrLaO4D1r?= =?us-ascii?Q?Z41nYtxHdzKqd5yE9ZtsvEw3wopLLJMwtgIOFayr24u5LJWkToGJ70MnP94h?= =?us-ascii?Q?PxoAvbSwQkxnyhzG1LYZ4Wxf54WUyZGu1ZD1CpPSjEodZiTuyWW67f+9fvNa?= =?us-ascii?Q?HeRN8n92cyB1dRxQWjBuqTNeRtBFuHkoLWMbr/rLti4dQttnJW0BfCJgkkGB?= =?us-ascii?Q?oJOBXddqLqRDnng+f65xybiDOnohOGKubIuqyQ43pE2ZVoZd1mIRI3Obi8R+?= =?us-ascii?Q?C1GbcWdql7ZhqSBIDt7DEljtqi1mdHZMQZ7vz3JxMmFdvjHzeInQY23Q5P60?= =?us-ascii?Q?GQ=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: WHYAGtTDCeJQhI6xwOGtQqWp3hfcaKksbyr6QnoYti8M2PVK6NB8MdxVwaxGbqf2p0yanWnDZoPVleb+TM3VYp8rwNDHHo+Fi6C/K3lHPchRYWXG7zY3axedZoWIonfVcdu1UPfQ7tyzWznnER4VxbHrLodDQrczoH3oIiUDvHVPV4btvIJIO0a2/4yGiD2wPgQh5BhAH3CehAxHOGKb25l88zgtE7cppDYsgjHQ5Ik6FiSHiM5dWkHsFqcnopcdLbf7V8aWhHgx6eKGCIui9d9CzCJqkFbgtKIAmMQ+o1Xawf5BsBjpryeP+0xyMeS8FxRxFn9z6FFsjMQqtXeN8CvQNVlRNtZ54JatQ5cFD8RMpA7I5BR6EioyB8Tl+DAk/I09N2001pPQsHZ7nOjSwazP5u4gXot2LraQhsAQLhp/WR13Jidj5jNvAf9zlm6FgIIUwpT66x6RvUpElfeEnecywsrRQd0AnpngEv6lNCg28TdOVdVcLMNyItwafdFKrvjiZRKoosxaoL/KVS4RFGhmx40zgG2+2LMI2qQy5z6QPIQr7dDYYbS4s43qASrEEFLUyZMJGI0yt+ph0Gk3uxivs5VHOCCfISr3ycL06aU= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d34a29b5-9ce7-44b2-150d-08dcff15f277 X-MS-Exchange-CrossTenant-AuthSource: CH3PR10MB7329.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 10:21:30.9328 (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: tPje6gvFc9GWGpVZBeaL9C9g7ihQzcR7yR5Ojilh7sMgjHBcQewNLewqaQSK6WHIXIYVs4PPIWFeTe9Px9WxMYUJQRu6ej4Lyh2cGeUk95Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4187 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-07_01,2024-11-06_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 bulkscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411070079 X-Proofpoint-ORIG-GUID: 5mdBIILOWk07rTbpKxVgphhJCeZHNMvp X-Proofpoint-GUID: 5mdBIILOWk07rTbpKxVgphhJCeZHNMvp 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 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: 1730974923066116600 Content-Type: text/plain; charset="utf-8" From: William Roche When a memory page is added to the hwpoison_page_list, include the page size information. This size is the backend real page size. To better deal with hugepages, we create a single entry for the entire page. Signed-off-by: William Roche --- accel/kvm/kvm-all.c | 8 +++++++- include/exec/cpu-common.h | 1 + system/physmem.c | 13 +++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 801cff16a5..6dd06f5edf 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -1266,6 +1266,7 @@ int kvm_vm_check_extension(KVMState *s, unsigned int = extension) */ typedef struct HWPoisonPage { ram_addr_t ram_addr; + size_t page_size; QLIST_ENTRY(HWPoisonPage) list; } HWPoisonPage; =20 @@ -1278,7 +1279,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, page->page_size); g_free(page); } } @@ -1286,6 +1287,10 @@ static void kvm_unpoison_all(void *param) void kvm_hwpoison_page_add(ram_addr_t ram_addr) { HWPoisonPage *page; + size_t sz =3D qemu_ram_pagesize_from_addr(ram_addr); + + if (sz > TARGET_PAGE_SIZE) + ram_addr =3D ROUND_DOWN(ram_addr, sz); =20 QLIST_FOREACH(page, &hwpoison_page_list, list) { if (page->ram_addr =3D=3D ram_addr) { @@ -1294,6 +1299,7 @@ void kvm_hwpoison_page_add(ram_addr_t ram_addr) } page =3D g_new(HWPoisonPage, 1); page->ram_addr =3D ram_addr; + page->page_size =3D sz; QLIST_INSERT_HEAD(&hwpoison_page_list, page, list); } =20 diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index 638dc806a5..8f8f7ad567 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -108,6 +108,7 @@ bool qemu_ram_is_named_file(RAMBlock *rb); int qemu_ram_get_fd(RAMBlock *rb); =20 size_t qemu_ram_pagesize(RAMBlock *block); +size_t qemu_ram_pagesize_from_addr(ram_addr_t addr); size_t qemu_ram_pagesize_largest(void); =20 /** diff --git a/system/physmem.c b/system/physmem.c index dc1db3a384..750604d47d 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -1665,6 +1665,19 @@ size_t qemu_ram_pagesize(RAMBlock *rb) return rb->page_size; } =20 +/* Return backend real page size used for the given ram_addr. */ +size_t qemu_ram_pagesize_from_addr(ram_addr_t addr) +{ + RAMBlock *rb; + + RCU_READ_LOCK_GUARD(); + rb =3D qemu_get_ram_block(addr); + if (!rb) { + return TARGET_PAGE_SIZE; + } + return qemu_ram_pagesize(rb); +} + /* Returns the largest size of page in use */ size_t qemu_ram_pagesize_largest(void) { --=20 2.43.5 From nobody Sat Nov 23 19:35:36 2024 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=1730975041; cv=pass; d=zohomail.com; s=zohoarc; b=jn4HYL61dZGGzeNiR1YuIflBbXCssHNHEJuShrrnyhsltEehyNTT53D2V42vO1hRi4aOlk2sjLwXKA3JaqpQIkkYfhag4fssvyju7L73pfXsUA7Fs/jDpiJUHYXpz4l9AdDWBaOFKSBNDfs2cbtP34vHnM3kZV2N958iLSc57A0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730975041; 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=BtL4wPizEP8e0OJHbaX12oEPFzRBndiK9nPlM1//Xp8=; b=lXsRNDMAIh4g8KiH6quxcRUmU7QqkNczh5oGJ70qX0+d26kNTbpb7rI+BS8sCEb7+RlStSXTRzYA0zFi5VVyM13KwsPzDk3vXGg4YrMtPeDy9ChR6pWZ+VvOmk8gTXQl5EDqP4wGxGUNzK7dJQMQ3xxb/jYScPqx4AhyaeTvIKw= 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 1730975041049324.46759633533816; Thu, 7 Nov 2024 02:24:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t8zeE-0008N5-R2; Thu, 07 Nov 2024 05:21:54 -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 1t8ze9-0008LS-54; Thu, 07 Nov 2024 05:21:49 -0500 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t8ze4-0001xl-Ps; Thu, 07 Nov 2024 05:21:47 -0500 Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A71fdCC031344; Thu, 7 Nov 2024 10:21:36 GMT Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42nb0cj52q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 10:21:36 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4A78xK2T005030; Thu, 7 Nov 2024 10:21:35 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2044.outbound.protection.outlook.com [104.47.55.44]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42p87d7d4u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 10:21:35 +0000 Received: from CH3PR10MB7329.namprd10.prod.outlook.com (2603:10b6:610:12c::16) by DM6PR10MB4187.namprd10.prod.outlook.com (2603:10b6:5:210::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.19; Thu, 7 Nov 2024 10:21:33 +0000 Received: from CH3PR10MB7329.namprd10.prod.outlook.com ([fe80::f238:6143:104c:da23]) by CH3PR10MB7329.namprd10.prod.outlook.com ([fe80::f238:6143:104c:da23%3]) with mapi id 15.20.8137.018; Thu, 7 Nov 2024 10:21:33 +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=BtL4wPizEP8e0OJHbaX12oEPFzRBndiK9nPlM1//Xp8=; b= Rm82Yfge6gPmunN+UOk+wKfIb6S/r1/4nfsalpBsrwJNpwQVKGhghsLmM4zizvhN YQZglXNE4+zl0YMybfZ/EmLNL6yxIt+eUm1slgN8pxrgRNtck0gWwhBnGY0kGX/N 9hwwoGflhEtyJjbT63L6zrvf7BPV6Fh16qlhTQGKNO4mk+NU47wXlhFtlGsamg2w jtACSXyE+T8WfhGs/m5Gg1QpBakm/r/DtJ5OaFzQfyOGJiCf29ZgYHzyF72gND5J gkzt3WjTYijsHrFpV7fd6rYefrGqz1mPjKRjpCLx6eGZS3jajRXfbg2FntHxJjZZ fWXg9lAe80NzNEiGUIw5nA== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kjS6eZALuq9m4oEzFwBb6UUUdrO43v0+rWBALCJDMtfoX4XwGrQR6oKDMbxnYMspijRPGaEl/Y57J0hKlHNT6D0ttaHfKHZHALo7EhfvzwtHiOg5o6UL6rmxxxYXC5bbKFFUwNnvzi3zB1JgFUKu6SW0d+nNn0RFxmO0/Ibw4NkIP3g7POXTwPgQzrtEJSjwfQtRBXhtv59EXlKUPnEEw3UnoV3ofhNkcD1LCIvgumVBc77/pWqSUIj7tOhciLkxRngJK3HnUJtf5Y/0ioc6WdfCwunWiPL8QJcjtVzxz1mapV936wRkoHZK3hChPVWuNMQUpY820nft7FbAEud1ug== 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=BtL4wPizEP8e0OJHbaX12oEPFzRBndiK9nPlM1//Xp8=; b=KJ8H70Q9BuiPgvbwRCpQIfEefhUn86UAmzWTsN0q11wPxWGacJ4xz6JrxC8ysZWuz5qjb435lSh518Vdyyj1WEUVCIbL3URYD/16JKd1tQg8YPyws2mQIXAbLBVDdi/ouptSUKEDjfIwuHrFZdcCeM27e/h2BUgqoqBEp+N8qNNpdIUImw8pcanhSUDcdhaFDODjPceZcG8S1ujGMiMOcbWYiRDUVipPfxRmLEZ2AGBSFuSOOyeXssKGZuSubxVd3AbdtM98qsOKspabRMtloCvyPvzOFv0N7sXbv9w0tUuUPh8p8QCRit32QqEkVb0CXsYRnVTMpisUMRFp4OC2Xg== 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=BtL4wPizEP8e0OJHbaX12oEPFzRBndiK9nPlM1//Xp8=; b=gEU9DWoeJX9nAHihwcmCnww3IbQGcw9nbpLB5AbhaLRYTJO9u7pMf9k8RkJnxdyUI+Jw4eG3csvZ5r/fiRY6UOnV3coWNY+ubVl9LPFGZC9hXxbyGmN+Zzc283euta3uqJttNwEEa+7vrQWO7E8nyOrgxEy/WI43/24r6sNxOfY= 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 v2 2/7] system/physmem: poisoned memory discard on reboot Date: Thu, 7 Nov 2024 10:21:21 +0000 Message-ID: <20241107102126.2183152-3-william.roche@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241107102126.2183152-1-william.roche@oracle.com> References: <20241107102126.2183152-1-william.roche@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BYAPR08CA0038.namprd08.prod.outlook.com (2603:10b6:a03:117::15) To CH3PR10MB7329.namprd10.prod.outlook.com (2603:10b6:610:12c::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PR10MB7329:EE_|DM6PR10MB4187:EE_ X-MS-Office365-Filtering-Correlation-Id: b744f9cd-151c-4a52-f139-08dcff15f3e7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|366016|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?I2ulV84fBQRWB5I6RJHMnQ4npJdbC0xmQgjBbMFQhh9+ch9QMi8cY2Dlvr4T?= =?us-ascii?Q?Hk9BZy8nsARBdqwEbNt1G9Stbz3Wf8PS2o7fwpkzdvxjjEXFet+xruRUEUIn?= =?us-ascii?Q?uDpRSZXM+zpB1qari4PL9SOK7c6irQ0MxS35g2YNBYDDMyBLxka3iov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pYDwN15RV0AXZ9FnoZ9qnQxIWHoP?= =?us-ascii?Q?MdYU96JT+CWlhl43JPx2WB3qmeaa8ouIPgWnPzwfq4pjfp9q9CZFKkf5uy/x?= =?us-ascii?Q?4+WlqcXVScSlTUkqCLjjvCA4A+oAmzIhKp4K0Rycn7RaoGBN5TpF5OnGJHXW?= =?us-ascii?Q?PaMb6HI6D/cP5OjVM/RoOHMUhq3rPy4qokpEWq+YaBO20kMtyMOF5h2Us03i?= =?us-ascii?Q?fmo2OjwQr2tv6ejTetL50+ZtjP2Qn1AssnG5+khZ5LVZugNWwtvANQaAGXrd?= =?us-ascii?Q?syZ6I9GIGITc5VON5SAv2Lq4?= 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)(7416014)(366016)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?bvcYdh0+FIzr23oLIurpM2MuIytWJMT+rywYuqqbSxtK6MtI5V7/kPhbzTXg?= =?us-ascii?Q?4n7ATdbWFwShG5NWt5J5AnVDk7uTIIToiJQmJYKXFsoxI0IiBXJTOGkaeyYA?= =?us-ascii?Q?Sw0uIqLh+RQC1W/oqW5Kt6pME3hbmA/4b4Jxte80QjgoyCRrC6gbq+C+47j9?= =?us-ascii?Q?hKaNACfTOij8L1OWdOZGaEGrKkn29FTjbt4Aiyfai8mVnimq8NXx2NGmvnSm?= =?us-ascii?Q?8pjoGxTGUPc+WDBq9Ck64FB+UzdGBKvNwZI8HQ+BIVhsEdocd2SLARiI0Gxy?= =?us-ascii?Q?SucB+eXnY2u6RCB5/I63c+A9wyrHCruORTIwb+0KZIuPWB6q3qrm8ZqZz1cJ?= =?us-ascii?Q?eYggY+u8lNazRyHae6xbulFnywueb0siDeVIt+8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M1p1NJX708kNvlgdl5AoqHc5cj45zQD3VwAB1JoJloG6AY3?= =?us-ascii?Q?PSZ6sdvIEGvpNuhKtjBB6ePzzHmmDl2j0RWmqWbmiA0sm9aPbzVZcpbUjL8I?= =?us-ascii?Q?HqTwMllusekiqwUETuh8chk5ZGsjR/ev0bUGury0+vicggrn1Pt6xhez/AtU?= =?us-ascii?Q?MXrXszfmOA6h3/d2KLSdEWYfr85m2s2EMfS48q2f4jcfRQD0Om6q5hvu24cl?= =?us-ascii?Q?m2FhxkPooqmmcj7hQxKlAzUAsiSp3dnK37JfejcT+zG9Mh+dHUJDoj2rZNrT?= =?us-ascii?Q?WHxxDOUJ/xn1d+y/ScySvC/z9/IBP7xYD5q/P2zIzahl/hP+Upiq+azpwTAB?= =?us-ascii?Q?EA=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: sEsbYBwMgxCwaTepzL9qSfBqy4Rols7vZEd1lvxbPRJuWu9BJypSosO+lHQmnYSdAU+YC289yfWxnOggxbrkP774ZfU2i7txbtWp7GvyFOuLfqiuUSyf7XrM6jYZY5DcceASog9RhOmI5TdtA6JBumJX4DWUWQd+FYyxBz+SxdO/BMXRWS2L11fm8huEu4Yvla4M7KqfozecyenMR1mNbZYOhB9Yuex1evagu5zvNw9p3Q1yxxNZwED4YJ+zv1iwbhjCKfImSV95h4w7vKF7YDG0RaWcP2m2GM/f83awBibiH0omKRQfLAhtNZRCEygtjXNCGvZqCIat33Wfa8NM3YvRKVSmHFmZLGtqd1exVAXR4dB7z2HgDiPxo4D9x448Ux933cYTc0bUambtExf4YSEDehXlYfAjyEbPSehna3kEvpaAaeo7sUWCWFCc1Ce3SgD8XsRrj3yGNO/2oa49BS07pJbFusbPZ1Ht0hTsWmJJi7JUPUmGQAIqB+XZG9HMNMskXx+fGs2UVoG1C4RseU79F30oStgQfimCsr30xlFjg5OrjJxG+SLMTmgpsptOT9/t4Vbt/qhNVrsMKfzKOPFj8nDC47MzKINaSgRCKn8= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b744f9cd-151c-4a52-f139-08dcff15f3e7 X-MS-Exchange-CrossTenant-AuthSource: CH3PR10MB7329.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 10:21:33.3101 (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: W7QemIw/xA459E4XAbGpZNKXNqWXNLsXcwEUBsGNFTrXHfADqPqo8WPJO1JEy0ChFg7DunNN8S69MJSPi4YozmYA3s45W54hK9igm5imkn8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4187 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-07_01,2024-11-06_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 adultscore=0 spamscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411070079 X-Proofpoint-ORIG-GUID: SAPm_RPyCR6wuzyL5wjnVSBmpwdAYm92 X-Proofpoint-GUID: SAPm_RPyCR6wuzyL5wjnVSBmpwdAYm92 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.165.32; envelope-from=william.roche@oracle.com; helo=mx0a-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, TVD_PH_BODY_ACCOUNTS_PRE=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: 1730975041396116600 Content-Type: text/plain; charset="utf-8" From: William Roche We take into account the recorded page sizes to repair the memory locations, calling ram_block_discard_range() to punch a hole in the backend file when necessary and regenerate a usable memory. Fall back to unmap/remap the memory location(s) if the kernel doesn't support the madvise calls used by ram_block_discard_range(). Hugetlbfs poison case is also taken into account as a hole punch with fallocate will reload a new page when first touched. Signed-off-by: William Roche --- system/physmem.c | 50 +++++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/system/physmem.c b/system/physmem.c index 750604d47d..dfea120cc5 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -2197,27 +2197,37 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t len= gth) } else if (xen_enabled()) { abort(); } else { - flags =3D MAP_FIXED; - flags |=3D block->flags & RAM_SHARED ? - MAP_SHARED : MAP_PRIVATE; - flags |=3D block->flags & RAM_NORESERVE ? MAP_NORESERVE : = 0; - 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, - offset + block->fd_offset); - } else { - flags |=3D MAP_ANONYMOUS; - area =3D mmap(vaddr, length, prot, flags, -1, 0); - } - if (area !=3D vaddr) { - error_report("Could not remap addr: " - RAM_ADDR_FMT "@" RAM_ADDR_FMT "", - length, addr); - exit(1); + if (ram_block_discard_range(block, offset + block->fd_offs= et, + length) !=3D 0) { + if (length > TARGET_PAGE_SIZE) { + /* punch hole is mandatory on hugetlbfs */ + error_report("large page recovery failure addr: " + RAM_ADDR_FMT "@" RAM_ADDR_FMT "", + length, addr); + exit(1); + } + flags =3D MAP_FIXED; + flags |=3D block->flags & RAM_SHARED ? + MAP_SHARED : MAP_PRIVATE; + flags |=3D block->flags & RAM_NORESERVE ? MAP_NORESERV= E : 0; + 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->f= d, + offset + block->fd_offset); + } else { + flags |=3D MAP_ANONYMOUS; + area =3D mmap(vaddr, length, prot, flags, -1, 0); + } + if (area !=3D vaddr) { + error_report("Could not remap addr: " + RAM_ADDR_FMT "@" RAM_ADDR_FMT "", + length, addr); + exit(1); + } + memory_try_enable_merging(vaddr, length); + qemu_ram_setup_dump(vaddr, length); } - memory_try_enable_merging(vaddr, length); - qemu_ram_setup_dump(vaddr, length); } } } --=20 2.43.5 From nobody Sat Nov 23 19:35:36 2024 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=1730974931; cv=pass; d=zohomail.com; s=zohoarc; b=FlEHsF/+MyLJrz+w3CZRFVMEFWdkG3qHWYZ9u5OQIG0uY8RbKoEt4IQ8YeJMPhksLqIK3k47fM64m4MViwAAZk89L50gn7WzPtDvuVekilmEjgP0gr1Su8hUwCRm7Iy4j1NjpH5wTrK9xNeDFtFJOTSZodf69qC7Lgfa9cMqyNo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730974931; 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=GEW89da9mr5UnO1EF3nQ/iyj+HstLwvCpbUPEV66wKo=; b=GMKct7uq34AQ1yHxePGHlWP6E+dfAFSwkv6UqMpYhXh/s2IllAIc6fuEGqczZze/h40CgcetMKmMZoi78ZXiXS24T/diVqRR6gt/dmOK72P6TP+dGKjwaT71XsBJufPbGbtWyl97c5B9JIKZinRdBrQczcc0tKKzVs0LGBPOlyg= 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 1730974931961245.36385918816336; Thu, 7 Nov 2024 02:22:11 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t8zeF-0008NG-3K; Thu, 07 Nov 2024 05:21:56 -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 1t8ze8-0008LT-Tm; Thu, 07 Nov 2024 05:21:49 -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 1t8ze6-0001y1-Fi; Thu, 07 Nov 2024 05:21:47 -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 4A71fwNd026505; Thu, 7 Nov 2024 10:21:39 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 42nav2a6rc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 10:21:38 +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 4A79xIGE036170; Thu, 7 Nov 2024 10:21:38 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2048.outbound.protection.outlook.com [104.47.55.48]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 42nahg4wbn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 10:21:38 +0000 Received: from CH3PR10MB7329.namprd10.prod.outlook.com (2603:10b6:610:12c::16) by DM6PR10MB4187.namprd10.prod.outlook.com (2603:10b6:5:210::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.19; Thu, 7 Nov 2024 10:21:35 +0000 Received: from CH3PR10MB7329.namprd10.prod.outlook.com ([fe80::f238:6143:104c:da23]) by CH3PR10MB7329.namprd10.prod.outlook.com ([fe80::f238:6143:104c:da23%3]) with mapi id 15.20.8137.018; Thu, 7 Nov 2024 10:21:35 +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=GEW89da9mr5UnO1EF3nQ/iyj+HstLwvCpbUPEV66wKo=; b= Uvc1CkBkLL98EI8YPl5+lpTvsiA5+xnjJVgdLJXPlZSLXIkzTYgS9wIpGlbv8kFt L2ouy10kG0fpqIc75633nIfjrItRUzdzZ/ciEMv79VArPF3lZ+/mnMMQqhbXGGJ0 VFHDIVT0V5kOLFpNG4q4IY3M9VMEBgLGFEF11Hq239BD6QoBxoqFm4LV2Xg5rE6I 6BaaVQfC6IHQIG4OwkrMcFXSm5qNY44pPAkj8VZz1z6oKszN2wG633TXwdFRjZE+ ivVuNlS2MgmtKbSjKt3Vzj7th4jxRj2Il+1iGXt9NVN7i1gvtyXDMI+VxDh3LgLw s/bPUWpcHWOdYBlh7irTMw== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kdagLG8hgpixWjks6BgEGYuWcKedOfrqRO44/hzfEFweDgsePQ5DkuPjUalSF5JgXYl42wrdGuWOYwJETG8G6Fna+lS9ccWt2Wfci/MRyQ36wY4Isg2rcduNYYgkkRhP+K1LFUcCD19RlywNOWAGW66/qTRh00ng5gfyQY+orQwf5ZJqVpVEPA9d6PNGzjdHci4uWiiu4Z0DFa5uHgrv8mCJjrg3OoFpyegXlBbofIJPjkCXA4EENIWA8KKUI2D4Xx0jqDoGVFnIikE92P8QTd1fG2BQNbgNt8o+X3DzaTRGCYzK2htDeksGe7tb3IVcIPp7q7ri38PQLjGv1lqVqw== 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=GEW89da9mr5UnO1EF3nQ/iyj+HstLwvCpbUPEV66wKo=; b=idL3G1R1fXxWVsAzKfbzi77d5+Zv8DuN6NBt/hEK/9+rJy1i17H9i94vRyTwOfAuuTO083mYA/wN9rEn9SqeBj7eRB03yyhKieXQtMzmV5qzYMzO9QVQbxW7tNC3wGT/H2iMBDlsu8VDOKYEzhSFWgR01byzjkmMSciH52ScH7FdRcOY4Oj9Sd4wdUpM+zVYzndiyUL/ru/PI/Os7y9PTWNXm9iu91TlX06r5SjNlD8q/UPdUG5FzpJJ5mQirMBwdlGTTxLcXcuWbHe0OZV32MC06lMermEtucvr6Wk3sp8E79uTZLNaUfMjQ/aUVtTPR3SB5IaADTuUnQrRjUvnsw== 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=GEW89da9mr5UnO1EF3nQ/iyj+HstLwvCpbUPEV66wKo=; b=szww7YRDugIXZ6ZrHdGsFX7RfYfHq3yGvDdXer4sRCHMMHghoy9LdAzG3tdLM2IBo3lXXr7fo8dvP0zUF92h3H2/CEAmxYLZ+Ies+Lj7SSoq9t+JREDPmSjGCAAQiWa8KxbWttoireKRZpF0UWHQ/ktdJS3JxY3pohxkABJ59+U= 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 v2 3/7] accel/kvm: Report the loss of a large memory page Date: Thu, 7 Nov 2024 10:21:22 +0000 Message-ID: <20241107102126.2183152-4-william.roche@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241107102126.2183152-1-william.roche@oracle.com> References: <20241107102126.2183152-1-william.roche@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BYAPR06CA0008.namprd06.prod.outlook.com (2603:10b6:a03:d4::21) To CH3PR10MB7329.namprd10.prod.outlook.com (2603:10b6:610:12c::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PR10MB7329:EE_|DM6PR10MB4187:EE_ X-MS-Office365-Filtering-Correlation-Id: 0dec6cf1-bfa1-4616-c351-08dcff15f540 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|366016|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?97t+X+HCxZTRxlhwYqe+PBAIaFfJJfS3pt8g/dSvJHg6f5TXcFpOG88Y/i+q?= =?us-ascii?Q?HIdLPjgrj6Y3vygCn1vxQY8ZJbRISym0QHObHxs2vYfmoZL6iaZtDABs/aGt?= =?us-ascii?Q?j4eFBd2TylI6VpV0krm1/5P3M7CvZpCKZXnpT1RVtLpleruk9PDn4OVZ0fyP?= =?us-ascii?Q?Nq61JxNNFRb7PtTeLREz9jMkfjQCmCVdFjIRfElQB6ysZZlI3v82SjqRa46r?= =?us-ascii?Q?CQrQt7Jh55ztSYoSPaxPTOtHzTJFIU366lwthTlqByfDDMOVD6hfjf1W7qqx?= =?us-ascii?Q?oRNMlnTaMbKib16TL6ECwphuQbBGEO/NmtzAj31G8fv2UTukq/8gF3RrLP8/?= =?us-ascii?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S5BLdd4OT2DBAeAejO/B?= =?us-ascii?Q?G+bqeZMHvW38KnDTouUVVTtb6IzDGKR9rUzhXuhidSkIrJKAMO/hEskE0EOF?= =?us-ascii?Q?Yv8=3D?= 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)(7416014)(366016)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?IEoP93QSaolUs2Ud+8U8X/NDMKtIoN3i5nU0qcdH+uiUQJvDZqUs9AeKM9nQ?= =?us-ascii?Q?8QYQ8+82C+o1JpDknITSSZsaV+5iigjxbNzxG6R0QLsZ+XAC+JV/7uKkL/RP?= =?us-ascii?Q?W2dCDBKS3Xxskyakx5gqweEFKToiX20P06NYilxRYicjYsxwHdYknpQNTh7t?= =?us-ascii?Q?gxn0P0mqPa+mrbVz9zS0wcapvzLyA0lwLV0McW3PLToLIraNA7Q0AW+/z9yX?= =?us-ascii?Q?suvVwRAHa+PSqT4R+A4+t/B3HNgeaOIMjNacULZPe/XIDm/6VwUmwhZY8EUu?= =?us-ascii?Q?eC8aRsOJXtkJHCle+j97u9hYTrVlhS74W1dVWwW5WE9PwZwVruWYP4uEKuRi?= =?us-ascii?Q?Zrj/TgsSVfOKh3z5HHhJN7c+nYwPl2oTH4RtApBRhTvsl9MypwiDD1w4Wvry?= =?us-ascii?Q?STmFaKJShYvpZfwPABhXylYbsVgmDv0Rkna8fG4piOpPGtgExpBznfZA3ivB?= =?us-ascii?Q?Wg/Y5HSnY27YDrZd1uFfAN17ZnDCKxLvGWmTtzY69/HhFPWu42AeQ55o82VG?= =?us-ascii?Q?+5ZXvaVuQ20AdCE5oJJz//4ikG53bADdZt1ZvSvYKwwCGca656u4mAQjYamN?= =?us-ascii?Q?bK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BLx8oSKZLNXh7Q8ZibejU?= =?us-ascii?Q?zVa9qgZdRtuiM7R9cDKaasSLiFHn5DRJoPUsWjknRRUsuYHorGNP2XoQsmXR?= =?us-ascii?Q?GYc9NCogfl7iiMRU0Au436juFtd3XdfDI2WWNuI35xCqxfeqeTbueXfwwT72?= =?us-ascii?Q?Mg=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: o2/YPRj9QOF8HRw7CLL9abQdVOVtgf2+CErE7CNaFkSmPUUrmL4klUJgC0EgY7zvEWeenFYed+DfrRjEL9kyUM7ptWXtYb+SrETsJuQCJYGKjtn0jEqFuju53GGPCJuLKny8gValgCJCEcXBXbpv4N1v4Yo1Vtb7/HbXAcQlw+sRqbXB3tDNC6osqUow0k18NAN2zYv5eaDLuKB3PS4qpKTfJQha7D3nE1IQdpfkfs4m7vbx8OXuMxdh/NBeVTWUvN840P6sOpyWvl7zWwL0XFEIuhqOH2KDDZcnoe60ZWlXG1HDQcJDF4IbHwRfTa6Jumn7Oe9OxkLMCCYNIZafGYERXjlTlEOwPbEUIPzNA5RdQuD8g1Q4PJZ5rYq8QuZWNLPVs2xoVcKjtZEJzHTyDsZtF++AXh/brjORnQg75GhBGy5ZD3+XYC8QftaLHxvp4rbqvIElgRcrQQJ62kyP+zSbW70DAsX7ZNKIB6+AMLn7avp61SKXkgCeuFaAV2GX2ZEB3ee16K+7Eegy4kO8mbgfDzTuF9NKSd3j20erRhMtOe+rGQChvbpeY48wp8YpM9jBJKf99TKCBzSGVd45TGVV1f6tHzs4RaaoWirOPRc= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0dec6cf1-bfa1-4616-c351-08dcff15f540 X-MS-Exchange-CrossTenant-AuthSource: CH3PR10MB7329.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 10:21:35.5404 (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: eoNXaa6sW46nxudtd+/zKzmYNm4JP0okX1hp0aA3SZDTMkoJobtMGuvtIRsr4WziZluf03+eUOOjeZM6YOJWAZ4spvL7QQYN4IRAd67ZYrw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4187 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-07_01,2024-11-06_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 mlxscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411070079 X-Proofpoint-GUID: ysV6_aSQbQrNnm1TU9BFzERmfideuWi9 X-Proofpoint-ORIG-GUID: ysV6_aSQbQrNnm1TU9BFzERmfideuWi9 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 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: 1730974933035116600 Content-Type: text/plain; charset="utf-8" From: William Roche When an entire large page is impacted by an error (hugetlbfs case), report better the size and location of this large memory hole, so give a warning message when this page is first hit: Memory error: Loosing a large page (size: X) at QEMU addr Y and GUEST addr Z Signed-off-by: William Roche --- accel/kvm/kvm-all.c | 9 ++++++++- include/sysemu/kvm_int.h | 4 +++- target/arm/kvm.c | 2 +- target/i386/kvm/kvm.c | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 6dd06f5edf..a572437115 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -1284,7 +1284,7 @@ static void kvm_unpoison_all(void *param) } } =20 -void kvm_hwpoison_page_add(ram_addr_t ram_addr) +void kvm_hwpoison_page_add(ram_addr_t ram_addr, void *ha, hwaddr gpa) { HWPoisonPage *page; size_t sz =3D qemu_ram_pagesize_from_addr(ram_addr); @@ -1301,6 +1301,13 @@ void kvm_hwpoison_page_add(ram_addr_t ram_addr) page->ram_addr =3D ram_addr; page->page_size =3D sz; QLIST_INSERT_HEAD(&hwpoison_page_list, page, list); + + if (sz > TARGET_PAGE_SIZE) { + gpa =3D ROUND_DOWN(gpa, sz); + ha =3D (void *)ROUND_DOWN((uint64_t)ha, sz); + warn_report("Memory error: Loosing a large page (size: %zu) " + "at QEMU addr %p and GUEST addr 0x%" HWADDR_PRIx, sz, ha, gpa); + } } =20 bool kvm_hwpoisoned_mem(void) diff --git a/include/sysemu/kvm_int.h b/include/sysemu/kvm_int.h index a1e72763da..ee34f1d225 100644 --- a/include/sysemu/kvm_int.h +++ b/include/sysemu/kvm_int.h @@ -178,10 +178,12 @@ void kvm_set_max_memslot_size(hwaddr max_slot_size); * * Parameters: * @ram_addr: the address in the RAM for the poisoned page + * @hva: host virtual address aka QEMU addr + * @gpa: guest physical address aka GUEST addr * * Add a poisoned page to the list * * Return: None. */ -void kvm_hwpoison_page_add(ram_addr_t ram_addr); +void kvm_hwpoison_page_add(ram_addr_t ram_addr, void *hva, hwaddr gpa); #endif diff --git a/target/arm/kvm.c b/target/arm/kvm.c index f1f1b5b375..aae66dba41 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -2359,7 +2359,7 @@ void kvm_arch_on_sigbus_vcpu(CPUState *c, int code, v= oid *addr) ram_addr =3D qemu_ram_addr_from_host(addr); if (ram_addr !=3D RAM_ADDR_INVALID && kvm_physical_memory_addr_from_host(c->kvm_state, addr, &paddr)= ) { - kvm_hwpoison_page_add(ram_addr); + kvm_hwpoison_page_add(ram_addr, addr, paddr); /* * If this is a BUS_MCEERR_AR, we know we have been called * synchronously from the vCPU thread, so we can easily diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index fd9f198892..fd7cd7008e 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -753,7 +753,7 @@ void kvm_arch_on_sigbus_vcpu(CPUState *c, int code, voi= d *addr) ram_addr =3D qemu_ram_addr_from_host(addr); if (ram_addr !=3D RAM_ADDR_INVALID && kvm_physical_memory_addr_from_host(c->kvm_state, addr, &paddr)= ) { - kvm_hwpoison_page_add(ram_addr); + kvm_hwpoison_page_add(ram_addr, addr, paddr); kvm_mce_inject(cpu, paddr, code); =20 /* --=20 2.43.5 From nobody Sat Nov 23 19:35:36 2024 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=1730975046; cv=pass; d=zohomail.com; s=zohoarc; b=Y4ZWvuJZ4kL76BH9OZ2x/DIhlTBekWBhU3XjekO1Kxpk7ynGsnhZ7QFS52X3uyLyJyzM2Q9jZYo6H9Vxi/+6UVSxuDiS7s/+JE+n8sCrRLQ3iIeRLDM1D8sjI6pGxepTSsDJ8mmkMWFL0LCXY4+8ghLvOC5eTfH8nGH69XyoyZY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730975046; 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=fXE9XjUPrH75g+oLHBDEzkL0PHDXYwMPT4fpyHVZuOk=; b=OK4JWobZvztx/PSNIRqM+9I0Gyr8fbUDyvNd+zDskNM03dd+Dw2+SducRiJmJjAW2DznUd+Wbr8xjC94nVNYUIWsSQTB2l7cyHwBqAtECdb1g9gwuwD+Rpq8AWPTKSV5w6SFvxUknqtMfNfSIHQ56D0jj+GU0LuXSZZRpEDxoR4= 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 1730975046146447.0274261293695; Thu, 7 Nov 2024 02:24:06 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t8zeI-0008OP-Mc; Thu, 07 Nov 2024 05:21:58 -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 1t8zeA-0008M4-IM; Thu, 07 Nov 2024 05:21:50 -0500 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t8ze8-0001yE-Vf; Thu, 07 Nov 2024 05:21:50 -0500 Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A71gRjs020388; Thu, 7 Nov 2024 10:21:41 GMT Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42ncmta39m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 10:21:41 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4A79tqJM005034; Thu, 7 Nov 2024 10:21:40 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2048.outbound.protection.outlook.com [104.47.58.48]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42p87d7d79-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 10:21:40 +0000 Received: from CH3PR10MB7329.namprd10.prod.outlook.com (2603:10b6:610:12c::16) by DM6PR10MB4187.namprd10.prod.outlook.com (2603:10b6:5:210::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.19; Thu, 7 Nov 2024 10:21:37 +0000 Received: from CH3PR10MB7329.namprd10.prod.outlook.com ([fe80::f238:6143:104c:da23]) by CH3PR10MB7329.namprd10.prod.outlook.com ([fe80::f238:6143:104c:da23%3]) with mapi id 15.20.8137.018; Thu, 7 Nov 2024 10:21:37 +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=fXE9XjUPrH75g+oLHBDEzkL0PHDXYwMPT4fpyHVZuOk=; b= XNehN9t4GXNsLBZ3exgTWhnbtOquvduJQRhT3yCGb+0myuaxm6Gu2yaf5rknpAK0 xrPWzopsRWZKOVTJF7ExuoZuGiOHyl5B1x7AHZlNbG9BzWoqTBj7Y4+lEHUxB9SS D6Jvtqee1KYGerWJeAeSXhFCvAl2cqMvEYv4uYanAC3Fk2zWnlAXlzfG3aqnyYT3 YD27+nKhk48Aln2Om8YheKYLd4xgUmTvVdK/pcV5/2t9CPWuDgn+kgaJy4vl47BP XattMemb7mGKvaw8PpzCf1Gl0VvmXoM3jZsvf1ehHlYkk+DLBbmIiK3Sdl75MQg6 r61aR0QzNf4uaPLC+N8BIQ== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=R230vii3BjCXzWkcoFWYQBeWLG9U4KnRLlS8xluGKDz1hKyYx/On3tcWOnj/MtwplOPN8E1YdbPyFWxK/tVO28Qqqupb17myX8VR4ZsPeasW9bzA+6myWq1Wg7AO37vBC/PAkUqOgkdvK32+1CTpZJq15l9zplc48Mg+dD/UMqSZtAe7HgKtqhq8BGqvXJWi65lqUvCqeZVbXliKcjEY8VDJg+d5yQ73caaC/+u04J5FbMaMwDXJEtxsGPerFY6ILNpJkS1cJqApSXaUhm3DmhrsYoLAnTZii8p76C30J44OvV4oDkjkyoef1kTip49bNVbVnWOzeZWsRZQ0q7WTWg== 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=fXE9XjUPrH75g+oLHBDEzkL0PHDXYwMPT4fpyHVZuOk=; b=m8CW982ty41hoOLUtLmOjxzbHNR+WrfjkBSZ6+sVHgjj/MsvMm7tMEgH5AOoZk9CnAYZOhj8HULOeSLp/YSRm7VcJMpD/5MoeHnF/xf4AFS9nbbp4wLnUuRVgtCAWsBQWNa7PvNj5gwPxAa8o22DA+Rwga7zPoCnX71Vi8EluXnwFYTdNRatyi5DGJJRZx1dV6XxnbmxcdxUpYepaXRBJk1p68trIWvYXbK0dAdFz4dO7v7tSi9RVKMXpFkLO1olLoDXhXbISeReS92tviFfTBSTnSfYBfBu7SuAAcBv0UCvb9xfret+ai6U6v7y+69yz3afv7gNBuOsxxAKHnDTRw== 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=fXE9XjUPrH75g+oLHBDEzkL0PHDXYwMPT4fpyHVZuOk=; b=KdBCTeRqYiV4CzeWSaYLcH/kcUVrGnICYUCePfQnQXl6dz79ozFn7WuwUiuWf9fFv8PJWHO8XM6Xaz8/h0DaDdg6THJmm/sdSgiBLC6Pzu11tPbST9EAGBWK8aRypcXGHnmJStDYOjmEzcwwcSXT5Om2RS/J3D5lig0jhLZ7yzw= 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 v2 4/7] numa: Introduce and use ram_block_notify_remap() Date: Thu, 7 Nov 2024 10:21:23 +0000 Message-ID: <20241107102126.2183152-5-william.roche@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241107102126.2183152-1-william.roche@oracle.com> References: <20241107102126.2183152-1-william.roche@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SJ0PR03CA0147.namprd03.prod.outlook.com (2603:10b6:a03:33c::32) To CH3PR10MB7329.namprd10.prod.outlook.com (2603:10b6:610:12c::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PR10MB7329:EE_|DM6PR10MB4187:EE_ X-MS-Office365-Filtering-Correlation-Id: 9800f390-e847-4bd7-a545-08dcff15f687 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|366016|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Dlm4KnOFfZDkkdyyoEsoCNwyHCu3W+48wWONhw3rCt+16rwk1GBtGhHNUhRj?= =?us-ascii?Q?2D9W73zeqD2zqjfyuOssXcRgkStAr/gfCaDW9RvDtt6CYXtxvcCkDKGNfvmf?= =?us-ascii?Q?YYOZQb8X0pSpmhwItYAFIsoCsb+x5aAnYIwMpfUSonUtnLKfd7yI5gzN5foa?= =?us-ascii?Q?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+2oAqc2xzcm3y?= =?us-ascii?Q?ssm5UqbTXLUSut/voPNQCT6ec8gAb1Z+B9/cE14slWFiSO6xhbWJSP41+eRS?= =?us-ascii?Q?OydgHKg9iRenwJtvTQti+cRvfBnx2XBn0ydc+y4e5a4YXWTc+lkItdRPtxxd?= =?us-ascii?Q?PvEwLWpu3eN9oCAF41hA+5tQxTw5NyW3Zx5viqgnED54FWgHTe124IjFISzJ?= =?us-ascii?Q?ur6YUYXzAnieH7bM2CLdfifrWEuyJdZ+gwf788GcFo2ueHmGCAbbAuDD7sng?= =?us-ascii?Q?QnxNG7tgBF2weM5S9c6HDQ5x?= 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)(7416014)(366016)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?UENG4Tw63SNu/Ee6Sk1YiWsbgJK6w8yqwhlkY7ASeTUQCFNLEfKq/IC8qtZN?= =?us-ascii?Q?uWBIMVu1QD39rwRKHvrrldTtY5n24WD/9Fyet9SzmzzlSZ+Q7QVvKksBjYNS?= =?us-ascii?Q?bV1km+E4RKwDf/pMfgln8kjYiJyCcdi5lxj7bLci/I1oTWmg/Udi+G9K35E8?= =?us-ascii?Q?mwQWw1/VmUmvwWpKarwaD/NISREQ4sQ1OYuKauhO7Nkwhls18C/R7geU45BX?= =?us-ascii?Q?wIbSX4nGSEhtmUYoKVKwwuB2MT7LWg7YX094LhTgmcCiZhWenYPiyYn8azJU?= =?us-ascii?Q?keWrCxXsyehCGdww6Soe7OaLFWyoCCfr+BMbnASk5OZ5gGayYI1P4upUqqQD?= =?us-ascii?Q?fg/isJjEK6lDZfYENFPB0pDs0Ct/99am+QfM9/OjS8TNl864eeSQw7kdN1t7?= =?us-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PRFupPR0KB9vQMKy0Wo8Eufjt7p2ZmY1roh5kfCOCYLnY= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9800f390-e847-4bd7-a545-08dcff15f687 X-MS-Exchange-CrossTenant-AuthSource: CH3PR10MB7329.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 10:21:37.6900 (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: /zP4sEgOdpi9tvdu7+Uo1Z/hVZyB2giLM2eXjKnWeelH48erYSWJLqscfaRhu9TrZZFCd1Gd9MudT6UsDCIrRNFXrUSc79XtKNgJzGLPdZg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4187 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-07_01,2024-11-06_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 adultscore=0 spamscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411070079 X-Proofpoint-GUID: 3-mCPM56Ttq2iA6ciyLKePMeGhPaqB7g X-Proofpoint-ORIG-GUID: 3-mCPM56Ttq2iA6ciyLKePMeGhPaqB7g 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.165.32; envelope-from=william.roche@oracle.com; helo=mx0a-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 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: 1730975047416116600 Content-Type: text/plain; charset="utf-8" From: David Hildenbrand Notify registered listeners about the remap at the end of qemu_ram_remap() so e.g., a memory backend can re-apply its settings correctly. Signed-off-by: David Hildenbrand Signed-off-by: William Roche --- hw/core/numa.c | 11 +++++++++++ include/exec/ramlist.h | 3 +++ system/physmem.c | 1 + 3 files changed, 15 insertions(+) diff --git a/hw/core/numa.c b/hw/core/numa.c index 1b5f44baea..4ca67db483 100644 --- a/hw/core/numa.c +++ b/hw/core/numa.c @@ -895,3 +895,14 @@ void ram_block_notify_resize(void *host, size_t old_si= ze, size_t new_size) } } } + +void ram_block_notify_remap(void *host, size_t offset, size_t size) +{ + RAMBlockNotifier *notifier; + + QLIST_FOREACH(notifier, &ram_list.ramblock_notifiers, next) { + if (notifier->ram_block_remapped) { + notifier->ram_block_remapped(notifier, host, offset, size); + } + } +} diff --git a/include/exec/ramlist.h b/include/exec/ramlist.h index d9cfe530be..c1dc785a57 100644 --- a/include/exec/ramlist.h +++ b/include/exec/ramlist.h @@ -72,6 +72,8 @@ struct RAMBlockNotifier { size_t max_size); void (*ram_block_resized)(RAMBlockNotifier *n, void *host, size_t old_= size, size_t new_size); + void (*ram_block_remapped)(RAMBlockNotifier *n, void *host, size_t off= set, + size_t size); QLIST_ENTRY(RAMBlockNotifier) next; }; =20 @@ -80,6 +82,7 @@ void ram_block_notifier_remove(RAMBlockNotifier *n); void ram_block_notify_add(void *host, size_t size, size_t max_size); void ram_block_notify_remove(void *host, size_t size, size_t max_size); void ram_block_notify_resize(void *host, size_t old_size, size_t new_size); +void ram_block_notify_remap(void *host, size_t offset, size_t size); =20 GString *ram_block_format(void); =20 diff --git a/system/physmem.c b/system/physmem.c index dfea120cc5..e72ca31451 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -2228,6 +2228,7 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t lengt= h) memory_try_enable_merging(vaddr, length); qemu_ram_setup_dump(vaddr, length); } + ram_block_notify_remap(block->host, offset, length); } } } --=20 2.43.5 From nobody Sat Nov 23 19:35:36 2024 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=1730975031; cv=pass; d=zohomail.com; s=zohoarc; b=IprFZCcpOs5hNfduyiR6fkvAn7qfykcg6JSOU54o91isDAA+Kq4hplNRSQP1T4iXwq/s0m6ylaAAPITJ7sgag3stMUJfdXj3OG/yk5pNaaDNYZdw6EO8vdlatIXfaB8hkaxKyLlYBmmL0q4ta1+MqrVphRMQ/05oZPqh7R9HyUM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730975031; 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=tMm7sfsa5tMZm+9vPsMqJy+JU6H3ZOklscSFRUBodPg=; b=MzpO5TH41LgIndsrbp+XTEFZaqfGET/YihW93J7UVKUVAEpN1loIKga2OJM+KPhvL+pq24cWqpg7UgYrU5hYJbPx59V4TXBbltIiRHdGOsST50JYWJbfLVpUAgem3n4DcrPOZW3PuLbkHtkGW17zh4v3sKEWNjtPaVNmCoFPTRE= 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 1730975031473922.3959224525952; Thu, 7 Nov 2024 02:23:51 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t8zeO-0008Ta-A5; Thu, 07 Nov 2024 05:22:04 -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 1t8zeG-0008O7-Pl; Thu, 07 Nov 2024 05:21:58 -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 1t8zeD-0001zQ-0Y; Thu, 07 Nov 2024 05:21:56 -0500 Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A71faqS021962; Thu, 7 Nov 2024 10:21:43 GMT Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42nbpst3ye-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 10:21:42 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4A79LanJ010012; Thu, 7 Nov 2024 10:21:42 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2041.outbound.protection.outlook.com [104.47.58.41]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 42nahg53bt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 10:21:42 +0000 Received: from CH3PR10MB7329.namprd10.prod.outlook.com (2603:10b6:610:12c::16) by DM6PR10MB4187.namprd10.prod.outlook.com (2603:10b6:5:210::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.19; Thu, 7 Nov 2024 10:21:40 +0000 Received: from CH3PR10MB7329.namprd10.prod.outlook.com ([fe80::f238:6143:104c:da23]) by CH3PR10MB7329.namprd10.prod.outlook.com ([fe80::f238:6143:104c:da23%3]) with mapi id 15.20.8137.018; Thu, 7 Nov 2024 10:21:40 +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=tMm7sfsa5tMZm+9vPsMqJy+JU6H3ZOklscSFRUBodPg=; b= Xh//7UEmu0ak9LE34UCKZmNBk6K3icnpsFDj0Q9MzaGRQH89s9c6yrP2Ihq9DGeQ GdS5gKV4vrH3yojWZk4R4lU59vRScSo+pwqAX5t3gxPKWUkI+1TM4cPydwZ2s6tQ 4TDLxwqQ2AkWScU1KnIImA4sSpVe1YIdsVqQvLoKhEJcn12Xusf4IwbH0DxZKDR3 TdQrZIsmAuBTJcFMefJGQSKXOJMNYWOOpWKNZI6jIgXZPCiUHh1wMCSTNuZxNjh7 9yipXr6CM4uC2oOiuKHn4HGgXIb3b8G8tsMEWaY4okJuhXmNes4RhD/UvzWBuljX Di5uzZk7bkO+dFWbIT7LJw== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WUMu30hc4zkbfwDkv48C3f63Y2W+W7Jqp4gTelWx4wgL9uc1esK2PFuMIaDIMnftMSjb5Yw8fQ2ondv1jF9/Up7OKZSvfSbRyDCASjRLkBR4oW3Z1UknY7DmXVO/2ocaSqyLJBH4RC5gIaaEKzwioIe/iLxan7oPP82Wn00YxkoOofpgdzYdSgi2dDg/aXV0tLzSVzu17uc4E/Z5U+63zHa6e28j7iFHi3I2kgnkXoBWJLKSp7gOSaObXSkfY+471rhvZrAlrKazn5c0OS748CXpvbmcu7IM6/9nmbl+tU0cyO53WPolh6yvY9TwisV0PsYRAEtqQZsgTJgCYjSAkw== 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=tMm7sfsa5tMZm+9vPsMqJy+JU6H3ZOklscSFRUBodPg=; b=EMaNK/Ktbk6mkb5V+59pa6PVS0OMZIe50QR82ylyfjU1MpwboA9/QfPUAv5u3XOsMqKTVJKM8OWPI+XZNAzK3pwRd5RdjRGpkm+vyfxRed9DyLQzL0KbRB63sFsLfD7eEZpX97y72BkeEkc1DJcFbiN3ziRT19B+Q/RDOrWD+SIVJk3iGOKeU3iFx9FVyDtpzoKg1Qm6rk/hJD9tR/HpHiZVAtkA3UKS0SR48r73bUEAbuid1s/mFBI18TQH5O+Gn+3FtwMLYrnGr+kaPvZOp7bKmEtAZErsXHeAmFcIePHqPkp+tDGPdWfBNuNOx1ip36Rr7Aq41a4Mj3j9GmQScg== 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=tMm7sfsa5tMZm+9vPsMqJy+JU6H3ZOklscSFRUBodPg=; b=LRw1ud7R6gA1PQiE7QcloQXZpCmUB833d6mYj4A20tp1W+3fw6V71ZBkTVVALrVv4Ia/R58+3VpsNL9dRGn1a4yf0nv52gmfHGHJ6pWUFc62heeJFoBNNRglmRatFyTAOK8F2dX1QJLJccQtEwOWqjzpX8QbhkFZgoC/GZ+CR8c= 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 v2 5/7] hostmem: Factor out applying settings Date: Thu, 7 Nov 2024 10:21:24 +0000 Message-ID: <20241107102126.2183152-6-william.roche@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241107102126.2183152-1-william.roche@oracle.com> References: <20241107102126.2183152-1-william.roche@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: BY3PR10CA0009.namprd10.prod.outlook.com (2603:10b6:a03:255::14) To CH3PR10MB7329.namprd10.prod.outlook.com (2603:10b6:610:12c::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PR10MB7329:EE_|DM6PR10MB4187:EE_ X-MS-Office365-Filtering-Correlation-Id: 54a8ee8e-3aa5-4709-182a-08dcff15f7e4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|366016|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?1YoTOZaMPiJTppOAp4N/eNGYblZTfCMrOWtaAV9WpJVrtsWfGYIRZa1D75hh?= =?us-ascii?Q?xfvulWPYzvJ+ZmdS28kqpr1NhfNuxVVGqLQp3pBCx4viW32K4biUsVSXclSv?= =?us-ascii?Q?dlVdx1DMS0cpFd2LfrxZPFmbvR2smd1JzyuDs7Ujg+cDXzuUfxqvT/Zn/qbO?= =?us-ascii?Q?6gpKwicEp/pco4LubEHz9MYzt6+wYLv/ZySoUKMSZeUfIDLBvGYrhyf+D+I4?= =?us-ascii?Q?cpBgoAYA7eV2NkTElh38yCaB5bgy5vTEdYkBcQzd3Jy4rt9ok1uW2oe6PQzA?= =?us-ascii?Q?wrxBCC2YJwJSt40B8O+iq6iBRF3fUIyLHshFfQqwLGIyVFUyK4p1eoI20+9q?= =?us-ascii?Q?7xH1e6uLaRDcFnq9mYxkaI9BoNptEXkP341/4fCqo9DfSgNYEttvF4mKgfZt?= =?us-ascii?Q?eAZcfYgfc0OAjAtQgIOD5qjD7c5EqZSLKU/erihG0QupKOndU9bLrrRNSZZP?= =?us-ascii?Q?0sAQJEu6zrMpT7TC+i3+eExgspzQBdpCPSP2msS/tnNPOnjExmLNt+N9Wv4P?= =?us-ascii?Q?Rm70Ixz24OVeM8f69S4C0NN9z4Dc+j4TKZqzLseAPmnS7oixacOZ0b2TysBz?= =?us-ascii?Q?UzPEPiMfJWRVYMsg8PlXYm3yYf80FQNY0BumTEg1uOuC+7WnduwoGAknaX6L?= =?us-ascii?Q?f3n02D/gPZz8leSbNniX/Zm0F7Z7ZgEM8erNvMzHOgZK27JS/aoQ/D0hkc9Y?= =?us-ascii?Q?tZ3pnv3TOAQnxiCECQo2WExVvrNAnYs8SbXVRolSfQpDjbOHbMWx7uuLUgZ6?= =?us-ascii?Q?Gmpirk4WWSiB9zX2VUUz7BOsq87k+KPrV3xJqllG6YFesWM+huhPLaXMRpPO?= =?us-ascii?Q?TRXVNt4AxlhXriBrakuCrniYMfmm06Zp9Pswwc33hBeFHchR/xqnv12QiSEh?= =?us-ascii?Q?G+acfrqTMya7USOr+5wZK4aHJynYGJP8x8+d2TTNkcTJsx8EpUjf1IUISNEi?= =?us-ascii?Q?ZVK1CUW9LDn61KehuHFtLfgQZbk7CAQf93Yn2Ike4hmi6iIxHrxrm1NlI7aO?= =?us-ascii?Q?CKL76wZYdArExfxKFtVNsLFpHKDiXcHJi9s03Nj28lEpdnCCMyfHG1kZKufS?= =?us-ascii?Q?ih99tVj9lBn+7dpnmlZ2ReUKn2LNCgpX6UCqk1ScK1qepsslxEfOuk6gnAJH?= =?us-ascii?Q?fx1Ojt6cDyH8dFM7ifyGYZ/Y1UgOkPqO8n/XzRpL/Hg/W48VcERA6aBmtVzw?= =?us-ascii?Q?NafzOIXiv4oqm1gGpHXeFgFmGN0kNNaFdlhGJmeCb3LrZpECaRGBrEeip8M0?= =?us-ascii?Q?RXh3dG0ScQHTjy//C41iec63p62hUD7fOkPF6Gd+ASu76MwbRtv30TSIKeC7?= =?us-ascii?Q?nCU=3D?= 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)(7416014)(366016)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?sz9XJxwly131rmz5Z8I5ebLFwth8wrDZS6JKNcAiBXeDcp2M3jvz6ajZJ8Mk?= =?us-ascii?Q?W7S5US9sRksOLb02o5fO9crgMTIpzyZHuTfKKcpfZ4yOu4XhMMupC5pMSpPb?= =?us-ascii?Q?8NAo0NVdHGCzoPKKBVjM9nPafiulZ4R6/gsHtCSm33+pa3yXeF2MVMm047Oa?= =?us-ascii?Q?a6D6BpBS8RBZa/V7ssIcApHTryci2jVhdaIM26KnbsOnZplA3egzAG6tbaz/?= =?us-ascii?Q?Gz7o9WxtHPNuohqqz1Dn9hPel89h83faeiVzMAvkkbHjUrOi5aQzu4syzRfQ?= =?us-ascii?Q?QwG8QZF+G8U8gQOOVUT/B7BN5WW4S1dTGiZ3IPHhE5Vur+cFTcU7j9/qVNEE?= =?us-ascii?Q?U7COOa1wxbnwywKT0YQNql/tQBTOAB7ITGjO3e3kOUn98gqAcQ1FafMXjRb6?= =?us-ascii?Q?W5zzZufnv1tKE+raEL+bb8VJVW+879vZVEgYciyn25LJjNKPmoqfhdC0erA8?= =?us-ascii?Q?iA8ELwK/i00p1OH4wnJ/qV8yssgTNAsJ79zhU6Z8MdTdQF7oNHPjmM5/KJty?= =?us-ascii?Q?v5iojZncv9BNEUwLQz2XOzymDe++KGgIn/FsVDY6ahDT6gefYxQbb2Up0dS/?= =?us-ascii?Q?z0KNlsntqJIoQnUUPzXwHWVl5UjslkAuoo1qZprXwoqJjKcPfzwdLp44EH2x?= =?us-ascii?Q?hmtONTose4Fn7TxTecoxYltdfpN1bi2GbQGAxaC0MLa7SVUWf2fCbL8JfLiY?= =?us-ascii?Q?9SQ6A+Hj1pkQ43LUu5VjgfJ/S5c8ct9GSPjDarfupoA27SO0Yc7z66jPno5/?= =?us-ascii?Q?rS1Qtr7ocPWLv5CEB1VkOJmjpmbED14rCaXdy8QVAi6msuMFobHHeV+JyUds?= =?us-ascii?Q?5zkHnRy9tq1QU54pc6mTRI0m3gqQRDDCSGEtLGypqLYbjQCqdEjnYPhr3Dpt?= =?us-ascii?Q?idFNs68HZ1/hrYJ9vkWPEnB0QWUr5lLOcRhlTMJqSBo/EKlx06F+2UVovdv+?= =?us-ascii?Q?5x4F13ejW8/EEY5ei4QqL0Ovb4SZ6CQQwX5TS1YzqG4CvriFXEBAO7Y+NWAQ?= =?us-ascii?Q?hL8lKFTO41GV4tdL3eTXgmZNlrtUYET6ZXqf5LEZbrblY9mlK9OoEUlUbEux?= =?us-ascii?Q?OMIS/kGocUZ07k4VsINWvUy1I9ZrYWOzv2x/Cw7gp3nuGLGm88FDtuI35VGl?= =?us-ascii?Q?BFWCVfbsVpQ1njSY/sZIOR5mR3BfebHNaKv8toIR7/CJn7V7yeIUAYqS7oqa?= =?us-ascii?Q?evHb+DBpO8xQppbWGoNlRU3Sj7+febYKWiUugzMVSPuEVwknQ8YBzsfdZZwS?= =?us-ascii?Q?KEdwhC43lS7MtLiwx/I74btMfIa3TGTdKEnueRhd8DY8mW0TimUzEYAphEIw?= =?us-ascii?Q?lOLqXvcnLkuWydDqOeYwP85/xR8p1RXdD/4hZj7ojdhKgdLSNO2wVS7huDl2?= =?us-ascii?Q?Cyne61sUxAyzB997RGEPzmuNe42EmlBe9Qfd+kdViWJXc8mqDSqrJWF53RYu?= =?us-ascii?Q?jVIzYUroGE/JYxUjGWKtFbjBbNHzr3+P0RujnhpDzwKWAPO2KmFJfue8HL5j?= =?us-ascii?Q?7yVFLRVqkSrMMgLICAijzHeOl9AXOT3Myq1xgYl3DIHCIFTLWPQsbQQgtmth?= =?us-ascii?Q?aMznMkqz3cpO0BEiFR73H8pwxuZMDEhnzGEyLErBy/c33kesQrmBGJ3Og7eG?= =?us-ascii?Q?ww=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: wzDRmPDEp7FFQVrOfFTBTnHJVbqcjBjCZx1vhG5gTUC8pTpseAIBTWHv/+CHy1mjHXSNk8FPzfFfk8eXxmLe4lGHd8UhafSF5WAlWHM0BGhN6ZYDUBBRAvVG9Rpk2uBTZb3V3F+Fj8a2sjv/XGrZsyMRTD0kuJlv6ccH5da+Wqwc8X0AMPzzdAYOjVEQqcZcPtEyTyQC7rrZUa4J7u16thzBcp0L6HswtLoeByzXc98IR74dRZvCGOTHPJ0CIMtX/wkzsVzzrMOMc3XS6F1K66GVfxbNjQciwEfviEPqYk7Q+ivmmK7xGc9d8Zp+bx1xPDc9WtnDvsrjUn9sQ6o50+lGsAbwl5wc39BY0uutsvwUDZwrlnpw4EfHy2PGZQqxJRJGUl6vFmrQELs3xLuQQVkBNt9Vhx0l2YXvCOh04KYHJgB9weqD51XtJnYwsnWFYpqMxhhqvs7zwKv4TRfaGCT8OBZ/BCHy4e/rqi2NKOy7HtIF07f1O9O67GF210FOJqq/Ar25YAW2nq0377xIzDaFiuzDbokFLxQxV+pRu4P5vpw/RGCVcT19blZUub3rVH/ROdODIpmRaVs+Zro8g6Hx/GWUGuvRLXmYSfLbBZA= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 54a8ee8e-3aa5-4709-182a-08dcff15f7e4 X-MS-Exchange-CrossTenant-AuthSource: CH3PR10MB7329.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 10:21:39.9867 (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: 3KVq142CdnkgtgYiLKGJxJ4YitHe1LyR71vOuwE1mmPsstbwZKyrWGZy4dNZrQmZ+VmVo4W+S+C3rRMsXTu2CE6gip3DfMMn5qKZsRPH0MA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4187 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-07_01,2024-11-06_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 bulkscore=0 malwarescore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411070079 X-Proofpoint-ORIG-GUID: 4K4v826o53Z9uUv6P93cWpL9wc3iiqqR X-Proofpoint-GUID: 4K4v826o53Z9uUv6P93cWpL9wc3iiqqR 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 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: 1730975033492116600 Content-Type: text/plain; charset="utf-8" From: David Hildenbrand We want to reuse the functionality when remapping or resizing RAM. Signed-off-by: David Hildenbrand Signed-off-by: William Roche --- backends/hostmem.c | 155 ++++++++++++++++++++++++--------------------- 1 file changed, 82 insertions(+), 73 deletions(-) diff --git a/backends/hostmem.c b/backends/hostmem.c index 181446626a..bf85d716e5 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -36,6 +36,87 @@ QEMU_BUILD_BUG_ON(HOST_MEM_POLICY_BIND !=3D MPOL_BIND); QEMU_BUILD_BUG_ON(HOST_MEM_POLICY_INTERLEAVE !=3D MPOL_INTERLEAVE); #endif =20 +static void host_memory_backend_apply_settings(HostMemoryBackend *backend, + void *ptr, uint64_t size, + Error **errp) +{ + bool async =3D !phase_check(PHASE_LATE_BACKENDS_CREATED); + + if (backend->merge) { + qemu_madvise(ptr, size, QEMU_MADV_MERGEABLE); + } + if (!backend->dump) { + qemu_madvise(ptr, size, QEMU_MADV_DONTDUMP); + } +#ifdef CONFIG_NUMA + unsigned long lastbit =3D find_last_bit(backend->host_nodes, MAX_NODES= ); + /* lastbit =3D=3D MAX_NODES means maxnode =3D 0 */ + unsigned long maxnode =3D (lastbit + 1) % (MAX_NODES + 1); + /* + * Ensure policy won't be ignored in case memory is preallocated + * before mbind(). note: MPOL_MF_STRICT is ignored on hugepages so + * this doesn't catch hugepage case. + */ + unsigned flags =3D MPOL_MF_STRICT | MPOL_MF_MOVE; + int mode =3D backend->policy; + + /* + * Check for invalid host-nodes and policies and give more verbose + * error messages than mbind(). + */ + if (maxnode && backend->policy =3D=3D MPOL_DEFAULT) { + error_setg(errp, "host-nodes must be empty for policy default," + " or you should explicitly specify a policy other" + " than default"); + return; + } else if (maxnode =3D=3D 0 && backend->policy !=3D MPOL_DEFAULT) { + error_setg(errp, "host-nodes must be set for policy %s", + HostMemPolicy_str(backend->policy)); + return; + } + + /* + * We can have up to MAX_NODES nodes, but we need to pass maxnode+1 + * as argument to mbind() due to an old Linux bug (feature?) which + * cuts off the last specified node. This means backend->host_nodes + * must have MAX_NODES+1 bits available. + */ + assert(sizeof(backend->host_nodes) >=3D + BITS_TO_LONGS(MAX_NODES + 1) * sizeof(unsigned long)); + assert(maxnode <=3D MAX_NODES); + +#ifdef HAVE_NUMA_HAS_PREFERRED_MANY + if (mode =3D=3D MPOL_PREFERRED && numa_has_preferred_many() > 0) { + /* + * Replace with MPOL_PREFERRED_MANY otherwise the mbind() below + * silently picks the first node. + */ + mode =3D MPOL_PREFERRED_MANY; + } +#endif + + if (maxnode && + mbind(ptr, size, mode, backend->host_nodes, maxnode + 1, flags)) { + if (backend->policy !=3D MPOL_DEFAULT || errno !=3D ENOSYS) { + error_setg_errno(errp, errno, + "cannot bind memory to host NUMA nodes"); + return; + } + } +#endif + /* + * Preallocate memory after the NUMA policy has been instantiated. + * This is necessary to guarantee memory is allocated with + * specified NUMA policy in place. + */ + if (backend->prealloc && + !qemu_prealloc_mem(memory_region_get_fd(&backend->mr), + ptr, size, backend->prealloc_threads, + backend->prealloc_context, async, errp)) { + return; + } +} + char * host_memory_backend_get_name(HostMemoryBackend *backend) { @@ -337,7 +418,6 @@ host_memory_backend_memory_complete(UserCreatable *uc, = Error **errp) void *ptr; uint64_t sz; size_t pagesize; - bool async =3D !phase_check(PHASE_LATE_BACKENDS_CREATED); =20 if (!bc->alloc) { return; @@ -357,78 +437,7 @@ host_memory_backend_memory_complete(UserCreatable *uc,= Error **errp) return; } =20 - if (backend->merge) { - qemu_madvise(ptr, sz, QEMU_MADV_MERGEABLE); - } - if (!backend->dump) { - qemu_madvise(ptr, sz, QEMU_MADV_DONTDUMP); - } -#ifdef CONFIG_NUMA - unsigned long lastbit =3D find_last_bit(backend->host_nodes, MAX_NODES= ); - /* lastbit =3D=3D MAX_NODES means maxnode =3D 0 */ - unsigned long maxnode =3D (lastbit + 1) % (MAX_NODES + 1); - /* - * Ensure policy won't be ignored in case memory is preallocated - * before mbind(). note: MPOL_MF_STRICT is ignored on hugepages so - * this doesn't catch hugepage case. - */ - unsigned flags =3D MPOL_MF_STRICT | MPOL_MF_MOVE; - int mode =3D backend->policy; - - /* check for invalid host-nodes and policies and give more verbose - * error messages than mbind(). */ - if (maxnode && backend->policy =3D=3D MPOL_DEFAULT) { - error_setg(errp, "host-nodes must be empty for policy default," - " or you should explicitly specify a policy other" - " than default"); - return; - } else if (maxnode =3D=3D 0 && backend->policy !=3D MPOL_DEFAULT) { - error_setg(errp, "host-nodes must be set for policy %s", - HostMemPolicy_str(backend->policy)); - return; - } - - /* - * We can have up to MAX_NODES nodes, but we need to pass maxnode+1 - * as argument to mbind() due to an old Linux bug (feature?) which - * cuts off the last specified node. This means backend->host_nodes - * must have MAX_NODES+1 bits available. - */ - assert(sizeof(backend->host_nodes) >=3D - BITS_TO_LONGS(MAX_NODES + 1) * sizeof(unsigned long)); - assert(maxnode <=3D MAX_NODES); - -#ifdef HAVE_NUMA_HAS_PREFERRED_MANY - if (mode =3D=3D MPOL_PREFERRED && numa_has_preferred_many() > 0) { - /* - * Replace with MPOL_PREFERRED_MANY otherwise the mbind() below - * silently picks the first node. - */ - mode =3D MPOL_PREFERRED_MANY; - } -#endif - - if (maxnode && - mbind(ptr, sz, mode, backend->host_nodes, maxnode + 1, flags)) { - if (backend->policy !=3D MPOL_DEFAULT || errno !=3D ENOSYS) { - error_setg_errno(errp, errno, - "cannot bind memory to host NUMA nodes"); - return; - } - } -#endif - /* - * Preallocate memory after the NUMA policy has been instantiated. - * This is necessary to guarantee memory is allocated with - * specified NUMA policy in place. - */ - if (backend->prealloc && !qemu_prealloc_mem(memory_region_get_fd(&back= end->mr), - ptr, sz, - backend->prealloc_threads, - backend->prealloc_context, - async, errp)) { - return; - } + host_memory_backend_apply_settings(backend, ptr, sz, errp); } =20 static bool --=20 2.43.5 From nobody Sat Nov 23 19:35:36 2024 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=1730975023; cv=pass; d=zohomail.com; s=zohoarc; b=RJV7b+2SxbgE4KFIVqxCKIUhpLpTXIgApoYd32MKV9vWG3QpfTYA/kdWz+FfO8sEqziqZ3Hfy3VZcXkQIELgM+Ox7SGWEGQho5foBeLyKMfh0NTpE8Vbv4ZxZ3R3gGwiEnLElXlEEYl9gvAPFbXNntR2ujL76zBPU1puBDF/aQg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730975023; 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=hozTV9COxoNCUrCZJhE/lLeMUbGO/UzlrugUmhEA71g=; b=gbXYEqU/mQ9KmwvNUIRoHjFXBR0vECM34krMSGcTjGgpCiG5ofNodQ6xL6KM4CvILzlvDd4SOtf2XUH8oozMntZCC+Jo06Kpvg35a5Lq2AdyQa2RmCNc4AK6+SMQj42DbHHYKqoTP7n+xzZzOsBAX1oLehnNTOFFIfkwV/nbgzE= 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 1730975023709154.79852213037407; Thu, 7 Nov 2024 02:23:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t8zeN-0008SX-Bo; Thu, 07 Nov 2024 05:22:03 -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 1t8zeF-0008Na-KG; Thu, 07 Nov 2024 05:21:56 -0500 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t8zeC-0001zG-Us; Thu, 07 Nov 2024 05:21:55 -0500 Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A71fdCE031344; Thu, 7 Nov 2024 10:21:45 GMT Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42nb0cj53e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 10:21:45 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 4A79USdX005116; Thu, 7 Nov 2024 10:21:45 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2046.outbound.protection.outlook.com [104.47.58.46]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42p87d7d9q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 10:21:44 +0000 Received: from CH3PR10MB7329.namprd10.prod.outlook.com (2603:10b6:610:12c::16) by DM6PR10MB4187.namprd10.prod.outlook.com (2603:10b6:5:210::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.19; Thu, 7 Nov 2024 10:21:42 +0000 Received: from CH3PR10MB7329.namprd10.prod.outlook.com ([fe80::f238:6143:104c:da23]) by CH3PR10MB7329.namprd10.prod.outlook.com ([fe80::f238:6143:104c:da23%3]) with mapi id 15.20.8137.018; Thu, 7 Nov 2024 10:21:42 +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=hozTV9COxoNCUrCZJhE/lLeMUbGO/UzlrugUmhEA71g=; b= l5oV/OXJYkv4j+ajiBk21YQghWsuFOC2pWkqpTl8bD6n+W+gtY8G0T3I5i2eMhq5 WLTeYebdHZCZsRhP/SMZGiJgL4x4Oy19sQEfsXbsAIHXTqI7L8oOnKak690z9Zqi MeLfxWxiMKhRFCX7K6g9A8HI3fWlbHfM1PXmY5wjywe44M1GvZEWGOJFksYLJu77 9c1ZLmuBmBX2IFQ0P/b/omW9Uz3tDRef6L6CZfl/dj1yXgHdgVRNd4rMtb78qsP7 vuo3urGnM+jRzYONjv8mWL+I7Q/n8GxNtnVuk6TvPVZ+AQLdvdCePcGycxJjzB/Q GwW2UqaTY4sOseYAW/v5Og== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lCd0vogZqHkGgAxrkxzbg2mhcf5Svv9egw8QqAAGAELggUkMtRLgTjJ7/hyNZpkLB8p345hOhsm4ckoEWtEmNJKpDInqUhHQPX/6uJztIdE32a0OCdZy6QmgnoRRAKSYW10JifQawKwYztfVrU7BCdG3zYchobqo2v3bymz+D46hONVxs814oxfXWKJ1jbFh2biByXcbKi/zEwvYCefu0hqKuJmvNYjt8s6sGmx6kWHBhKRHtHN0CAA2xvYZU4thGGJKnrHzAKZK9wCl3KkH3xEMs9W5H75DptbBONzPmdCGUzqALCuOpHs20AGkwsEKc6fQB/df7HpY8mbu/9dSvw== 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=hozTV9COxoNCUrCZJhE/lLeMUbGO/UzlrugUmhEA71g=; b=B3LP6EiJiPyuJE9vD1K5KLrSl28hq0IQ63EsG8/vr87Tp1FrhWasBxH1G0zrakCpXl5+hU2RE98TohcYPukQn1udLC7Sw+X86Z5F3BVzGtyP8ua7qdNZwL/1h9aHLctKL9p/rJp+k2m2tl7sIXIKUS2/TGbOxFCsSl7SJ7fKL8US8JBmHvfFkJvomzrFRQu7i37Q2iMGQpz+pObBkdqLyMLT/l3k/WNFXACpOhMUJLNVonbZx7N2vf0cJTglLoH0iHVmg0tV7PP0kpeUddA8b9QV9yr3HsvcTuxnN5Wq2nn7A7sEXDD8n/d5ch5dgN/7tstzsMHrnAq7Bm+U6FLz4w== 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=hozTV9COxoNCUrCZJhE/lLeMUbGO/UzlrugUmhEA71g=; b=nsRM8FUorZHcwGwDjQUDcKqRhlh0Gi61C9gyURLNMcMEPX2aH6jidyHXG6qZmVhvAR905L51S9rPo5IEKQ/1Sol6C4l6WtzWJu3PVkf+pEfCUcU8GCT1hm1kBb0dNrv9qJL3N3AIChPWx06DqxuqssPi6R4SglWzifdtWgMRr6Y= 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 v2 6/7] hostmem: Handle remapping of RAM Date: Thu, 7 Nov 2024 10:21:25 +0000 Message-ID: <20241107102126.2183152-7-william.roche@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241107102126.2183152-1-william.roche@oracle.com> References: <20241107102126.2183152-1-william.roche@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SJ0PR05CA0016.namprd05.prod.outlook.com (2603:10b6:a03:33b::21) To CH3PR10MB7329.namprd10.prod.outlook.com (2603:10b6:610:12c::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PR10MB7329:EE_|DM6PR10MB4187:EE_ X-MS-Office365-Filtering-Correlation-Id: f0d54f01-4cdf-41f9-972f-08dcff15f923 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|366016|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?7IMGTERChQ7JBe+khOeRG3RHI9ad+Z8u83e1bJPq8KOe0OgfoCSwGwXXkF2l?= =?us-ascii?Q?k+40X1DyAarb3GYjbvWX4YjrbZSYlAjstgNXD7wD3/jAOL8veMQ5NGR9Ct3u?= =?us-ascii?Q?ugDSYMq9qUv+nAYFKB0PdE7yt187U5LS4/QEm3Xd4PyNihoDNwz/vYIkAvg9?= =?us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RaibUM/rVMMelG3I81c2IgtcYNoK0DwoCJU?= =?us-ascii?Q?q4TBJG8MSliG5AEF9Beou1S1rbW7GUZ3v/3jjRyHo3cbTcSQZ52eUeBo06b8?= =?us-ascii?Q?l++N852VKyg3vqsohtK/yU0L61wSGZcVpT4P+4SB5z0YiWKYuz2Z2kxalJZ4?= =?us-ascii?Q?yL7n9HvbZsFc3Q6hpqoD9yXcwWi1kidU9xx4YyE3odiu/i3+So4ITjvIA3yS?= =?us-ascii?Q?OEfdntJG28MTqZDByWa070mVd/6MR1y+zsNMQqamiUA9qZorYd4faO3KaL3w?= =?us-ascii?Q?R32k/8NuptM2PB1SX+wQVOHH?= 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)(7416014)(366016)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?FblwEaBH5J1EvFEM8HlokfBYCnTG8wiVlC3DpFpq21aJPYXfXAhgwjpqpZQH?= =?us-ascii?Q?sqIrAmpMuCkdQMUbxYJtTRefwvAJkeZ3f+CWMBRkSXMOrXEpFvQb4+k6K+fF?= =?us-ascii?Q?EL1F9evKCJAuHl4LgWWjWWt7f+JzxRTbX1fHsKh639IJZnpiNFyCWYSTptUf?= =?us-ascii?Q?Fd+D+iUPXzNk/JRJlYxnJXrnuiJKb5vj9sMAAuWo2P8BNst9vjsQ+BFH7Jje?= =?us-ascii?Q?m1aZc1T12iyeZzPivugEAeUXqGMPjvhMEkOk9vq68mYki7wsWbG8kYHt4t+R?= =?us-ascii?Q?dYeCHK2DLs9Qcrp4OQUsQCCamIl+1e5eiy43q451fnuE7pz0nW4bBn3ob5cS?= =?us-ascii?Q?FL+SAFv8GOPQ4phQgMA1UPfbPadIFzIRsKyZkA6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QSu1nDjYdHwAzTfcmE4UhE7toDqzPf0mrJ4yu6K11cxCW6rb/WbuY2ZDA8m6u+Gvh6pMhvlG7PUbV8r8= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f0d54f01-4cdf-41f9-972f-08dcff15f923 X-MS-Exchange-CrossTenant-AuthSource: CH3PR10MB7329.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 10:21:42.0986 (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: l7tREJNSSbNqT3IXpD6HI3RWgPj+bgNaIDackkqpBm9tWMtEf7rvC/nTdDVv3bI+I/3/ffVoobvk8DgziKd98gmmCBYBdVgpqRx3T3NVYJk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4187 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-07_01,2024-11-06_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 adultscore=0 spamscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411070079 X-Proofpoint-ORIG-GUID: pdA19SCm8rsDwT1KazcqKeVoGyJiB7ki X-Proofpoint-GUID: pdA19SCm8rsDwT1KazcqKeVoGyJiB7ki 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.165.32; envelope-from=william.roche@oracle.com; helo=mx0a-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 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: 1730975025412116600 Content-Type: text/plain; charset="utf-8" From: David Hildenbrand Let's register a RAM block notifier and react on remap notifications. Simply re-apply the settings. Warn only when something goes wrong. Note: qemu_ram_remap() will not remap when RAM_PREALLOC is set. Could be that hostmem is still missing to update that flag ... Signed-off-by: David Hildenbrand Signed-off-by: William Roche --- backends/hostmem.c | 29 +++++++++++++++++++++++++++++ include/sysemu/hostmem.h | 1 + 2 files changed, 30 insertions(+) diff --git a/backends/hostmem.c b/backends/hostmem.c index bf85d716e5..fbd8708664 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -361,11 +361,32 @@ static void host_memory_backend_set_prealloc_threads(= Object *obj, Visitor *v, backend->prealloc_threads =3D value; } =20 +static void host_memory_backend_ram_remapped(RAMBlockNotifier *n, void *ho= st, + size_t offset, size_t size) +{ + HostMemoryBackend *backend =3D container_of(n, HostMemoryBackend, + ram_notifier); + Error *err =3D NULL; + + if (!host_memory_backend_mr_inited(backend) || + memory_region_get_ram_ptr(&backend->mr) !=3D host) { + return; + } + + host_memory_backend_apply_settings(backend, host + offset, size, &err); + if (err) { + warn_report_err(err); + } +} + static void host_memory_backend_init(Object *obj) { HostMemoryBackend *backend =3D MEMORY_BACKEND(obj); MachineState *machine =3D MACHINE(qdev_get_machine()); =20 + backend->ram_notifier.ram_block_remapped =3D host_memory_backend_ram_r= emapped; + ram_block_notifier_add(&backend->ram_notifier); + /* TODO: convert access to globals to compat properties */ backend->merge =3D machine_mem_merge(machine); backend->dump =3D machine_dump_guest_core(machine); @@ -379,6 +400,13 @@ static void host_memory_backend_post_init(Object *obj) object_apply_compat_props(obj); } =20 +static void host_memory_backend_finalize(Object *obj) +{ + HostMemoryBackend *backend =3D MEMORY_BACKEND(obj); + + ram_block_notifier_remove(&backend->ram_notifier); +} + bool host_memory_backend_mr_inited(HostMemoryBackend *backend) { /* @@ -595,6 +623,7 @@ static const TypeInfo host_memory_backend_info =3D { .instance_size =3D sizeof(HostMemoryBackend), .instance_init =3D host_memory_backend_init, .instance_post_init =3D host_memory_backend_post_init, + .instance_finalize =3D host_memory_backend_finalize, .interfaces =3D (InterfaceInfo[]) { { TYPE_USER_CREATABLE }, { } diff --git a/include/sysemu/hostmem.h b/include/sysemu/hostmem.h index de47ae59e4..062a68c8fc 100644 --- a/include/sysemu/hostmem.h +++ b/include/sysemu/hostmem.h @@ -81,6 +81,7 @@ struct HostMemoryBackend { HostMemPolicy policy; =20 MemoryRegion mr; + RAMBlockNotifier ram_notifier; }; =20 bool host_memory_backend_mr_inited(HostMemoryBackend *backend); --=20 2.43.5 From nobody Sat Nov 23 19:35:36 2024 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=1730975025; cv=pass; d=zohomail.com; s=zohoarc; b=OT93r/JVZqDS8un1uwkYtgMRLrPYmkAV978FBpoXk1WC//tzxkGx+rSBdnNPvR6MjxvsvGxTuCm7YlD3kWOvXCaMyGIqzrhwgo9ISiriRaNDzjsGOwv5IZqocqHFxEEF1ErBv3wbIPSPmT0A/hwZ3MldcxASDMyaKgZLXYCOaNs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730975025; 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=jeyke96+8XdUGC7dBmIOrQRrlN3Zn+u9Xf3j5gg4Ztc=; b=XRVEDGinDoKC1BQYQJPxWOHr5B/CyzVhBPo57XP1WOYk1PhOC2n/cazybz1VP+PbbDbMNxPb4CfxPcIJEEO8GdI6PGJpLZyH5b/vRUER/e2ksttR80AQLXk9OxAcKt8WSSdRbs3APObJHWEzcDj/6C8eTtMzUeZOC6XTXUjm44U= 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 1730975025820376.0286215072507; Thu, 7 Nov 2024 02:23:45 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t8zeL-0008Pv-LL; Thu, 07 Nov 2024 05:22:02 -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 1t8zeG-0008O0-I7; Thu, 07 Nov 2024 05:21:57 -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 1t8zeE-0001ze-UU; Thu, 07 Nov 2024 05:21:56 -0500 Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4A71fZFc021950; Thu, 7 Nov 2024 10:21:48 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 42nbpst3ym-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 10:21:48 +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 4A78plMD008558; Thu, 7 Nov 2024 10:21:47 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2040.outbound.protection.outlook.com [104.47.70.40]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42nah9t0xa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 07 Nov 2024 10:21:47 +0000 Received: from CH3PR10MB7329.namprd10.prod.outlook.com (2603:10b6:610:12c::16) by DM6PR10MB4187.namprd10.prod.outlook.com (2603:10b6:5:210::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.19; Thu, 7 Nov 2024 10:21:44 +0000 Received: from CH3PR10MB7329.namprd10.prod.outlook.com ([fe80::f238:6143:104c:da23]) by CH3PR10MB7329.namprd10.prod.outlook.com ([fe80::f238:6143:104c:da23%3]) with mapi id 15.20.8137.018; Thu, 7 Nov 2024 10:21:44 +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=jeyke96+8XdUGC7dBmIOrQRrlN3Zn+u9Xf3j5gg4Ztc=; b= KzLVJLXMmxXl3y8so0ToHvWhzErh8G+Fy3AxchUrk6KbRUzddABDt6U6oLwewDsy K0GnMj0Krpmmv4PVecO0hxD0IihWp1RjW33N8YB7carR9Hs2H7b6s4vJ2gFaEul6 372lsYAmEI78+K/MjU6nQd/u0wFPBcuibwfrwqPnPVv/dkphowNbn+SagXMQHiD3 5XSyd52dz4/L7S2cRrKnuO6z5CuyORYB4u9uUwBm6sAFKUFv1YIeOccows1U8VG4 IrRhrvyhlI5kiBkNYqiYpPMQ8TxpME0OjYEzVdMHHDdPJaQHGoBKukChy28o4MrF NxHQdJsYh6iV7WT8JaSHiw== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ihj7eY5jHL9vt6kT9UP48YtRMSyyfnNXHc+xxp72bZ1wjgqm+ZPx5nr8HPzg0DjwqJKLVkhuzd6SS18PNJXXRxAjPBWriecHTtkORZjyXYExWGRbn8pqYz/+uDYoXVNTPjJWVG9i9CfwlD8/Uym1wRBuldhRTSPWJN43DPwYAAgvuBxsQ1l3QmtENaV5NPw3KnxoXXJbFqC6N7ABZwa0AIguEPvud6JiE9fpPhMaPq2c0yZRwO0gB57O84xjvkvFOQIMHZwc05iOoYMRzu45Ro1/4B9t6x24CHxp2DbvTOrWW3XrCE6+OCWRwjVhE72xnKdDFXmobbh3uni6fe7YJQ== 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=jeyke96+8XdUGC7dBmIOrQRrlN3Zn+u9Xf3j5gg4Ztc=; b=gHpPnFwML1bgaNjvYEP2orLg4aZd2IqEMrSkB/SpzKGA3AFAWSIYs1mSA61rWFkVctBw1Rvhv/n8j+9lymolDlPUYEB0ixR17e6zXkjE7ZR8uRPQ3M6kFvigwr7MEVCISsdHbVBwFAkUMA7SGD+QDyXYQxdF1wk2+mMvqpGXO7hWLrznFdjBKDGjFn7PA2T1q5ZrKPGs5aAhTEuBdlXuSUzfhscEM2+sDrULWPyYaPBRtzCoF3X+ShjjYktV8unzwxT+vuFdqdopsTaNS8tbXy25uaYs8Arh8izumLFOxRBu2wkRekrgsEofBPVg7vA2x7DomIsp0dmqw9IUUyW9nA== 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=jeyke96+8XdUGC7dBmIOrQRrlN3Zn+u9Xf3j5gg4Ztc=; b=oi5jDGHm6jVQHHEmL+xbbDEYCaqdy32ztVAQK8lC8btKskw+VHAYsq0YQ++ryT2wEf5NcLIpQfHTAAMhz2K/mbIasCQZKr+L8T16UlJzLXqywvRpQbr1mK5LJJShMZZHwk342wmNyvYGQqP8NRCdlIU4f5mmvTG/Vp6B9PTrOl0= 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 v2 7/7] system/physmem: Memory settings applied on remap notification Date: Thu, 7 Nov 2024 10:21:26 +0000 Message-ID: <20241107102126.2183152-8-william.roche@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241107102126.2183152-1-william.roche@oracle.com> References: <20241107102126.2183152-1-william.roche@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SJ0PR05CA0025.namprd05.prod.outlook.com (2603:10b6:a03:33b::30) To CH3PR10MB7329.namprd10.prod.outlook.com (2603:10b6:610:12c::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PR10MB7329:EE_|DM6PR10MB4187:EE_ X-MS-Office365-Filtering-Correlation-Id: 99a41aab-7639-4d0d-98fa-08dcff15fa7b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|366016|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?u/5baVu9V665QX3GQMl0x0dMvBJfOZLEm3DSj8RjYxzIrKqmTLyJyURCWp1l?= =?us-ascii?Q?2yWOfm+9szODc8t389Tj7S/aLJ7+taxkl/5fB1DkvVuYpQoH5wUruz/HHhXp?= =?us-ascii?Q?3NhllxRkw5/9p0Y+PWe3FIKsbnzOp4wSQ3Pvl4ZiZ9Gd+t/MyQ5M06ZeCJUN?= =?us-ascii?Q?/kcyWOXsYS3bG7Czm0pg2NIKTaWoziY/Tm05Orgk6rqAfrRfG1zIPwvnxef2?= =?us-ascii?Q?etL6LJZTwblTjqeSIM+QJ3FNTqvDh8heqs6ujzjhFv/LJ5pzti2zgxq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QK6HEumGzVUjFptJYKyqlYd?= =?us-ascii?Q?W+SyWwA/rmmj9dP5CfPu4FYkkZyNv9JtCXVjB18ZaJl+b1NCD0cQN/tmdA2/?= =?us-ascii?Q?7SRkVmHn2SU3VJ/A88fYDDLmVfOaxt5M+WaI2lqKYXdg0UNo7zMgexdcBqoK?= =?us-ascii?Q?lB4kZK4PdnfaGnT3xmwA8IFT?= 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)(7416014)(366016)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?HfIIG/OQHvqVbJd3HfGMgHlqYMbM04XRhjRI3j572YxmkmynLpUyLPmDiDR9?= =?us-ascii?Q?iKrlCXKTaWnmKm68CxtGFoD/GX2OKljX434qZ98i9OkJjXuxF7P8OQoSUO++?= =?us-ascii?Q?SlqRzgH3KQecU+e+cXph8uK2WkQmMAKbK18AwVKZ8L77WxIDC0u5FlkaEhzr?= =?us-ascii?Q?omLzb80qs03Y5/TrQCAaE/RzECeZl7AK8QZhohxkHnJCwAYuMsQ7pw7yy7fP?= =?us-ascii?Q?gTBPhc71obU+qgIeHoOzEqJDkWr6I11w4cyKUzcVGEI7gYhEovFRVjl0wJU8?= =?us-ascii?Q?PEy2+0nZ8MS3jtpMyBmA1ekRjOiGvbrbFK9Ro4mBgvAmya/nVzmYcHWKXekZ?= =?us-ascii?Q?5xYtVclO/KCGOZuHfGpZ1w6k7vcyvOz5OyzkjHdK+fon1CZQc2ss20lSitEf?= =?us-ascii?Q?zR7yvNnUGykTE7Imwxz3CLGcWOry0onSZqtEEBKZsJMmAov+WxAoJa30Glna?= =?us-ascii?Q?7Zg4FAAYMHC0297226OvBG+AAHBYLui9/QKVwzZ7E+qYno0BG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Davp2N5Oqhi11Aqm6wQ3Ul0jrub/VV9NnxAJBLS5noS1eZW?= =?us-ascii?Q?d4mnKv0Z1QRxPK9qKUDzU6Xz3OcMfsW1wrVozO82zQGG1gghvZ0W764LnzX1?= =?us-ascii?Q?ynTNrO0k3KakNHotpAwaDPTDp6oWZSzlcw9WfGSq4XXRCNsCxEyTToWPYIsL?= =?us-ascii?Q?0LT0ahsoMDEVGSthHsME2WpbEA6MSijpTzzu4k1Uxbl1XoWLtctLv8jOlwd5?= =?us-ascii?Q?Nw=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: hP/WZnPkZDZqTO1MjW4IMs+aWOy9nJ6e2AdfCp539AJtDhyPpQtLRXwr1FpamctAfHEECYNpTgtSwlHY1ND4E9Sa3CPVOCmjBRTEg/ZcATz2+LO9kTRTduEQrBVL9m889jmE++KNrHVUp3n3RFZkZH3qVNo/iAUfKlVmsyl4wBs6j+G1XomTY2fx5LBznLq4uXV3JLh6Ktn3QuWBBOXVuvs1otvtJuHGWesaupAKxnk3YXPhTxzvr1kSEuHWsiGwQdW6vUhbMzwow7dgIpx47uAAwCqO+kYNXki3YDxXH3XZ98yyxFgrQzj8R6iPnoSrj1KBAmGPgeMgZoqpPlPe/UM8lHfexqmBr57j3zZ/wDntHtrm129A+RFpc/4h0FSBCGKhlW4OpopZHUrLZhwr/ZzL9ZI3g5gos54skOgN7j/mCSp9uP2kZVbppcq94yi+P76ON43vd32JStGPljZxDAah6ij+SS/kMJ6j7W6llQ8+zzUDWi5Ifw5FFDh6bmQ0N3QGkLCLbCoZ08mjS/gPRhSbOqFJ3kW2mwXFem0oNhZQy3xcAZfJ88vPGE3p130Ut6N6Of17r/e1MB2q/8R95L2mCF60RLxVpFJfzwy2gCE= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 99a41aab-7639-4d0d-98fa-08dcff15fa7b X-MS-Exchange-CrossTenant-AuthSource: CH3PR10MB7329.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2024 10:21:44.3424 (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: Avj513UXtWEV2dEj564+tHwL0rgbo/FrDKT4gkYgWuP6keZrPQAZp7yNui/xb0iyQbGVwuE8J5+ZOOjSLo+/AvWLtwTgyDLC0xf7hefIbXM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4187 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-11-07_01,2024-11-06_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 spamscore=0 adultscore=0 phishscore=0 suspectscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2411070079 X-Proofpoint-ORIG-GUID: SDefPObSeaEcgdwoP9vvO5QWReDmC_4R X-Proofpoint-GUID: SDefPObSeaEcgdwoP9vvO5QWReDmC_4R 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 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: 1730975027308116600 Content-Type: text/plain; charset="utf-8" From: William Roche Merging and dump settings are handled by the remap notification in addition to memory policy and preallocation. If preallocation is set on a memory block, qemu_prealloc_mem() call is needed also after a ram_block_discard_range() use for this block. Signed-off-by: William Roche --- system/physmem.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/system/physmem.c b/system/physmem.c index e72ca31451..72129d5b1b 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -2225,8 +2225,6 @@ void qemu_ram_remap(ram_addr_t addr, ram_addr_t lengt= h) length, addr); exit(1); } - memory_try_enable_merging(vaddr, length); - qemu_ram_setup_dump(vaddr, length); } ram_block_notify_remap(block->host, offset, length); } --=20 2.43.5