Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1294029rwl; Fri, 24 Mar 2023 08:40:06 -0700 (PDT) X-Google-Smtp-Source: AKy350bYeNcWzTLkg/Gb1Ma6y8CyaZzXS0BLK+UTrchsCb/26YPL0bSAc8Y/c+/wcTe8zb+D98/m X-Received: by 2002:a17:906:3806:b0:931:fdf0:7eee with SMTP id v6-20020a170906380600b00931fdf07eeemr2903165ejc.56.1679672405945; Fri, 24 Mar 2023 08:40:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679672405; cv=none; d=google.com; s=arc-20160816; b=HPnbF1GHo6QIITSg8+pxcscoULTSNJv/EYJMkgxy0V6eJy445mxBxyKFL6AuiXUDp1 sjKaIeManCcQ/OFj985SEd9Y8wHjHVWfnOHetoc9oy0ggMOe4DjXJbyISKQR+j9eN9Ns zwjoe3gAddC3zlf+lJqOAVzNA4j3I8XR/Ns7skqRVO+g6q1wiKITYJRqLxV+Muy0Wi3N TX5a7ClDCoRboCOEks85NQiKjBL9E7HCV2hdzLregu9LbtPF+J8t3vOQ6GKlm0j+YbyC u3jF4k44vYvM0LM0FS2I1rwTtVtXU1XpaYEZOzWmHujC/NdRQeNg1IxsC1JErDjLCo8h pf6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Z/Kz7kV+UiInmN3q36fZWIJQ0sjJV/FHyS/DppuKTvQ=; b=qe2/WVPpKT5nYEJjE8jBoISkf13v/zmBTGmkF01hOInj2L+Cy/f+MAqRhe83+RB+nD /a4AufrvOyQ4m45OM12+IvUqUwp1UeHVUu9YmxgUmmR1ef2cG6FSki9YLVTD2OYbFOc2 Mu+MVLk6Et5yoDoarDlo4yO0Jf2OW2sx9omGm25kSyNVA5PYN6nZXBJxNKZwm17TUrBI 4on3l0AbBibKljeOB5yjQDX5Qpx4742wDNUF1LvEtFtdXQ5MJATeoXDWLrSDsXNhT2VR bW+fJD6m1eGmJmfXHHmKLCEryFS0ZbS5Iv0H8tYv3FgTm68LPMCv6H4te9dq6qiAhSEc 95jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="eW4Ah/mr"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c9-20020a170906762900b008bf6a0f7ecasi21194761ejn.110.2023.03.24.08.39.42; Fri, 24 Mar 2023 08:40:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="eW4Ah/mr"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231596AbjCXPhe (ORCPT + 99 others); Fri, 24 Mar 2023 11:37:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232151AbjCXPha (ORCPT ); Fri, 24 Mar 2023 11:37:30 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 962AA1EFC0 for ; Fri, 24 Mar 2023 08:36:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679672180; 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; bh=Z/Kz7kV+UiInmN3q36fZWIJQ0sjJV/FHyS/DppuKTvQ=; b=eW4Ah/mrfC7pv7ma80zN3R370PX2euPb2qm2LBIa7wvv6x5uO3pmBg3NkMxdDTKGZE3Nnp JvDzCj8v452/k3jZBECeQ9pEXoDMUW3zE4VfnjASEakS83drUi1oVvldt5xr1K4MbsVRVC xlyuTkZeGLqAEDVQAL9Cr0f+GGsFsBA= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-418-j52mJxbLPbKSphSnMXY6wA-1; Fri, 24 Mar 2023 11:36:18 -0400 X-MC-Unique: j52mJxbLPbKSphSnMXY6wA-1 Received: by mail-ed1-f69.google.com with SMTP id c1-20020a0564021f8100b004acbe232c03so3690646edc.9 for ; Fri, 24 Mar 2023 08:36:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679672177; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Z/Kz7kV+UiInmN3q36fZWIJQ0sjJV/FHyS/DppuKTvQ=; b=Ck8AdVo5DXX5Lp0gZ3ix9jacYUjgcUZBlUiXNOHMh10qP9zUN9TsmmXFWXnLDru4qX UB5nNZNXfPUI2yLtfAuo4Ew1eaACESDQ0euJ9mwOe+cm1qugkWYxT8n5GnODoTIJgS2a JHstUCXhOfvEKI9WdlhBZdCFBabEt2BvicK0J5wZIu5Ymz/IB+leYH0NbKyqEFCi/ICQ csdTYIUd4hFxrcRG/pbQ5aMQ9j7h7QIY/OLBDqXl0DDjT0Vy8ZPqTgGJZ4eypib6uLZC y25yEkiWg5IXultSLCePOgQc3+6lonfKmwsBs9OYQRxnT2bR3ylrlUMu+zWG60EdnR69 XUzQ== X-Gm-Message-State: AAQBX9fWrBzpWib5Mwc2kAyl1aZI6DKa9zxlGW+vf2mTVix1jtQ06J45 lA1m6ossp1dHEGYSjvyMkoeILYzwqYltuKRgDho7x/OEI6XlDroxm1AyV9kX8E72LgihB1BXBeW 9W9KUl4hRVvyc2or69DndJJ/f X-Received: by 2002:aa7:c6c8:0:b0:4f9:deb4:b986 with SMTP id b8-20020aa7c6c8000000b004f9deb4b986mr2885727eds.7.1679672177747; Fri, 24 Mar 2023 08:36:17 -0700 (PDT) X-Received: by 2002:aa7:c6c8:0:b0:4f9:deb4:b986 with SMTP id b8-20020aa7c6c8000000b004f9deb4b986mr2885714eds.7.1679672177492; Fri, 24 Mar 2023 08:36:17 -0700 (PDT) Received: from localhost.localdomain (host-82-53-134-98.retail.telecomitalia.it. [82.53.134.98]) by smtp.gmail.com with ESMTPSA id a27-20020a509b5b000000b00501dd53dbfbsm5468613edj.75.2023.03.24.08.36.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Mar 2023 08:36:16 -0700 (PDT) From: Stefano Garzarella To: virtualization@lists.linux-foundation.org Cc: stefanha@redhat.com, Jason Wang , linux-kernel@vger.kernel.org, Andrey Zhadchenko , "Michael S. Tsirkin" , kvm@vger.kernel.org, netdev@vger.kernel.org, eperezma@redhat.com, Stefano Garzarella Subject: [PATCH v4 0/9] vdpa_sim: add support for user VA Date: Fri, 24 Mar 2023 16:35:58 +0100 Message-Id: <20230324153607.46836-1-sgarzare@redhat.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series adds support for the use of user virtual addresses in the vDPA simulator devices. The main reason for this change is to lift the pinning of all guest memory. Especially with virtio devices implemented in software. The next step would be to generalize the code in vdpa-sim to allow the implementation of in-kernel software devices. Similar to vhost, but using vDPA so we can reuse the same software stack (e.g. in QEMU) for both HW and SW devices. For example, we have never merged vhost-blk, and lately there has been interest. So it would be nice to do it directly with vDPA to reuse the same code in the VMM for both HW and SW vDPA block devices. The main problem (addressed by this series) was due to the pinning of all guest memory, which thus prevented the overcommit of guest memory. Thanks, Stefano Changelog listed in each patch. v3: https://lore.kernel.org/lkml/20230321154228.182769-1-sgarzare@redhat.com/ v2: https://lore.kernel.org/lkml/20230302113421.174582-1-sgarzare@redhat.com/ RFC v1: https://lore.kernel.org/lkml/20221214163025.103075-1-sgarzare@redhat.com/ Stefano Garzarella (9): vdpa: add bind_mm/unbind_mm callbacks vhost-vdpa: use bind_mm/unbind_mm device callbacks vringh: replace kmap_atomic() with kmap_local_page() vringh: define the stride used for translation vringh: support VA with iotlb vdpa_sim: make devices agnostic for work management vdpa_sim: use kthread worker vdpa_sim: replace the spinlock with a mutex to protect the state vdpa_sim: add support for user VA drivers/vdpa/vdpa_sim/vdpa_sim.h | 11 +- include/linux/vdpa.h | 10 ++ include/linux/vringh.h | 9 ++ drivers/vdpa/vdpa_sim/vdpa_sim.c | 161 ++++++++++++++++++++----- drivers/vdpa/vdpa_sim/vdpa_sim_blk.c | 10 +- drivers/vdpa/vdpa_sim/vdpa_sim_net.c | 10 +- drivers/vhost/vdpa.c | 34 ++++++ drivers/vhost/vringh.c | 173 ++++++++++++++++++++++----- 8 files changed, 340 insertions(+), 78 deletions(-) -- 2.39.2