From nobody Sat Nov 23 10:14:58 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; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1730288970; cv=none; d=zohomail.com; s=zohoarc; b=kld++0B+VykuQEXFEsX5O9TwodvrMHUeNdGvGMajUraDReptdi0z1Vjh10wATKzOtTjyF38zTWWJed6FFicMABvMt4QWpI8jS6YJYna7Ye7EWAwUPz7yYqO9WygSYflqigyey/bUO9dToD6lDQuo4uqvWp65767Cia7Jb2eC+tk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730288970; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=fFA4KnpqYQAYG7V06hkXCF08eankx3XnmRg26x0tlVI=; b=EUhYXTi7EtWURrpAtCshCZp30qwEPAmuMDasnugDI63GDdxzCBNKZIkJ4UACPgyf9j9FQFVEevad9SYaKnxdNypJq/AQozZySHq1gnysieBC8Y5fZB3kWlaEB7lw7sr4HBFrEFGegEonAfeIumGixryRF0B/ux+VPCZAqqCWSfk= 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; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1730288970251597.6168579397638; Wed, 30 Oct 2024 04:49:30 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.828131.1242968 (Exim 4.92) (envelope-from ) id 1t67C8-00020J-2f; Wed, 30 Oct 2024 11:49:00 +0000 Received: by outflank-mailman (output) from mailman id 828131.1242968; Wed, 30 Oct 2024 11:49:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t67C7-00020C-Up; Wed, 30 Oct 2024 11:48:59 +0000 Received: by outflank-mailman (input) for mailman id 828131; Wed, 30 Oct 2024 11:48:59 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t67C7-000206-Bx for xen-devel@lists.xenproject.org; Wed, 30 Oct 2024 11:48:59 +0000 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [2a00:1450:4864:20::636]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id f104f85a-96b4-11ef-99a3-01e77a169b0f; Wed, 30 Oct 2024 12:48:55 +0100 (CET) Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-a9a156513a1so1020781766b.0 for ; Wed, 30 Oct 2024 04:48:55 -0700 (PDT) Received: from localhost ([213.195.115.182]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9b1f028fcesm566968666b.53.2024.10.30.04.48.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2024 04:48:54 -0700 (PDT) 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: f104f85a-96b4-11ef-99a3-01e77a169b0f X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDA6MTQ1MDo0ODY0OjIwOjo2MzYiLCJoZWxvIjoibWFpbC1lajEteDYzNi5nb29nbGUuY29tIn0= X-Custom-Transaction: eyJpZCI6ImYxMDRmODVhLTk2YjQtMTFlZi05OWEzLTAxZTc3YTE2OWIwZiIsInRzIjoxNzMwMjg4OTM1LjU3Njg3OCwic2VuZGVyIjoicm9nZXIucGF1QGNsb3VkLmNvbSIsInJlY2lwaWVudCI6Inhlbi1kZXZlbEBsaXN0cy54ZW5wcm9qZWN0Lm9yZyJ9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1730288934; x=1730893734; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=fFA4KnpqYQAYG7V06hkXCF08eankx3XnmRg26x0tlVI=; b=PE6/O5SZUjJm5zcytYp2MfA/1J9DMGlWvhGNpx9GGY+uZMTQ+FnZz/VB2BQxqymiLG eR775DKLBQoF0fp+tYJC5xGrjufKPbzSKsFP9OdzChMgvNdROVarGQnnwIrLpMnlWgz4 fOWifNpelCxs2RZ6M0iP9QvmJt67Uqx+CHfDk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730288934; x=1730893734; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fFA4KnpqYQAYG7V06hkXCF08eankx3XnmRg26x0tlVI=; b=HKrPBzfVNdzz+oj1XLRLUjjY1pKjT1Y9YYLUnJR2d4eAUlpy/Bos2JAR0U1UWbvkeD HLOc0Ri+7WBDJ8CuGyWDUhhcgeTbGiNIhiaQUFtfLLYH+ZDacaJpsiihtmo8YXQQHw0f +OnRifiotfPtBJ14BPoF57z6DqGgmRyHN/BGfh5jheK6qzhGn8eWY1v1PeeUDkQA3YoD cz1Huuz1wQoNjw1/wUTNQgqvXCw6bRDcpOk2hGM45MRGaoo8OxocQhQs/B5n6biPvj4Y Y15jjYtDu0ZOjwcVYPVHfxTqNojzKQ9Vr0yzAQGaRn0jlRtVpEgf1hG9dGMYX5vDIYb0 Dm6Q== X-Gm-Message-State: AOJu0Yz9NuYwRxxyZkaR8e3JxCeEz0SgdeRQZb35kAEd+WXQgYiZK42m ghlq14SUhd4WnC2lOoWQdR0LaRcY8f6jVOMfbTWYduCLIJCGClT8sG9VyCrlJYb3suiKNyd0EgJ y X-Google-Smtp-Source: AGHT+IEKW9z+hv1cqQeIZtcizoHAP6ApgMZ3QzzL9FXjrhDF82/rt9gl+s1ww0c30tP1lHwkbbQYvA== X-Received: by 2002:a17:907:948b:b0:a9a:835b:fc8e with SMTP id a640c23a62f3a-a9de6330780mr1525664966b.54.1730288934508; Wed, 30 Oct 2024 04:48:54 -0700 (PDT) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Jan Beulich , Andrew Cooper Subject: [PATCH] x86/mm: ensure L2 is always freed if empty Date: Wed, 30 Oct 2024 12:48:52 +0100 Message-ID: <20241030114852.55530-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1730288971931116600 The current logic in modify_xen_mappings() allows for fully empty L2 tables= to not be freed and unhooked from the parent L3 if the last L2 slot is not populated. Ensure that even when an L2 slot is empty the logic to check whether the wh= ole L2 can be removed is not skipped. Signed-off-by: Roger Pau Monn=C3=A9 Reviewed-by: Jan Beulich --- I've attempted to find a Fixes tag for this one, but I'm afraid there have = been many changes in the function, and it's possibly the code that introduced th= e L2 freeing (4376c05c31132) the one that failed to originally adjust this case. --- xen/arch/x86/mm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index d537a799bced..0f53dcebad95 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -5717,7 +5717,7 @@ int modify_xen_mappings(unsigned long s, unsigned lon= g e, unsigned int nf) =20 v +=3D 1UL << L2_PAGETABLE_SHIFT; v &=3D ~((1UL << L2_PAGETABLE_SHIFT) - 1); - continue; + goto check_l3; } =20 if ( l2e_get_flags(*pl2e) & _PAGE_PSE ) --=20 2.46.0