Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2239255rwl; Thu, 13 Apr 2023 03:49:13 -0700 (PDT) X-Google-Smtp-Source: AKy350bOK09A7Bh540KAXUAREM83P6+q0LcJmf8LDXH/qoiXmbbr/WntaQKFESSpntnw4E/OQoFi X-Received: by 2002:a05:6402:2814:b0:504:b99c:abd with SMTP id h20-20020a056402281400b00504b99c0abdmr6113570ede.4.1681382952963; Thu, 13 Apr 2023 03:49:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681382952; cv=none; d=google.com; s=arc-20160816; b=Giva2KK0MEtZvjzRmjNShwBIBhnx8xikiaSDXGv1i1B2qTNp6PrSTEWjIUAwNbXptL M0X0YtbwdmbRgGe8cyUwpqZnb64ia1sF7zTaVnbAget6tmb27KK7rRhwYcI9ApX8Y9cL 6xCipwUCQlVMmWcGlDvzwURd2TYHXW7U/lYWtjBen+oEFEGUjvA2yz6EURY+r517r84D zFT4wgPyAa/s5pkxkE27hwueIqFFXcOV3qgu7gZttWL36ZNWinlB6c/GOXgJ6jEVf3Ay pDuFHG4lQ+7mx0wiE0pzoAb1lVdEIveDXVC74N8jIZmbeZktC4sDOIam6wVkCrqabKTy gyoQ== 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:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id; bh=0qsxslceU95bed6QAPo3HQ8hNTnSvIm0VV2UOcQuF0Y=; b=jmM3Ajiip2XIxePDoKl0jA6mFU1ZF8rB9hW9y2VY3Z/q+W6xu3Cu44g5EOlwds1dLU 7zvIAxYaBWXzxVAwxZXbskSbA2X+hHZUy3+/fKpASUp1Pqoztrh6XwPI4D6rOx9rX528 QNKjb6JdpojSSIz20Fwght4A40YO5mz75tGAWzznaJeNkoAB0KpjsOWc49+Wj80Wj1Ib xniTmphKfVlGPPcL3WAa1qweNUUIkddBbNZUjJKB7zVyaur3x0pOzeVN/GyNjq/s4bey 635At6NgXAsZFwfAIPzvOu6gb16E5qMd+tZmBZH01UaddB8lWKiDbxmS0mxBSquPbMfd DlOw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g6-20020aa7d1c6000000b00504b60632cdsi1495590edp.651.2023.04.13.03.48.48; Thu, 13 Apr 2023 03:49:12 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229876AbjDMKpJ (ORCPT + 99 others); Thu, 13 Apr 2023 06:45:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229516AbjDMKpG (ORCPT ); Thu, 13 Apr 2023 06:45:06 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0A0D0E4A for ; Thu, 13 Apr 2023 03:45:05 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 42948C14; Thu, 13 Apr 2023 03:45:49 -0700 (PDT) Received: from [10.57.20.214] (unknown [10.57.20.214]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A5E2E3F6C4; Thu, 13 Apr 2023 03:45:03 -0700 (PDT) Message-ID: <08c9f2a2-b2fc-2574-e10a-b6dbd0caedb0@arm.com> Date: Thu, 13 Apr 2023 11:44:56 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH v3] iommu: Optimise PCI SAC address trick To: John Garry , joro@8bytes.org Cc: will@kernel.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Linus Torvalds , kuba@kernel.org References: <40141c33-243c-5da6-fbea-3122e47c7808@oracle.com> <02eebcda-f60e-f8ed-7057-cf293d15a173@oracle.com> Content-Language: en-GB From: Robin Murphy In-Reply-To: <02eebcda-f60e-f8ed-7057-cf293d15a173@oracle.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,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 2023-04-13 11:16, John Garry wrote: > On 20/01/2023 11:33, John Garry wrote: >> On 18/01/2023 17:26, Robin Murphy wrote: >>> Per the reasoning in commit 4bf7fda4dce2 ("iommu/dma: Add config for >>> PCI SAC address trick") and its subsequent revert, this mechanism no >>> longer serves its original purpose, but now only works around broken >>> hardware/drivers in a way that is unfortunately too impactful to remove. >>> >>> This does not, however prevent us from solving the performance impact >>> which the workaround imposes on large-scale systems that don't need it. >>> That is felt once the 32-bit IOVA space fills up and we keep >>> unsuccessfully trying to allocate from it. However, if we get to that >>> point then in fact it's already the endgame. The nature of the allocator >>> is such that the first IOVA we give to a device after the 32-bit space >>> runs out will be the highest possible address for that device, ever. >>> If that works, then great, we can be pretty sure it's safe to optimise >>> for speed by always allocating from the full range. And if it doesn't, >>> then the worst has already happened and any brokenness is now showing, >>> so there's no point continuing to try to hide it. >>> >>> To that end, implement a flag to refine this into a per-device policy >>> that can automatically get itself out of the way if and when it stops >>> being useful. >>> >>> CC: John Garry >>> CC: Linus Torvalds >>> Signed-off-by: Robin Murphy >>> --- >>> >>> v3: Expand the flag name, add a print with inline commentary for good >>>      measure, and refactor the code flow even more (too many ifs and >>>      indents...) such that I didn't presume to carry forward John's R-b. >> >> I like the new changes, so feel free to add: >> >> Reviewed-by: John Garry > > Is there any chance that this can be picked up? > > I also saw that it fixed an issue for Jakub (cc'ed) recently. Oh, thanks for the reminder - IIRC this wants a minor rebase now, let me double-check and send a v4 that applies cleanly... Cheers, Robin.