Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1222624
| From | Cornelia Huck <cornelia.huck@de.ibm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH V4 3/4] kvm: fix zero length mmio searching |
| Date | 2015-09-11 10:40 +0200 |
| Message-ID | <q7s2e-4Hu-25@gated-at.bofh.it> (permalink) |
| References | <q7n2x-645-3@gated-at.bofh.it> <q7n2y-645-11@gated-at.bofh.it> <q7rSy-4w9-19@gated-at.bofh.it> |
| Organization | IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Martina Koederitz Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294 |
On Fri, 11 Sep 2015 10:26:41 +0200
Paolo Bonzini <pbonzini@redhat.com> wrote:
> On 11/09/2015 05:17, Jason Wang wrote:
> > + int len = r2->len ? r1->len : 0;
> > +
> > if (r1->addr < r2->addr)
> > return -1;
> > - if (r1->addr + r1->len > r2->addr + r2->len)
> > + if (r1->addr + len > r2->addr + r2->len)
> > return 1;
>
> Perhaps better:
>
> gpa_t addr1 = r1->addr;
> gpa_t addr2 = r2->addr;
>
> if (addr1 < addr2)
> return -1;
>
> /* If r2->len == 0, match the exact address. If r2->len != 0,
> * accept any overlapping write. Any order is acceptable for
> * overlapping ranges, because kvm_io_bus_get_first_dev ensures
> * we process all of them.
> */
> if (r2->len) {
> addr1 += r1->len;
> addr2 += r2->len;
> }
>
> if (addr1 > addr2)
> return 1;
>
> return 0;
>
+1 to documenting what the semantics are :)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH V4 0/4] Fast MMIO eventfd fixes Jason Wang <jasowang@redhat.com> - 2015-09-11 05:20 +0200
[PATCH V4 3/4] kvm: fix zero length mmio searching Jason Wang <jasowang@redhat.com> - 2015-09-11 05:20 +0200
Re: [PATCH V4 3/4] kvm: fix zero length mmio searching Paolo Bonzini <pbonzini@redhat.com> - 2015-09-11 10:30 +0200
Re: [PATCH V4 3/4] kvm: fix zero length mmio searching Cornelia Huck <cornelia.huck@de.ibm.com> - 2015-09-11 10:40 +0200
Re: [PATCH V4 3/4] kvm: fix zero length mmio searching Jason Wang <jasowang@redhat.com> - 2015-09-11 11:30 +0200
Re: [PATCH V4 0/4] Fast MMIO eventfd fixes "Michael S. Tsirkin" <mst@redhat.com> - 2015-09-11 10:20 +0200
Re: [PATCH V4 0/4] Fast MMIO eventfd fixes Paolo Bonzini <pbonzini@redhat.com> - 2015-09-11 10:40 +0200
Re: [PATCH V4 0/4] Fast MMIO eventfd fixes Jason Wang <jasowang@redhat.com> - 2015-09-11 11:30 +0200
Re: [PATCH V4 0/4] Fast MMIO eventfd fixes "Michael S. Tsirkin" <mst@redhat.com> - 2015-09-13 11:00 +0200
Re: [PATCH V4 0/4] Fast MMIO eventfd fixes "Michael S. Tsirkin" <mst@redhat.com> - 2015-09-13 11:00 +0200
csiph-web