From mboxrd@z Thu Jan 1 00:00:00 1970 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9094D216A2 for ; Tue, 15 Oct 2024 13:17:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 82FC76B0089; Tue, 15 Oct 2024 09:17:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7DE8E6B008A; Tue, 15 Oct 2024 09:17:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6A5026B008C; Tue, 15 Oct 2024 09:17:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 4E38A6B0089 for ; Tue, 15 Oct 2024 09:17:47 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id F2AB71C634C for ; Tue, 15 Oct 2024 13:17:36 +0000 (UTC) X-FDA: 82675888806.18.E947180 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) by imf14.hostedemail.com (Postfix) with ESMTP id C086D100014 for ; Tue, 15 Oct 2024 13:17:35 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=MgcKbs7q; spf=none (imf14.hostedemail.com: domain of thomas.hellstrom@linux.intel.com has no SPF policy when checking 192.198.163.9) smtp.mailfrom=thomas.hellstrom@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728998122; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=qgUG7mUO/Q61vFMkgqWq/P8BxIx1EByyJ7fGxhh6WYs=; b=Brnw7q5nO19TZBN7XflHY1q+sY6Q8GQXB/myO0dhbb87kLAy/kzIe/ouiEQ71K55T9YfRr GhmAQdHa/aShpxTwEz7FTqG77pwJPC0XBhI5LYiHPaMn2LenyfhD03AfdQ1pcB4zuO9LWy hDPh6edmn+JCfr1GqlcHo9eLLjEl+o0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728998122; a=rsa-sha256; cv=none; b=F/4m6atuL+mCCbCvbTLmbc53PXS8lioNTQRRAfx+4xRk7hQ4/ql6BueuTcx8PVGHjuPhO6 eB9DE//5CarvD5HhrfjseQwoQScEz9h4HmR8iG/o7FM7vKADO46WbdbA3h1XrlZZcfW/m0 qyrSopprHGJ9BpimzGjd7xqpngCXezE= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=MgcKbs7q; spf=none (imf14.hostedemail.com: domain of thomas.hellstrom@linux.intel.com has no SPF policy when checking 192.198.163.9) smtp.mailfrom=thomas.hellstrom@linux.intel.com; dmarc=pass (policy=none) header.from=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1728998264; x=1760534264; h=message-id:subject:from:to:cc:date:in-reply-to: references:content-transfer-encoding:mime-version; bh=qgUG7mUO/Q61vFMkgqWq/P8BxIx1EByyJ7fGxhh6WYs=; b=MgcKbs7q4Gf4Ya3KQCl8SMMVvJ3nNxC+T4SAydoHZOADog13/lPe+2eL sMI2qi8aJyIofS9Bk4cvUhWgsx5Bqu7aXncAJZtjyQpLx1J1s1QGHRKg9 9SkbSX7DY5vClUw13ii9sJM4+vZBW1pKJchu1/9xZUMdIpsxtpyKw0JIS ta592hkzBLbWH6vGvpd52lpBiu02/FHnRRfUAOxUWdNPQV2RUvwUOy+Zk lUl4SJmrNBjv6u7H7pe8hHOp+zqEtCYK6rytxRp7ELb09ng3+mRL0AJ7a 7iYXgRiWo7PYR0TYiamq1kQhPG5KpUgwn6rZv+v9saZfqWx383SjNBhEy w==; X-CSE-ConnectionGUID: 8sop1UkATs+Fc4AzI4aryA== X-CSE-MsgGUID: cdQED9eBQC6G/ewfc3OKyg== X-IronPort-AV: E=McAfee;i="6700,10204,11225"; a="39022660" X-IronPort-AV: E=Sophos;i="6.11,205,1725346800"; d="scan'208";a="39022660" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Oct 2024 06:17:43 -0700 X-CSE-ConnectionGUID: pVrQG5LGS2OpD9jjiHNQwQ== X-CSE-MsgGUID: FITRH2q/SSmbQVhGr0vC9Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,205,1725346800"; d="scan'208";a="81874750" Received: from cpetruta-mobl1.ger.corp.intel.com (HELO [10.245.246.43]) ([10.245.246.43]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Oct 2024 06:17:40 -0700 Message-ID: <67d855c26e95d89997f0ae5a0e1a5fdc636f6b95.camel@linux.intel.com> Subject: Re: [RFC PATCH] mm/hmm, mm/migrate_device: Allow p2p access and p2p migration From: Thomas =?ISO-8859-1?Q?Hellstr=F6m?= To: Jason Gunthorpe Cc: intel-xe@lists.freedesktop.org, Matthew Brost , Simona Vetter , DRI-devel , Linux Memory Management List , LKML Date: Tue, 15 Oct 2024 15:17:37 +0200 In-Reply-To: <20241015130221.GK3394334@nvidia.com> References: <20241015111322.97514-1-thomas.hellstrom@linux.intel.com> <20241015121759.GG3394334@nvidia.com> <19fb79c069b812b164abd4f79d38bb12d2f5afa4.camel@linux.intel.com> <20241015130221.GK3394334@nvidia.com> Autocrypt: addr=thomas.hellstrom@linux.intel.com; prefer-encrypt=mutual; keydata=mDMEZaWU6xYJKwYBBAHaRw8BAQdAj/We1UBCIrAm9H5t5Z7+elYJowdlhiYE8zUXgxcFz360SFRob21hcyBIZWxsc3Ryw7ZtIChJbnRlbCBMaW51eCBlbWFpbCkgPHRob21hcy5oZWxsc3Ryb21AbGludXguaW50ZWwuY29tPoiTBBMWCgA7FiEEbJFDO8NaBua8diGTuBaTVQrGBr8FAmWllOsCGwMFCwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQuBaTVQrGBr/yQAD/Z1B+Kzy2JTuIy9LsKfC9FJmt1K/4qgaVeZMIKCAxf2UBAJhmZ5jmkDIf6YghfINZlYq6ixyWnOkWMuSLmELwOsgPuDgEZaWU6xIKKwYBBAGXVQEFAQEHQF9v/LNGegctctMWGHvmV/6oKOWWf/vd4MeqoSYTxVBTAwEIB4h4BBgWCgAgFiEEbJFDO8NaBua8diGTuBaTVQrGBr8FAmWllOsCGwwACgkQuBaTVQrGBr/P2QD9Gts6Ee91w3SzOelNjsus/DcCTBb3fRugJoqcfxjKU0gBAKIFVMvVUGbhlEi6EFTZmBZ0QIZEIzOOVfkaIgWelFEH Organization: Intel Sweden AB, Registration Number: 556189-6027 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.4 (3.50.4-1.fc39) MIME-Version: 1.0 X-Rspamd-Queue-Id: C086D100014 X-Stat-Signature: amtj1j6kcdj4qb6w7jky31y5jriaia1x X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1728998255-566694 X-HE-Meta: U2FsdGVkX18WkatXyMQDp6qAI6f1cmwKYMmfccEFM0G50BjRF3prValcQv9yOJlWdQdJq85as/nmA6NnmX3SAt7zQPMOLq9B39lP0n5lPgDP5Dpq+S+lxJdLYz/hO71D7XtMQW2L+ojehakaYgxFl2sMYKB6aJOs3Lmg6bPWRlh5UG22IVppBxkHDAJG20yqJ64Pd/JeZIqfJqHkA/3VGkzlVJb56vx7Aya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0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Tue, 2024-10-15 at 10:02 -0300, Jason Gunthorpe wrote: > On Tue, Oct 15, 2024 at 02:41:24PM +0200, Thomas Hellstr=C3=B6m wrote: > > > It has nothing to do with kernel P2P, you are just allowing more > > > selective filtering of dev_private_owner. You should focus on > > > that in > > > the naming, not p2p. ie allow_dev_private() > > >=20 > > > P2P is stuff that is dealing with MEMORY_DEVICE_PCI_P2PDMA. > >=20 > > Yes, although the intention was to incorporate also other fast > > interconnects in "P2P", not just "PCIe P2P", but I'll definitely > > take a > > look at the naming. >=20 > It has nothing to do with that, you are just filtering the device > private pages differently than default. >=20 > Your end use might be P2P, but at this API level it certainly is not. Sure. Will find something more suitable. >=20 > > > This is just allowing more instances of the same driver to co- > > > ordinate > > > their device private memory handle, for whatever purpose. > >=20 > > Exactly, or theoretically even cross-driver. >=20 > I don't want to see things like drivers changing their pgmap handles > privately somehow. If we are going to make it cross driver then it > needs to be generalized alot more. Cross-driver is initially not a thing, so let's worry about that later. My impression though is that this is the only change required for hmm_range_fault() and that infrastructure for opt-in and dma-mapping would need to be provided elsewhere? >=20 > > >=20 > > > Otherwise I don't see a particular problem, though we have talked > > > about widening the matching for device_private more broadly using > > > some > > > kind of grouping tag or something like that instead of a > > > callback. > > > You > > > may consider that as an alternative > >=20 > > Yes. Looked at that, but (if I understand you correctly) that would > > be > > the case mentioned in the commit message where the group would be > > set > > up statically at dev_pagemap creation time? >=20 > Not necessarily statically, but the membership would be stored in the > pagemap and by updated during hotplug/etc >=20 > If this is for P2P then the dynamic behavior is pretty limited, some > kind of NxN bitmap. >=20 > > > hmm_range struct inside a caller private data struct and use that > > > instead if inventing a whole new struct and pointer. > >=20 > > Our first attempt was based on that but then that wouldn't be > > reusable > > in the migrate_device.c code. Hence the extra indirection. >=20 > It is performance path, you should prefer duplication rather than > slowing it down.. OK. Will look at duplicating. Thanks, Thomas >=20 > Jason