From: Janosch Frank <frankja@linux.ibm.com>
To: David Hildenbrand <david@redhat.com>,
Janis Schoetterl-Glausch <scgl@linux.ibm.com>,
kvm@vger.kernel.org, borntraeger@de.ibm.com,
imbrenda@linux.ibm.com, Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>
Cc: cohuck@redhat.com, linux-s390@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] KVM: s390: gaccess: Cleanup access to guest frames
Date: Wed, 18 Aug 2021 10:06:31 +0200 [thread overview]
Message-ID: <584ca757-4eb4-491e-a4cd-7bc60fb04b61@linux.ibm.com> (raw)
In-Reply-To: <d11128bb-18f6-5210-6f42-74a89d8edcf7@redhat.com>
On 8/18/21 9:54 AM, David Hildenbrand wrote:
> On 16.08.21 17:07, Janis Schoetterl-Glausch wrote:
>> Introduce a helper function for guest frame access.
>> Rewrite the calculation of the gpa and the length of the segment
>> to be more readable.
>>
>> Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
[...]
>> - unsigned long _len, gpa;
>> + unsigned long gpa;
>> + unsigned int seg;
>> int rc = 0;
>>
>> while (len && !rc) {
>> gpa = kvm_s390_real_to_abs(vcpu, gra);
>> - _len = min(PAGE_SIZE - (gpa & ~PAGE_MASK), len);
>> - if (mode)
>> - rc = write_guest_abs(vcpu, gpa, data, _len);
>> - else
>> - rc = read_guest_abs(vcpu, gpa, data, _len);
>> - len -= _len;
>> - gra += _len;
>> - data += _len;
>> + seg = min(PAGE_SIZE - offset_in_page(gpa), len);
>
> What does "seg" mean? I certainly know when "len" means -- which is also
> what the function eats.
What does "_len" mean especially in contrast to "len"?
"seg" is used in the common kvm guest access functions so it's at least
consistent although I share the sentiment that it's not a great name for
the length we access inside the page.
Originally I suggested "len_in_page" if you have a better name I'd
expect we'll both be happy to discuss it :-)
>
>> + rc = access_guest_frame(vcpu->kvm, mode, gpa, data, seg);
>> + len -= seg;
>> + gra += seg;
>> + data += seg;
>> }
>> return rc;
>> }
>>
>
>
next prev parent reply other threads:[~2021-08-18 8:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-16 15:07 [PATCH 0/2] KVM: s390: Some gaccess cleanup Janis Schoetterl-Glausch
2021-08-16 15:07 ` [PATCH 1/2] KVM: s390: gaccess: Cleanup access to guest frames Janis Schoetterl-Glausch
2021-08-18 7:46 ` Janosch Frank
2021-08-18 7:54 ` David Hildenbrand
2021-08-18 8:06 ` Janosch Frank [this message]
2021-08-18 8:44 ` David Hildenbrand
2021-08-18 8:48 ` Janis Schoetterl-Glausch
2021-08-19 13:53 ` Janis Schoetterl-Glausch
2021-08-19 14:11 ` Janosch Frank
2021-08-18 9:00 ` Janis Schoetterl-Glausch
2021-08-16 15:07 ` [PATCH 2/2] KVM: s390: gaccess: Refactor access address range check Janis Schoetterl-Glausch
2021-08-18 10:08 ` Claudio Imbrenda
2021-08-19 12:39 ` Janis Schoetterl-Glausch
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=584ca757-4eb4-491e-a4cd-7bc60fb04b61@linux.ibm.com \
--to=frankja@linux.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.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=scgl@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