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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3B016C52D7B for ; Tue, 13 Aug 2024 19:09:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 12C1510E3E2; Tue, 13 Aug 2024 19:09:15 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="jgrH3C4F"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by gabe.freedesktop.org (Postfix) with ESMTPS id D530610E3DA; Tue, 13 Aug 2024 19:09:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1723576153; x=1755112153; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=ROis5DL6h9gSvnnBepvWUD1IIIhTabbM47EQ0Ppm42g=; b=jgrH3C4FbD9cXFXFq9TsJ9alLEkwoGsekejgXBd81AMUgGHbXxIt6Gok ZPxmc6SdCf87xAiPqtjn33p+eEi/n03RYnrHERrNKGp7Sg2dDigq+8mBw IwFyfnPDZ0VqsWZ0xR2ayS5mlgkM7ZQcCTQ9qgrW4/kKm7ddK0gE34bN8 aRJ1fGp7b0UgvTHA5gHBdZuEAdjiZDqONUJ+8yQJpThkMp07MOGHo/je3 sXM437c0iuoA1L2+m8A6bwqHRcfFSMgklGsjgDzu14vY9Cr1b+QhbtB0A qJAoQ/0MVWq8cZMb+bL4NIXkGNfwapDbPkvsDgTdQkcjOoS5PCCeVAMLE Q==; X-CSE-ConnectionGUID: yZkwH71aRja760jVrmCFug== X-CSE-MsgGUID: dbQSsK1FRbC5IO5NGyBJew== X-IronPort-AV: E=McAfee;i="6700,10204,11163"; a="47162564" X-IronPort-AV: E=Sophos;i="6.09,286,1716274800"; d="scan'208";a="47162564" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Aug 2024 12:09:12 -0700 X-CSE-ConnectionGUID: zFk5wz9PRB+b6d4tUEAmGQ== X-CSE-MsgGUID: D5ckQiCcR7m6xpSjYyTCZw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,286,1716274800"; d="scan'208";a="89439379" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orviesa002.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 13 Aug 2024 12:09:13 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 13 Aug 2024 12:09:11 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Tue, 13 Aug 2024 12:09:11 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.48) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Tue, 13 Aug 2024 12:09:10 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=H342UkK41lV4cmKGyG05ueByK567I+Pw7geLNiVlNJ6E0JVXF/JVcUdwfkVfYTa5fQGww7gQ9OuxCNycjuKLvXpTyYGyAViAUbXUq6XCRHk71/QPFEP9SAl6wuNpXt5e30tpTso+ENeIpZXv+jTQA4C8QXVYdPnwb2JTcrdZHV5BDDl3LfclHv1a0k0Meg8jmLYaqyMUYhXBeZam16YxFK5O7gI21mwhkCB/oJEUhstv9vSJyWAaRPbaux+rFCkODNTcjOnlJRS2vRI4gpyr7Ei1vlGUQO4xfBBb/XyiamsEhm4rZhZi/rm66gzX5HHuUbHu7DOMx6kPu/sM2z1b1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=V+x9Io18Jh/NjvvYy1jLUqXJxkrqqg+q7iwVfyN+6oE=; b=WMwmSjNgqbOuIdZlGeLyDO2bvA8+x9DXNTiYbgq6wOXXz0mysFpgK/kWe8FWN71RoZQXuDd2NDLBvidlcHq0XaWUOV5rEKXLXEjFyvFzc8svsXEeYAGjqBiBFwvXpDTBfIFz6aTCRBCebRbSVxd3aIEVAkSnbwxcLDlAEwBovhMnnOM8OeEECy8SDlnnLOboq4vO+mzeiCPiXYTZkdzDAQZcVa0Bw7/jftjtnclBQmsmHU9U3jhH9M4rZf2+hRFjzCTHfb1CRC4yS7/VSrBL80GNDdDptLXPkwv+bkcRFhmcjEW8K8VDvjsd/KGA2SBHLnyeCpJR62f/AwJxEWPiHw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from PH7PR11MB6522.namprd11.prod.outlook.com (2603:10b6:510:212::12) by CH3PR11MB7770.namprd11.prod.outlook.com (2603:10b6:610:129::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.32; Tue, 13 Aug 2024 19:09:07 +0000 Received: from PH7PR11MB6522.namprd11.prod.outlook.com ([fe80::9e94:e21f:e11a:332]) by PH7PR11MB6522.namprd11.prod.outlook.com ([fe80::9e94:e21f:e11a:332%6]) with mapi id 15.20.7828.031; Tue, 13 Aug 2024 19:09:07 +0000 Date: Tue, 13 Aug 2024 19:08:02 +0000 From: Matthew Brost To: Daniel Vetter CC: Andi Shyti , intel-gfx , dri-devel , Chris Wilson , Lionel Landwerlin , Nirmoy Das Subject: Re: [PATCH 0/2] Allow partial memory mapping for cpu memory Message-ID: References: <20240807100521.478266-1-andi.shyti@linux.intel.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: SJ0PR03CA0376.namprd03.prod.outlook.com (2603:10b6:a03:3a1::21) To PH7PR11MB6522.namprd11.prod.outlook.com (2603:10b6:510:212::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR11MB6522:EE_|CH3PR11MB7770:EE_ X-MS-Office365-Filtering-Correlation-Id: 90c34556-ee45-4c64-ea59-08dcbbcb67cb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?mUwOHrAyWOBZZLw7nbMtLCecwejq54p2fn8brEVSBSvnSBOUc9QIfqP2UmTa?= =?us-ascii?Q?PrCH+pnW9SIr1ZiD5WZfnFs+LPT9+QY4AOn91gRE/dkymnw9RIw6bFOtQUEP?= =?us-ascii?Q?MLJHiWxZkYZJ/XbW3WFv7FlX/Mdlkyl2q9Ec/o7lE2zCebh3f6qE+moElDZl?= =?us-ascii?Q?Bw5aHPd/0QcLtorRwW3Ziamn6BDi/xLxVN3RW7/1Yvw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JdqBOEhbBS3+10kXwtddN99FUt/AMo97i1Xw33DW?= =?us-ascii?Q?oh68ZSxagcTxajGFHJTOT4ZDfFp5Hlj1PSy9NWizbE/fLAoRZA4Ddany507E?= =?us-ascii?Q?6YxNH3e4TmrCn5j97SQ41KfN3wSPKohmyw9Fch8Y9pyfLZAfLokgOAMQYo/q?= =?us-ascii?Q?B3bxC4705XsRlyz36GY2XOeu7keZl+oX28RfZWs1AmD/EOGyTjGGoP20Y/sr?= =?us-ascii?Q?TWA=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH7PR11MB6522.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?yWXcNvtOFqEu5GVDHLhM87BKiIiU+PF9T+WJS5rxnJjbzROcFoazj3MdqhEf?= =?us-ascii?Q?JyBRJ10+2M6uYn2l7LOTwfJl2EwPw3Jq/mVFXG5P964iw/2WypJXEf4W/6bW?= =?us-ascii?Q?fJosSCio5Pm5pKQMMUOJdDua+W/BdK0rKFOwTXXvzc5rSzYMzrEIQgjAZRGm?= =?us-ascii?Q?l2rEqhB/zA4nvnn9cahrqYxN3YZaWIWk1EKr79Yin+hUtiu0YQqxKcRTFdtz?= =?us-ascii?Q?+MUtwqDAqxdKYL3gxx8ApD2Q0OLm/93TWlsAK8cP2uZAtDBgvlixNH/IrFCn?= =?us-ascii?Q?qzQWMvz1HGJ9gnFBMomUb2O0j0UNzxyZtG70aJG4aaAEtyQTdgrZYs67Pio1?= =?us-ascii?Q?6cvBJ7UIqQGAPvpVOX2Xn+TXZwtCOZIeOU8Le+RRjm+0qwx9SJUoK4VzsQkB?= =?us-ascii?Q?OKRINQQPfDpFgd3LWxUrMy5J3EdyXGXD/jpVKFZkycjQXRYn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9tF6nPVzWs5iVnoPIjlOnixUoIy?= =?us-ascii?Q?PpVNy1t1wBvAX/pL5GJMItK2uUE1UND26a+OYycQ2Rp9ZsppaTi5mnLLYMw6?= =?us-ascii?Q?ptVWgPu61EtubtW8EsBkNug4fvU1OhhL0rXu0H0CfV6Tk16CJFJ7152R+DcW?= =?us-ascii?Q?mXVFAd/LAm1Q+qjRDFonrDxyk7lJPiJg3L+c2h069NjRKyA9cCK/iDmG+l5b?= =?us-ascii?Q?pezNzR6Yz+qh9o7836EEKOfvgaHi+mujMiyjqBTV/aLQAPqpfSrbfrUCJRw0?= =?us-ascii?Q?fg=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 90c34556-ee45-4c64-ea59-08dcbbcb67cb X-MS-Exchange-CrossTenant-AuthSource: PH7PR11MB6522.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Aug 2024 19:09:07.5121 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: j1gd+0xZafTryZNPnaw5WSKgu4h221rog/YXZp0rtH6ICZa91eqZmd4V+UaXKbFMWGrMzd81Zz9Pc/Erjnx4BA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR11MB7770 X-OriginatorOrg: intel.com X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Tue, Aug 13, 2024 at 04:09:55PM +0200, Daniel Vetter wrote: > On Tue, Aug 13, 2024 at 02:54:31AM +0000, Matthew Brost wrote: > > On Mon, Aug 12, 2024 at 04:45:32PM +0200, Daniel Vetter wrote: > > > On Mon, Aug 12, 2024 at 01:51:30PM +0200, Andi Shyti wrote: > > > > Hi Daniel, > > > > > > > > On Mon, Aug 12, 2024 at 11:11:21AM +0200, Daniel Vetter wrote: > > > > > On Fri, Aug 09, 2024 at 11:20:56AM +0100, Andi Shyti wrote: > > > > > > On Fri, Aug 09, 2024 at 10:53:38AM +0200, Daniel Vetter wrote: > > > > > > > On Wed, Aug 07, 2024 at 11:05:19AM +0100, Andi Shyti wrote: > > > > > > > > This patch series concludes on the memory mapping fixes and > > > > > > > > improvements by allowing partial memory mapping for the cpu > > > > > > > > memory as well. > > > > > > > > > > > > > > > > The partial memory mapping by adding an object offset was > > > > > > > > implicitely included in commit 8bdd9ef7e9b1 ("drm/i915/gem: Fix > > > > > > > > Virtual Memory mapping boundaries calculation") for the gtt > > > > > > > > memory. > > > > > > > > > > > > > > Does userspace actually care? Do we have a flag or something, so that > > > > > > > userspace can discover this? > > > > > > > > > > > > > > Adding complexity of any kind is absolute no-go, unless there's a > > > > > > > userspace need. This also includes the gtt accidental fix. > > > > > > > > > > > > Actually this missing functionality was initially filed as a bug > > > > > > by mesa folks. So that this patch was requested by them (Lionel > > > > > > is Cc'ed). > > > > > > > > > > > > The tests cases that have been sent previously and I'm going to > > > > > > send again, are directly taken from mesa use cases. > > > > > > > > > > Please add the relevant mesa MR to this patch then, and some relevant > > > > > explanations for how userspace detects this all and decides to use it. > > > > > > > > AFAIK, there is no Mesa MR. We are adding a feature that was > > > > missing, but Mesa already supported it (indeed, Nimroy suggested > > > > adding the Fixes tag for this). > > > > > > > > Also because, Mesa was receiving an invalid address error and > > > > asked to support the partial mapping of the memory. > > > > > > Uh this sounds a bit too much like just yolo'ing uabi. There's two cases: > > > > > > - Either this is a regression, it worked previously, mesa is now angry. > > > Then we absolutely need a Fixes: tag, and we also need that for the > > > preceeding work to re-enable this for gtt mappings. > > > > > > - Or mesa is just plain wrong here, which is what my guess is. Because bo > > > mappings have always been full-object (except for the old-style shm > > > mmaps). In that case mesa needs to be fixed (because we're not going to > > > backport old uapi). > > > > > > Also in that case, _if_ (and that's a really big if) we really want this > > > uapi, we need it in xe too, it needs a proper mesa MR to use it, it > > > > I looked at this code from Xe PoV to see if we support this and I think > > we actually do as our CPU fault handler more or less just calls > > ttm_bo_vm_fault_reserved which has similar code to this patch. So I > > think this actually a valid fix. Can't be 100% sure though as I quickly > > just reversed engineered this code and TTM. > > That's the fault path, which isn't relevant here since you already have > the vma set up. The relevant path is the mmap path, which is common for > all gem drivers nowadays and the lookup handled entirely in the core. Well > except for i915-gem being absolutely massively over the top special in > everything. i915-gem being extremely special here is also why this patch > caught my attention, because it just furthers the divergence instead of at > least stopping. Since we've given up on trying to get i915-gem onto common > code and patterns that's not an option, and the reason why xe exists ... > > Anyway that common gem bo mmap code code is in drm_gem_mmap and still only > allows exact matches. > > Unless I'm completely blind, it does happen :-) > Not blind. > > We don't have IGT test cases for this in Xe though, we likely should add > > some if mesa is doing this. > > I'd expect they would fail ... > Just wrote one, it fails. So agree with everything you are saying. Sorry for the noise. Matt > Cheers, Sima > -- > Daniel Vetter > Software Engineer, Intel Corporation > http://blog.ffwll.ch