From nobody Sat Dec 28 11:48:03 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1734455239; cv=none; d=zohomail.com; s=zohoarc; b=g/0jHwCbCuJFDlvXHtUZDML6Hbwu0L8IdMQkCaylo4i2rcBZvDa8sEksPXG3kf2oK6DWzdhjWbzS4awq2Tbg93hvExkJNdV/Q8j2CPXDBBJMbu4+Wb7K17fniEuXczIKpeeF4/A76c5wL6fnfnzanoQ4BE8gXgEoa6I77HC/iOw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1734455239; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=TrreipUOqvu+e4eZhr8owwgZAEd1TzrMBSTgToeJEUs=; b=lGVgo/SAHDv1KzjvimzH0wsAXHVYz0VetWwfGsywxSvPnPKvEeAUFkXCx8otlvGw8eC3R3cf6/dwOVg2fBmqWB/lieuRpuKy3QfKEUEYYJ1Nm5ekCYZAvUD6CAcwSIRjBDC6c5aviit2V66SmH58q0tpFgVNgMYMfxX+UpHRefE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1734455239374311.7232096308545; Tue, 17 Dec 2024 09:07:19 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.859580.1271758 (Exim 4.92) (envelope-from ) id 1tNb23-0007wa-SD; Tue, 17 Dec 2024 17:06:51 +0000 Received: by outflank-mailman (output) from mailman id 859580.1271758; Tue, 17 Dec 2024 17:06:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tNb23-0007wM-LQ; Tue, 17 Dec 2024 17:06:51 +0000 Received: by outflank-mailman (input) for mailman id 859580; Tue, 17 Dec 2024 17:06:50 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tNb22-0006B0-22 for xen-devel@lists.xenproject.org; Tue, 17 Dec 2024 17:06:50 +0000 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [2a00:1450:4864:20::636]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 4de667a8-bc99-11ef-a0d6-8be0dac302b0; Tue, 17 Dec 2024 18:06:49 +0100 (CET) Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-aa689a37dd4so1053199566b.3 for ; Tue, 17 Dec 2024 09:06:49 -0800 (PST) Received: from carlo-ubuntu.home.arpa (host-95-230-250-178.business.telecomitalia.it. [95.230.250.178]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aab963910f7sm461362666b.166.2024.12.17.09.06.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Dec 2024 09:06:48 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 4de667a8-bc99-11ef-a0d6-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=minervasys-tech.20230601.gappssmtp.com; s=20230601; t=1734455209; x=1735060009; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TrreipUOqvu+e4eZhr8owwgZAEd1TzrMBSTgToeJEUs=; b=u5tVwYtQFHX0aTcLsu/aXOfStxknP2Af0R7Wi92nfYNeUDHIxpFSfW9gKVzMc2goAH wuUXan7318HACfcXb2fYQ0OxFHl59qdl8waAimMu3RcCMHjECA1+VuKSeod89SKjz/cP ICTI5MAQc01l5qjwSyyO7QGNxsEL6T4CHdJOZtYnyh86q6B77xkLOqspWEBcxb6WX+0S sySpJknP1oMi5lonnYj1Su7GO7ALwIJaDZ1NFmnBBCUMm36gAywvg3yvsb64DqDubUJ0 2S9uPsU7F4lR7OSnSgCLxzTB9SVSAjuEQoBIMaS0m1FXG1nWOtXh0nr7IV3Yhk/WyCtH fXTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734455209; x=1735060009; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TrreipUOqvu+e4eZhr8owwgZAEd1TzrMBSTgToeJEUs=; b=ODNbS5mf4AjbkPVUjGayu2g+38JANRpL1np7CtCVMbGHUwgmXjg4KpwtMq51zNnlLy rMda/nizn11NH9nT/lHQe6XyY7p9Md1zydFa+idcnX8e6CjADSBE2og6JPnqYig+y5/U 7ae2iCvP7F/Gd2I45LegYPYrQ+hJEJew8OsXoaYQXF5FOOFzuCajp1M2wEI36xQ+4nr/ ktgMe7IpDkMrSfw7LloSaPYSAtlQqsMOEJf2QDKLPQ6I6hjYqdfW+67GbmbSEIdhFEwQ lv8MB0Ewh1x07imWUBxI+Djo3thcA/HwqJQIrJIGjKCV49rEclY6zkNw0bRujw75rcCc qvSQ== X-Gm-Message-State: AOJu0YwidKP2XkGC8JD1Lu1zuY0h6+LoWKQyLg2LPV/ufxoWbfwrYAvn EEFZm7eH3XBhMzZXYEpm4esNGNeOafl2wTAmVQTjE228jmyKSgec+Ia+s/WMGEld+uGPsIT/6ky Q+p4= X-Gm-Gg: ASbGncsQ69F5bUj8miI/DZGU0KAZJZ0z5dtTkLz+Wvq5K69jRnYGS6/fWon98SS7rUH uNIBh7o+Fyfrs6KY9BFJP4d8H8ojYZ3tN8/hGpAuGv3mBdp7QPhRsSwdBC5X+RG9mZDnmuH+N9O 19fVvLmErrn4ylj3KBgxJVGcJEa6ySXlXb3TnzMhWDSQi2LoGBXAIMw7XIL6DzL7t4fyWMOpzgc kNdfccmtxlGOyyO/ULZpyCT67wl5t7L91IfYFgzccA3DBgjlxWwmLI2AUP4oS6xIf+p4XCuqutu Z2Gb7Inyx3+IMXWM63gYyd9adIV4UcRwYWtYCn8+P7g2/6GSuGyYzkCyTZA= X-Google-Smtp-Source: AGHT+IFuCSa53dAt3X2uYHYt3kSIWw1yJmJ/rrSQ+FLSFp9jh3JwOm6m4Wkm74+jmHFUlcpIQOHKYA== X-Received: by 2002:a17:906:23e1:b0:aa6:96be:2bed with SMTP id a640c23a62f3a-aab77ee8ae6mr1461073066b.59.1734455208785; Tue, 17 Dec 2024 09:06:48 -0800 (PST) From: Carlo Nonato To: xen-devel@lists.xenproject.org Cc: andrea.bastoni@minervasys.tech, marco.solieri@minervasys.tech, Carlo Nonato , Andrew Cooper , Anthony PERARD , Michal Orzel , Jan Beulich , Julien Grall , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini Subject: [PATCH v13 08/12] xen/page_alloc: introduce preserved page flags macro Date: Tue, 17 Dec 2024 18:06:33 +0100 Message-ID: <20241217170637.233097-9-carlo.nonato@minervasys.tech> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241217170637.233097-1-carlo.nonato@minervasys.tech> References: <20241217170637.233097-1-carlo.nonato@minervasys.tech> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @minervasys-tech.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1734455241607116600 Content-Type: text/plain; charset="utf-8" PGC_static and PGC_extra need to be preserved when assigning a page. Define a new macro that groups those flags and use it instead of or'ing every time. Signed-off-by: Carlo Nonato Reviewed-by: Jan Beulich --- v13: - no changes v12: - fixed wrong patch sent in v11 - added comment on PGC_preserved v11: - removed PGC_broken from PGC_preserved - removed PGC preservation from mark_page_free() v10: - fixed commit message v9: - add PGC_broken to PGC_preserved - clear PGC_extra in alloc_domheap_pages() only if MEMF_no_refcount is set v8: - fixed PGC_extra ASSERT fail in alloc_domheap_pages() by removing PGC_extra before freeing v7: - PGC_preserved used also in mark_page_free() v6: - preserved_flags renamed to PGC_preserved - PGC_preserved is used only in assign_pages() v5: - new patch --- xen/common/page_alloc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index da505a79f6..6dc8e0d5c9 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -161,6 +161,10 @@ #endif =20 #define PGC_no_buddy_merge PGC_static +/* + * Flags that are preserved in assign_pages() (and only there) + */ +#define PGC_preserved (PGC_extra | PGC_static) =20 #ifndef PGT_TYPE_INFO_INITIALIZER #define PGT_TYPE_INFO_INITIALIZER 0 @@ -2385,7 +2389,7 @@ int assign_pages( =20 for ( i =3D 0; i < nr; i++ ) { - ASSERT(!(pg[i].count_info & ~(PGC_extra | PGC_static))); + ASSERT(!(pg[i].count_info & ~PGC_preserved)); if ( pg[i].count_info & PGC_extra ) extra_pages++; } @@ -2445,7 +2449,7 @@ int assign_pages( page_set_owner(&pg[i], d); smp_wmb(); /* Domain pointer must be visible before updating refcn= t. */ pg[i].count_info =3D - (pg[i].count_info & (PGC_extra | PGC_static)) | PGC_allocated = | 1; + (pg[i].count_info & PGC_preserved) | PGC_allocated | 1; =20 page_list_add_tail(&pg[i], page_to_list(d, &pg[i])); } --=20 2.43.0