Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2619318rbb; Wed, 28 Feb 2024 07:28:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWnsEmc1FmnJLh8LGT4A7ipHeM78PeaBHRkU9TKDc5aQ3PlcHNbnYjLWPiDC27lxCB7erN2CebykRrkbPCi1J/hOpSHIc1vSs/a/9Kc6A== X-Google-Smtp-Source: AGHT+IEdETwTSCgsEw5YLfn9WQxA6flSnQdc3eb9JKZDxYOrKOzpE/s97v9kZPWEgqHZ/ocFpcjm X-Received: by 2002:aa7:df8e:0:b0:566:47ee:b8b4 with SMTP id b14-20020aa7df8e000000b0056647eeb8b4mr3383831edy.17.1709134129273; Wed, 28 Feb 2024 07:28:49 -0800 (PST) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id bt16-20020a0564020a5000b005665c07b967si962524edb.57.2024.02.28.07.28.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 07:28:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-85260-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SZ7VOY95; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-85260-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-85260-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 84B241F28A59 for ; Wed, 28 Feb 2024 15:28:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D4CE115B99D; Wed, 28 Feb 2024 15:28:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="SZ7VOY95" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D43B873515 for ; Wed, 28 Feb 2024 15:28:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=198.175.65.14 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709134119; cv=fail; b=gANXw7MWPTwjqnMtZbSRBnSv3I6O0lg4r1AP+xmjRrOwcYIgCZAgotFjFUE9fJgBqrBKewwvHym1wvPEFqAxJio8u5YCcJdw4nZOcLKuBeUCrF/8ZMgco2CF0U5wONz9M5M8UevMm1E2Y5EVsPF1mfvHQPIGXCRUqRAy9dRY2P0= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709134119; c=relaxed/simple; bh=haE4SvNZhX9U3JAZiWE3ugR6L7k9VJTo94pROwGWI9E=; h=Date:From:To:CC:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=EVxPQpmdx4K7IcrGkDfFu3YB5QcfcA6UE0yePzuKRoBPYUWbbRIw6Ad+M/X/w6bHtB4zddRTG4N/EwpeijpTDTJRpC0yReZaXsasUJHRRKc7E8S5aM1zBGI4TcrQXy2U006abZcpJ9qgxliI/tB4vd/Yy8c1Q/YfOjgg2w+46nc= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=SZ7VOY95; arc=fail smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709134117; x=1740670117; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=haE4SvNZhX9U3JAZiWE3ugR6L7k9VJTo94pROwGWI9E=; b=SZ7VOY95GlaJwijp59AHHKJDmbuTEEFSBrMOPTCWBVin8DKmvQI1jhdO 6sP10yEijszMIdA4XcWSYuJMiqCxYwcPepyIoPp2lr/LT2/dOslyP7qRL Q0esAGPGlS69SpV8z81iWo52ZRRl3dzj41/dCF/Yyx6zJhY/acVOcUaH8 hMQQzWRW60z7Z9ZX5znSoY1TbHDr/C2foD2h9ykh68v4j5W2tVd8vnvTJ hjusrH5HjUmTo6lmuuVuGU+M7tzW+zduJXfCir+RqFCbqU0E9pbCsA1MZ 2OjGbYR/UKVdYTGzhP+otj+e9vFo2yp9lT8BUMMb5iJbjiC6mZQ6GRj/4 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10998"; a="7362616" X-IronPort-AV: E=Sophos;i="6.06,190,1705392000"; d="scan'208";a="7362616" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Feb 2024 07:28:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,190,1705392000"; d="scan'208";a="12036789" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmviesa003.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 28 Feb 2024 07:28:36 -0800 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 28 Feb 2024 07:28:35 -0800 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX612.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 28 Feb 2024 07:28:35 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Wed, 28 Feb 2024 07:28:35 -0800 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.40) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 28 Feb 2024 07:28:33 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WaErXErDtIP6VoPsSnMeVtmpKOLdjbYly/ccLbP/wIfvFPDMnlKut9pJmsd8sQI7p6qPSa9GhfRZzWqCq3NAI+MtDwhfMank1MtW4XBVWUvWVULEPXspMYHNkhzd6Be4HMII4tRot4qZa4WdEn8RKVJF0AAMBn0/R5xpJLAnl3ZOAs8JyeUPrnKS1TBNcFCU0r5KTQcJI0hp1rRCmt2ZKtypBPQs5jX1uCYH0V+pXQIAEYgkT7S3GunikRmI8uUGmljUvQZS0ijVa6H637LU1aDNVqUBlz48CAXlEDFKeEWnnIE2UlZqBS9Mn0L1bjS9O/qRXZZgHqJpAbE4nesKMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=VmyFnVn12TZYu4e6llCvTtiLbWZZgIeUMfYpXSmB/l0=; b=iguzc7qe096VScJZ1oz0ZYCl3X66Hk1k3tz6qQ8M5Cvfoa8+GIKm2BjBdUYa2UW4QU6WWsvL2HiEceBC2N3VFGTh3UKSJVecgl6c1Js3R4/TbrsT5ooY1Ld5Wd3/x4BT9PLvuM3COFx67PayOYFDx++5F/T39nlogX//Dq7vo5dSLWAftn/VYopAPQt4KzI236cvjQ3m8QoZqBxax4wXcwNIWt5NPXqAJ7Wbl/q3f19lhE2rZhWyvFbRa11cHvBoh1pG4gm/LsCclwNbfTNiE1rmxdAzp64HAjKVyhRd0KFbncKzkuUnwYvDZZ0r7ZNHsYt0j2AC+/MzKkcusQpdsA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from CY5PR11MB6139.namprd11.prod.outlook.com (2603:10b6:930:29::17) by CH3PR11MB8413.namprd11.prod.outlook.com (2603:10b6:610:170::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.23; Wed, 28 Feb 2024 15:28:31 +0000 Received: from CY5PR11MB6139.namprd11.prod.outlook.com ([fe80::7352:aa4b:e13e:cb01]) by CY5PR11MB6139.namprd11.prod.outlook.com ([fe80::7352:aa4b:e13e:cb01%7]) with mapi id 15.20.7339.024; Wed, 28 Feb 2024 15:28:31 +0000 Date: Wed, 28 Feb 2024 09:28:28 -0600 From: Lucas De Marchi To: Arnd Bergmann CC: Arnd Bergmann , Oded Gabbay , Thomas =?utf-8?Q?Hellstr=C3=B6m?= , "Maarten Lankhorst" , Maxime Ripard , Thomas Zimmermann , Dave Airlie , Daniel Vetter , Rodrigo Vivi , Matt Roper , "Matthew Brost" , , , Subject: Re: [PATCH 3/3] [v2] drm/xe/xe2: fix 64-bit division in pte_update_size Message-ID: References: <20240226124736.1272949-1-arnd@kernel.org> <20240226124736.1272949-3-arnd@kernel.org> <0c6127da-53d8-4c37-8337-e64e3e91bbaf@app.fastmail.com> Content-Type: text/plain; charset="us-ascii"; format=flowed Content-Disposition: inline In-Reply-To: <0c6127da-53d8-4c37-8337-e64e3e91bbaf@app.fastmail.com> X-ClientProxiedBy: SJ0PR03CA0356.namprd03.prod.outlook.com (2603:10b6:a03:39c::31) To CY5PR11MB6139.namprd11.prod.outlook.com (2603:10b6:930:29::17) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY5PR11MB6139:EE_|CH3PR11MB8413:EE_ X-MS-Office365-Filtering-Correlation-Id: c38970bf-620f-4b73-3ea6-08dc3871eba1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eybQJGdHJa98Dzfd0ratxy/hPNRow5AQ2URB5LObjqPStFk2XC0NwF74PiD+BarQgN68ZtUWRtJ4O3fvunmA2qftRnclKVTcVYy8x0i4HZNc5myiqiMMu5+k4oxk6dVL3PBzYEaFOVBc/RBV0IrggAqHyfeTtyvcbLu5/LZybgW3QdBCefBeVnkEhDoNRta0M/weUQLax/g585JcK/1be0pNOet7J2FhQLCi/ogMDDQQZJMdUEjg9dZVqfxyMXZOxp0ToruWHtac7gpMrkUdAJvf6/w9eBx643gkY/Ow+yL0uFPX8qkiA7XqWQzFw8WPZ3a7+1YIwjibiud6SFYJ+LL17x/dIjd6OWFQTgOtM5PztcBGFhTi9EexZMbcHLDi3WKMTPRIFAFy0sz+wnvjmP2sy3b0ake7KBxvPQbl1/hOdKAtBixr176vektJCir4zc9twYFno1v0ClM1gwtG3khWJQ3Sdf61T5ae7MS/B7/BbDp+T8/HmUjY4xK1/NZvKEULbna3y/VX9ILf4Y2zkokV486aId8S6p7HTTh84HO3O9cHrNXNeIWsnRr7Q7ZU6jPNJGJiA8g7w4szyYH9OB93C5ICUpBwixSwGHGLxewypNK8Jb3myi7L6EMBC0dEf8fQkAiHNrw6J2JouTnPuA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY5PR11MB6139.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?YmzF7+lZ3QCjcOhUdnnqJdXON+IGJGLCpuKuTXn5Wq0pPXgdMv7L0oJ9MfKO?= =?us-ascii?Q?h7B4O5ZZSLRqZQ8F8GG3ydPCcS5y9qrLzV1cOMFacGg4ymxFHdhP6JhdA28u?= =?us-ascii?Q?Q4DgC6bHHMyewUbc11meAgisYaemhVhmT5axfBVf74yqYRC6afb5Ao/hP/n/?= =?us-ascii?Q?7kOE0iDX+OHe4jm1lRag1cClfzQJgGSaVcRoHFTh8oabQUOAxvxG+rM532Hl?= =?us-ascii?Q?x/q8Gp1tBR0uGot/yTPHfiXXYZL/xi4cMU5TKEheSoDHuvJcKy5Fp/9NiN5F?= =?us-ascii?Q?5rKIDaZvIbPbUUuU6C/zTeoZEczUO3OnhomBh+JH+ig9/J2YmkyZccjDkvMB?= =?us-ascii?Q?qtPsW3v3AfGuAL3bmFZCKbZZNfeBmnZxLhAWzXXCw+JXbE3e9CwqgI4ghmtR?= =?us-ascii?Q?8HOWZItfJeHN6UJnVs7nsM03W37VtdVTB3tSY8DSDv3S7dV8/yXmUHS/nf2k?= =?us-ascii?Q?c0i3mdGgNnpGuDTFl+pUmt8vWLoO2HUAlWW4jEnmkPIzRvy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XkjULddObifi39wt7OwgHQfpIKDS8TjvtD7rWyvO0?= =?us-ascii?Q?RmRErg+H/qK7PES0BWuo3qCMKBDA8NbO/ghjUmzhIPNfp7Y2LH18fv4pQ8jP?= =?us-ascii?Q?Mg9TMWHfv6z7BkdztnQA8H7t7Rby1x94/leQitG77atr7wzccx6IUuGXz1oc?= =?us-ascii?Q?PITpjGHqBa40fhxAYTj3zwTr7r/a93iLw3/gOFlJdKRc0gatavc5YvYg9dZY?= =?us-ascii?Q?9w=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: c38970bf-620f-4b73-3ea6-08dc3871eba1 X-MS-Exchange-CrossTenant-AuthSource: CY5PR11MB6139.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2024 15:28:31.7194 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ucpV6zu9VfGwvxBRLJbASEi9e2fFoDepJs9XjA/rILvvJ+wu75pk5AhyVdvh5PR8g8zbn5NpIlRjR8qL/L6uSnQYikoItBTnUAGWUXqDa7k= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR11MB8413 X-OriginatorOrg: intel.com On Wed, Feb 28, 2024 at 01:26:29PM +0100, Arnd Bergmann wrote: >On Mon, Feb 26, 2024, at 17:40, Lucas De Marchi wrote: >> On Mon, Feb 26, 2024 at 01:46:38PM +0100, Arnd Bergmann wrote: >>> >>>Fixes: 237412e45390 ("drm/xe: Enable 32bits build") >>>Signed-off-by: Arnd Bergmann >>>--- >>>v2: use correct Fixes tag >> >> but what about the other comment? How are we supposed to use >> DIV_ROUND_UP() but then in some places (which?) have to open code it? > >The problem is not DIV_ROUND_UP() but the division but the 64-bit >division itself. There is a DIV_ROUND_UP_ULL() macro that would >address the build failure as well, but doing the shift is much >more efficient here since it can be done in a couple of instructions. > >> What compiler does this fail on? > >I saw it with clang-19 on 32-bit arm, but I assume it happens >on others as well. somehow it passed on x86 :-/ > >>> drivers/gpu/drm/xe/xe_migrate.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>>diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c >>>index a66fdf2d2991..ee1bb938c493 100644 >>>--- a/drivers/gpu/drm/xe/xe_migrate.c >>>+++ b/drivers/gpu/drm/xe/xe_migrate.c >>>@@ -462,7 +462,7 @@ static u32 pte_update_size(struct xe_migrate *m, >>> } else { >>> /* Clip L0 to available size */ >>> u64 size = min(*L0, (u64)avail_pts * SZ_2M); >>>- u64 num_4k_pages = DIV_ROUND_UP(size, XE_PAGE_SIZE); >>>+ u32 num_4k_pages = (size + XE_PAGE_SIZE - 1) >> XE_PTE_SHIFT; >> >> also the commit message doesn't seem to match the patch as you are only >> changing one instance. > >Not sure what you mean. As I wrote in the changelog, the >second instance is fixed by using a 32-bit division here, >which does not cause link failures. I missed the type conversion to u32 and was thinking there was another hunk missing for the second change. all looks good to me now and I will apply later today to drm-xe-next. Thanks. Reviewed-by: Lucas De Marchi Lucas De Marchi > > Arnd