public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Douglas Freimuth <freimuth@linux.ibm.com>
To: Claudio Imbrenda <imbrenda@linux.ibm.com>,
	Matthew Rosato <mjrosato@linux.ibm.com>
Cc: borntraeger@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 v4 1/3] KVM: s390: Add map/unmap ioctl and clean mappings post-guest
Date: Tue, 5 May 2026 13:21:40 -0400	[thread overview]
Message-ID: <d989de34-f41b-4164-96d0-840bb999e628@linux.ibm.com> (raw)
In-Reply-To: <20260430173106.1da375d8@p-imbrenda>



On 4/30/26 11:31 AM, Claudio Imbrenda wrote:
> On Wed, 29 Apr 2026 10:44:51 -0400
> Matthew Rosato <mjrosato@linux.ibm.com> wrote:
> 
> [...]
> 
>>
>>> +		if (locked)
>>> +			mmap_read_unlock(mm);
>>> +		mmput(mm);
>>> +	}
>>> +
>>> +	return page;
>>> +}
>>> +
>>> +static int kvm_s390_adapter_map(struct kvm *kvm, unsigned int id, __u64 addr)
>>> +{
>>> +	struct s390_io_adapter *adapter = get_io_adapter(kvm, id);
>>> +	struct s390_map_info *map;
>>> +	unsigned long flags;
>>> +	__u64 host_addr;
>>> +	int ret, idx;
>>> +
>>> +	if (!adapter || !addr)
>>> +		return -EINVAL;
>>> +
>>> +	map = kzalloc_obj(*map, GFP_KERNEL_ACCOUNT);
>>> +	if (!map)
>>> +		return -ENOMEM;
>>> +
>>> +	INIT_LIST_HEAD(&map->list);
>>> +	idx = srcu_read_lock(&kvm->srcu);
>>> +	host_addr = gpa_to_hva(kvm, addr);
>>> +	if (kvm_is_error_hva(host_addr)) {
>>> +		srcu_read_unlock(&kvm->srcu, idx);
>>> +		kfree(map);
>>
>> Drop this kfree(), you already do this when you goto out
> 
> have you considered using __free(kvfree) and let the compiler free map
> for you automatically? (or it doesn't work here?)
> 
> [...]

Claudio good suggestion to consider, thank you. At this stage I will 
consider it for follow-on including looking at how you have used in 
other parts of the kernel. And will consider for new projects too.

  reply	other threads:[~2026-05-05 17:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-23 23:53 [PATCH v4 0/3] KVM: s390: Introducing kvm_arch_set_irq_inatomic Fast Inject Douglas Freimuth
2026-04-23 23:53 ` [PATCH v4 1/3] KVM: s390: Add map/unmap ioctl and clean mappings post-guest Douglas Freimuth
2026-04-29 14:44   ` Matthew Rosato
2026-04-30 15:31     ` Claudio Imbrenda
2026-05-05 17:21       ` Douglas Freimuth [this message]
2026-04-30 20:10     ` Matthew Rosato
2026-04-30 21:05     ` Douglas Freimuth
2026-04-23 23:53 ` [PATCH v4 2/3] KVM: s390: Enable adapter_indicators_set to use mapped pages Douglas Freimuth
2026-04-23 23:53 ` [PATCH v4 3/3] KVM: s390: Introducing kvm_arch_set_irq_inatomic fast inject Douglas Freimuth
2026-04-29 16:11   ` Matthew Rosato
2026-05-04 13:21     ` Douglas Freimuth

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=d989de34-f41b-4164-96d0-840bb999e628@linux.ibm.com \
    --to=freimuth@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=david@kernel.org \
    --cc=frankja@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=mjrosato@linux.ibm.com \
    --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