Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp7238313ybp; Wed, 16 Oct 2019 05:59:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqyXMmAuiIMUOO3qpG9za+L4Dh10oKuJX9J59ZCfzgMwuPIh0VS0iK5dXZVr6QzrTkLHmmH2 X-Received: by 2002:a05:6402:1454:: with SMTP id d20mr24898347edx.53.1571230758122; Wed, 16 Oct 2019 05:59:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571230758; cv=none; d=google.com; s=arc-20160816; b=fSnCD4ULSjKeg7PjtzwhKauSaAIEpNnE1ec81eyu7osNQNLBMWqWn69mg9rDhv8Lz3 u+THMigpsz/HZezrKcWBLnMJMrDXeIVfaOKVWjUTF54IsY3NPdmSogDQg27UyO/TAsgi F5047cOB1wzVdawvSCamy0j3468v+h4Jl0L1ldyD0eKZ9MzIIjoQ2PI+vEWwyLeHRcKM aTUJbySjGmtBwygGoiBJi/ouLAQgraY2dJ25QKMV74FSsLRb35u8Wv9BuKjMx77DeKCI hd+MesgGBh0XNxBNIZwvfQBNCtrP/e2b0cqxL0+SAV+BePazRmPqsoL16EOt8DtqzdHO bmiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=6cSi/VaBu5qlG+iJux71TE9YR4HRfY9/qMQAkEfziBc=; b=dtxkgKH3YvAO+LVKDK0MHJ42VwRbUAOU81rB98FJu17oEyO9NjHXLu/ROFT64kp7v8 RWt2Qz4oM44UsK0+awuERxsWlvoayD9sNAYuvjkfOIGZT4BpoyfbPbnAaU9DphmV0E3v FYE/G2WeEsjJM85cTFXMr/qfiqRhF5t8nauag80C/8RKTuI9qVfUDJaWjppcKDqYg0uj pQgOHlAoRSZJ9H8axS+FNwn19cxevDLq22S6r5fYDGvIOeJGml2PigqiNkugjZJP13ol aXkZ3Bzib7T8oc5nGMY6WEJKEyPz6vx6Bc0CKtPURLAs3bZuEhg66KXpisCH3VlrGZqW Kedw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Sih3elzl; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m1si15326475eji.86.2019.10.16.05.58.53; Wed, 16 Oct 2019 05:59:18 -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; dkim=pass header.i=@linaro.org header.s=google header.b=Sih3elzl; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391510AbfJPIhi (ORCPT + 99 others); Wed, 16 Oct 2019 04:37:38 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:43704 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726804AbfJPIhh (ORCPT ); Wed, 16 Oct 2019 04:37:37 -0400 Received: by mail-pl1-f196.google.com with SMTP id f21so10920378plj.10 for ; Wed, 16 Oct 2019 01:37:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=6cSi/VaBu5qlG+iJux71TE9YR4HRfY9/qMQAkEfziBc=; b=Sih3elzljcS0vhgJ36VNbRv5XOwR5L9xaCP9+NFtnvXSBLwbjexzqFbTtHyWv38WkB fEsNhmhm2OCHgx8ouEzAbulTJ29ur77D6v3p7loHNwCv7VILm7zArLV3Er7knHyfrCmD PFn1YxvCZvKFGCXdZicc+JTb9qJY/Yc/zwNEhfN30CJcyRnUadDrKBNTMdLa8sI8h4Pv N8cN9aIG65SAYaepi4+sst/PGGJa4HRRmxvKnWEGy7Ll7Wp6G5HwOYPHBcqN9DWHai1P XPtfY4pg9bQiXT/WKmGuxOe3eORhfNHNl/1JWrG/ytm0LtjZjbrwu7bwx8OLUAqzwL7h oDvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=6cSi/VaBu5qlG+iJux71TE9YR4HRfY9/qMQAkEfziBc=; b=qvxfezRRCE+toc5ORqHK+Bn5Gylg2NfhjGjle0gTmVw6DLAV5l1fgPEXKl3tAe4DCY RRxbpNvZDFgh5dN0MX/+VyziyIkAWTEMsS+CgxVTZ5Ikx/Xfarf4yJG5+y8C06EgExTT ebviae687oceoElkLZt/am+M3xtSHZsQ4ho1DWRRIp+HTG8+SRQOiqCDMKoclJZlwtqz 6Joai4Gv32pm4exmzaWa5ne9qm9fGx96/y2XDQLvhC+ckM/GT0nEV3BHrWWWKDLUmAk2 0wntQSkyRBHGrc0NPNidARX66H2QHx7BRAiSWSBoWCSRTT35fF0uuXmdTO6sS0MAAE9R YYFA== X-Gm-Message-State: APjAAAVdr0VzeZ614iprrBrhWvUhbBZF9hGX9um3lfGDSXxJbMj8aJJh 9b5oMH/iO5FxKFUfZYx9q90k+w== X-Received: by 2002:a17:902:7c8f:: with SMTP id y15mr40413967pll.0.1571215057114; Wed, 16 Oct 2019 01:37:37 -0700 (PDT) Received: from [10.111.0.242] ([85.203.47.199]) by smtp.gmail.com with ESMTPSA id e6sm32782799pfl.146.2019.10.16.01.37.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Oct 2019 01:37:36 -0700 (PDT) Subject: Re: [PATCH v5 2/3] uacce: add uacce driver To: reg Kroah-Hartman Cc: Jonathan Cameron , Arnd Bergmann , grant.likely@arm.com, jean-philippe , ilias.apalodimas@linaro.org, francois.ozog@linaro.org, kenneth-lee-2012@foxmail.com, Wangzhou , linux-accelerators@lists.ozlabs.org, linux-kernel@vger.kernel.org, Kenneth Lee , Zaibo Xu References: <1571035735-31882-1-git-send-email-zhangfei.gao@linaro.org> <1571035735-31882-3-git-send-email-zhangfei.gao@linaro.org> <20191014113231.00002967@huawei.com> <20191015175555.GB1072965@kroah.com> From: zhangfei Message-ID: Date: Wed, 16 Oct 2019 16:37:28 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191015175555.GB1072965@kroah.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/10/16 上午1:55, reg Kroah-Hartman wrote: > On Tue, Oct 15, 2019 at 03:39:00PM +0800, zhangfei wrote: >> Hi, Jonathan >> >> On 2019/10/14 下午6:32, Jonathan Cameron wrote: >>> On Mon, 14 Oct 2019 14:48:54 +0800 >>> Zhangfei Gao wrote: >>> >>>> From: Kenneth Lee >>>> >>>> Uacce (Unified/User-space-access-intended Accelerator Framework) targets to >>>> provide Shared Virtual Addressing (SVA) between accelerators and processes. >>>> So accelerator can access any data structure of the main cpu. >>>> This differs from the data sharing between cpu and io device, which share >>>> data content rather than address. >>>> Since unified address, hardware and user space of process can share the >>>> same virtual address in the communication. >>>> >>>> Uacce create a chrdev for every registration, the queue is allocated to >>>> the process when the chrdev is opened. Then the process can access the >>>> hardware resource by interact with the queue file. By mmap the queue >>>> file space to user space, the process can directly put requests to the >>>> hardware without syscall to the kernel space. >>>> >>>> Signed-off-by: Kenneth Lee >>>> Signed-off-by: Zaibo Xu >>>> Signed-off-by: Zhou Wang >>>> Signed-off-by: Zhangfei Gao >>> Hi, >>> >>> Some superficial comments from me. >> Thanks for the suggestion. >>>> +/* >>>> + * While user space releases a queue, all the relatives on the queue >>>> + * should be released immediately by this putting. >>> This one needs rewording but I'm not quite sure what >>> relatives are in this case. >>>> + */ >>>> +static long uacce_put_queue(struct uacce_queue *q) >>>> +{ >>>> + struct uacce_device *uacce = q->uacce; >>>> + >>>> + mutex_lock(&uacce_mutex); >>>> + >>>> + if ((q->state == UACCE_Q_STARTED) && uacce->ops->stop_queue) >>>> + uacce->ops->stop_queue(q); >>>> + >>>> + if ((q->state == UACCE_Q_INIT || q->state == UACCE_Q_STARTED) && >>>> + uacce->ops->put_queue) >>>> + uacce->ops->put_queue(q); >>>> + >>>> + q->state = UACCE_Q_ZOMBIE; >>>> + mutex_unlock(&uacce_mutex); >>>> + >>>> + return 0; >>>> +} >>>> + >>> .. >>> >>>> + >>>> +static ssize_t qfrs_size_show(struct device *dev, >>>> + struct device_attribute *attr, char *buf) >>>> +{ >>>> + struct uacce_device *uacce = to_uacce_device(dev); >>>> + unsigned long size; >>>> + int i, ret; >>>> + >>>> + for (i = 0, ret = 0; i < UACCE_QFRT_MAX; i++) { >>>> + size = uacce->qf_pg_size[i] << PAGE_SHIFT; >>>> + if (i == UACCE_QFRT_SS) >>>> + break; >>>> + ret += sprintf(buf + ret, "%lu\t", size); >>>> + } >>>> + ret += sprintf(buf + ret, "%lu\n", size); >>>> + >>>> + return ret; >>>> +} >>> This may break the sysfs rule of one thing per file. If you have >>> multiple regions, they should probably each have their own file >>> to give their size. >> Is the rule must be applied? > Yes, it always must be followed. Please fix. > OK, understand. Have updated in v6. Thanks for the patience.