Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1800156imw; Sat, 16 Jul 2022 15:26:03 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s/X6FUJT8RI/a9wSfofLjB1nuyan4usrskRkpmQM63UAsRYU9AhUPseAoDbI+TktaI0FQr X-Received: by 2002:a17:906:5d04:b0:722:f46c:b891 with SMTP id g4-20020a1709065d0400b00722f46cb891mr20135000ejt.4.1658010363664; Sat, 16 Jul 2022 15:26:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658010363; cv=none; d=google.com; s=arc-20160816; b=NPouHablZzMEw5Gyekg2LEXNPADhfzUhJ5TXJ7g2+aTOIRPS1c0Zd4xOHkmTLOzxvi lIVP69x8zcQOLppVfhZN+v8X0y+BMCJsIWMnNNVB+KdA4UQFl5VQOhkFgMswsdhZO0QA KmcOR47FCVUIWV2xGBwIjmH9zQrSv97Rpcftccft3/F0qfmpYCNUCUeF8Xfoqw64yc8r KsC9kNKXYDxMn30PL3+61DWThMBOX4WbhHGZ5OFoOwLBTFL2yzs9zYTOkxvgeH26OXxU pOtRhXXED3l3K6JSr35gcn4lzmim9BdbDB+6ewdzRVPPfRxQ0PfPBnK4XwkrLQ7h4s/9 s9Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=AcjWh/Vyv/p487/TiHDxM9foCDPT53sV1cJadscCohE=; b=iJTb7vpoHFpE187QrHaFwzyioNj9A+dBIsX7pvSAODrZ1JAK2ZvOOJGD1QJwThApmi IF2QOj9Z74XZDHuG8o62SCOB0J6B2gCU4Hiy3gS4/Hq5wVrHF8alMLdQ0xkM9HFL8seY JKW0WFjiLf9B6cvKC9onqWFNAcQKGyg+YMNfaVlsPqKwq6OY9xRtrXpi/lljlUewaYvr k9cRE2D98h08UPcmWiPovMKQMMlgAEM068B1Ej6RtN9/hSt58SjSo+KIuFe/9OPikRrP 2V9ajrzixRyNOwd4SbNYqqvl4fNjkOjnN11yb0cv55YkRovyTOYcK0xiEhy6jweN+10q 6AQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=PgN9wmVj; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b12-20020a056402350c00b0042e0cfdab0fsi13225788edd.6.2022.07.16.15.25.38; Sat, 16 Jul 2022 15:26:03 -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=@linux-foundation.org header.s=google header.b=PgN9wmVj; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232499AbiGPWJF (ORCPT + 99 others); Sat, 16 Jul 2022 18:09:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232444AbiGPWJC (ORCPT ); Sat, 16 Jul 2022 18:09:02 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEAB55F90 for ; Sat, 16 Jul 2022 15:09:00 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id va17so15005450ejb.0 for ; Sat, 16 Jul 2022 15:09:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AcjWh/Vyv/p487/TiHDxM9foCDPT53sV1cJadscCohE=; b=PgN9wmVjO3lR3KoSzFAY1iWb2IFmaxa116V4LWyxcRywTrML/HZOcILWc+leY52aWj D1DdypmH28pNlpnSvS8eWcv5N65gLyHTT9NsoIE3FS1bYMyYqlKVpJ8x7p+ob0ZtLJV8 szWud/nfhwbnu0JcZmnJ7/ClpeGR8eTdIZxbU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AcjWh/Vyv/p487/TiHDxM9foCDPT53sV1cJadscCohE=; b=Hi2afLmwRwBUqpPM31NTtH/R4lDKU8nxnBWVtUzC82m2peKLGcy8gFvW5J8/F4yVup xqP3K2aV0re6cd3blrgcX66ksDi+xffvpVYkJvhQilBSN2fVC7ouLeOvLFype9b4GE8j 6jeRa2LLXvyn6R2VKeTHqZ4CmQq2jTLmym+76qPBExTK+bFI+qb28yR9WqqMfJkCvDlI 5azcRsEqu510wmSUS5Vvw8z0FKIn8sCcSzuojt/St2hJy/FM4pOakU+vPv2Mf7SlHRxj V1/qTQd+Adt7qjfbNLbiRwNo3lNq7rPJa7h6qhCNTXOsGGD2dGSF/d1njukzTV4S++r8 7bnw== X-Gm-Message-State: AJIora/WFCMpXQKAJdKMrE6+SHcuI6A0thkzTOaIUhNdafM+X3PAUg6D BBmt5YRSdhbki8GEEe0edG8/2U1RNih+Wzt0 X-Received: by 2002:a17:907:2bde:b0:72b:4da0:6f3c with SMTP id gv30-20020a1709072bde00b0072b4da06f3cmr19593994ejc.623.1658009339300; Sat, 16 Jul 2022 15:08:59 -0700 (PDT) Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com. [209.85.221.41]) by smtp.gmail.com with ESMTPSA id e14-20020a170906314e00b00711d546f8a8sm3577160eje.139.2022.07.16.15.08.56 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 16 Jul 2022 15:08:57 -0700 (PDT) Received: by mail-wr1-f41.google.com with SMTP id h17so11772747wrx.0 for ; Sat, 16 Jul 2022 15:08:56 -0700 (PDT) X-Received: by 2002:a05:6000:1f8c:b0:21d:7e98:51ba with SMTP id bw12-20020a0560001f8c00b0021d7e9851bamr16864641wrb.442.1658009335873; Sat, 16 Jul 2022 15:08:55 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Sat, 16 Jul 2022 15:08:39 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [git pull] drm fixes for 5.19-rc7 To: Nathan Chancellor , Matthew Auld , Nirmoy Das , Rodrigo Vivi , =?UTF-8?Q?Thomas_Hellstr=C3=B6m?= Cc: Dave Airlie , Daniel Vetter , dri-devel , LKML Content-Type: multipart/mixed; boundary="00000000000080390c05e3f36106" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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 --00000000000080390c05e3f36106 Content-Type: text/plain; charset="UTF-8" On Sat, Jul 16, 2022 at 2:35 PM Linus Torvalds wrote: > > That said, even those type simplifications do not fix the fundamental > issue. That "DIV_ROUND_UP()" still ends up being a 64-bit divide, > although now it's at least a "64-by-32" bit divide. Hmm. The "DIV_ROUND_UP()" issue could be solved by just making the rule be that the max_segment size is always a power of two. Then you don't need the (expensive!) DIV_ROUND_UP(), and can just use the regular "round_up()" that works on powers-of-two. And the simplest way to do that is to just make "max_segments" be 2GB. The whole "round_down(UINT_MAX, page_alignment)" seems entirely pointless. Do you really want segments that are some odd number just under the 4GB mark, and force expensive divides? For consistency, I used the same value in i915_rsgt_from_buddy_resource(). I have no idea if that makes sense. Anyway, the attached patch is COMPLETELY UNTESTED. But it at least seems to compile. Maybe. Linus --00000000000080390c05e3f36106 Content-Type: text/x-patch; charset="US-ASCII"; name="patch.diff" Content-Disposition: attachment; filename="patch.diff" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_l5ofxmky0 IGRyaXZlcnMvZ3B1L2RybS9pOTE1L2k5MTVfc2NhdHRlcmxpc3QuYyB8IDggKysrKystLS0KIDEg ZmlsZSBjaGFuZ2VkLCA1IGluc2VydGlvbnMoKyksIDMgZGVsZXRpb25zKC0pCgpkaWZmIC0tZ2l0 IGEvZHJpdmVycy9ncHUvZHJtL2k5MTUvaTkxNV9zY2F0dGVybGlzdC5jIGIvZHJpdmVycy9ncHUv ZHJtL2k5MTUvaTkxNV9zY2F0dGVybGlzdC5jCmluZGV4IGY2M2I1MGI3MWUxMC4uODMwZGNkODMz ZDRlIDEwMDY0NAotLS0gYS9kcml2ZXJzL2dwdS9kcm0vaTkxNS9pOTE1X3NjYXR0ZXJsaXN0LmMK KysrIGIvZHJpdmVycy9ncHUvZHJtL2k5MTUvaTkxNV9zY2F0dGVybGlzdC5jCkBAIC04MSw3ICs4 MSw5IEBAIHN0cnVjdCBpOTE1X3JlZmN0X3NndCAqaTkxNV9yc2d0X2Zyb21fbW1fbm9kZShjb25z dCBzdHJ1Y3QgZHJtX21tX25vZGUgKm5vZGUsCiAJCQkJCSAgICAgIHU2NCByZWdpb25fc3RhcnQs CiAJCQkJCSAgICAgIHU2NCBwYWdlX2FsaWdubWVudCkKIHsKLQljb25zdCB1NjQgbWF4X3NlZ21l bnQgPSByb3VuZF9kb3duKFVJTlRfTUFYLCBwYWdlX2FsaWdubWVudCk7CisJLy8gTWFrZSBzdXJl IG1heF9zZWdtZW50IChhbmQgdGh1cyBzZWdtZW50X3BhZ2VzKSBpcworCS8vIGEgcG93ZXIgb2Yg dHdvIHRoYXQgZml0cyBpbi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