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 Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CD2E2C433EF for ; Thu, 27 Jan 2022 08:06:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 80D6F41C50; Thu, 27 Jan 2022 08:06:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OjDtpXt3pAVb; Thu, 27 Jan 2022 08:06:33 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id 2266741C27; Thu, 27 Jan 2022 08:06:33 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id D83A4C001A; Thu, 27 Jan 2022 08:06:32 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id C54E4C000B for ; Thu, 27 Jan 2022 08:06:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 9ED2D6108F for ; Thu, 27 Jan 2022 08:06:30 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com 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 txPd-2Yy_PeG for ; Thu, 27 Jan 2022 08:06:29 +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 [170.10.129.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 6FBCC60F4B for ; Thu, 27 Jan 2022 08:06:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643270788; 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: in-reply-to:in-reply-to:references:references; bh=504wFKnHwwkFfPMgKXlwh2pWyCBgbL4WyM0tygoZNNQ=; b=e8naWrWu6u7mhAmIiMeML7u8RvLYBVV7uE4Kn+OdLzpepWt1PcgOZC/HcYlPmPnmd6oAWC doGy3rRD7GG6Cmq1yOhNv8mzwaqzbr7U3NDb/wTQV6v2fGQnV1pd3FWqWAvlMpJDPN03ij MlRxmkpm0vVdA811LHXnvxJ+DQlw5ow= Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-519-OpTHYxD6O2eZ5n25-WQ7jA-1; Thu, 27 Jan 2022 03:06:26 -0500 X-MC-Unique: OpTHYxD6O2eZ5n25-WQ7jA-1 Received: by mail-pj1-f71.google.com with SMTP id em10-20020a17090b014a00b001b5f2f3b5ffso1477425pjb.1 for ; Thu, 27 Jan 2022 00:06:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=504wFKnHwwkFfPMgKXlwh2pWyCBgbL4WyM0tygoZNNQ=; b=du2gpmUcyrE+JZdv/9R7qkToBUfMP8cdvKEzGzUxk74KpGX5EfDWZ/MoqOCMVbMWSf odH8Hnun1sWjgm5PCVfxiVj2SdJ0OphLL16bfsx+ODFO0icJEwGOgn5yYTvwUnMNKggn pp/cy5+IC1LDu8BYXCTPymXo13DJVFca4U+cpUY0NwoDrqh6yfe8G963aavZ6k0CcDug ihtTrWKMFo7Y5B+253U26w43PB1VwlJHEu/he87M11QAQBIdlBykWzjZOrhbiO5XZBJr kwkN49FD1oxicTndRuYXg5XQQCrAg9ESVU1hKjYCpqRaEqUO54L7wBhVtxTwt7q+eydC N7gw== X-Gm-Message-State: AOAM531MUV2/DSyLXTtHrJUNjGfmBHPDuQIFEtaRbwX1sgGf2AwcPm40 FAojYE+lxTmk1W1NGUJ7iTliGHXowWlXeSh4qUFqvxdkrr0RCqKhCqgWieTG3AlkvKjsGGhdyit 4VO6eNoD78MGCpgSA+iTbpI/D/XdMPXwT6zS/1UakbQ== X-Received: by 2002:a17:90b:4c11:: with SMTP id na17mr12923671pjb.208.1643270785786; Thu, 27 Jan 2022 00:06:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJyLKfGJjeS4YswQ/QKDZOAXPs/PKdHTyVn17lLFQab1SuE9NkeWoTsMumy/vbjTkOUgHRMDEg== X-Received: by 2002:a17:90b:4c11:: with SMTP id na17mr12923639pjb.208.1643270785491; Thu, 27 Jan 2022 00:06:25 -0800 (PST) Received: from xz-m1.local ([111.197.238.41]) by smtp.gmail.com with ESMTPSA id f15sm4385357pfn.19.2022.01.27.00.06.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 00:06:25 -0800 (PST) Date: Thu, 27 Jan 2022 16:06:19 +0800 From: Peter Xu To: Eugenio Perez Martin Subject: Re: [PATCH 21/31] util: Add iova_tree_alloc Message-ID: References: <20220121202733.404989-1-eperezma@redhat.com> <20220121202733.404989-22-eperezma@redhat.com> MIME-Version: 1.0 In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Cc: Laurent Vivier , Parav Pandit , Cindy Lu , "Michael S. Tsirkin" , Richard Henderson , qemu-level , Gautam Dawar , Markus Armbruster , Eduardo Habkost , Harpreet Singh Anand , Xiao W Wang , Stefan Hajnoczi , Eli Cohen , Paolo Bonzini , Zhu Lingshan , virtualization , Eric Blake 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" On Tue, Jan 25, 2022 at 10:40:01AM +0100, Eugenio Perez Martin wrote: > So I think that the first step to remove complexity from the old one > is to remove iova_begin and iova_end. > > As Jason points out, removing iova_end is easier. It has the drawback > of having to traverse all the list beyond iova_end, but a well formed > iova tree should contain none. If the guest can manipulate it, it's > only hurting itself adding nodes to it. > > It's possible to extract the check for hole_right (or this in Jason's > proposal) as a special case too. > > But removing the iova_begin parameter is more complicated. We cannot > know if it's a valid hole without knowing iova_begin, and we cannot > resume traversing. Could we assume iova_begin will always be 0? I > think not, the vdpa device can return anything through syscall. Frankly I don't know what's the syscall you're talking about, but after a 2nd thought and after I went back and re-read your previous version more carefully (the one without the list) I think it seems working to me in general. I should have tried harder when reviewing the first time! I mean this one: https://lore.kernel.org/qemu-devel/20211029183525.1776416-24-eperezma@redhat.com/ Though this time I have some comments on the details. Personally I like that one (probably with some amendment upon the old version) more than the current list-based approach. But I'd like to know your thoughts too (including Jason). I'll further comment in that thread soon. Thanks, -- Peter Xu _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization 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 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 646DAC433EF for ; Thu, 27 Jan 2022 08:43:04 +0000 (UTC) Received: from localhost ([::1]:53938 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nD0Mx-0003Bo-Cl for qemu-devel@archiver.kernel.org; Thu, 27 Jan 2022 03:43:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53148) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCznh-0002VZ-Gm for qemu-devel@nongnu.org; Thu, 27 Jan 2022 03:06:41 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:32661) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nCznf-0002Fs-86 for qemu-devel@nongnu.org; Thu, 27 Jan 2022 03:06:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643270793; 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: in-reply-to:in-reply-to:references:references; bh=504wFKnHwwkFfPMgKXlwh2pWyCBgbL4WyM0tygoZNNQ=; b=PgzeprEjsSeRWLdXveGH87perQH+nmsPrCV3JHaLbuhJ0nUcVIlK9x/Xs73BN0iGlhbt7Y VGrG+Y74Syt5pGmsCfc7b3nCofZeiloyKbeKxamgo1yfm1HDD05C3/p5yhDBJL3OG03sx4 eLZwG3epkhg1ItZPjMSo7tW1aeHWzO8= Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-356-Wfxe1fdwOHGje9ypLHgZxw-1; Thu, 27 Jan 2022 03:06:26 -0500 X-MC-Unique: Wfxe1fdwOHGje9ypLHgZxw-1 Received: by mail-pf1-f197.google.com with SMTP id 68-20020a621547000000b004c74bbd2819so1201972pfv.18 for ; Thu, 27 Jan 2022 00:06:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=504wFKnHwwkFfPMgKXlwh2pWyCBgbL4WyM0tygoZNNQ=; b=hH25qVCZunO3EIUfYJVjd6j5cY5MIuH+l9/mvw0enXVcBwasvcCdUtfAH6VkbmXf0s dwEMZwFrrSMOeZsJGDxhM35HLKMrRNstYgNj/l4Gx7V6QwrTJf/ptLPZCc0Aygc+XHiQ FmSoIXAgOM5o4XuBmCpHeBHTJAp4byLDPPGf4wdsXYfGATNeasFjsz9KMHWKQSTOmMJj 4Yq46TG7iMMSNwTFWdMjwKE2UtiKQRW/cWwFZeFsoJAvf4XPc2uoLA6Q0jM5opIILHHf th61KibJrFdoskJPLbPbdys5iQbQQv+/p/AkUgqDdoP4Ux/oP//BgmoXv7g8z7ne035P 13Dw== X-Gm-Message-State: AOAM533RFLmYdDyygOQn7bf6qx//3O572XbS0XVZi3LInNoiOzIJxrkR hglTn8Qb8lsKGtU1D1umJk/ZPhSssYe3VDmmajwxSK/YurC5Z1GLwWOkvGYz5uldbIhf/V25RU9 tErp9d7BGAxtcqC8= X-Received: by 2002:a17:90b:4c11:: with SMTP id na17mr12923666pjb.208.1643270785784; Thu, 27 Jan 2022 00:06:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJyLKfGJjeS4YswQ/QKDZOAXPs/PKdHTyVn17lLFQab1SuE9NkeWoTsMumy/vbjTkOUgHRMDEg== X-Received: by 2002:a17:90b:4c11:: with SMTP id na17mr12923639pjb.208.1643270785491; Thu, 27 Jan 2022 00:06:25 -0800 (PST) Received: from xz-m1.local ([111.197.238.41]) by smtp.gmail.com with ESMTPSA id f15sm4385357pfn.19.2022.01.27.00.06.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 00:06:25 -0800 (PST) Date: Thu, 27 Jan 2022 16:06:19 +0800 From: Peter Xu To: Eugenio Perez Martin Subject: Re: [PATCH 21/31] util: Add iova_tree_alloc Message-ID: References: <20220121202733.404989-1-eperezma@redhat.com> <20220121202733.404989-22-eperezma@redhat.com> MIME-Version: 1.0 In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Received-SPF: pass client-ip=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.159, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Parav Pandit , Cindy Lu , "Michael S. Tsirkin" , Jason Wang , Juan Quintela , Richard Henderson , qemu-level , Gautam Dawar , Markus Armbruster , Eduardo Habkost , Harpreet Singh Anand , Xiao W Wang , Stefan Hajnoczi , Eli Cohen , Paolo Bonzini , Zhu Lingshan , virtualization , Eric Blake , Stefano Garzarella Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Tue, Jan 25, 2022 at 10:40:01AM +0100, Eugenio Perez Martin wrote: > So I think that the first step to remove complexity from the old one > is to remove iova_begin and iova_end. > > As Jason points out, removing iova_end is easier. It has the drawback > of having to traverse all the list beyond iova_end, but a well formed > iova tree should contain none. If the guest can manipulate it, it's > only hurting itself adding nodes to it. > > It's possible to extract the check for hole_right (or this in Jason's > proposal) as a special case too. > > But removing the iova_begin parameter is more complicated. We cannot > know if it's a valid hole without knowing iova_begin, and we cannot > resume traversing. Could we assume iova_begin will always be 0? I > think not, the vdpa device can return anything through syscall. Frankly I don't know what's the syscall you're talking about, but after a 2nd thought and after I went back and re-read your previous version more carefully (the one without the list) I think it seems working to me in general. I should have tried harder when reviewing the first time! I mean this one: https://lore.kernel.org/qemu-devel/20211029183525.1776416-24-eperezma@redhat.com/ Though this time I have some comments on the details. Personally I like that one (probably with some amendment upon the old version) more than the current list-based approach. But I'd like to know your thoughts too (including Jason). I'll further comment in that thread soon. Thanks, -- Peter Xu