All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mats Petersson <mats.petersson@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: "konrad.wilk@oracle.com" <konrad.wilk@oracle.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH] Improve performance of IOCTL_PRIVCMD_MMAPBATCH_V2
Date: Wed, 21 Nov 2012 10:51:26 +0000	[thread overview]
Message-ID: <50ACB22E.4070101@citrix.com> (raw)
In-Reply-To: <50ACBB1A02000078000AA4E2@nat28.tlf.novell.com>

On 21/11/12 10:29, Jan Beulich wrote:
>>>> On 16.11.12 at 15:45, Mats Petersson <mats.petersson@citrix.com> wrote:
>> @@ -2526,12 +2540,25 @@ int xen_remap_domain_mfn_range(struct vm_area_struct *vma,
>>   		if (err)
>>   			goto out;
>>   
>> -		err = HYPERVISOR_mmu_update(mmu_update, batch, NULL, domid);
>> -		if (err < 0)
>> -			goto out;
>> +		/* We record the error for each page that gives an error, but
>> +		 * continue mapping until the whole set is done */
>> +		do {
>> +			err = HYPERVISOR_mmu_update(&mmu_update[index],
>> +						    batch_left, &done, domid);
>> +			if (err < 0) {
>> +				if (err_ptr)
>> +					err_ptr[index] = err;
> Shouldn't you increment "done" here, in order to not retry the failed
> slot immediately?

Yes, good spot - for some reason, I have double checked the behaviour of 
"done", and it returns the index of the item which gave the error, not 
actually "how many were processed".

I have rewritten this part of code for V3 of this patch, but I think it 
still requires an increment of "done" to make it work correctly.
>
>> +				else /* exit if error and no err_ptr */
>> +					goto out;
>> +			}
>> +			batch_left -= done;
>> +			index += done;
>> +		} while (batch_left);
>>   
>>   		nr -= batch;
>>   		addr += range;
>> +		if (err_ptr)
>> +			err_ptr += batch;
>>   	}
>>   
>>   	err = 0;
>> @@ -303,6 +349,8 @@ static int mmap_return_errors_v1(void *data, void *state)
>>   	return __put_user(*mfnp, st->user_mfn++);
>>   }
>>   
>> +
>> +
> ???
This is cleaned up in the V3 patch.
>>   static struct vm_operations_struct privcmd_vm_ops;
>>   
>>   static long privcmd_ioctl_mmap_batch(void __user *udata, int version)
>> @@ -319,6 +367,8 @@ static long privcmd_ioctl_mmap_batch(void __user *udata,
>> int version)
>>   	if (!xen_initial_domain())
>>   		return -EPERM;
>>   
>> +
>> +
> ???
As above.

--
Mats
> Jan
>
>>   	switch (version) {
>>   	case 1:
>>   		if (copy_from_user(&m, udata, sizeof(struct privcmd_mmapbatch)))
>
>
>

  reply	other threads:[~2012-11-21 10:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-16 14:45 [PATCH] Improve performance of IOCTL_PRIVCMD_MMAPBATCH_V2 Mats Petersson
2012-11-16 15:48 ` David Vrabel
2012-11-16 16:03   ` Mats Petersson
2012-11-21 10:29 ` Jan Beulich
2012-11-21 10:51   ` Mats Petersson [this message]
2012-11-21 10:57     ` Jan Beulich

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=50ACB22E.4070101@citrix.com \
    --to=mats.petersson@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=konrad.wilk@oracle.com \
    --cc=xen-devel@lists.xen.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 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.