From nobody Fri Nov 22 19:02:11 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=1716581047; cv=none; d=zohomail.com; s=zohoarc; b=d3ZyK8tJ+j41Pop6j5gn7IYvjclf10+sjFF5RBGwvFeVmSAUoR6G0gxRI71dmMFzU/kIFFDCVAWlD2MKgKUH9vaneeIuymnU5R+AeKqI62Zlt5+YQtj02U+vJeAJUBE0BL5xpTcBORr0uExirfPVEHy0AZsYLe+gnMFHmSzeGzc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1716581047; h=Content-Type: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=HcvFli469CD4OUU+qKqIt2aUdVZOLqd4ksEwvUfVXhg=; b=EbL4ijKSHSlx2I2AdkFNQH/vyJTjWGbx3Ec3EdUGpE8fLbc9KnIu8UnP1DXMUfmkmQBJw7YQVZjP92R7B6LDPYXGhvu8nUxBQiIDVwilrDchVlzpnMCyyHIAfaE5l/TleSyPkkHlvSUM8G90fTYePERhNUZhOa5DVNz4NQlNEok= 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 1716581047944995.8434084938509; Fri, 24 May 2024 13:04:07 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.729748.1135025 (Exim 4.92) (envelope-from ) id 1sAb8n-0007rh-CP; Fri, 24 May 2024 20:03:49 +0000 Received: by outflank-mailman (output) from mailman id 729748.1135025; Fri, 24 May 2024 20:03:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sAb8n-0007r0-7c; Fri, 24 May 2024 20:03:49 +0000 Received: by outflank-mailman (input) for mailman id 729748; Fri, 24 May 2024 20:03:48 +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 1sAb8m-00076x-7T for xen-devel@lists.xenproject.org; Fri, 24 May 2024 20:03:48 +0000 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [2a00:1450:4864:20::22d]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id bb530fd6-1a08-11ef-90a1-e314d9c70b13; Fri, 24 May 2024 22:03:47 +0200 (CEST) Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2e576057c2bso137040041fa.1 for ; Fri, 24 May 2024 13:03:47 -0700 (PDT) Received: from andrewcoop.citrite.net ([160.101.139.1]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a626c9377d8sm173553066b.55.2024.05.24.13.03.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 13:03:46 -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: bb530fd6-1a08-11ef-90a1-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1716581027; x=1717185827; 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=HcvFli469CD4OUU+qKqIt2aUdVZOLqd4ksEwvUfVXhg=; b=tMjwoj/WoBzXXrRXI2vSSvfnBCJUWWz2JveF3LyAps+Pya3YK+JxJBS6kXaBfBZeN/ xwpVYmd255e+fgjFbdMkTNpVmNeZgfSt/QJpJ54YSxj2G/6bqgv+/2ue7gFY8Pr9slWf VANQO/Rex4kK+QKsF3EQfMDB3lPTApNOdUqIk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716581027; x=1717185827; 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=HcvFli469CD4OUU+qKqIt2aUdVZOLqd4ksEwvUfVXhg=; b=n9LqQtZqtqt8J12rNKWvpCLDqcRJQ2rPm7CgOU2xMFA8gOtJaMGpCeLarlwIfRErtj ApLX5wTbLxO7XYFn72P6/KpzRP+Ju5u1C0RMtQ9j92gU9kvu4p6K66XBCPUniE9CJDUE 6m5XldV8uUCPygnY+2ar/fWFnwRvSv6+KgaIf2xYPQ/Sw1BZ31uWBMG9KsemRFcedlDr YHzt9eGP+TL9RvoaSS2HBUQhZ2qwRSmRERvVyA1RvxQla8F6yObamWnyx/r5qaJ2SL+Z UwyCUoMVKPpsmsphynTEzcE6BI97oaqy1Y6wZcWqzPaxfOZEp8NIXX33UE8W1GJgmb31 OA9w== X-Gm-Message-State: AOJu0YxuS15NSPVwp/73eGplKVLxIaLWqw46gsusG1yYHnKFZyEEfFoV vkVoJe8lBkMOHbUHv9sjzNrNxN0n9kC/83ZLM01AF0+RyC7hdZXMgm0nbqNp0EI0iAdd96xudeJ 4LNs= X-Google-Smtp-Source: AGHT+IFW77E6sOaTPxeY1Anh235eDcr+kQYnA1qSCVR/tfE2QVye//bW0h/5/1gXeVXq88hbfi6MTA== X-Received: by 2002:a2e:8910:0:b0:2e2:64d:6849 with SMTP id 38308e7fff4ca-2e95b27b09bmr24937071fa.50.1716581026945; Fri, 24 May 2024 13:03:46 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Wei Liu , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Michal Orzel , Oleksii Kurochko , Shawn Anastasio , "consulting @ bugseng . com" , Simone Ballarin , Federico Serafini , Nicola Vetrini Subject: [PATCH v2 04/13] xen/page_alloc: Coerce min(flsl(), foo) expressions to being unsigned Date: Fri, 24 May 2024 21:03:29 +0100 Message-Id: <20240524200338.1232391-5-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240524200338.1232391-1-andrew.cooper3@citrix.com> References: <20240524200338.1232391-1-andrew.cooper3@citrix.com> 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: 1716581048585100002 This is in order to maintain bisectability through the subsequent changes, where flsl() changes sign-ness non-atomically by architecture. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Michal Orzel CC: Oleksii Kurochko CC: Shawn Anastasio CC: consulting@bugseng.com CC: Simone Ballarin CC: Federico Serafini CC: Nicola Vetrini v2: * New --- xen/common/page_alloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c index 7c1bdfc046bf..8d3342e95236 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -1842,7 +1842,7 @@ static void _init_heap_pages(const struct page_info *= pg, * Note that the value of ffsl() and flsl() starts from 1 so we ne= ed * to decrement it by 1. */ - unsigned int inc_order =3D min(MAX_ORDER, flsl(e - s) - 1); + unsigned int inc_order =3D min(MAX_ORDER + 0U, flsl(e - s) - 1U); =20 if ( s ) inc_order =3D min(inc_order, ffsl(s) - 1U); @@ -2266,7 +2266,7 @@ void __init xenheap_max_mfn(unsigned long mfn) ASSERT(!first_node_initialised); ASSERT(!xenheap_bits); BUILD_BUG_ON((PADDR_BITS - PAGE_SHIFT) >=3D BITS_PER_LONG); - xenheap_bits =3D min(flsl(mfn + 1) - 1 + PAGE_SHIFT, PADDR_BITS); + xenheap_bits =3D min(flsl(mfn + 1) - 1U + PAGE_SHIFT, PADDR_BITS + 0U); printk(XENLOG_INFO "Xen heap: %u bits\n", xenheap_bits); } =20 --=20 2.30.2