Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1091651rdb; Mon, 19 Feb 2024 04:11:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXzr1i4Tegk0z7Ymn7+1EPR1A+hDRg/jqlbIB+epKoBo9n6r5n+LdEb9U4YwHq7uAzWHsJeqtfp8yr2qumNnWx36YBT3IionycbqNDJMA== X-Google-Smtp-Source: AGHT+IHcWHyksP6TU5K+CSDBX+MbMUN3Qy8om/c52JaAhygBAGGwSn1MKvpRHf2jAAkM1ByI3gT/ X-Received: by 2002:a17:902:6b4b:b0:1da:933:fb15 with SMTP id g11-20020a1709026b4b00b001da0933fb15mr12930185plt.0.1708344671994; Mon, 19 Feb 2024 04:11:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708344671; cv=pass; d=google.com; s=arc-20160816; b=aeXYOoJgNNJp6Su5qsCQJZY490TkKHcx3o8ra93IbPEWetxkpGZqJ0OIcMU+/CpXnv MipH9OYh33odaWqJQd+d0P0LStazlWoV5le7aSRqiqer43t0gMhBVlKnzrFEhYettlob hSMT2pj7iNIKm9NQfq9gLE9YxX5aLDIda8TVyeX+DbKp3tH1keRgPujWAP+fZ499V2K+ 27Rr2OQZ2MElDYgHTcoR3sdMz+CstgIdH+9gYPbWDqD0i0AdHvXeVxpY1BJfxSqZicCJ n00Zv6hYtBFK8GZ9kn5Sa48zo4bMfgvh/OKoWVhLyT2FnDiWDpVZRbfHxwUod8L1+Ugv QU/A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=n9I8G2PlQMB+H1y2QCQl+/ahJcKeLvi/jUMksMR0t3g=; fh=Ng63uo7yo2vrE/GQ2gqX8gE4fAUFiyzgsrw1zBeQc7I=; b=qeztN6CEXTX92fgPbs5W9h5AW2qE3QjCPYyxG2jVJqB4YNZ+hCUk6uOb21gLpAFzaa QxQFLkFiHekk5g0/+g88a21Nj3Du2dMLb9vh328tuBJm/bliFxU+G24AotbKSwL3vapS vlCzm1fx+o30rKx/LyV3zBi6F1OGuI+tH+DGDz5deWl7skeGMLyXQ5yG3sRchiPt/UBP O3UkAzJ/iChH+rdHOZFv88Sc7p5uXV7Pc+G/0VXaYy2fdXwDY1z+18nXwFDl86L+CVd4 R3QP/HwUjT5XM4rBLOedVmUuDtCUC0NzOUK6OuhRKKA6F53cIKlOLXI+WicHqztoUK/k 2KdA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lTAYxurw; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-71250-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71250-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id iw14-20020a170903044e00b001db3d1c72f6si4200176plb.328.2024.02.19.04.11.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 04:11:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71250-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lTAYxurw; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-71250-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71250-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 30391B21C38 for ; Mon, 19 Feb 2024 11:51:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0D57E36AE1; Mon, 19 Feb 2024 11:49:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="lTAYxurw" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (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 A46C0364C6 for ; Mon, 19 Feb 2024 11:49:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708343368; cv=none; b=JlSn632IVhUiceY8VK7prTh6ENkzODcqfbLcmR2EudXVeQsCiSDz/ywpCuomPaLJaBVNUFdvegUqHUFYt/PW2oaWL9wEEZhWIkONTlJDQrk2ynMQw4oE66vEwhPTqR+yJ35iiRTUZGzS+0q2fiXtR6c4bW2VRDfXx6sK+0A7cOI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708343368; c=relaxed/simple; bh=42XZ7hX+wU9FWriVYFFf2JlaTu+LTLTxliJ/DxOsXJg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Svir4Aedq9NxI7KNPBdvNcDwHuIEnQ98RvYTblXRrpmEc8iOJNsQ/D+6UGBPXgrSeekbmcZWVOArdCCv8EGDhcaTVzcvyIFVCxSosK6iw/au4yeIn+hUAvMVzUqUofjcmXc46AHAd4JWhOPk0H+QKsvi89fji1+/Iza9laYyDcY= ARC-Authentication-Results:i=1; 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=lTAYxurw; arc=none smtp.client-ip=198.175.65.19 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=1708343367; x=1739879367; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=42XZ7hX+wU9FWriVYFFf2JlaTu+LTLTxliJ/DxOsXJg=; b=lTAYxurw1DHGf8WCWL4ZxY0/nj8sQjesuuEMengKraNYJpFNuybyzpGL +FAmWoPt3Qizk2SaztKl73IoC/X5urISnNPwuj43mcG8kuosOvqQ3CVeO iGRvwsGJmp/qCgbZB2M19m3bEgR9/tkxa4snR4yqsVKPFs3KBiAVRtgK6 +6dU4eHuLzqpE/MgvDP8WyYKBK4He1w4LLUhttFx6HBHbUpzfgxaVYfPn iUvA+5ZAOxGNXqIbQiZv7yDAyUfAEHCEd+bolJTVZ/ER8d4KZWiRESAQA As60izrah1gXuxsEn1Q02nD2f4rvRRqG2+CJ9jrFSCWPQoKJjaSa0ejdd g==; X-IronPort-AV: E=McAfee;i="6600,9927,10988"; a="2282126" X-IronPort-AV: E=Sophos;i="6.06,170,1705392000"; d="scan'208";a="2282126" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Feb 2024 03:49:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,170,1705392000"; d="scan'208";a="9139099" Received: from proe-mobl.ger.corp.intel.com (HELO [10.252.22.52]) ([10.252.22.52]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Feb 2024 03:49:23 -0800 Message-ID: <124a084e-9f8e-4b38-a0e3-9dfac0312e97@intel.com> Date: Mon, 19 Feb 2024 11:49:19 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] drm/tests/drm_buddy: avoid 64-bit calculation Content-Language: en-GB To: =?UTF-8?Q?Christian_K=C3=B6nig?= , Arnd Bergmann , Randy Dunlap , Arnd Bergmann , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: Dave Airlie , Daniel Vetter , Arunpravin Paneer Selvam , David Gow , =?UTF-8?Q?Ma=C3=ADra_Canal?= , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20240216202442.2493031-1-arnd@kernel.org> <745e156e-c3ec-427f-98ad-bfc7d3cfd846@infradead.org> <4cdc5b58-11c1-490d-8c3b-6352d8f1b8cb@amd.com> From: Matthew Auld In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 19/02/2024 11:41, Christian König wrote: > Am 19.02.24 um 12:29 schrieb Arnd Bergmann: >> On Mon, Feb 19, 2024, at 12:22, Christian König wrote: >>> Am 17.02.24 um 02:31 schrieb Randy Dunlap: >>>> On 2/16/24 12:24, Arnd Bergmann wrote: >>>>> From: Arnd Bergmann >>>>> >>>>> The newly added drm_test_buddy_alloc_contiguous() test fails to >>>>> link on >>>>> 32-bit targets because of inadvertent 64-bit calculations: >>>>> >>>>> ERROR: modpost: "__aeabi_uldivmod" >>>>> [drivers/gpu/drm/tests/drm_buddy_test.ko] undefined! >>>>> ERROR: modpost: "__aeabi_ldivmod" >>>>> [drivers/gpu/drm/tests/drm_buddy_test.ko] undefined! >>>>> >>>>> >From what I can tell, the numbers cannot possibly overflow a >>>>> 32-bit size, >>>>> so use different types for these. >>>>> >>>>> I noticed that the function has another possible flaw in that is mixes >>>>> what it calls pages with 4KB units. This is a big confusing at best, >>>>> or possibly broken when built on machines with larger pages. >>>>> >>>>> Fixes: a64056bb5a32 ("drm/tests/drm_buddy: add alloc_contiguous test") >>>>> Signed-off-by: Arnd Bergmann >>>> Tested-by: Randy Dunlap >>> I've just pushed a similar patch Mathew came up a bit earlier to >>> drm-misc-fixes. >>> >>> Sorry for the noise, I have to catch up on picking up patches for >>> misc-fixes and misc-next. >> Ok, thanks. >> >> Have you looked at how this code works for larger values of PAGE_SIZE? >> Is there any need to change other things or will this work with the >> hardcoded 4KB chunks? > > I haven't looked into the details, but I've pointed out before that > using PAGE_SIZE in the buddy or its test cases would be incorrect. > > Background is that the buddy allocator is for devices and those work > independent of the CPU PAGE_SIZE. So it can be that on a CPU with 64k > pages the buddy still needs to work with 4k. > > Could be that this is work, but could as well be that this is completely > broken. Arun and Mathew needs to answer this, I haven't tested it nor > reviewed the code. Yeah, we should not be using PAGE_SIZE or PAGE_SHIFT in drm_buddy.[ch] and tests/drm_buddy_test.c. The smallest default page size is SZ_4K for drm_buddy. A patch to fix that would be very welcome. If no takers I can send something. > > Regards, > Christian. > >> >>       Arnd >