All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Paul Mackerras" <paulus@ozlabs.org>,
	"Christian Borntraeger" <borntraeger@de.ibm.com>,
	"Janosch Frank" <frankja@linux.ibm.com>,
	"David Hildenbrand" <david@redhat.com>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"Sean Christopherson" <sean.j.christopherson@intel.com>,
	"Vitaly Kuznetsov" <vkuznets@redhat.com>,
	"Wanpeng Li" <wanpengli@tencent.com>,
	"Jim Mattson" <jmattson@google.com>,
	"Joerg Roedel" <joro@8bytes.org>, "Marc Zyngier" <maz@kernel.org>,
	"James Morse" <james.morse@arm.com>,
	"Julien Thierry" <julien.thierry.kdev@gmail.com>,
	"Suzuki K Poulose" <suzuki.poulose@arm.com>,
	linux-mips@vger.kernel.org, kvm@vger.kernel.org,
	kvm-ppc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org,
	"Christoffer Dall" <christoffer.dall@arm.com>,
	"Peter Xu" <peterx@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: [PATCH v6 03/22] KVM: Don't free new memslot if allocation of said memslot fails
Date: Tue, 18 Feb 2020 13:07:17 -0800	[thread overview]
Message-ID: <20200218210736.16432-4-sean.j.christopherson@intel.com> (raw)
In-Reply-To: <20200218210736.16432-1-sean.j.christopherson@intel.com>

The two implementations of kvm_arch_create_memslot() in x86 and PPC are
both good citizens and free up all local resources if creation fails.
Return immediately (via a superfluous goto) instead of calling
kvm_free_memslot().

Note, the call to kvm_free_memslot() is effectively an expensive nop in
this case as there are no resources to be freed.

No functional change intended.

Acked-by: Christoffer Dall <christoffer.dall@arm.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
 virt/kvm/kvm_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index ac9c7c103453..68d5329b4ae5 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1089,7 +1089,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
 		new.userspace_addr = mem->userspace_addr;
 
 		if (kvm_arch_create_memslot(kvm, &new, npages))
-			goto out_free;
+			goto out;
 	}
 
 	/* Allocate page dirty bitmap if needed */
-- 
2.24.1


WARNING: multiple messages have this Message-ID (diff)
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Wanpeng Li" <wanpengli@tencent.com>,
	kvm@vger.kernel.org, "David Hildenbrand" <david@redhat.com>,
	linux-mips@vger.kernel.org, "Paul Mackerras" <paulus@ozlabs.org>,
	kvmarm@lists.cs.columbia.edu,
	"Janosch Frank" <frankja@linux.ibm.com>,
	"Marc Zyngier" <maz@kernel.org>, "Joerg Roedel" <joro@8bytes.org>,
	"Christian Borntraeger" <borntraeger@de.ibm.com>,
	kvm-ppc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	"Jim Mattson" <jmattson@google.com>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"Sean Christopherson" <sean.j.christopherson@intel.com>,
	linux-kernel@vger.kernel.org,
	"Vitaly Kuznetsov" <vkuznets@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: [PATCH v6 03/22] KVM: Don't free new memslot if allocation of said memslot fails
Date: Tue, 18 Feb 2020 13:07:17 -0800	[thread overview]
Message-ID: <20200218210736.16432-4-sean.j.christopherson@intel.com> (raw)
In-Reply-To: <20200218210736.16432-1-sean.j.christopherson@intel.com>

The two implementations of kvm_arch_create_memslot() in x86 and PPC are
both good citizens and free up all local resources if creation fails.
Return immediately (via a superfluous goto) instead of calling
kvm_free_memslot().

Note, the call to kvm_free_memslot() is effectively an expensive nop in
this case as there are no resources to be freed.

No functional change intended.

Acked-by: Christoffer Dall <christoffer.dall@arm.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
 virt/kvm/kvm_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index ac9c7c103453..68d5329b4ae5 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1089,7 +1089,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
 		new.userspace_addr = mem->userspace_addr;
 
 		if (kvm_arch_create_memslot(kvm, &new, npages))
-			goto out_free;
+			goto out;
 	}
 
 	/* Allocate page dirty bitmap if needed */
-- 
2.24.1

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

WARNING: multiple messages have this Message-ID (diff)
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Wanpeng Li" <wanpengli@tencent.com>,
	kvm@vger.kernel.org, "David Hildenbrand" <david@redhat.com>,
	"Peter Xu" <peterx@redhat.com>,
	linux-mips@vger.kernel.org, "Paul Mackerras" <paulus@ozlabs.org>,
	kvmarm@lists.cs.columbia.edu,
	"Janosch Frank" <frankja@linux.ibm.com>,
	"Marc Zyngier" <maz@kernel.org>, "Joerg Roedel" <joro@8bytes.org>,
	"Christian Borntraeger" <borntraeger@de.ibm.com>,
	"Julien Thierry" <julien.thierry.kdev@gmail.com>,
	"Suzuki K Poulose" <suzuki.poulose@arm.com>,
	kvm-ppc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	"Jim Mattson" <jmattson@google.com>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"Christoffer Dall" <christoffer.dall@arm.com>,
	"Sean Christopherson" <sean.j.christopherson@intel.com>,
	linux-kernel@vger.kernel.org, "James Morse" <james.morse@arm.com>,
	"Vitaly Kuznetsov" <vkuznets@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: [PATCH v6 03/22] KVM: Don't free new memslot if allocation of said memslot fails
Date: Tue, 18 Feb 2020 13:07:17 -0800	[thread overview]
Message-ID: <20200218210736.16432-4-sean.j.christopherson@intel.com> (raw)
In-Reply-To: <20200218210736.16432-1-sean.j.christopherson@intel.com>

The two implementations of kvm_arch_create_memslot() in x86 and PPC are
both good citizens and free up all local resources if creation fails.
Return immediately (via a superfluous goto) instead of calling
kvm_free_memslot().

Note, the call to kvm_free_memslot() is effectively an expensive nop in
this case as there are no resources to be freed.

No functional change intended.

Acked-by: Christoffer Dall <christoffer.dall@arm.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
 virt/kvm/kvm_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index ac9c7c103453..68d5329b4ae5 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1089,7 +1089,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
 		new.userspace_addr = mem->userspace_addr;
 
 		if (kvm_arch_create_memslot(kvm, &new, npages))
-			goto out_free;
+			goto out;
 	}
 
 	/* Allocate page dirty bitmap if needed */
-- 
2.24.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Paul Mackerras" <paulus@ozlabs.org>,
	"Christian Borntraeger" <borntraeger@de.ibm.com>,
	"Janosch Frank" <frankja@linux.ibm.com>,
	"David Hildenbrand" <david@redhat.com>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"Sean Christopherson" <sean.j.christopherson@intel.com>,
	"Vitaly Kuznetsov" <vkuznets@redhat.com>,
	"Wanpeng Li" <wanpengli@tencent.com>,
	"Jim Mattson" <jmattson@google.com>,
	"Joerg Roedel" <joro@8bytes.org>, "Marc Zyngier" <maz@kernel.org>,
	"James Morse" <james.morse@arm.com>,
	"Julien Thierry" <julien.thierry.kdev@gmail.com>,
	"Suzuki K Poulose" <suzuki.poulose@arm.com>,
	linux-mips@vger.kernel.org, kvm@vger.kernel.org,
	kvm-ppc@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org,
	"Christoffer Dall" <christoffer.dall@arm.com>,
	"Peter Xu" <peterx@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: [PATCH v6 03/22] KVM: Don't free new memslot if allocation of said memslot fails
Date: Tue, 18 Feb 2020 21:07:17 +0000	[thread overview]
Message-ID: <20200218210736.16432-4-sean.j.christopherson@intel.com> (raw)
In-Reply-To: <20200218210736.16432-1-sean.j.christopherson@intel.com>

The two implementations of kvm_arch_create_memslot() in x86 and PPC are
both good citizens and free up all local resources if creation fails.
Return immediately (via a superfluous goto) instead of calling
kvm_free_memslot().

Note, the call to kvm_free_memslot() is effectively an expensive nop in
this case as there are no resources to be freed.

No functional change intended.

Acked-by: Christoffer Dall <christoffer.dall@arm.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
 virt/kvm/kvm_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index ac9c7c103453..68d5329b4ae5 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1089,7 +1089,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
 		new.userspace_addr = mem->userspace_addr;
 
 		if (kvm_arch_create_memslot(kvm, &new, npages))
-			goto out_free;
+			goto out;
 	}
 
 	/* Allocate page dirty bitmap if needed */
-- 
2.24.1

  parent reply	other threads:[~2020-02-18 21:09 UTC|newest]

Thread overview: 111+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-18 21:07 [PATCH v6 00/22] KVM: Dynamically size memslot arrays Sean Christopherson
2020-02-18 21:07 ` Sean Christopherson
2020-02-18 21:07 ` Sean Christopherson
2020-02-18 21:07 ` Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 01/22] KVM: x86: Allocate new rmap and large page tracking when moving memslot Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-19 19:10   ` Peter Xu
2020-02-19 19:10     ` Peter Xu
2020-02-19 19:10     ` Peter Xu
2020-02-19 19:10     ` Peter Xu
2020-02-18 21:07 ` [PATCH v6 02/22] KVM: Reinstall old memslots if arch preparation fails Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07 ` Sean Christopherson [this message]
2020-02-18 21:07   ` [PATCH v6 03/22] KVM: Don't free new memslot if allocation of said memslot fails Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 04/22] KVM: PPC: Move memslot memory allocation into prepare_memory_region() Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 05/22] KVM: x86: Allocate memslot resources during prepare_memory_region() Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 06/22] KVM: Drop kvm_arch_create_memslot() Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 07/22] KVM: Explicitly free allocated-but-unused dirty bitmap Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 08/22] KVM: Refactor error handling for setting memory region Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 09/22] KVM: Move setting of memslot into helper routine Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 10/22] KVM: Drop "const" attribute from old memslot in commit_memory_region() Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 11/22] KVM: x86: Free arrays for old memslot when moving memslot's base gfn Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 12/22] KVM: Move memslot deletion to helper function Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 13/22] KVM: Simplify kvm_free_memslot() and all its descendents Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 14/22] KVM: Clean up local variable usage in __kvm_set_memory_region() Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-21 17:43   ` Paolo Bonzini
2020-02-21 17:43     ` Paolo Bonzini
2020-02-21 17:43     ` Paolo Bonzini
2020-02-21 17:43     ` Paolo Bonzini
2020-02-18 21:07 ` [PATCH v6 15/22] KVM: Provide common implementation for generic dirty log functions Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 16/22] KVM: Ensure validity of memslot with respect to kvm_get_dirty_log() Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 17/22] KVM: Terminate memslot walks via used_slots Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-21 17:47   ` Paolo Bonzini
2020-02-21 17:47     ` Paolo Bonzini
2020-02-21 17:47     ` Paolo Bonzini
2020-02-21 17:47     ` Paolo Bonzini
2020-02-18 21:07 ` [PATCH v6 18/22] KVM: Dynamically size memslot array based on number of used slots Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 19/22] KVM: selftests: Add test for KVM_SET_USER_MEMORY_REGION Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 20/22] KVM: x86/mmu: Move kvm_arch_flush_remote_tlbs_memslot() to mmu.c Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 21/22] KVM: x86/mmu: Use ranged-based TLB flush for dirty log memslot flush Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-19  9:22   ` Sergei Shtylyov
2020-02-19  9:22     ` Sergei Shtylyov
2020-02-19  9:22     ` Sergei Shtylyov
2020-02-19 15:18     ` Sean Christopherson
2020-02-19 15:18       ` Sean Christopherson
2020-02-19 15:18       ` Sean Christopherson
2020-02-19 15:18       ` Sean Christopherson
2020-02-18 21:07 ` [PATCH v6 22/22] KVM: x86/mmu: Consolidate open coded variants of memslot TLB flushes Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson
2020-02-18 21:07   ` Sean Christopherson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200218210736.16432-4-sean.j.christopherson@intel.com \
    --to=sean.j.christopherson@intel.com \
    --cc=borntraeger@de.ibm.com \
    --cc=christoffer.dall@arm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=frankja@linux.ibm.com \
    --cc=james.morse@arm.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=julien.thierry.kdev@gmail.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=paulus@ozlabs.org \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=suzuki.poulose@arm.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.