Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4071983pxv; Mon, 28 Jun 2021 21:20:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwV4Xi7tsY7UyB4DiWZXJBPVrkFbNU8His0JpSqMk7Ui04JlGQHY7SIsmHghC4e7o1EIuyp X-Received: by 2002:aa7:df85:: with SMTP id b5mr38085666edy.90.1624940403653; Mon, 28 Jun 2021 21:20:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624940403; cv=none; d=google.com; s=arc-20160816; b=rd19OqkHzaGwRm5zFE1HUhsqghrWeJ6sAj9xDkSCJ6enjm8wRq5GTLmsGyuEKyR5N4 ZbXGwnsBohCMHgDtKBQE0oWh0BX74g1UKLWfHDOT2n22ZfR0wwg1B+UD0lCWVPQZiHw+ CLiRPomA3zCxtWrMOQBGHyRKsiumeRySh9GbJEMm67SsVigJ/ktOKyBYAhkQWgjwIKVB FjjM8MFXS17nfIWcVPIPDUnU6OErI1eQX30Vbu7gMBAgZmVAYGVU1wvCECCVbhDX3lej XrpFst+lzRbqGPBl7/DwOo4SACygWMgTw8ua7HW8q1WvXzgI271UtGiWL5m/FvCAGm+9 eXzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=artctqxsXOBji6dZlUYYfDDilnt3HH/T60QvobzscDY=; b=W9gyxophLvGBFONCVJwHGscDg8xd2Z26G44Tcs+WisXqhmpGf8Dyo7QTFIsfBLMpYD eUESIpHsEWk1HohY+x2dbw86dc7xUXvb04Zn0F+Vr4atXV7Zp/j858hsj3dUuxHyvnXV qxm/jH1JUg8YQlskILThNN6lk1krsNFdIuoKDUSJa6NiSub1OxC9lvJgEJJG56N4cZ2p rJ6XmvyI2vG9dluI4N83ZKBzEIz+kojhnoFybq61DbJXMwZrRoONAlS82PpkOnncFJNd 1mqmLi9ReJRKA0VkgtiTdTBXfxbiAjn7RKntuLYApRxCHDOlpgBFE50UTn4k+LonHERu gkMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PAb0HPXz; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 5si14797958ejh.535.2021.06.28.21.19.40; Mon, 28 Jun 2021 21:20:03 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PAb0HPXz; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229517AbhF2EVJ (ORCPT + 99 others); Tue, 29 Jun 2021 00:21:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:43873 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229480AbhF2EVI (ORCPT ); Tue, 29 Jun 2021 00:21:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624940321; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=artctqxsXOBji6dZlUYYfDDilnt3HH/T60QvobzscDY=; b=PAb0HPXzD5k01hNjGDFk4ZjYjkEnKVZ9PwA/HI4Rhm5aNgJxeNiiLCuBrmfYUlDM4Xyv6f RDV7i+gvduud6t4wAn6omvf9+zcR2ckMhtjhOW0T0M+czRxXh9dmIIJuqnUG/qGcRyI5+d NFamugOjjL+vD0ktDi5NJepUtxIUGEA= Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-254-YizQmZB6OcO4hLTv7e9VGw-1; Tue, 29 Jun 2021 00:18:39 -0400 X-MC-Unique: YizQmZB6OcO4hLTv7e9VGw-1 Received: by mail-pl1-f200.google.com with SMTP id 4-20020a170902c204b0290121d3ad80ecso6697347pll.6 for ; Mon, 28 Jun 2021 21:18:39 -0700 (PDT) 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=artctqxsXOBji6dZlUYYfDDilnt3HH/T60QvobzscDY=; b=KwZ6b3LfCmK0j+VyMLoas++0MhcQmAi/XpXT0bFdSYUKYOQK4D4UQQhcVaxxM+hA6l +xurqGxbUO+6Km1ScbQIS+W4tImj7PI3zb1lpbMVvn3slh3trl4ls2Tq1uH9YYst/zXl 5UqizjLiHZfqb1ZVZUTdUbcEIWJGefKTA2jCh6Il15XaSYBqJCtnfSZVy1Gun3gMIKrw mEz9MFCTmv/NN4oasBIsGNZA3T9QVEydXW6DlRxIKFd1OmRBj7/5ZjfWR9PpGyghgCUR lQnNZj1bsAq0FXcWVzKtttyEOHvpeSvc8zy8oOMsoLo/vBqxxsYviC/5O7o5tC0qSbQr 8Y3A== X-Gm-Message-State: AOAM533XBEEjFrgtIrcu7gQlsOUqBH6OwS9Wj8zdL8YfN06eecAzjex/ ZwXZDQiXzhLBnjDB4yQbHHN2g6Bq0WSb9iZbNFvS+KAFt9w4fq5WZNkjwlVoq9bq+7XV7WvYDFH /H2R+AAh0QtLpvh3VRXMJn4/cNXlLmRgIF22z06lgeVgHnLiBC5zzSsozjd4Z235e/R0LIjjN0B md X-Received: by 2002:a62:b616:0:b029:303:aa7b:b2e0 with SMTP id j22-20020a62b6160000b0290303aa7bb2e0mr28469466pff.21.1624939864960; Mon, 28 Jun 2021 21:11:04 -0700 (PDT) X-Received: by 2002:a62:b616:0:b029:303:aa7b:b2e0 with SMTP id j22-20020a62b6160000b0290303aa7bb2e0mr28469429pff.21.1624939864605; Mon, 28 Jun 2021 21:11:04 -0700 (PDT) Received: from wangxiaodeMacBook-Air.local ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id cs1sm1085868pjb.56.2021.06.28.21.10.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Jun 2021 21:11:04 -0700 (PDT) Subject: Re: [PATCH v8 00/10] Introduce VDUSE - vDPA Device in Userspace To: "Liu, Xiaodong" , Xie Yongji , "mst@redhat.com" , "stefanha@redhat.com" , "sgarzare@redhat.com" , "parav@nvidia.com" , "hch@infradead.org" , "christian.brauner@canonical.com" , "rdunlap@infradead.org" , "willy@infradead.org" , "viro@zeniv.linux.org.uk" , "axboe@kernel.dk" , "bcrl@kvack.org" , "corbet@lwn.net" , "mika.penttila@nextfour.com" , "dan.carpenter@oracle.com" , "joro@8bytes.org" , "gregkh@linuxfoundation.org" Cc: "songmuchun@bytedance.com" , "virtualization@lists.linux-foundation.org" , "netdev@vger.kernel.org" , "kvm@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "iommu@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" References: <20210615141331.407-1-xieyongji@bytedance.com> <20210628103309.GA205554@storage2.sh.intel.com> From: Jason Wang Message-ID: <41cc419e-48b5-6755-0cb0-9033bd1310e4@redhat.com> Date: Tue, 29 Jun 2021 12:10:51 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=iso-2022-jp; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2021/6/28 下午1:54, Liu, Xiaodong 写道: >> Several issues: >> >> - VDUSE needs to limit the total size of the bounce buffers (64M if I was not >> wrong). Does it work for SPDK? > Yes, Jason. It is enough and works for SPDK. > Since it's a kind of bounce buffer mainly for in-flight IO, so limited size like > 64MB is enough. Ok. > >> - VDUSE can use hugepages but I'm not sure we can mandate hugepages (or we >> need introduce new flags for supporting this) > Same with your worry, I'm afraid too that it is a hard for a kernel module > to directly preallocate hugepage internal. > What I tried is that: > 1. A simple agent daemon (represents for one device) `preallocates` and maps > dozens of 2MB hugepages (like 64MB) for one device. > 2. The daemon passes its mapping addr&len and hugepage fd to kernel > module through created IOCTL. > 3. Kernel module remaps the hugepages inside kernel. Such model should work, but the main "issue" is that it introduce overheads in the case of vhost-vDPA. Note that in the case of vhost-vDPA, we don't use bounce buffer, the userspace pages were shared directly. And since DMA is not done per page, it prevents us from using tricks like vm_insert_page() in those cases. > 4. Vhost user target gets and maps hugepage fd from kernel module > in vhost-user msg through Unix Domain Socket cmsg. > Then kernel module and target map on the same hugepage based > bounce buffer for in-flight IO. > > If there is one option in VDUSE to map userspace preallocated memory, then > VDUSE should be able to mandate it even it is hugepage based. > As above, this requires some kind of re-design since VDUSE depends on the model of mmap(MAP_SHARED) instead of umem registering. Thanks