mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Rosato <mjrosato@linux.ibm.com>
To: Douglas Freimuth <freimuth@linux.ibm.com>,
	borntraeger@linux.ibm.com, imbrenda@linux.ibm.com,
	frankja@linux.ibm.com, david@kernel.org, hca@linux.ibm.com,
	gor@linux.ibm.com, agordeev@linux.ibm.com, svens@linux.ibm.com,
	kvm@vger.kernel.org, linux-s390@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v8 1/3] KVM: s390: Add map/unmap ioctl and clean mappings post-guest
Date: Thu, 28 May 2026 09:52:41 -0400	[thread overview]
Message-ID: <7891b20d-0eef-49f7-8d3c-bf7bb16b49e4@linux.ibm.com> (raw)
In-Reply-To: <20260526015323.207343-2-freimuth@linux.ibm.com>

On 5/25/26 9:53 PM, Douglas Freimuth wrote:
> s390 needs map/unmap ioctls, which map the adapter set
> indicator pages, so the pages can be accessed when interrupts are
> disabled. The mappings are cleaned up when the guest is removed.
> pin_user_pages_remote is used for both the ioctl as well
> as the pin-on-demand logic in adapter_indicators_set().
> 
> Map/Unmap ioctls are fenced in order to avoid the longterm pinning
> in Secure Execution environments. In Secure Execution
> environments the path of execution available before this patch is followed.
> 
> Statistical counters to count map/unmap functions for adapter indicator
> pages are added. The counters can be used to analyze
> map/unmap functions in non-Secure Execution environments and similarly
> can be used to analyze Secure Execution environments where the counters
> will not be incremented as the adapter indicator pages are not mapped.
> 
> Signed-off-by: Douglas Freimuth <freimuth@linux.ibm.com>

I gave you a reviewed-by tag on v7 with the caveat that you move the kvm
lock earlier in register_io_adapter (which you did) so that review tag
should have been included with this patch.  Please include it in next version
or it will get lost.



> @@ -2412,6 +2412,7 @@ static int register_io_adapter(struct kvm_device *dev,
>  	struct s390_io_adapter *adapter;
>  	struct kvm_s390_io_adapter adapter_info;
>  
> +	mutex_lock(&dev->kvm->lock);
>  	if (copy_from_user(&adapter_info,
>  			   (void __user *)attr->addr, sizeof(adapter_info)))
>  		return -EFAULT;
That said...  
Please also handle the sashiko comment for this patch, you moved the kvm lock
earlier like I requested but that means now all of the nonzero return paths
have to drop it before returning, the above is just one example.  

Sounds like a case for either using guard(mutex) [1] or something like

int rc = 0;
if (bad_things_happen) {
  rc = -WHATEVER;
  goto out;
}
[...]
out:
   mutex_unlock(&dev->kvm->lock);
   return rc;

[1]: https://lwn.net/Articles/934679/

  reply	other threads:[~2026-05-28 13:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26  1:53 [PATCH v8 0/3] KVM: s390: Introducing kvm_arch_set_irq_inatomic Fast Inject Douglas Freimuth
2026-05-26  1:53 ` [PATCH v8 1/3] KVM: s390: Add map/unmap ioctl and clean mappings post-guest Douglas Freimuth
2026-05-28 13:52   ` Matthew Rosato [this message]
2026-05-26  1:53 ` [PATCH v8 2/3] KVM: s390: Enable adapter_indicators_set to use mapped pages Douglas Freimuth
2026-05-28 13:57   ` Matthew Rosato
2026-05-26  1:53 ` [PATCH v8 3/3] KVM: s390: Introducing kvm_arch_set_irq_inatomic fast inject Douglas Freimuth
2026-05-28 16:06   ` Matthew Rosato

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=7891b20d-0eef-49f7-8d3c-bf7bb16b49e4@linux.ibm.com \
    --to=mjrosato@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=david@kernel.org \
    --cc=frankja@linux.ibm.com \
    --cc=freimuth@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=svens@linux.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome