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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAD00C4332F for ; Fri, 25 Nov 2022 12:42:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230166AbiKYMmP (ORCPT ); Fri, 25 Nov 2022 07:42:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230105AbiKYMmO (ORCPT ); Fri, 25 Nov 2022 07:42:14 -0500 Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F7091086 for ; Fri, 25 Nov 2022 04:42:12 -0800 (PST) Received: by mail-qk1-x735.google.com with SMTP id p18so2559672qkg.2 for ; Fri, 25 Nov 2022 04:42:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=AXnQVTJbjL0K8bweNYfJIDhmo5mKhRKv6UCn43ckNoA=; b=hFA5mhB4gYkZ6dvymO+yCPpHJr4wYTRpVwdug8QvW7UnFNDL6rM0WQidk6U/8qnTmS rui6AG08HaVf6nQmnTnBdlEE9Z1O0PNZ5Zf4hPjr7y7FUZbubqO+E1MYLLblaUSPcf+u WgAZKKDew/hQed/WOMYr/z57cAUZ7E7xyousQrLXF5xvNJTBeIl6pqcNeGz3aI2GAfms uyXHDGwBFg9vDswitm+ryD8XHSdIWIfsOJS+h7VsGtYRKk+x38imYZVeiOsQgZ6Rggyh EmU5kc3SXe4hExSA0Pcs1Eu4bdDXbeKHwoR91q37q0Xbl1gqIVgOrmv9BA8rOAc6DDl4 H+eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=AXnQVTJbjL0K8bweNYfJIDhmo5mKhRKv6UCn43ckNoA=; b=3bUpnr6I7/TJSZpLAW1vNCrf4gIVTgCg6j1q8TK1m+ID18DHq+k94Ph62paxtVOEjn T3q23G0log1ggB9GMpmAhc4jF3pq5KsNVvi76dKsLdPI7Shhi6cl+WKiccuUpl9FaoNI 0JIXH2M2TdfVx2NDljJnZIFRIihCbV4k/A02tmYkPlFKv/nAZU18DPPPMmHGx8C8QBxr zn4KtbEAUbx/T/0efQRuaHfo384Q5V219DkGhCbtc4SCkfKCtQ2f87HSYnI8jgf/QwOS y8GehM//7B62VgmKOjVCGASYSx6L0CpXiZ+txk8hkyZrDp/qvc6myytcfbV4a4ud2Gjq aNPw== X-Gm-Message-State: ANoB5plAxb6BI8QIUnP1CLZReHvP07s6f9AmEA2N/IfD77cIWd7bWNFA R3s56wcIbFa9Sbm3rNRjAdixcQ== X-Google-Smtp-Source: AA0mqf7H2Z6S0Nl+QLspuujn/xhlSfOTbB1s2HR1GB3WNdjaKzOBGpuvEhnFpKyZCppyd1c8z5EM2w== X-Received: by 2002:ae9:f404:0:b0:6fa:22a2:6d80 with SMTP id y4-20020ae9f404000000b006fa22a26d80mr32718830qkl.210.1669380131577; Fri, 25 Nov 2022 04:42:11 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-47-55-122-23.dhcp-dynamic.fibreop.ns.bellaliant.net. [47.55.122.23]) by smtp.gmail.com with ESMTPSA id l4-20020ac84a84000000b003a57a317c17sm2162966qtq.74.2022.11.25.04.42.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Nov 2022 04:42:10 -0800 (PST) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1oyY1x-00DRrF-O5; Fri, 25 Nov 2022 08:42:09 -0400 Date: Fri, 25 Nov 2022 08:42:09 -0400 From: Jason Gunthorpe To: Joao Martins Cc: kvm@vger.kernel.org, Alex Williamson , Cornelia Huck , Avihai Horon , Yishai Hadas Subject: Re: [PATCH v1 2/2] vfio/iova_bitmap: Fix PAGE_SIZE unaligned bitmaps Message-ID: References: <20221025193114.58695-1-joao.m.martins@oracle.com> <20221025193114.58695-3-joao.m.martins@oracle.com> <8914ef49-aad4-1461-1176-6d46190d5cd8@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8914ef49-aad4-1461-1176-6d46190d5cd8@oracle.com> Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Fri, Nov 25, 2022 at 10:37:39AM +0000, Joao Martins wrote: > > Yes, when we move this to iommufd the test suite should be included, > > either as integrated using the mock domain and the selftests or > > otherwise. > > So in iommufd counterpart I have already tests which exercise this. But not as > extensive. We are getting to the point where we should start posting the iommufd dirty tracking stuff. Do you have time to work on it for the next cycle? Meaning get it largely sorted out in the next 3 weeks for review? > > void iova_bitmap_set(struct iova_bitmap *bitmap, > > unsigned long iova, size_t length) > > { > > struct iova_bitmap_map *mapped = &bitmap->mapped; > > unsigned cur_bit = > > ((iova - mapped->iova) >> mapped->pgshift) + mapped->pgoff * 8; > > unsigned long last_bit = > > (((iova + length - 1) - mapped->iova) >> mapped->pgshift) + > > mapped->pgoff * 8; > > > > do { > > unsigned int page_idx = cur_bit / BITS_PER_PAGE; > > unsigned int nbits = > > min(BITS_PER_PAGE - cur_bit, last_bit - cur_bit + 1); min(BITS_PER_PAGE - (cur_bit % BITS_PER_PAGE), ...) > Not sure if the vfio tree is a rebasing tree (or not?) and can just send a new > version, It isn't, you should just post a new patch on top of Alex's current tree "rework iova_bitmap_et to handle all page crossings" and along the way revert the first bit Jason