From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06F4DC07E96 for ; Mon, 12 Jul 2021 03:08:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DBB9F6103E for ; Mon, 12 Jul 2021 03:08:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232507AbhGLDKp (ORCPT ); Sun, 11 Jul 2021 23:10:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:41109 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230022AbhGLDKo (ORCPT ); Sun, 11 Jul 2021 23:10:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626059275; 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=DigXiH/LTULD0RvNd551qqlSUUAL5xHAN7DKU/yDOVs=; b=QPXxG3OyZXCbZI8aUNQ0sU+1eQG2yB8FZ4MnKwvOpkJLmCfQcjiE4lTiiN4cqYlF3AoA85 m8D8HIo0PU2TYYQ9S/5WERlc20BQrjE4aEQ2VdS3pMv/Cl8KX0Xq5aiHl9HO6889psQkdP sETKkWZkh9kpEfjH9tvk15k28msHAJM= Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-512-NKfHzTfxNDyTSDekY_3r5A-1; Sun, 11 Jul 2021 23:07:54 -0400 X-MC-Unique: NKfHzTfxNDyTSDekY_3r5A-1 Received: by mail-pg1-f197.google.com with SMTP id y1-20020a655b410000b02902235977d00cso13637708pgr.21 for ; Sun, 11 Jul 2021 20:07:54 -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=DigXiH/LTULD0RvNd551qqlSUUAL5xHAN7DKU/yDOVs=; b=Z7uajVHZWgGX7nv1OqBr5gXuNvklCLG2selAl+nQ9+cpIjR4FvyZNT7UsVwZ0ltMpS BoscUO9yUEsq4zzTNwFJqIQrifk0Vpn4ZXXXnw3dc+GiJI0mKfAOtLgDwYUh3bOjQRgL H682GKYKmLoUbd/tyWXfk4MMgmwQiSASZj0vnUH6eErNutz/QFjnWoNK/lO9wW+/YIX/ Q0tgrhla/1IvyfY4GlItd8E76bP41tnBeWY8//22bN5QDo/Skx0yU/kNWg3ZVbN4/sGa p9VmZVbmnuB5nhh1JBYUMFP3PeySuo2OVCJf3bfEUGbwv7nkcQJ3sQhnj21jzTf/C2Dv kEgg== X-Gm-Message-State: AOAM533r1XCOFcjJJ2ftwB80MmdIdWGYsowJzGbJscEdW1R6ynREoWpi Cshx9oSwYBQLLpvvbjQ31Bj/zuECgFWIoz0wvSY0CcE9qOoRDH9iRqaoo2Wp04I23kcz+IMc8Ww jd+X5FDZEkG/dZKwTi342y5O5 X-Received: by 2002:a17:902:7489:b029:129:c0d3:96ca with SMTP id h9-20020a1709027489b0290129c0d396camr23766930pll.46.1626059273335; Sun, 11 Jul 2021 20:07:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxESf9PbVdwF/2IJoYJMIgdbQYf4I6nxhfXcDxjtsXifXfkOeknetHp4Hd3RPbbf5QVI0UF5A== X-Received: by 2002:a17:902:7489:b029:129:c0d3:96ca with SMTP id h9-20020a1709027489b0290129c0d396camr23766914pll.46.1626059273074; Sun, 11 Jul 2021 20:07:53 -0700 (PDT) Received: from wangxiaodeMacBook-Air.local ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id j15sm11693382pjl.15.2021.07.11.20.07.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 11 Jul 2021 20:07:52 -0700 (PDT) Subject: Re: [RFC PATCH V2 0/7] Do not read from descripto ring To: "Michael S. Tsirkin" Cc: Christoph Hellwig , virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, xieyongji@bytedance.com, stefanha@redhat.com, file@sect.tu-berlin.de, ashish.kalra@amd.com, konrad.wilk@oracle.com, kvm@vger.kernel.org References: <20210423080942.2997-1-jasowang@redhat.com> <0e9d70b7-6c8a-4ff5-1fa9-3c4f04885bb8@redhat.com> <20210506041057-mutt-send-email-mst@kernel.org> <20210506123829.GA403858@infradead.org> <20210514063516-mutt-send-email-mst@kernel.org> <8bf22db2-97d4-9f88-8b6b-d685fd63ac8b@redhat.com> <20210711120627-mutt-send-email-mst@kernel.org> From: Jason Wang Message-ID: Date: Mon, 12 Jul 2021 11:07:44 +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: <20210711120627-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2021/7/12 上午12:08, Michael S. Tsirkin 写道: > On Fri, Jun 04, 2021 at 01:38:01PM +0800, Jason Wang wrote: >> 在 2021/5/14 下午7:13, Michael S. Tsirkin 写道: >>> On Thu, May 06, 2021 at 01:38:29PM +0100, Christoph Hellwig wrote: >>>> On Thu, May 06, 2021 at 04:12:17AM -0400, Michael S. Tsirkin wrote: >>>>> Let's try for just a bit, won't make this window anyway: >>>>> >>>>> I have an old idea. Add a way to find out that unmap is a nop >>>>> (or more exactly does not use the address/length). >>>>> Then in that case even with DMA API we do not need >>>>> the extra data. Hmm? >>>> So we actually do have a check for that from the early days of the DMA >>>> API, but it only works at compile time: CONFIG_NEED_DMA_MAP_STATE. >>>> >>>> But given how rare configs without an iommu or swiotlb are these days >>>> it has stopped to be very useful. Unfortunately a runtime-version is >>>> not entirely trivial, but maybe if we allow for false positives we >>>> could do something like this >>>> >>>> bool dma_direct_need_state(struct device *dev) >>>> { >>>> /* some areas could not be covered by any map at all */ >>>> if (dev->dma_range_map) >>>> return false; >>>> if (force_dma_unencrypted(dev)) >>>> return false; >>>> if (dma_direct_need_sync(dev)) >>>> return false; >>>> return *dev->dma_mask == DMA_BIT_MASK(64); >>>> } >>>> >>>> bool dma_need_state(struct device *dev) >>>> { >>>> const struct dma_map_ops *ops = get_dma_ops(dev); >>>> >>>> if (dma_map_direct(dev, ops)) >>>> return dma_direct_need_state(dev); >>>> return ops->unmap_page || >>>> ops->sync_single_for_cpu || ops->sync_single_for_device; >>>> } >>> Yea that sounds like a good idea. We will need to document that. >>> >>> >>> Something like: >>> >>> /* >>> * dma_need_state - report whether unmap calls use the address and length >>> * @dev: device to guery >>> * >>> * This is a runtime version of CONFIG_NEED_DMA_MAP_STATE. >>> * >>> * Return the value indicating whether dma_unmap_* and dma_sync_* calls for the device >>> * use the DMA state parameters passed to them. >>> * The DMA state parameters are: scatter/gather list/table, address and >>> * length. >>> * >>> * If dma_need_state returns false then DMA state parameters are >>> * ignored by all dma_unmap_* and dma_sync_* calls, so it is safe to pass 0 for >>> * address and length, and DMA_UNMAP_SG_TABLE_INVALID and >>> * DMA_UNMAP_SG_LIST_INVALID for s/g table and length respectively. >>> * If dma_need_state returns true then DMA state might >>> * be used and so the actual values are required. >>> */ >>> >>> And we will need DMA_UNMAP_SG_TABLE_INVALID and >>> DMA_UNMAP_SG_LIST_INVALID as pointers to an empty global table and list >>> for calls such as dma_unmap_sgtable that dereference pointers before checking >>> they are used. >>> >>> >>> Does this look good? >>> >>> The table/length variants are for consistency, virtio specifically does >>> not use s/g at the moment, but it seems nicer than leaving >>> users wonder what to do about these. >>> >>> Thoughts? Jason want to try implementing? >> >> I can add it in my todo list other if other people are interested in this, >> please let us know. >> >> But this is just about saving the efforts of unmap and it doesn't eliminate >> the necessary of using private memory (addr, length) for the metadata for >> validating the device inputs. > > Besides unmap, why do we need to validate address? Sorry, it's not validating actually, the driver doesn't do any validation. As the subject, the driver will just use the metadata stored in the desc_state instead of the one stored in the descriptor ring. > length can be > typically validated by specific drivers - not all of them even use it .. > >> And just to clarify, the slight regression we see is testing without >> VIRTIO_F_ACCESS_PLATFORM which means DMA API is not used. > I guess this is due to extra cache pressure? Yes. > Maybe create yet another > array just for DMA state ... I'm not sure I get this, we use this basically: struct vring_desc_extra {         dma_addr_t addr;                /* Buffer DMA addr. */         u32 len;                        /* Buffer length. */         u16 flags;                      /* Descriptor flags. */         u16 next;                       /* The next desc state in a list. */ }; Except for the "next" the rest are all DMA state. Thanks > >> So I will go to post a formal version of this series and we can start from >> there. >> >> Thanks >> >> From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.7 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41552C07E9C for ; Mon, 12 Jul 2021 03:08:02 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C6CD660FE9 for ; Mon, 12 Jul 2021 03:08:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C6CD660FE9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=virtualization-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 7BF586071A; Mon, 12 Jul 2021 03:08:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ppd0vh-PLvIG; Mon, 12 Jul 2021 03:08:00 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id D57B66059C; Mon, 12 Jul 2021 03:07:59 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id A5442C001A; Mon, 12 Jul 2021 03:07:59 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 757DFC000E for ; Mon, 12 Jul 2021 03:07:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 5CB95401B1 for ; Mon, 12 Jul 2021 03:07:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BAfTpAfcwmhi for ; Mon, 12 Jul 2021 03:07:57 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id 12428400C2 for ; Mon, 12 Jul 2021 03:07:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1626059275; 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=DigXiH/LTULD0RvNd551qqlSUUAL5xHAN7DKU/yDOVs=; b=QPXxG3OyZXCbZI8aUNQ0sU+1eQG2yB8FZ4MnKwvOpkJLmCfQcjiE4lTiiN4cqYlF3AoA85 m8D8HIo0PU2TYYQ9S/5WERlc20BQrjE4aEQ2VdS3pMv/Cl8KX0Xq5aiHl9HO6889psQkdP sETKkWZkh9kpEfjH9tvk15k28msHAJM= Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-491-1KCNluOoOxm8hNHGdPO8Ag-1; Sun, 11 Jul 2021 23:07:54 -0400 X-MC-Unique: 1KCNluOoOxm8hNHGdPO8Ag-1 Received: by mail-pf1-f198.google.com with SMTP id j10-20020a056a00174ab029031e1e93e88dso11754431pfc.3 for ; Sun, 11 Jul 2021 20:07:54 -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=DigXiH/LTULD0RvNd551qqlSUUAL5xHAN7DKU/yDOVs=; b=Y+lo2SfMovkkzPDfCGbB2Nc9sA5JPWqebL9CxXRHf21NzeMLCfSRl1hzZ8O4OxVAM7 u07mpFhLbSeUN79oD+FOFddcgzqjEXP9TFH0G1apLxuBfDXHftSUoFyKdWXBvTubQ4cV pIVgbb1iCcuWfOVIw/LR7kSmz71MbM7k/H0E6ESfCaWZ5KL6CVgLxfieYGMTQs2BtM2S GPGMt5qINUgYa3/ALXJMZisP0mpN05j8LQeJDpSgUMD3QsliokHP/3nEpRbbSNztwoOq IGHUn7Jhp/OA/MUW9W16YNh0ldQxzayOfgB1IoCkANUkI1OhywX8MlG8s2zKIBVmmQnN lCmQ== X-Gm-Message-State: AOAM531Px537dTTJgbD6Ch3qLtctU0V4r1lsxOfNaSVkCfVUF3VTVshY HblOjYI3WNitKVnT30pd0tRjqJhfP3p+wZGNj41RMd8YI1LBLLP4mh/FeXas2isnwCFC5dGIsDD PqiEFVKgudXRXZnCCMCAtAlVz2P3Cc9T8JXRkQEcEFA== X-Received: by 2002:a17:902:7489:b029:129:c0d3:96ca with SMTP id h9-20020a1709027489b0290129c0d396camr23766929pll.46.1626059273334; Sun, 11 Jul 2021 20:07:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxESf9PbVdwF/2IJoYJMIgdbQYf4I6nxhfXcDxjtsXifXfkOeknetHp4Hd3RPbbf5QVI0UF5A== X-Received: by 2002:a17:902:7489:b029:129:c0d3:96ca with SMTP id h9-20020a1709027489b0290129c0d396camr23766914pll.46.1626059273074; Sun, 11 Jul 2021 20:07:53 -0700 (PDT) Received: from wangxiaodeMacBook-Air.local ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id j15sm11693382pjl.15.2021.07.11.20.07.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 11 Jul 2021 20:07:52 -0700 (PDT) Subject: Re: [RFC PATCH V2 0/7] Do not read from descripto ring To: "Michael S. Tsirkin" References: <20210423080942.2997-1-jasowang@redhat.com> <0e9d70b7-6c8a-4ff5-1fa9-3c4f04885bb8@redhat.com> <20210506041057-mutt-send-email-mst@kernel.org> <20210506123829.GA403858@infradead.org> <20210514063516-mutt-send-email-mst@kernel.org> <8bf22db2-97d4-9f88-8b6b-d685fd63ac8b@redhat.com> <20210711120627-mutt-send-email-mst@kernel.org> From: Jason Wang Message-ID: Date: Mon, 12 Jul 2021 11:07:44 +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: <20210711120627-mutt-send-email-mst@kernel.org> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jasowang@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Cc: ashish.kalra@amd.com, file@sect.tu-berlin.de, kvm@vger.kernel.org, konrad.wilk@oracle.com, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Christoph Hellwig , xieyongji@bytedance.com, stefanha@redhat.com X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: base64 Content-Type: text/plain; charset="utf-8"; Format="flowed" Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" CuWcqCAyMDIxLzcvMTIg5LiK5Y2IMTI6MDgsIE1pY2hhZWwgUy4gVHNpcmtpbiDlhpnpgZM6Cj4g T24gRnJpLCBKdW4gMDQsIDIwMjEgYXQgMDE6Mzg6MDFQTSArMDgwMCwgSmFzb24gV2FuZyB3cm90 ZToKPj4g5ZyoIDIwMjEvNS8xNCDkuIvljYg3OjEzLCBNaWNoYWVsIFMuIFRzaXJraW4g5YaZ6YGT Ogo+Pj4gT24gVGh1LCBNYXkgMDYsIDIwMjEgYXQgMDE6Mz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