Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp482098imi; Fri, 22 Jul 2022 03:22:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uksGnYfezE8eAnhIrH9DXI0OHbaEvDWzCa1hWZxgQiz8x8oXL9+jTah4+MaolD4jdfYHeb X-Received: by 2002:a05:6402:4308:b0:43b:d231:f3fd with SMTP id m8-20020a056402430800b0043bd231f3fdmr2371063edc.205.1658485358330; Fri, 22 Jul 2022 03:22:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658485358; cv=none; d=google.com; s=arc-20160816; b=d5DONIc9UqUNE4oCfdW/TiG52VRoC9s+Q2rBnP9W0Dtq7qWSSB+MeRzVKGLrln1to+ bHPF8gZ0MH/nn9N65JK76bdypy4AXCteGbZlob5v2fQ2UrcP3zYZFLBzonpK7rnsVrAi BcxsdyYts5ch6UCkS8CxkxnUWGQ/mK4fb0BKYpMOJyWMeC+q875JN4/lncSN3hYsg7pv BwV0S19wX11bjqNWN30qw1dJ5BhKlKqjkSK/g+0nOJJ0JSiWUeVgOaWgmN2gkdearzNT /EbLcWttfsfou7UqFu0OzW+zdQkU9SxR6/EoGyBDGrqrWf7oJYGRddF976I8bYvhFVbn JDqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=qvKJFrDKdvQlbic00hWPnMvKRvHPE/BWnwBlW95H1zA=; b=lJM7t/xe0LqBW5FwRXH6xYNYtbGt5Nz1wrIDK0R5eQkue1T0yT9+jExL9tPm+3jrog gpR56bFP3AmoPx+hVffJ0YHlpnvRQOjkI40brXlM+UplIcv6UjAL5P/fl00TzVyYI6Mp omam3P7YLlxfrwKLalBbJjUE8tpda9VEbuqBk8MlPYr9+KA6pOJnVEHVX0r1azZS+crR 0BXkZ0a/SUIjVIk2oRk5ZumJc8dW2WP3RWew+8y+Yl+0DtqUALjD3gNSeTSyE4Kk8cxX 37bkcMpCyoOPTJfgzBBBuGEXoYv75i0hQn+GgmahkM0dr1Ued9dnOO0Pxa1y7a6pKTOt 6ZjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZRiHLLid; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m13-20020a170906848d00b0072b13fa7314si904758ejx.439.2022.07.22.03.22.12; Fri, 22 Jul 2022 03:22:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZRiHLLid; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233858AbiGVKOJ (ORCPT + 99 others); Fri, 22 Jul 2022 06:14:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231226AbiGVKOH (ORCPT ); Fri, 22 Jul 2022 06:14:07 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA4247694F for ; Fri, 22 Jul 2022 03:14:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658484846; x=1690020846; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=SKPrtA2rILFUjYQxZJSiARCkKS6SUAGjnJyVAykGQWc=; b=ZRiHLLidczJPd5qhZH4OwhW/C5ED3xhr1iwB3odVXMNd9Tig6RCeQAPz TCmgOmv6hmCo+a9BxL+EMR8YQgnVKM5PnkP4orAcqXDRtQfn9XULrHz/+ /ty7YgJu4hxhN0VJ1CaLGOAhKYLu6tqK7Nv8ll7wOBYC94iX72W9qwMNs UINVyEX2M2iy4mCHiMpXkZzZSFysq6/rbyxh8LAfV8AMmEgZhb7CBEvFU C9zjsUz8mMXlCbalsFkURCCT0LKZHseb8FxmnI581VMhO9+Nm8BxKIqDN UkdHT2Aa6003QGJRSK/un4jWH3EtRzmT7vUElhF5bCi8sonlCouCrXv2A A==; X-IronPort-AV: E=McAfee;i="6400,9594,10415"; a="313006451" X-IronPort-AV: E=Sophos;i="5.93,185,1654585200"; d="scan'208";a="313006451" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.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 Subject: Re: [PATCH] drm/i915: stop using swiotlb Content-Language: en-US To: Christoph Hellwig Cc: Robert Beckett , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter , kernel@collabora.com, Thomas Hellstrom , Matthew Auld , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org 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 X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HK_RANDOM_ENVFROM,HK_RANDOM_FROM, NICE_REPLY_A,RCVD_IN_DNSWL_HI,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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