From: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
To: Will Deacon <will.deacon@arm.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [PATCH 4/5] kvmtool: Save datamatch as little endian in {add,del}_event
Date: Wed, 17 Jun 2015 09:17:49 +0200 [thread overview]
Message-ID: <20150617071749.GA19051@alberich> (raw)
In-Reply-To: <20150616171713.GP30522@arm.com>
On Tue, Jun 16, 2015 at 06:17:14PM +0100, Will Deacon wrote:
> On Mon, Jun 15, 2015 at 12:49:45PM +0100, Andreas Herrmann wrote:
> > W/o dedicated endianess it's impossible to find reliably a match
> > e.g. in kernel/virt/kvm/eventfd.c ioeventfd_in_range.
>
> Hmm, but shouldn't this be the endianness of the guest, rather than just
> forcing things to little-endian?
With my patch and following adaption to
ioeventfd_in_range (in virt/kvm/eventfd.c):
switch (len) {
case 1:
_val = *(u8 *)val;
break;
case 2:
_val = le16_to_cpu(*(u16 *)val);
break;
case 4:
_val = le32_to_cpu(*(u32 *)val);
break;
case 8:
_val = le64_to_cpu(*(u64 *)val);
break;
default:
return false;
}
return _val == le64_to_cpu(p->datamatch) ? true : false;
datamatch is properly evaluated on either endianess.
The current code in ioeventfd_in_range looks fragile to me (for big
endian systems) and didn't work with kvmtool:
switch (len) {
case 1:
_val = *(u8 *)val;
break;
case 2:
_val = *(u16 *)val;
break;
case 4:
_val = *(u32 *)val;
break;
case 8:
_val = *(u64 *)val;
break;
default:
return false;
}
return _val == p->datamatch ? true : false;
But now I see, w/o a correponding kernel change the patch shouldn't
be merged.
Andreas
next prev parent reply other threads:[~2015-06-17 7:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-15 11:49 [PATCH 0/5] kvmtool: Misc fixes Andreas Herrmann
2015-06-15 11:49 ` [PATCH 1/5] kvmtool: Fix compile error on MIPS Andreas Herrmann
2015-06-15 11:49 ` [PATCH 2/5] kvmtool: Fix regression introduced with d2a7ddff4 Andreas Herrmann
2015-06-15 11:49 ` [PATCH 3/5] kvmtool: Register each guest memory bank as vhost_memory_region Andreas Herrmann
2015-06-15 11:49 ` [PATCH 4/5] kvmtool: Save datamatch as little endian in {add,del}_event Andreas Herrmann
2015-06-16 17:17 ` Will Deacon
2015-06-17 7:17 ` Andreas Herrmann [this message]
2015-06-17 10:03 ` Will Deacon
2015-06-15 11:49 ` [PATCH 5/5] kvmtool: Fix length of ioevent for VIRTIO_PCI_QUEUE_NOTIFY Andreas Herrmann
2015-06-16 17:29 ` [PATCH 0/5] kvmtool: Misc fixes Will Deacon
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=20150617071749.GA19051@alberich \
--to=andreas.herrmann@caviumnetworks.com \
--cc=kvm@vger.kernel.org \
--cc=will.deacon@arm.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 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.