public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Rosato <mjrosato@linux.ibm.com>
To: Heiko Carstens <hca@linux.ibm.com>
Cc: joro@8bytes.org, will@kernel.org, robin.murphy@arm.com,
	gerald.schaefer@linux.ibm.com, schnelle@linux.ibm.com,
	gor@linux.ibm.com, agordeev@linux.ibm.com, svens@linux.ibm.com,
	borntraeger@linux.ibm.com, clg@redhat.com, iommu@lists.linux.dev,
	linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Subject: Re: [PATCH v4 5/5] iommu/s390: allow larger region tables
Date: Tue, 1 Apr 2025 10:08:20 -0400	[thread overview]
Message-ID: <12f7109f-5375-4301-ac69-077761a0106f@linux.ibm.com> (raw)
In-Reply-To: <20250401091115.7691Bd6-hca@linux.ibm.com>

On 4/1/25 5:11 AM, Heiko Carstens wrote:
> On Mon, Mar 31, 2025 at 04:21:59PM -0400, Matthew Rosato wrote:
>> Extend the aperture calculation to consider sizes beyond the maximum
>> size of a region third table.  Attempt to always use the smallest
>> table size possible to avoid unnecessary extra steps during translation.
>> Update reserved region calculations to use the appropriate table size.
>>
>> Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
>> ---
>>  arch/s390/include/asm/pci_dma.h |  1 +
>>  drivers/iommu/s390-iommu.c      | 71 ++++++++++++++++++++++++---------
>>  2 files changed, 53 insertions(+), 19 deletions(-)
> 
> ...
> 
>> +	spin_lock_irqsave(&zdev->dom_lock, flags);
>> +	if (zdev->s390_domain->type == IOMMU_DOMAIN_BLOCKED ||
>> +	    zdev->s390_domain->type == IOMMU_DOMAIN_IDENTITY)
>> +		goto out;
>> +
>> +	s390_domain = to_s390_domain(zdev->s390_domain);
>> +	if (zdev->end_dma < max_tbl_size(s390_domain)) {
>> +		end_resv = max_tbl_size(s390_domain) - zdev->end_dma;
>> +		region = iommu_alloc_resv_region(zdev->end_dma + 1, end_resv,
>> +						 0, IOMMU_RESV_RESERVED,
>> +						 GFP_KERNEL);
> 
> GFP_KERNEL allocation while holding a spinlock is not correct.

Looks like I broke this in v3 -- Thanks for catching it.  There's no need to hold this spinlock for as long as we do here, including over the allocation itself; I will re-arrange so we can safely use GFP_KERNEL here.  


      reply	other threads:[~2025-04-01 14:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-31 20:21 [PATCH v4 0/5] iommu/s390: support additional table regions Matthew Rosato
2025-03-31 20:21 ` [PATCH v4 1/5] iommu/s390: set appropriate IOTA region type Matthew Rosato
2025-03-31 20:21 ` [PATCH v4 2/5] iommu/s390: support cleanup of additional table regions Matthew Rosato
2025-03-31 20:21 ` [PATCH v4 3/5] iommu/s390: support iova_to_phys for " Matthew Rosato
2025-03-31 20:21 ` [PATCH v4 4/5] iommu/s390: support map/unmap " Matthew Rosato
2025-03-31 20:21 ` [PATCH v4 5/5] iommu/s390: allow larger region tables Matthew Rosato
2025-04-01  9:11   ` Heiko Carstens
2025-04-01 14:08     ` Matthew Rosato [this message]

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=12f7109f-5375-4301-ac69-077761a0106f@linux.ibm.com \
    --to=mjrosato@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=clg@redhat.com \
    --cc=gerald.schaefer@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=schnelle@linux.ibm.com \
    --cc=svens@linux.ibm.com \
    --cc=will@kernel.org \
    /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