Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1108595rdb; Wed, 6 Dec 2023 08:48:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IEdVyV63KUHhlHvNigeEXHcyWoXWt1j0GCG3HixhU+/YBhDP1SxmnRh1cpjYTaVc7zk69ZH X-Received: by 2002:a05:6a20:e107:b0:18f:cb0e:f970 with SMTP id kr7-20020a056a20e10700b0018fcb0ef970mr1034444pzb.9.1701881297783; Wed, 06 Dec 2023 08:48:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701881297; cv=pass; d=google.com; s=arc-20160816; b=vX3WvlC3bT0PsfTmiBxZlrWHMAgU8n4cgFzw4QxKL1dWfoBXP0asL3ONHshTtsC7QI mF9mmN9vno0MxgloUsa1r5M6AhbkMGTs6AqMJKzO3DCaW9PAsSdjXjJkezoUlpycj69h Kf0G/Qssqnl+M4MxGjyfUasIV3dPlHtOC+WBQMerS91D/AzLpEiNP2PpMFNYFN+vbP4k e2EbG0mxGKH3pq4cmJT0BVuttHMU5/T+2xthjUP3UroZzC/6/qF+D5bG+xtASSc9QSZy z4zzm/RJatr0zdc8MEnxeAFmgDbHqw169qNIr9P0XZYlhhBgF2pyQeduZb4EanE/zLkQ mamw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:in-reply-to:content-disposition :references:message-id:subject:cc:to:from:date:dkim-signature; bh=cPXFmOM2k3qyPi62hYgnnEkkF8MPM3VteBX9M4Q4HIg=; fh=/iLimwIbLn2JYrMUF0OVaQl7KNe/uA4xPlirfdIussI=; b=iYmPhL9YigEedG7k1J3AfygjBc04ryDypSZ4SEAtNUYacDZ5r8fs96C/VsyfoU6JLz 3Pdqk2ZbtSoPMJOAF6qInCVJDC3cFAUBpqLZghccCpbYKuejJD3ugfPc4ooIpE0IUoUc MEYX5M9iJs5IBo4Tzp6C3vuhQPBn5vB1w1n3Q9EGCicxJQ3cn8jUzWW+7IyX0lunCC3r Sn0LkXAFfwbglCPYFFP7dEppUMP/k9fCz/HPcOL4kd8joXibSz5N7NBTMlAbPAhT2pGc qoFh8altxjD8QHe2Uw3TCr9sOTksHNpxaWS9TKdUnq83sO2sZ8mo8+kdfcmLUkr7qJOh 6szQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=GpTJ9gaB; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id w8-20020a6556c8000000b005c66240925dsi157593pgs.546.2023.12.06.08.48.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 08:48:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=GpTJ9gaB; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 302578028A60; Wed, 6 Dec 2023 08:48:12 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378851AbjLFQsC (ORCPT + 99 others); Wed, 6 Dec 2023 11:48:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378367AbjLFQsB (ORCPT ); Wed, 6 Dec 2023 11:48:01 -0500 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2079.outbound.protection.outlook.com [40.107.212.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82072D3; Wed, 6 Dec 2023 08:48:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QWfoXd5+TAIII3Lz8U2uyDbCohWMjh0TLLWSCrv2YSkjDqIQPoDaLwDTnYlk+dsZ0icDho7zcuUehxmXOA8YHVxneR3v0i9exv40iiHWGGRnlHSYts061GqKSFJ01GXJ+WT48GdyqEmDMVzT41LjlGDsHCmbd0PoqbBrdVJ55+FWctYq1QfP9k/GGGe17HZFnlmEGhIGnrndomUoNhjft5Q5l1xKHA4k6KEC8o/BJAEJzgueGqmCMv45IaNDfkba6dCSWECfKVxaPoW9QywpHGVfsxYAUKohgFx6erNB0cJkd0vmTcZgOa8OyF//JEEEg0bdcqF1FjR7HCXGOmYInQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cPXFmOM2k3qyPi62hYgnnEkkF8MPM3VteBX9M4Q4HIg=; b=NQzORgGEqFYxfe0hHA3rtS8OEcS8aa8MyhoUhKb3EJT9YF+EymmuUJfqW0CBAle4S7Ah6sntpQlS7QGcNQZRGATOS4wzyZ+GQ0V+FdY9Z7SDnGnTusLy+wyruf9n6Q0+Oea5A8Jhsw79KQ8tKJT244K0PlzCKiAJAKCdQLE89bexUSYWJ2kBK3xp/JgW05HnKUuqEjJyHIVI1JBs6RReV4HwMf5jcXspqafvKkKEfkHNxdtIEGaMkd/Ms/nB0HxG4C3DEqbBIQe7Zki7HaU1P1pxntr3kgMqi2xyixIWFtLgAA5c5UKxKIkYzhCYll5dGMjmvhPP6NKRQwT6z6yC+Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cPXFmOM2k3qyPi62hYgnnEkkF8MPM3VteBX9M4Q4HIg=; b=GpTJ9gaBZfwQNlpAYwlX4p+zuyaBkWYgHZsBMCtMwkhpsjRA6SGZZGswKKMR6MxkipqMlQZFmRug6/lWhlZClXkt5b9jdt0PSMF7NwkE9sOJtbXge59mAifo+v616oIaHenbkK+QRWqTGOT7AkeTWObXOyVrsilkCRf0ggjgJrLC3gSD4axKv4aXi/cWzytefBRQf1YiC2oWghIVOw5LqrV9suSgYnwyv2iysdElzn9qWfxnPWvyvIDKiIk5AbOsdF3sdJmnRkTGbfGhg+ca1wzlHZYaYk3Cf/8gj9c4nNjhX1rUhBHE6ZCifnl456TRSHnTt9gTXf//2Va1UYPQVw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) by SJ1PR12MB6171.namprd12.prod.outlook.com (2603:10b6:a03:45a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.27; Wed, 6 Dec 2023 16:48:03 +0000 Received: from LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::60d4:c1e3:e1aa:8f93]) by LV2PR12MB5869.namprd12.prod.outlook.com ([fe80::60d4:c1e3:e1aa:8f93%4]) with mapi id 15.20.7046.034; Wed, 6 Dec 2023 16:48:03 +0000 Date: Wed, 6 Dec 2023 12:48:02 -0400 From: Jason Gunthorpe To: Catalin Marinas Cc: Lorenzo Pieralisi , Marc Zyngier , ankita@nvidia.com, Shameerali Kolothum Thodi , oliver.upton@linux.dev, suzuki.poulose@arm.com, yuzenghui@huawei.com, will@kernel.org, ardb@kernel.org, akpm@linux-foundation.org, gshan@redhat.com, aniketa@nvidia.com, cjia@nvidia.com, kwankhede@nvidia.com, targupta@nvidia.com, vsethi@nvidia.com, acurrid@nvidia.com, apopple@nvidia.com, jhubbard@nvidia.com, danw@nvidia.com, mochs@nvidia.com, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 1/1] KVM: arm64: allow the VM to select DEVICE_* and NORMAL_NC for IO memory Message-ID: <20231206164802.GT2692119@nvidia.com> References: <20231205130517.GD2692119@nvidia.com> <20231205164318.GG2692119@nvidia.com> <20231205194822.GL2692119@nvidia.com> <20231206150556.GQ2692119@nvidia.com> <20231206153809.GS2692119@nvidia.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: MN2PR15CA0063.namprd15.prod.outlook.com (2603:10b6:208:237::32) To LV2PR12MB5869.namprd12.prod.outlook.com (2603:10b6:408:176::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV2PR12MB5869:EE_|SJ1PR12MB6171:EE_ X-MS-Office365-Filtering-Correlation-Id: 3866fe20-9d9b-4d36-a84b-08dbf67b1d01 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xy55FX6KsUfxybQC1kYqU37S1uHzQxNYSF+dCQ/ule99YsUs+B+bKs5KA3ADzVoVXjEXD5zPUkbQRkax6Cxg+RBoqrczc0GaV4UYN0RypLCy9GYtJp4nVBQd/prTbxUv2MFPc0ccCFrTq1dwDhvgeVdbjzIOpXh1Wh2OE67c1mG9ohpSA2FzvA/OetbSxgyQNn9tThJ19Wx4OtuT3MlePGYcKRViJUXtFzOsYP8gvQLkM0Xey3zbWejaNFlJAETuZnGMmK0EwvZrnxbOsFKCow7yJurZ5L1PG6tNkcT4yV0MjH2ZLWK6dvkTkaR3Bhu/CbrgvET/UAGzAUrj6aYJTvMtYdvx2GI8HuPivwFvF1nxzAC4ewiWEFX/q7tbewITm1QCKIXPlT2YMIsjjy1OnUvWj6xOGDlQX1NapQKvnoknsvwyoUIkrhLAJdxFL8RqpN/Zlg/pdFPb52YweMx4/SpKGUDhrEZyGPLreSqQ4T5gzFYoruq/KdeBC/fET+LfSYN8zvxsxbytBW16EupK+XzlD8EphKx3bN9JxsoVStuxAQWKqSCKV8njReoH0DOm X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5869.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(136003)(376002)(39860400002)(396003)(346002)(230922051799003)(1800799012)(451199024)(186009)(64100799003)(6916009)(38100700002)(86362001)(6506007)(5660300002)(8676002)(4326008)(66476007)(54906003)(7416002)(66946007)(478600001)(316002)(41300700001)(6512007)(33656002)(2906002)(36756003)(8936002)(26005)(66556008)(1076003)(6486002)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?vgXhN8xZjUaXP/Jkn9+XSSJYKDQAFzhMBnBi9G6IWC5NbmgalQB0qi0Pl+fh?= =?us-ascii?Q?sPtKfcSaY5+6v8faQ/AjmA6Q5Ll5Jjei4uy4jljyJOztwPSS841ZGKC+c7IF?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Zn+/Yao/Us1lEfVDDfRDhyjkGDXgD3xSx?= =?us-ascii?Q?YzzRDURZuiVwpdB5oFhVhAru6/8H/Rc4QsWBIs27lMbcjwaDw5ab8UegPsgn?= =?us-ascii?Q?rdsOIyNSqxGXe4Z5JlC1aq20gBLAhEiftpk7nzjRl0LpDe0a/sKm32Q3htcG?= =?us-ascii?Q?Mi2q+kuqavA2QtiHXYuHeXQhqD2LRfkydw3fO+sTd0smo9JURentJmj6n48H?= =?us-ascii?Q?aS3+eVPkQt1Q0T4nqmEma2ixNDXEaelVp1/xDuWLFKldLC66FW7RAllVJU9q?= =?us-ascii?Q?dx3u9QiDOcd0wQ6K+xesYbmKWNJCqPD9UAug+4DzJ895WAy0SHNoIffogq4Z?= =?us-ascii?Q?Yl2ToX3XgXzfIPR92Ij0wTdlCuFN8Oi6NpidAuwEK7BdSyF4Oyey6Wkot9Kb?= =?us-ascii?Q?/P/RGo4d/OJIqlxff/UKSQRqSJnPeiDQdrGNo2oQHO685g4e+2xetIfCGfgT?= =?us-ascii?Q?AFc9Iz7VokhAo47ZqAYduktFOrrjngL61a7WHtQIpGKc8zC7PRnaG7TfbFD6?= =?us-ascii?Q?Jw7ksQYeY8sRaK0dP7aessAMYl3awZsUPt6TrZdks3xUiEKZP0+MYD22xgNU?= =?us-ascii?Q?TY3DR24Cns9LNjmWQtJ4Us0B0mrNgabKuVW5Fc0J?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3866fe20-9d9b-4d36-a84b-08dbf67b1d01 X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5869.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2023 16:48:03.3145 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: gwBaVBxLkcJYB8Vl88lNk0uBtFZaU+27YDo7zSdcKDI0f/b1zDhTZhSTYhHYlVnX X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6171 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 06 Dec 2023 08:48:12 -0800 (PST) On Wed, Dec 06, 2023 at 04:23:25PM +0000, Catalin Marinas wrote: > On Wed, Dec 06, 2023 at 11:38:09AM -0400, Jason Gunthorpe wrote: > > On Wed, Dec 06, 2023 at 04:18:05PM +0100, Lorenzo Pieralisi wrote: > > > On Wed, Dec 06, 2023 at 11:05:56AM -0400, Jason Gunthorpe wrote: > > > > On Wed, Dec 06, 2023 at 02:49:02PM +0000, Catalin Marinas wrote: > > > > > BTW, on those Mellanox devices that require different attributes within > > > > > a BAR, do they have a problem with speculative reads causing > > > > > side-effects? > > > > > > > > Yes. We definitely have had that problem in the past on older > > > > devices. VFIO must map the BAR using pgprot_device/noncached() into > > > > the VMM, no other choice is functionally OK. > > > > > > Were those BARs tagged as prefetchable or non-prefetchable ? I assume the > > > latter but please let me know if I am guessing wrong. > > > > I don't know it was quite old HW. Probably. > > > > Just because a BAR is not marked as prefetchable doesn't mean that the > > device can't use NORMAL_NC on subsets of it. > > What about the other way around - would we have a prefetchable BAR that > has portions which are unprefetchable? I would say possibly. Prefetch is a dead concept in PCIe, it was obsoleted in PCI-X about 20 years ago. No PCIe system has ever done prefetch. There is a strong incentive to mark BAR's as prefetchable because it allows 64 bit addressing in configurations with bridges. So.. I would expect people have done interesting things here. Jason