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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 BF690C28D13 for ; Tue, 23 Aug 2022 03:21:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:Reply-To:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:Cc:To:Subject:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Amje7exLk4x/+XOh0JJ3NyuYkLN+8rPAMEueJ/09l2Q=; b=s/jAwHWo3SA8H1 ZoHnwlHYWdrjHhjtQD3oUSfQ5ex1U0FepOYonMNpMRz5LWI79aNkQjdyJo7dAmhJ/WEqd4MyyB21h 0DrwmmK36+GWz0pRBAGfMB5SonJIDO8UDL8QCG5uFQtR+QTonO+pYPZMKuYgkemO6gGvXPgo4AGO4 7NRsypc/i48494AcsPed4SBAdBL5M51JLtM4aVKTzACjolnSvFdyCMFvPn/KuB1GLL9p+YKeNqy8T vhDomiq+x7uehwY1E5F56CYFp+001OKmt1vyomOpJsfl2/79WH3XW95703cXXhmUkFzKNAD5phV7O cDVhNFoToVsp+b0wF+tA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQKS7-001If6-UW; Tue, 23 Aug 2022 03:19:46 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQKRw-001IZG-RC for linux-arm-kernel@lists.infradead.org; Tue, 23 Aug 2022 03:19:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661224771; h=from:from:reply-to: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=2ANTOwf8ibiQnhay23Kr+MLhE1efu6Ju+xkjCoFvJ1Q=; b=UME05rWqAWeA/kiezdG0sPAUtbDzuHdvcG/QbWM3PHtfEtE7l3Fe0tgyZ73Gk0PY3R7gzz FIc6jPZdBsaLYQiU4vuQrjwkN+J1xCUGnJCpUsh68RiH6CxGooQJXl8p/+vgCeEDka+zza ApXeGwN5EOW7wItx9zssln4lr/LhoJI= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-508-g4xrL82LMhKJQVBZhkz-yQ-1; Mon, 22 Aug 2022 23:19:27 -0400 X-MC-Unique: g4xrL82LMhKJQVBZhkz-yQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 48A7E2999B31; Tue, 23 Aug 2022 03:19:26 +0000 (UTC) Received: from [10.64.54.16] (vpn2-54-16.bne.redhat.com [10.64.54.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 555641121315; Tue, 23 Aug 2022 03:19:18 +0000 (UTC) Subject: Re: [PATCH v1 1/5] KVM: arm64: Enable ring-based dirty memory tracking To: Peter Xu Cc: Marc Zyngier , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, pbonzini@redhat.com, corbet@lwn.net, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, catalin.marinas@arm.com, will@kernel.org, shuah@kernel.org, seanjc@google.com, drjones@redhat.com, dmatlack@google.com, bgardon@google.com, ricarkol@google.com, zhenyzha@redhat.com, shan.gavin@gmail.com References: <20220819005601.198436-1-gshan@redhat.com> <20220819005601.198436-2-gshan@redhat.com> <87lerkwtm5.wl-maz@kernel.org> <41fb5a1f-29a9-e6bb-9fab-4c83a2a8fce5@redhat.com> From: Gavin Shan Message-ID: Date: Tue, 23 Aug 2022 13:19:15 +1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220822_201933_057423_894B3B74 X-CRM114-Status: GOOD ( 24.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Gavin Shan Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Peter, On 8/23/22 4:55 AM, Peter Xu wrote: > On Mon, Aug 22, 2022 at 11:58:20AM +1000, Gavin Shan wrote: >>> For context, the documentation says: >>> >>> >>> - if KVM_CAP_DIRTY_LOG_RING is available, a number of pages at >>> KVM_DIRTY_LOG_PAGE_OFFSET * PAGE_SIZE. [...] >>> >>> >>> What is the reason for picking this particular value? >>> >> >> It's inherited from x86. I don't think it has to be this particular value. >> The value is used to distinguish the region's owners like kvm_run, KVM_PIO_PAGE_OFFSET, >> KVM_COALESCED_MMIO_PAGE_OFFSET, and KVM_DIRTY_LOG_PAGE_OFFSET. >> >> How about to have 2 for KVM_DIRTY_LOG_PAGE_OFFSET in next revision? >> The virtual area is cheap, I guess it's also nice to use x86's >> pattern to have 64 for KVM_DIRTY_LOG_PAGE_OFFSET. >> >> #define KVM_COALESCED_MMIO_PAGE_OFFSET 1 >> #define KVM_DIRTY_LOG_PAGE_OFFSET 2 > > It was chosen not to be continuous of previous used offset because it'll be > the 1st vcpu region that can cover multiple & dynamic number of pages. I > wanted to leave the 3-63 (x86 used offset 2 already) for small fields so > they can be continuous, which looks a little bit cleaner. > > Currently how many pages it'll use depends on the size set by the user, > though there's a max size limited by KVM_DIRTY_RING_MAX_ENTRIES, which is a > maximum of 1MB memory. > > So I think setting it to 2 is okay, as long as we keep the rest 1MB address > space for the per-vcpu ring structure, so any new vcpu fields (even if only > 1 page will be needed) need to be after that maximum size of the ring. > Thanks for the details. I think it'd keep the layout since virtual area is really cheap. So lets keep it as of being if Marc doesn't object. In this way, the new area, which is usually one page size can go after KVM_COALESCED_MMIO_PAGE_OFFSET. #define KVM_DIRTY_LOG_PAGE_OFFSET 64 Thanks, Gavin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel