Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp855116ybt; Fri, 26 Jun 2020 13:13:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuwKFZsTBrpskdhxLnRjmBSwZbwK52JoqbytDXlLdoIyo/h0HR8LxxTkvyJ9lhTskzgnR7 X-Received: by 2002:a17:906:2e83:: with SMTP id o3mr481163eji.261.1593202438578; Fri, 26 Jun 2020 13:13:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593202438; cv=none; d=google.com; s=arc-20160816; b=wLbJNHj1lFHfTWgPvcAis4m5Q0FXx5bYGJ+DuIsg40QvCBba5IzzO2esrnadnKWVq0 j++uhUy65mRJjdKiPc5TZ0zsQfUDPm/guJGVuwsOloCouC7fnl24s5wbCZESYGfmwQjj FeYkOtS9I8I2Tj/jVAb2xN2U1JxjXb2U1m9rrzQCiOxH8fdfBIJryajc1KmkYAxqjTBS OV4eVXTH5cpfh3O1CAbVgEqaO0YzanhgdeWH5nxaREDco5s6Rx1s7du3LNfzIxku5SRz bFVo+k8KW9C+/IIydYd94kR//rIDx4X7eNkRgQf7BGttzn1/T9bY2poqGYkZGXL7DB4b 2jMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=6Xy0u9ZIdPHFKrbPF244ZSOyapUjhgqMox5+e9GJPbg=; b=SKXJtbnvw52FIFURYdUaE+DQlOtSdLO9gb7UCEdwe28A0D/A7fYgNSZnGzDY/FPT7i Zo0X+nOEHerStAik/eRy95bKR/JFOwxYItBZjZyglk9KLxCNNINsdo2y1YLmqZEIA+P6 YQurCWkdZrqAMdkrsfN2fg0qYEerIWsjnLr6B2AxmKdgH8i6Mv4kGzYsOf5oc9b+i9GA J8fXMkdKT33d/cJsENrcZQsEQSEDx1Lxe6Ba1VPV4AlzY+WuExE05FTeUjPu3TswGxZc dnlzul0STB1vwLSxIUzgKB1EJUR/luXflBZxxO4WNFwMrV0zudLcEEO73iCwhZ9JLkbo J/rw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cn9si6973979edb.325.2020.06.26.13.13.35; Fri, 26 Jun 2020 13:13:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726056AbgFZUIQ (ORCPT + 99 others); Fri, 26 Jun 2020 16:08:16 -0400 Received: from mga01.intel.com ([192.55.52.88]:8814 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725823AbgFZUIQ (ORCPT ); Fri, 26 Jun 2020 16:08:16 -0400 IronPort-SDR: 6CUANNw87mm0T/cC4tTQ5Qu1D4l9JrvWd6EFJO5g+M7FMZIQSGAXfxuAn1IJVJ5t5Wj74Brufz t3Wu3Ez7lh3A== X-IronPort-AV: E=McAfee;i="6000,8403,9664"; a="163495099" X-IronPort-AV: E=Sophos;i="5.75,284,1589266800"; d="scan'208";a="163495099" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2020 13:08:15 -0700 IronPort-SDR: DFxhAN9uAkgMQalhsvNo9cBN/6ui9Dzq1fygm1mPOL8AVTs4uAwUqd36H8Rr7JhvRtvzPtOvP2 Uv4rlwNWx0Cw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,284,1589266800"; d="scan'208";a="302432552" Received: from iweiny-desk2.sc.intel.com ([10.3.52.147]) by fmsmga004.fm.intel.com with ESMTP; 26 Jun 2020 13:08:15 -0700 Date: Fri, 26 Jun 2020 13:08:15 -0700 From: Ira Weiny To: Thomas Ruf Cc: Dave Jiang , Vinod Koul , Federico Vaga , Dan Williams , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, "Kumar, Sanjay K" , "Luck, Tony" Subject: Re: DMA Engine: Transfer From Userspace Message-ID: <20200626200815.GC2454695@iweiny-DESK2.sc.intel.com> References: <5614531.lOV4Wx5bFT@harkonnen> <20200621072457.GA2324254@vkoul-mobl> <581f1761-e582-c770-169a-ee3374baf25c@intel.com> <84270660.632865.1593072688966@mailbusiness.ionos.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <84270660.632865.1593072688966@mailbusiness.ionos.de> User-Agent: Mutt/1.11.1 (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 25, 2020 at 10:11:28AM +0200, Thomas Ruf wrote: > > > On 25 June 2020 at 02:42 Dave Jiang wrote: > > > > > > > > > > On 6/21/2020 12:24 AM, Vinod Koul wrote: > > > On 19-06-20, 16:31, Dave Jiang wrote: > > >> > > >> > > >> On 6/19/2020 3:47 PM, Federico Vaga wrote: > > >>> Hello, > > >>> > > >>> is there the possibility of using a DMA engine channel from userspace? > > >>> > > >>> Something like: > > >>> - configure DMA using ioctl() (or whatever configuration mechanism) > > >>> - read() or write() to trigger the transfer > > >>> > > >> > > >> I may have supposedly promised Vinod to look into possibly providing > > >> something like this in the future. But I have not gotten around to do that > > >> yet. Currently, no such support. > > > > > > And I do still have serious reservations about this topic :) Opening up > > > userspace access to DMA does not sound very great from security point of > > > view. > > > > What about doing it with DMA engine that supports PASID? That way the user can > > really only trash its own address space and kernel is protected. > > Sounds interesting! Not sure if this is really needed in that case... > I have already implemented checks of vm_area_struct for contiguous memory or even do a get_user_pages_fast for user memory to pin it (hope that is the correct term here). Of course i have to do that for every involved page. FWIW there is a new pin_user_pages_fast()/unpin_user_page() interface now. Ira > But i will do some checks if my code is really suitable to avoid misusage. > > Best regards, > Thomas