Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2176043imm; Thu, 2 Aug 2018 07:24:57 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf3AGWteGNnwiMdpSE4dPV+Umfy8EFDdvdoGhbNdBR2JpPrDbcFDzFLKfrxQdEWZZVJ4Cnr X-Received: by 2002:a65:498c:: with SMTP id r12-v6mr3110489pgs.112.1533219897246; Thu, 02 Aug 2018 07:24:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533219897; cv=none; d=google.com; s=arc-20160816; b=wuR0D/rWhl0zEp6tUOTUWtvBDVDNy+sub6t0Y5wGSieRPHkai1MLTehTOwOyMqaL58 k6jACy+G6+r2qOUN4ZNxwM6LeZHn54s79RdPDHb/t7yCfkywcaqCwsjm12ETB4knGoVN SF9E6TQchliQI6rp5HkyKJjAd3xLUMGMmsXujmJkQjiOcQVikO0txzUuveXsdo+tL3H/ pT34kKVDgyOZdt6ozmqY2wsXioAL3ERFqhLjwchkTdRyXmS1gvviIDZSLCNbpxzTx5PP KolgqF2wHPbaBjhhTqgGvV9ulvvE+ZGJGMWM6CCkwrn43r3c2dfe0IuwuAo1+EVYPCwN 04/Q== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=CIgqx8VoLGMrZn9U3KuOAlnZP+AdDhHKwGp7zQW1qBo=; b=q3oLRJN4hYnYiIA+oOGKEse1nqPy74aFXA6z6uipsEx2HdJmknaz98xA6MlIn/06aI MK3V4TmEze5De8dCbHamJhhpJXlbzBAaTDh4w32Xgd2KefOIaCRRNXTTJejo14tLcwDz +WD4AUDV1pWjAKEx9pe3dra8RryluuY73cCM2cur4i3fEglWTthPBL1KFyGaNsegnagR uXHZdKBflYQcJKUih/ZqQC6YKQ3hdEmm+nhGzjQhrtOo7URWcKeyoVXDr4mk/1Fuvtil cKB+T76iEZzAMEmd8pxp+eo+4gDbGZhZnjsUhOdzhy9CCgGK4+JD193gTdaen6edKNDS byNw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l6-v6si2064092pgl.567.2018.08.02.07.24.42; Thu, 02 Aug 2018 07:24:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387484AbeHBQOO (ORCPT + 99 others); Thu, 2 Aug 2018 12:14:14 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:56026 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732202AbeHBQOO (ORCPT ); Thu, 2 Aug 2018 12:14:14 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8DAE772627; Thu, 2 Aug 2018 14:22:47 +0000 (UTC) Received: from redhat.com (unknown [10.20.6.215]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D65AF2026D69; Thu, 2 Aug 2018 14:22:44 +0000 (UTC) Date: Thu, 2 Aug 2018 10:22:43 -0400 From: Jerome Glisse To: Kenneth Lee Cc: "Tian, Kevin" , Hao Fang , Alex Williamson , Herbert Xu , "kvm@vger.kernel.org" , Jonathan Corbet , Greg Kroah-Hartman , Zaibo Xu , "linux-doc@vger.kernel.org" , "Kumar, Sanjay K" , Kenneth Lee , "iommu@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" , "linuxarm@huawei.com" , "linux-crypto@vger.kernel.org" , Philippe Ombredanne , Thomas Gleixner , "David S . Miller" , "linux-accelerators@lists.ozlabs.org" Subject: Re: [RFC PATCH 0/7] A General Accelerator Framework, WarpDrive Message-ID: <20180802142243.GA3481@redhat.com> References: <20180801102221.5308-1-nek.in.cn@gmail.com> <20180801165644.GA3820@redhat.com> <20180802040557.GL160746@Turing-Arch-b> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180802040557.GL160746@Turing-Arch-b> User-Agent: Mutt/1.10.0 (2018-05-17) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 02 Aug 2018 14:22:47 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 02 Aug 2018 14:22:47 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jglisse@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 02, 2018 at 12:05:57PM +0800, Kenneth Lee wrote: > On Thu, Aug 02, 2018 at 02:33:12AM +0000, Tian, Kevin wrote: > > Date: Thu, 2 Aug 2018 02:33:12 +0000 > > > From: Jerome Glisse > > > On Wed, Aug 01, 2018 at 06:22:14PM +0800, Kenneth Lee wrote: > > > > From: Kenneth Lee > > > > > > > > WarpDrive is an accelerator framework to expose the hardware > > > capabilities > > > > directly to the user space. It makes use of the exist vfio and vfio-mdev > > > > facilities. So the user application can send request and DMA to the > > > > hardware without interaction with the kernel. This remove the latency > > > > of syscall and context switch. > > > > > > > > The patchset contains documents for the detail. Please refer to it for > > > more > > > > information. > > > > > > > > This patchset is intended to be used with Jean Philippe Brucker's SVA > > > > patch [1] (Which is also in RFC stage). But it is not mandatory. This > > > > patchset is tested in the latest mainline kernel without the SVA patches. > > > > So it support only one process for each accelerator. > > > > > > > > With SVA support, WarpDrive can support multi-process in the same > > > > accelerator device. We tested it in our SoC integrated Accelerator (board > > > > ID: D06, Chip ID: HIP08). A reference work tree can be found here: [2]. > > > > > > I have not fully inspected things nor do i know enough about > > > this Hisilicon ZIP accelerator to ascertain, but from glimpsing > > > at the code it seems that it is unsafe to use even with SVA due > > > to the doorbell. There is a comment talking about safetyness > > > in patch 7. > > > > > > Exposing thing to userspace is always enticing, but if it is > > > a security risk then it should clearly say so and maybe a > > > kernel boot flag should be necessary to allow such device to > > > be use. > > > > > But doorbell is just a notification. Except for DOS (to make hardware busy) it > cannot actually take or change anything from the kernel space. And the DOS > problem can be always taken as the problem that a group of processes share the > same kernel entity. > > In the coming HIP09 hardware, the doorbell will come with a random number so > only the process who allocated the queue can knock it correctly. When doorbell is ring the hardware start fetching commands from the queue and execute them ? If so than a rogue process B might ring the doorbell of process A which would starts execution of random commands (ie whatever random memory value there is left inside the command buffer memory, could be old commands i guess). If this is not how this doorbell works then, yes it can only do a denial of service i guess. Issue i have with doorbell is that i have seen 10 differents implementations in 10 differents hw and each are different as to what ringing or value written to the doorbell does. It is painfull to track what is what for each hw. > > > My more general question is do we want to grow VFIO to become > > > a more generic device driver API. This patchset adds a command > > > queue concept to it (i don't think it exist today but i have > > > not follow VFIO closely). > > > > > The thing is, VFIO is the only place to support DMA from user land. If we don't > put it here, we have to create another similar facility to support the same. No it is not, network device, GPU, block device, ... they all do support DMA. The point i am trying to make here is that even in your mechanisms the userspace must have a specific userspace drivers for each hardware and thus there are virtually no differences between having this userspace driver open a device file in vfio or somewhere else in the device filesystem. This is just a different path. So this is why i do not see any benefit to having all drivers with SVM (can we please use SVM and not SVA as SVM is what have been use in more places so far). Cheers, J?r?me