All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Peter Gonda <pgonda@google.com>
Cc: kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
	David Rientjes <rientjes@google.com>,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	Brijesh Singh <brijesh.singh@amd.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] KVM, SEV: Refactor out function for unregistering encrypted regions
Date: Tue, 13 Jul 2021 21:40:55 +0000	[thread overview]
Message-ID: <YO4IZwk0M4GoVoit@google.com> (raw)
In-Reply-To: <20210621163118.1040170-2-pgonda@google.com>

On Mon, Jun 21, 2021, Peter Gonda wrote:
> Factor out helper function for freeing the encrypted region list.

...

>  arch/x86/kvm/svm/sev.c | 26 +++++++++++++++++---------
>  1 file changed, 17 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
> index 46e339c84998..5af46ff6ec48 100644
> --- a/arch/x86/kvm/svm/sev.c
> +++ b/arch/x86/kvm/svm/sev.c
> @@ -1767,11 +1767,25 @@ int svm_vm_copy_asid_from(struct kvm *kvm, unsigned int source_fd)
>  	return ret;
>  }
>  
> +static void __unregister_region_list_locked(struct kvm *kvm,
> +					    struct list_head *mem_regions)

I don't think the underscores or the "locked" qualifier are necessary.  Unlike
__unregister_enc_region_locked(), there is no unregister_region_list() to avoid.

I'd also votes to drop "list" and instead use a plural "regions".  Without the
plural form, it's not immediately obvious that the difference is that this
helper deletes multiple regions.

Last nit, I assume these are all encrypted regions?  If so, unregister_enc_regions()
seems like the natural choice.

> +{
> +	struct enc_region *pos, *q;
> +
> +	lockdep_assert_held(&kvm->lock);

This locked (big thumbs up) is part of why I think it's a-ok to drop the "locked"
qualifier.

> +
> +	if (list_empty(mem_regions))
> +		return;
> +
> +	list_for_each_entry_safe(pos, q, mem_regions, list) {
> +		__unregister_enc_region_locked(kvm, pos);
> +		cond_resched();
> +	}
> +}

  parent reply	other threads:[~2021-07-13 21:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-21 16:31 [PATCH 0/3] Add AMD SEV and SEV-ES local migration support Peter Gonda
2021-06-21 16:31 ` [PATCH 1/3] KVM, SEV: Refactor out function for unregistering encrypted regions Peter Gonda
2021-07-12 20:05   ` Brijesh Singh
2021-07-13 21:40   ` Sean Christopherson [this message]
2021-07-13 23:18   ` Marc Orr
2021-06-21 16:31 ` [PATCH 2/3] KVM, SEV: Add support for SEV local migration Peter Gonda
2021-07-12 21:09   ` Brijesh Singh
2021-07-13 20:12     ` Peter Gonda
2021-07-13 22:12   ` Sean Christopherson
2021-07-13 23:24   ` Marc Orr
2021-06-21 16:31 ` [PATCH 3/3] KVM, SEV: Add support for SEV-ES " Peter Gonda
2021-07-13 18:41   ` Brijesh Singh
2021-07-13 22:21   ` Sean Christopherson
2021-07-13 23:25   ` Marc Orr

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=YO4IZwk0M4GoVoit@google.com \
    --to=seanjc@google.com \
    --cc=bp@alien8.de \
    --cc=brijesh.singh@amd.com \
    --cc=dgilbert@redhat.com \
    --cc=hpa@zytor.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=pgonda@google.com \
    --cc=rientjes@google.com \
    --cc=tglx@linutronix.de \
    --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.