Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp336161ybj; Thu, 19 Sep 2019 15:17:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqzbMgjSIFjXB1IYEMvkqxozs/1iEcxWffRKCzwEgvIiN4naw9/lMCAM3azLgezzDGKlP2G4 X-Received: by 2002:a50:e79b:: with SMTP id b27mr18677488edn.186.1568931464080; Thu, 19 Sep 2019 15:17:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568931464; cv=none; d=google.com; s=arc-20160816; b=v/tajCKOkm2AfYlQucaqxYRZejU82io3E1SaWgp44o6JPYejuCaE+VeV9kYkpZV9jN pGDhAWpRysZFPi8GbZPl/vcwmBlca/vZSdeQJ3FRf0QoVMEtvgB6nQRZ7WeUrQjapLvv hT9PctLjCjY1OTt6DPK4DAUpRGBfltmG/QNHy9ltoj7xDmW7JSajtjuzgHzjWbg8MAAC dYppes/Siio2yzfifFwylvbTR1nHlk9WAyczCETE+0/zraMmW1hQcM2wm8AMqrS7qZTQ 1949r75GgtFVNO8rRSDpFfsinwfCvYLT1U42aPz8437QVnZZA36ni4L0zXMr0w/45suZ sTUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=TbULLQy4cFgojjnnC4S2g5nL98KynTXLKJrymfGu+tw=; b=HUr+eLf/yfVvd9YPsiB5KgWp/m4OGefhbuhxSaQiGVByu6OP6WQAALL/M4MAzkC761 05YwiwvlNMYAKBhXNKc4yi1xXQIyFE4S0ItDYPOM11o4vz9EzTZybWVmy6NwjZapr28g c1/YjbAN3Sg89QjmQQ7g6Yuc2hN7+gnE96FSp1TE7MRS72VWtzfRliaaDYHYnqo0j8bp KudgZko3ynSSTPzNXfpb8qxJ1gl2sSA/NLUO6b2UEA1Uh72fyBYLG/J0QNKnuPGRKQpz jo45fpCWaRwpwwK+00TRD98tAx12yXgf3lssRAl2S4M1415nikYjhooRYJvQ+qXNq5p8 k0mQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j3si53244edj.448.2019.09.19.15.17.21; Thu, 19 Sep 2019 15:17:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392396AbfISTjR (ORCPT + 99 others); Thu, 19 Sep 2019 15:39:17 -0400 Received: from mga07.intel.com ([134.134.136.100]:50290 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392354AbfISTjR (ORCPT ); Thu, 19 Sep 2019 15:39:17 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Sep 2019 12:39:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,524,1559545200"; d="scan'208";a="217417278" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.41]) by fmsmga002.fm.intel.com with ESMTP; 19 Sep 2019 12:39:15 -0700 Date: Thu, 19 Sep 2019 12:39:15 -0700 From: Sean Christopherson To: Paul Mackerras Cc: James Hogan , Christian Borntraeger , Janosch Frank , Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Marc Zyngier , David Hildenbrand , Cornelia Huck , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , James Morse , Julien Thierry , Suzuki K Pouloze , linux-mips@vger.kernel.org, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org Subject: Re: [PATCH 10/13] KVM: Provide common implementation for generic dirty log functions Message-ID: <20190919193915.GC30495@linux.intel.com> References: <20190911185038.24341-1-sean.j.christopherson@intel.com> <20190911185038.24341-11-sean.j.christopherson@intel.com> <20190919002242.GA19503@blackberry> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190919002242.GA19503@blackberry> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 19, 2019 at 10:22:42AM +1000, Paul Mackerras wrote: > On Wed, Sep 11, 2019 at 11:50:35AM -0700, Sean Christopherson wrote: > > Move the implementations of KVM_GET_DIRTY_LOG and KVM_CLEAR_DIRTY_LOG > > for CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT into common KVM code. > > The arch specific implemenations are extremely similar, differing > > only in whether the dirty log needs to be sync'd from hardware (x86) > > and how the TLBs are flushed. Add new arch hooks to handle sync > > and TLB flush; the sync will also be used for non-generic dirty log > > support in a future patch (s390). > > > > The ulterior motive for providing a common implementation is to > > eliminate the dependency between arch and common code with respect to > > the memslot referenced by the dirty log, i.e. to make it obvious in the > > code that the validity of the memslot is guaranteed, as a future patch > > will rework memslot handling such that id_to_memslot() can return NULL. > > I notice you add empty definitions of kvm_arch_sync_dirty_log() for > PPC, both Book E and Book 3S. Given that PPC doesn't select > CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT, why is this necessary? s390 has a non-empty kvm_arch_sync_dirty_log() but doesn't select CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT. Patch 11/13 moves s390's call of kvm_arch_sync_dirty_log() from s390's kvm_vm_ioctl_get_dirty_log() into the common (but not "generic") kvm_get_dirty_log() so that it's obvious that kvm_vm_ioctl_get_dirty_log() and kvm_get_dirty_log() are operating on the same memslot, i.e. aren't independently querying id_to_memslot(). I originally made kvm_arch_sync_dirty_log() opt-in with a __KVM_HAVE_ARCH macro, but the resulting #ifdeffery felt uglier than having PPC and ARM provide empty functions.