Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp40085rdb; Fri, 16 Feb 2024 20:01:15 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWZiA8EJ5ZeqemzTtyVDgKVmTylztcutPWuTBQV8Dh3447zA1HkE9M5fM4ZVlwZEC/a9QxJzlCXjmlg3mE3nyEHjee97Run5t+423vBHA== X-Google-Smtp-Source: AGHT+IFjAjfg7ceuLXKZ9G9/FYFD8hc09P166oluQelvQgsh/QNa4yKiM8k5rIkobfgZrUAnc8tv X-Received: by 2002:a05:6512:1d1:b0:511:4465:3e21 with SMTP id f17-20020a05651201d100b0051144653e21mr4496486lfp.25.1708142475814; Fri, 16 Feb 2024 20:01:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708142475; cv=pass; d=google.com; s=arc-20160816; b=OTBlWZWJH+7TFiG0c9p16VwY8LXW4Ge7qUF+oE40ZhjpYoSut+WUcdHbvwbtrSZBpT phPth/ktXqUV2aJwo2OwO2fLYWbrfctZ9WlGxEIWeTYpobkYarJqfWvJM6ymvoxkhzui gXACII1HaG4LQcfwnLx+6bIjhlKhocOgBdWbn4raTQXNd3y6RkwbVhWM01oFqLww/H4l 3/P68xclURYTFU5VBSxoBuZ3TD0cC+JHB+DUT7gvcI0c8Rbi9k57ujuGNaRF9yhBH3+J gI/gPvSt9Znt0Zw20r4mT583UcVzZidnvOrxZR9mXHBPnWeresKq2fXO8BadIqLA19uy i/jw== 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=NVv3jtwrIr3uSH0TL3zX4hdOSOGZmVK7PYBdingjYrw=; fh=PW+fw8dntRlPCM6/TlGNUZ93UwKhfENRSI1hcBBzXjM=; b=naw4xhdf/zw6CtD7kCmY1ZYgtFuC6GfXETedltkYSVaEPYOBN7gEH3nJTpDLhYn9G2 Si9XiZGGNgGYx6ci73F8jZ6jACcygx7+KlIqQh8vJgaP/iVZOz5b1dz1k2ohhrkdQfVs 4W5wah0Y/EufrZ9HI7lEClVXMGXG3/ryZybeU78V6buRWVq7c0+OnehESyQpWq6eMkMv lnHclHAwYMV5g1smhtHTkAvD3CkT8SK+ynKmnAVSTbw/dY0eV0hVzLKTA7B0+JEoelj9 DMedvjj7e0rDJG3vX7nUrIxdKlKx0ZZqn2Zvy9YaTixAkoXyWC2yCz1iu3yWA/GxvK3x +Row==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=aXfdGNXK; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-69647-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69647-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id de15-20020a056402308f00b00563ffb48888si505420edb.263.2024.02.16.20.01.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 20:01:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69647-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=@infradead.org header.s=bombadil.20210309 header.b=aXfdGNXK; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-69647-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69647-linux.lists.archive=gmail.com@vger.kernel.org" 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 8AD391F22ABC for ; Sat, 17 Feb 2024 01:31:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 79CD817727; Sat, 17 Feb 2024 01:31:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="aXfdGNXK" Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 73350149E06 for ; Sat, 17 Feb 2024 01:31:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708133481; cv=none; b=bf27Cnhy24ATZgF/rSRjSmVJ+OqRNiuXXo02qXnauPKGnPVmj4Vq2C+yplylnwWKhEemE1B8XG7pmL3QT5DDKpEVK9+ULF0PwdWdvvVYK4f1NBvj4nywMpwMRb7ZtOdhfPJjz34z8m0LDm3Tzq1rMVhuGQ4XAQvLZGhaEydMQe0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708133481; c=relaxed/simple; bh=FxZTiOnH28ta9w4qyeQlCyVM9g7hAjeN2oBcrxtUBCs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=EVIcHLuuq56xEsHCstE6ombnazyxAJ0FPKYbHbEMMcxv34LMPje4eqN8GCmKC7CJ70aflm5k1sFuc+6PWY2jkVlv7jTG7Zt45mM5IB+UpqYxK0LFLPp+Cba29INXv/HUWZLfmQADOcAtBn8omXKeJ5+WlJH24B53JVI4XjSRiuM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=aXfdGNXK; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Sender:Reply-To:Content-ID:Content-Description; bh=NVv3jtwrIr3uSH0TL3zX4hdOSOGZmVK7PYBdingjYrw=; b=aXfdGNXKG9dBi+YSFnau8+kxeZ pWjB04/AIlIJuH1vgHrQiuIF0ptiyg9HYMTQnktakyIMRR7eMOsOlpP3ClweoDmzY9MVAduKVcjS+ QlOhK+7J1svCzQ86p4C9rz2L9PIcc7cFOTy1WUTMJDA5aQG7kfNxv8meLZCQk5u6oqC/tl1CSnW9G GEdDP8+OebsSHv6n8h7VEC1SmakH5N/iCL9SlDReZ7qSZR3fGeonOmeogyjtk47K7eYM6Zwa1HZPH 7czHGcfpc09dfl5OpBQufNOEsMWNH9Ifwm1XsYWr1IGKGD2dUwVM2uk0Bfq0CsFXO2/5Cu0w+Genj N4kN1IrA==; Received: from [50.53.50.0] (helo=[192.168.254.15]) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rb9Xl-00000004Pfk-0nYR; Sat, 17 Feb 2024 01:31:06 +0000 Message-ID: <745e156e-c3ec-427f-98ad-bfc7d3cfd846@infradead.org> Date: Fri, 16 Feb 2024 17:31:03 -0800 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-US To: Arnd Bergmann , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: Arnd Bergmann , David Airlie , Daniel Vetter , Arunpravin Paneer Selvam , =?UTF-8?Q?Christian_K=C3=B6nig?= , David Gow , =?UTF-8?Q?Ma=C3=ADra_Canal?= , Matthew Auld , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20240216202442.2493031-1-arnd@kernel.org> From: Randy Dunlap In-Reply-To: <20240216202442.2493031-1-arnd@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 Thanks. > --- > drivers/gpu/drm/tests/drm_buddy_test.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/tests/drm_buddy_test.c b/drivers/gpu/drm/tests/drm_buddy_test.c > index fee6bec757d1..50a5f98cd5bd 100644 > --- a/drivers/gpu/drm/tests/drm_buddy_test.c > +++ b/drivers/gpu/drm/tests/drm_buddy_test.c > @@ -21,7 +21,8 @@ static inline u64 get_size(int order, u64 chunk_size) > > static void drm_test_buddy_alloc_contiguous(struct kunit *test) > { > - u64 mm_size, ps = SZ_4K, i, n_pages, total; > + u64 mm_size, total; > + u32 i, ps = SZ_4K, n_pages; > struct drm_buddy_block *block; > struct drm_buddy mm; > LIST_HEAD(left); > @@ -29,7 +30,8 @@ static void drm_test_buddy_alloc_contiguous(struct kunit *test) > LIST_HEAD(right); > LIST_HEAD(allocated); > > - mm_size = 16 * 3 * SZ_4K; > + n_pages = 16 * 3; > + mm_size = n_pages * SZ_4K; > > KUNIT_EXPECT_FALSE(test, drm_buddy_init(&mm, mm_size, ps)); > > @@ -42,7 +44,6 @@ static void drm_test_buddy_alloc_contiguous(struct kunit *test) > */ > > i = 0; > - n_pages = mm_size / ps; > do { > struct list_head *list; > int slot = i % 3; -- #Randy