From nobody Sat Apr 5 20:42:00 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; arc=pass (i=1 dmarc=pass fromdomain=oracle.com); dmarc=fail(p=reject dis=none) header.from=oracle.com ARC-Seal: i=2; a=rsa-sha256; t=1738013595; cv=pass; d=zohomail.com; s=zohoarc; b=XfoLbAP3AM4bWtmene6mZj+frRfb6GjreCbrw5+/+ZuqwJqpG9Ovw0Ne0ZEsfoos0KwCqh3XlGnhKQ6CzIwHwTrGJRTXxqI75lP8Sj4ivQ/fw+XVHaTQczg+Q4vG1sQe7MiplQvrDY44zTprLhJFPfLAz4SbjumM8pqBnDHlGcI= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1738013595; 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=K+SxdrdX1InTxo5zQE56qa247cTBfeTJ3jhGnfvxBow=; b=VWTAatO+o6yWokfTaZXWS5QDUUCV84yhWKxVjQynfvDz/F3789+5VlO9vHZ1U2S58Upt6dDZkykqW7uECM/m/WupYiiTPaBfB96KbeJTNMTyS3R8mFly1Uyun2MfRgZTTJLndIdMEWAFPG9eRclYetI+M63c5e4jW22PBxCDDDM= 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 1738013595121136.92135608480226; Mon, 27 Jan 2025 13:33:15 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tcWi3-000791-8Q; Mon, 27 Jan 2025 16:31:55 -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 1tcWi1-00078S-4c; Mon, 27 Jan 2025 16:31:53 -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 1tcWhz-0003uV-BK; Mon, 27 Jan 2025 16:31:52 -0500 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50RLR3tQ015041; Mon, 27 Jan 2025 21:31:39 GMT Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 44ej2j80ds-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Jan 2025 21:31:39 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 50RKSlri021979; Mon, 27 Jan 2025 21:31:38 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2175.outbound.protection.outlook.com [104.47.56.175]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 44cpd7hsp5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Jan 2025 21:31:38 +0000 Received: from CH3PR10MB7329.namprd10.prod.outlook.com (2603:10b6:610:12c::16) by PH0PR10MB4614.namprd10.prod.outlook.com (2603:10b6:510:42::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8377.23; Mon, 27 Jan 2025 21:31:36 +0000 Received: from CH3PR10MB7329.namprd10.prod.outlook.com ([fe80::f238:6143:104c:da23]) by CH3PR10MB7329.namprd10.prod.outlook.com ([fe80::f238:6143:104c:da23%6]) with mapi id 15.20.8377.021; Mon, 27 Jan 2025 21:31:36 +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=K+SxdrdX1InTxo5zQE56qa247cTBfeTJ3jhGnfvxBow=; b= GZG3Nh2RHzg6tHmzRWVAG4n23U4aUtgXsp+hECSkatVxp46KVmuzMv8fNkp5tnve E39cVhlujhpiQYCVaAD/rqSb2PnGWBIo6hk/xAPoCqgC35mEWYoY7px7qprBBPQ6 dNoYUj6vYaGRxGm8G0ZG35T2R55XDa7unHsNaYO0ozG3yGVKiJKWhKw9ley3fupo Bw1Bt+Tu5CGCSPnsH/hcqrFVcEzlN5fRmvmGhqHaOqUcBMWe7jUqf9OQKyki0tlt WcED09R4A5muqQRNfHJZx2woSQcvHNzEPglMNIM/ix1bNAvsbx5Yfij03jk3uu5t F02b4j0ck3aCOd+uIpzBUQ== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uDNwyy19wEbMYLPmlJTZ1zEaCIeHU4jJZHhXdXuvupDKinggA+ll1ga0D44yA9ofx4rfqUsmi0aH0+Cr9Lw7SuD637MTW8Q9jN0l3nBZEUpE4Pan+VS7kYGnUHyuJT6QVJI5ao9Vl3rfKS/z03iAMgVJqq21nlnXd10m+/2vZN6fS4r9rdrfd8BQYgT1JHV4wByx3OFAUuhjbhoSVUH0Vkn+r/x8OAcjdBVds+7C0uFevsrIaV9uMs+E0RfFaGHIWfguWENeqkYeFhbj18+rS9ws4LwRzKPgIXv6PH1aPTyDUihc4KtFokPVyqimXVC14GH4v75SqEEyOO29mzBMUA== 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=K+SxdrdX1InTxo5zQE56qa247cTBfeTJ3jhGnfvxBow=; b=G40L8Co5qxr6DAFetL/imVD7Yjbyhp93eTjF9Dl6lwsClQVMUJSY/usPdxjeQJgT9Z4hKCD8Y6VhuLspy25ExSBDxFyHa27Vd8U40qzR6Q5Z00lqu8QUeyFU1wK4dNF1cUVKl2YKqW2YFmevwx/aIkDZcgePHQJLMwM4wAGVptBK/EEJbmi/MfFRYyrR2g/FiFtf4Re1pcuRyMDKOKP97Ilfk01W/nuXDZr6jFp6DOXjy46Ehrd1q507FCm/ua70pcvnSdF6lVU/h91bIoo9rccfwL2VQxHO1r+wo69JssID8Oj3OFRZhDDJVBkqjL/cMtIT+1bLZHkHRUTMUAVNeg== 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=K+SxdrdX1InTxo5zQE56qa247cTBfeTJ3jhGnfvxBow=; b=m3CXXKguQK72i86RHUIOkFJpW81WwW5SBRzNX/GoYurbBWaRl66RPYmoDanYcOaJNpYHDHKwMOi2JzoaG1zAo+cQSEFNktNtS/UcDRvJPm7IN2pcGQNjNN7LBBqYdu16fnIPgQNThhnWR0w4DnDjagIklO4hq7SfzcUNkFDNVqI= From: =?UTF-8?q?=E2=80=9CWilliam=20Roche?= To: david@redhat.com, kvm@vger.kernel.org, qemu-devel@nongnu.org, qemu-arm@nongnu.org Cc: william.roche@oracle.com, peterx@redhat.com, pbonzini@redhat.com, richard.henderson@linaro.org, philmd@linaro.org, peter.maydell@linaro.org, mtosatti@redhat.com, imammedo@redhat.com, eduardo@habkost.net, marcel.apfelbaum@gmail.com, wangyanan55@huawei.com, zhao1.liu@intel.com, joao.m.martins@oracle.com Subject: [PATCH v6 5/6] hostmem: Factor out applying settings Date: Mon, 27 Jan 2025 21:31:06 +0000 Message-ID: <20250127213107.3454680-6-william.roche@oracle.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20250127213107.3454680-1-william.roche@oracle.com> References: <20250127213107.3454680-1-william.roche@oracle.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: LO6P123CA0014.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:338::17) To CH3PR10MB7329.namprd10.prod.outlook.com (2603:10b6:610:12c::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PR10MB7329:EE_|PH0PR10MB4614:EE_ X-MS-Office365-Filtering-Correlation-Id: f92cf85a-65fd-49bc-5b42-08dd3f19fa23 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|7416014|376014|7053199007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?DYmrAqAiQrON74/04wLzNRiaxusdbbbHx3ZvkcqXBUh4+69o6satBDkgkOLm?= =?us-ascii?Q?cyll5y23QxrcmCU8WAQDYCDKTD6jZay8V/8zhlJtaVwkKQb6CEZ1y+ouFwbY?= =?us-ascii?Q?zXaGFg+3dnZ4Lh2+IWsimOZIB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ascii?Q?iA8NI5GX5/iX9c3bsILvz8aS9OVt89tkxdrpInHBANTYOWyg7ZAxWZ04m1pk?= =?us-ascii?Q?mKJdd6jdR84R10Xqg3IX9QGBa2wsV2sTGsyFNZHSy/GP4+8EAmAnHkByo7mr?= =?us-ascii?Q?w96Asr1RkiuZRsY8PkSCLP1Lbl6NroAkyACi0zFiQJhKlqRejMfzFj+C5oiF?= =?us-ascii?Q?13167XjcQ9kykfeiWh0/VPVTqvR1b83cOrhuNlQIhq2q4JyYNtHIuxaX1ngn?= =?us-ascii?Q?rzLHsGMngemYEuPewGbByFdYH1Le5nIr/kgiJhVis66c1F1cuaJjae5nHDTo?= =?us-ascii?Q?ImNe7H7bZJrFL4ng0Aq21dlYIAIi21bvyP8D/nGfbfmhV1rs+5cDdGQPLHuh?= =?us-ascii?Q?qb528y85h/bXc8e3dvZrShUOxMdF?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH3PR10MB7329.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(7416014)(376014)(7053199007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ZUbC9YU0O2gCkFZ0CFLNfHvFKAi9gEb0haE5UL78mnhnPgaX+xSWTCv49YEc?= =?us-ascii?Q?VuAzpkYTV1d4yIDRWvBlrVHumC1DRHQGYZGR/Tv3JpyLn+yB53ykkGoNEnWz?= =?us-ascii?Q?ngNJNoOL8N6l92GWA/rY1Ydb0l5EhrOjDTmJ9AlMUGQy5qJwqkoTHQk8/VKX?= =?us-ascii?Q?vhhWMEITYq4wI5pGm5EVmkbFeG7XO1aX+fGZ9/CgtftGSg1fNez2WxIjNjKa?= =?us-ascii?Q?N2hYSdMASuTa0W2WicnkJPRJgRVruIpICAsLZiuEC1U8icNwH88Fi+tLeYiy?= =?us-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7BsN68mRH/LvxryjS6maqbeOw/ftw7RUkW1fUeCm5?= =?us-ascii?Q?3N4LHVJEnWDoRB6NyKLp5R6EWzH+uX7Pdyzc1Xieqy0lVX7q4YJWKSxQ0+Uq?= =?us-ascii?Q?YSTWT/KkKQwuFNAX0eRwXIe9Ys4xN2TH7dIBVl3vqQubbHOeeESPjoabf7QR?= =?us-ascii?Q?Ch146Td7Dl2KhmZgB2wlRDdWuI/hdK8GgBXR0kYlL/eM1EuCukJRkuQTARX0?= =?us-ascii?Q?E5GgjTiAqQuI0SbZWSKiN29Iuekw50OPLZ1vmbtLudVExGV2zqhiSb1uGhzY?= =?us-ascii?Q?gG+a4N0MiWAJ4bdvVbelcozEHGoTI/AyH77eSrzB9rltupSHwMFPRKJLxKV2?= =?us-ascii?Q?V2zQD3qmxCBMFyAbKsP2qPYM7Kg9y8FsFynO7ytcPNkgjvpASpdKO90JikRF?= =?us-ascii?Q?CJxw+pGvX4Iiqrj8hFccUMuieyjAzbCSWpKvvo1sDyBx7NZSHU9STvkWRO6W?= =?us-ascii?Q?Og=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: HQ5+aYjaA32W3cOR3kAsg3oz1D26gZZ0rZD/qXGUyyao6wmilY6VQTU2usqGuZ1K02DxDB6b7saWrszl4k+TATkP5Nvk7w8MVhPaVYIraOkZXIb2RTCpUt5Q+41w/WznKPh7lu/5gr8iJhK5koscT/lz1QS53a37553UWlzDxyFoOyvZXI19rUkHl4H5uVQhfl1mznw6WTUw8CAl5aAEs+ALGqcFbLL/35j3FYxDUjpf/fje3CHTbnb3mKIXMpCawhz/6G9kiEkHBkHwhwMWFsWsZFdNqffojhZicYIQj3j2qba2rFaz0ivtID0qXVCIk5hczcxzjzrSoi9iCNmeG+7pKJTuwN8+GrnMF1ZNkOA0jA58ySRiKOwrNIe3vhz7ejpHn3m38oCfOHJ0CaLf05qZK0ZaRnB4Xl9fkG5iNGMP5D7fx5vRKMbMCLH0gYjTdwBcw+Sy6TnpA8meY/lyAGVMdZ+cQMToUmJmrb4CY62pDZrxUEdWaRQpJL2Qi2aG5WZ5FcuBQtoDnkEwPjGZt9po9t8VPrsNtXGDkDrbL13UtjCatdtcdPzaYPYiBHGELeL2rPhUd0yJjTFH5H3ymBW1LDplM5yFD8VyvN6GrIg= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f92cf85a-65fd-49bc-5b42-08dd3f19fa23 X-MS-Exchange-CrossTenant-AuthSource: CH3PR10MB7329.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2025 21:31:36.2265 (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: H5NX2DRDshRwyg2EumwgDfF/eiCw46PUW7fjsYTuIG+LHm63o+QC1IXXvwhmRFtJUAB75JhR9zShu9uv46W0lhLKnnmdMf/bL50KkUnNy9A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB4614 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-27_10,2025-01-27_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=0 mlxlogscore=999 bulkscore=0 phishscore=0 mlxscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2411120000 definitions=main-2501270169 X-Proofpoint-GUID: gK5Ji-Pn0n4AL86-YuUZcoO3k4SvzgIm X-Proofpoint-ORIG-GUID: gK5Ji-Pn0n4AL86-YuUZcoO3k4SvzgIm Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=205.220.177.32; envelope-from=william.roche@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @oracle.onmicrosoft.com) X-ZM-MESSAGEID: 1738013597926019000 Content-Type: text/plain; charset="utf-8" From: David Hildenbrand We want to reuse the functionality when remapping 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 bceca1a8d9..46d80f98b4 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