From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E91E11C549C for ; Fri, 20 Dec 2024 12:47:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734698829; cv=none; b=Bu1pmP5PogzIl1HTKWeXrS8ujOQla+nhXjoHtr6eakPfsqmpcNJJtdYh4UJDkHuQOcPkc5AownAhjJXO1Qz6+rFyf2i2kd8+1iaoTHDtjgYi/UtODmzfN56YxKvyUfOobcf7k+A/OKxENoxYZNgl70rbs3WPb6AE5jAHMiOdjuQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734698829; c=relaxed/simple; bh=5Ocn+jWFBDXcvVZEroyNzYUYmGQOLYPSqU5A1IFsIBA=; h=From:To:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=FBybdib/Kycm4LaxciONv3/sZeWuLq3Vo7EGu3Ig5UvnrOYzmGKpL1Jt1ieAEd91uPDZUWidp3ku8pFy4WvCOLV1r3iS0OBZ+e+Wg8137XH8IuUqwZndiA6LA537jWIiFVy1/ytOW8df+uOyKoI0EqOEiQhLGN0lS4izAABh1lc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=WTAgO4FL; arc=none smtp.client-ip=198.175.65.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="WTAgO4FL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1734698828; x=1766234828; h=from:to:subject:in-reply-to:references:date:message-id: mime-version:content-transfer-encoding; bh=5Ocn+jWFBDXcvVZEroyNzYUYmGQOLYPSqU5A1IFsIBA=; b=WTAgO4FLiZ/yhp1pEFDV9EcqB4mxxq3/m/dlpAWbmOiUW7SBJ+WfSKvV WiX8as3x0T/TKqG7Hj8/KCIJlozLfzNTdkewCA3TCQTiZU/2cHkPK27uv ZXDwfXpYygu/00NsHn/mgqrssdPVYQHEuudQEDInfqmiwdQbeu8U1ZYm0 E1ABQCQrV/JVsFNh1O7tWF2zIrPju4qmEt44hB9wzOw7pWcfP2m2pdnZa +DX3U4k3qn0A1soxmX6f9XEDHUM/BS4l2RcTUAaN5wp3mqfktwHwl5yqY Mdvqv4P5Zlr21J3IUc3aoR6q71aSO9AYkAsRMVTI5mL/QYKUZAd2K9h+7 g==; X-CSE-ConnectionGUID: aiTowjIEQ4Ga70VQeOZ3XA== X-CSE-MsgGUID: o1BnRmPnRVSEO2XVbQd/jA== X-IronPort-AV: E=McAfee;i="6700,10204,11292"; a="38930591" X-IronPort-AV: E=Sophos;i="6.12,250,1728975600"; d="scan'208";a="38930591" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2024 04:47:07 -0800 X-CSE-ConnectionGUID: 3nxr9j4TQiGTtaDiu+bX2g== X-CSE-MsgGUID: Zn5u0Kx8TyiSvB26rr6IzQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="102634360" Received: from mkuoppal-desk.fi.intel.com (HELO localhost) ([10.237.72.193]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2024 04:47:04 -0800 From: Mika Kuoppala To: Joonas Lahtinen , Andrzej Hajda , Christian =?utf-8?Q?K=C3=B6nig?= , Christoph Hellwig , Jonathan Cavitt , Linux MM , Maciej Patelczyk , dri-devel@lists.freedesktop.org, intel-xe@lists.freedesktop.org, lkml Subject: Re: [PATCH 14/26] drm/xe/eudebug: implement userptr_vma access In-Reply-To: <173444476233.58433.15197725556816943129@jlahtine-mobl.ger.corp.intel.com> References: <20241209133318.1806472-1-mika.kuoppala@linux.intel.com> <20241209133318.1806472-15-mika.kuoppala@linux.intel.com> <173382321353.8959.8314520413901294535@jlahtine-mobl.ger.corp.intel.com> <173383187817.17709.7100544929981970614@jlahtine-mobl.ger.corp.intel.com> <173392197322.40386.12252741494998606453@jlahtine-mobl.ger.corp.intel.com> <173444476233.58433.15197725556816943129@jlahtine-mobl.ger.corp.intel.com> Date: Fri, 20 Dec 2024 14:47:17 +0200 Message-ID: <87o716bjxm.fsf@mkuoppal-desk> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Joonas Lahtinen writes: > Quoting Joonas Lahtinen (2024-12-11 14:59:33) >> Quoting Christian K=C3=B6nig (2024-12-10 16:03:14) > > > >> > If you really want to expose an interface to userspace which walks the= process >> > page table, installs an MMU notifier, kmaps the resulting page and the= n memcpy >> > to/from it then you absolutely *must* run that by guys like Christoph = Hellwig, >> > Andrew and even Linus. > >> > I'm pretty sure that those guys will note that a device driver should >> > absolutely not mess with such stuff. > > > >> > But that seems like a high-overhead thing to do due to the overhea= d of >> > setting up a transfer per data word and going over the PCI bus twi= ce >> > compared to accessing the memory directly by CPU when it trivially= can. >> >=20 >> >=20 >> > Understandable, but that will create another way of accessing process = memory. > > Based on this feedback and some further discussion, we now have an altern= ative > implementation for this interface via access_process_vm function posted b= y Mika: > > https://lore.kernel.org/dri-devel/20241216141721.2051279-1-mika.kuoppala@= linux.intel.com/ v2: https://lore.kernel.org/dri-devel/20241220113108.2386842-1-mika.kuoppala@li= nux.intel.com/ -Mika > > It's a couple of dozen lines don't need to do any open-coded kmapping, on= ly utilizing > the pre-existing memory access functions. > > Hopefully that would address the above concerns? > > Regards, Joonas > > PS. It could still be optimized further to directly use the struct mm > from within the mm notifier, and go with access_remote_vm using that, > but would require new symbol export. > > For demonstration it is implemented by grabbing the task_struct and using > the already exported access_process_vm function.