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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 814F4C43334 for ; Fri, 22 Jul 2022 10:14:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DCFBD93087; Fri, 22 Jul 2022 10:14:08 +0000 (UTC) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7D7F293084; Fri, 22 Jul 2022 10:14:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658484847; x=1690020847; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=SKPrtA2rILFUjYQxZJSiARCkKS6SUAGjnJyVAykGQWc=; b=aZ9Cqg33yt+muvaXEDs+k590VUPE30+5aY+azQTVbwGEDkzECZxGDioO vQ6GDOsBuKswFcxz6eaapWXUX1BtJ2JZJkKqmpXjJ1ExTAyOr2BcRlYzI eSyWOhaDZW2AeF/8bJDZCanGVsztm5FW3t8x1GhwdBGEGlzMnqtvf9JQS pUUrmCe289Y2oLrlWmM66B+Ky0OjjUEAx9xJgbdbGVRx1XGAtU3w2mf69 qKbEwkrk/2OFSP3GOOdsHDDDmtBBRcYcbEHu0WzhprwVpGv71X2mAa2Pk t+E8w7vNUuZcQ8m+mCYfeGmWuuIea5DY7U609uVPIDn7sg4UZG8rWvobM w==; X-IronPort-AV: E=McAfee;i="6400,9594,10415"; a="267679331" X-IronPort-AV: E=Sophos;i="5.93,185,1654585200"; d="scan'208";a="267679331" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2022 03:14:06 -0700 X-IronPort-AV: E=Sophos;i="5.93,185,1654585200"; d="scan'208";a="574119258" Received: from lflintof-mobl1.ger.corp.intel.com (HELO [10.213.217.10]) ([10.213.217.10]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2022 03:14:03 -0700 Message-ID: Date: Fri, 22 Jul 2022 11:13:59 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Content-Language: en-US To: Christoph Hellwig References: <20220721174307.1085741-1-bob.beckett@collabora.com> <20220722095859.GB14113@lst.de> From: Tvrtko Ursulin Organization: Intel Corporation UK Plc In-Reply-To: <20220722095859.GB14113@lst.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Intel-gfx] [PATCH] drm/i915: stop using swiotlb X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org, David Airlie , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, Thomas Hellstrom , Matthew Auld , Rodrigo Vivi , kernel@collabora.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On 22/07/2022 10:58, Christoph Hellwig wrote: > 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. Yep. Problem we have is struct scatterlist length field, which is unsigned int, since all our backing storage handling is built on top of it. Therefore I think capping in this helper should be good. Regards, Tvrtko