From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2058C433EF for ; Fri, 22 Jul 2022 09:59:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234138AbiGVJ7N (ORCPT ); Fri, 22 Jul 2022 05:59:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234516AbiGVJ7D (ORCPT ); Fri, 22 Jul 2022 05:59:03 -0400 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C06FF3FA13 for ; Fri, 22 Jul 2022 02:59:02 -0700 (PDT) Received: by verein.lst.de (Postfix, from userid 2407) id 8F04568AFE; Fri, 22 Jul 2022 11:58:59 +0200 (CEST) Date: Fri, 22 Jul 2022 11:58:59 +0200 From: Christoph Hellwig To: Tvrtko Ursulin Cc: Robert Beckett , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter , kernel@collabora.com, Christoph Hellwig , Thomas Hellstrom , Matthew Auld , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/i915: stop using swiotlb Message-ID: <20220722095859.GB14113@lst.de> References: <20220721174307.1085741-1-bob.beckett@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 22, 2022 at 10:45:54AM +0100, Tvrtko Ursulin wrote: >> - unsigned int size = swiotlb_max_segment(); >> - >> - if (size == 0) >> - size = UINT_MAX; > > On a more detailed look, there was a CI failure which makes me think this > cap might need to stay. Because max sg segment is unsigned int. So I wonder > if sg contstruction overflows without it. > > If this quick analysis is right, you could leave i915_sg_segment_size > helper and cap the return from dma_max_mapping_size to UINT_MAX in it. As dma_max_mapping_size retuns a size_t it would be good to make all variables using it a size_t as well. In places where that gets lower to an unsigned int your probably want this cap.