From: Blue Swirl <blauwirbel@gmail.com> To: Anthony Liguori <anthony@codemonkey.ws> Cc: kvm@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>, Michael Tokarev <mjt@tls.msk.ru>, qemu-devel@nongnu.org, Alex Williamson <alex.williamson@redhat.com>, Jan Kiszka <jan.kiszka@web.de>, Avi Kivity <avi@redhat.com> Subject: Re: [PATCH 4/4] kvm: i386: Add classic PCI device assignment Date: Sat, 1 Sep 2012 09:20:21 +0000 [thread overview] Message-ID: <CAAu8pHueSeuNHoOYQx42gKkp5DpV2ij=+Sj=jtKxsrVHK_ZZEg@mail.gmail.com> (raw) In-Reply-To: <87d32a3csy.fsf@codemonkey.ws> On Tue, Aug 28, 2012 at 9:51 PM, Anthony Liguori <anthony@codemonkey.ws> wrote: > Blue Swirl <blauwirbel@gmail.com> writes: > >> On Tue, Aug 28, 2012 at 7:31 PM, Anthony Liguori <anthony@codemonkey.ws> wrote: >>> Blue Swirl <blauwirbel@gmail.com> writes: >>> >>>> On Tue, Aug 28, 2012 at 5:28 PM, Michael S. Tsirkin <mst@redhat.com> wrote: >>>>> On Tue, Aug 28, 2012 at 05:01:55PM +0000, Blue Swirl wrote: >>>>>> On Tue, Aug 28, 2012 at 7:35 AM, Michael Tokarev <mjt@tls.msk.ru> wrote: >>>>>> > On 27.08.2012 22:56, Blue Swirl wrote: >>>>>> > [] >>>>>> >>> +static uint32_t slow_bar_readb(void *opaque, target_phys_addr_t addr) >>>>>> >>> +{ >>>>>> >>> + AssignedDevRegion *d = opaque; >>>>>> >>> + uint8_t *in = d->u.r_virtbase + addr; >>>>>> >> >>>>>> >> Don't perform arithmetic with void pointers. >>>>>> > >>>>>> > There are a few places in common qemu code which does this for a very >>>>>> > long time. So I guess it is safe now. >>>>>> >>>>>> It's a non-standard GCC extension. >>>>> >>>>> So? We use many other GCC extensions. grep for typeof. >>>> >>>> Dependencies should not be introduced trivially. In this case, it's >>>> pretty easy to avoid void pointer arithmetic as Jan's next version >>>> shows. >>> >>> The standard is vague with respect void arithmetic. Most compilers >>> allow it. A very good analysis of the standard can be found below. >>> >>> http://stackoverflow.com/questions/3523145/pointer-arithmetic-for-void-pointer-in-c >> >> The analysis would seem to show that arithmetic may be acceptable, but >> it doesn't say that void pointers must be treated like char pointers. >> In my view, this would make sense: >> >> char *cptr; >> void *vptr; >> >> Since >> cptr++; >> is equivalent to >> cptr = (char *)((uintptr_t)cptr + sizeof(*cptr)); >> >> therefore >> >> vptr++; >> should be equivalent to >> vptr = (void *)((uintptr_t)vptr + sizeof(*vptr)); >> That is, vptr++ should be equivalent to vptr += 0 because sizeof(void) >> should be 0 if allowed. > > sizeof(void) == 1 > > With GCC at least. It's not valid C (0 is just how I think it should be if allowed). Also GCC can reject it even with std=gnu89 (default, C89 with GNU extensions): $ cat void.c unsigned long x = sizeof(void); $ gcc -pedantic void.c -c void.c:1: warning: invalid application of 'sizeof' to a void type > Regards, > > Anthony Liguori > >>> >>> Regards, >>> >>> Anthony Liguori >>> >>>> >>>>> >>>>> Is there a work in progress to build GCC with visual studio? >>>>> If yes what are the chances KVM device assignment >>>>> will work on windows? >>>> >>>> IIRC there was really a project to use KVM on Windows and another >>>> project to build QEMU with MSVC. >>>> >>>>> >>>>> Look QEMU codebase is what it is. Unless you rework all existing >>>>> code to confirm to your taste, I do not see why you NACK valid new code >>>>> unless it confirms to same. >>>> >>>> Yes, I'd be happy to fix the style with huge patches at once. But our >>>> fearless leader does not agree, so we are stuck with the codebase >>>> being what it is until it is fixed one step at a time. >>>> >>>>> >>>>>> > >>>>>> > /mjt >>>> -- >>>> To unsubscribe from this list: send the line "unsubscribe kvm" in >>>> the body of a message to majordomo@vger.kernel.org >>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Blue Swirl <blauwirbel@gmail.com> To: Anthony Liguori <anthony@codemonkey.ws> Cc: kvm@vger.kernel.org, "Michael S. Tsirkin" <mst@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>, Michael Tokarev <mjt@tls.msk.ru>, qemu-devel@nongnu.org, Alex Williamson <alex.williamson@redhat.com>, Jan Kiszka <jan.kiszka@web.de>, Avi Kivity <avi@redhat.com> Subject: Re: [Qemu-devel] [PATCH 4/4] kvm: i386: Add classic PCI device assignment Date: Sat, 1 Sep 2012 09:20:21 +0000 [thread overview] Message-ID: <CAAu8pHueSeuNHoOYQx42gKkp5DpV2ij=+Sj=jtKxsrVHK_ZZEg@mail.gmail.com> (raw) In-Reply-To: <87d32a3csy.fsf@codemonkey.ws> On Tue, Aug 28, 2012 at 9:51 PM, Anthony Liguori <anthony@codemonkey.ws> wrote: > Blue Swirl <blauwirbel@gmail.com> writes: > >> On Tue, Aug 28, 2012 at 7:31 PM, Anthony Liguori <anthony@codemonkey.ws> wrote: >>> Blue Swirl <blauwirbel@gmail.com> writes: >>> >>>> On Tue, Aug 28, 2012 at 5:28 PM, Michael S. Tsirkin <mst@redhat.com> wrote: >>>>> On Tue, Aug 28, 2012 at 05:01:55PM +0000, Blue Swirl wrote: >>>>>> On Tue, Aug 28, 2012 at 7:35 AM, Michael Tokarev <mjt@tls.msk.ru> wrote: >>>>>> > On 27.08.2012 22:56, Blue Swirl wrote: >>>>>> > [] >>>>>> >>> +static uint32_t slow_bar_readb(void *opaque, target_phys_addr_t addr) >>>>>> >>> +{ >>>>>> >>> + AssignedDevRegion *d = opaque; >>>>>> >>> + uint8_t *in = d->u.r_virtbase + addr; >>>>>> >> >>>>>> >> Don't perform arithmetic with void pointers. >>>>>> > >>>>>> > There are a few places in common qemu code which does this for a very >>>>>> > long time. So I guess it is safe now. >>>>>> >>>>>> It's a non-standard GCC extension. >>>>> >>>>> So? We use many other GCC extensions. grep for typeof. >>>> >>>> Dependencies should not be introduced trivially. In this case, it's >>>> pretty easy to avoid void pointer arithmetic as Jan's next version >>>> shows. >>> >>> The standard is vague with respect void arithmetic. Most compilers >>> allow it. A very good analysis of the standard can be found below. >>> >>> http://stackoverflow.com/questions/3523145/pointer-arithmetic-for-void-pointer-in-c >> >> The analysis would seem to show that arithmetic may be acceptable, but >> it doesn't say that void pointers must be treated like char pointers. >> In my view, this would make sense: >> >> char *cptr; >> void *vptr; >> >> Since >> cptr++; >> is equivalent to >> cptr = (char *)((uintptr_t)cptr + sizeof(*cptr)); >> >> therefore >> >> vptr++; >> should be equivalent to >> vptr = (void *)((uintptr_t)vptr + sizeof(*vptr)); >> That is, vptr++ should be equivalent to vptr += 0 because sizeof(void) >> should be 0 if allowed. > > sizeof(void) == 1 > > With GCC at least. It's not valid C (0 is just how I think it should be if allowed). Also GCC can reject it even with std=gnu89 (default, C89 with GNU extensions): $ cat void.c unsigned long x = sizeof(void); $ gcc -pedantic void.c -c void.c:1: warning: invalid application of 'sizeof' to a void type > Regards, > > Anthony Liguori > >>> >>> Regards, >>> >>> Anthony Liguori >>> >>>> >>>>> >>>>> Is there a work in progress to build GCC with visual studio? >>>>> If yes what are the chances KVM device assignment >>>>> will work on windows? >>>> >>>> IIRC there was really a project to use KVM on Windows and another >>>> project to build QEMU with MSVC. >>>> >>>>> >>>>> Look QEMU codebase is what it is. Unless you rework all existing >>>>> code to confirm to your taste, I do not see why you NACK valid new code >>>>> unless it confirms to same. >>>> >>>> Yes, I'd be happy to fix the style with huge patches at once. But our >>>> fearless leader does not agree, so we are stuck with the codebase >>>> being what it is until it is fixed one step at a time. >>>> >>>>> >>>>>> > >>>>>> > /mjt >>>> -- >>>> To unsubscribe from this list: send the line "unsubscribe kvm" in >>>> the body of a message to majordomo@vger.kernel.org >>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2012-09-01 9:20 UTC|newest] Thread overview: 146+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-08-27 6:28 [PATCH 0/4] uq/master: Add classic PCI device assignment Jan Kiszka 2012-08-27 6:28 ` [Qemu-devel] " Jan Kiszka 2012-08-27 6:28 ` [PATCH 1/4] kvm: Introduce kvm_irqchip_update_msi_route Jan Kiszka 2012-08-27 6:28 ` [Qemu-devel] " Jan Kiszka 2012-08-27 6:28 ` [PATCH 2/4] kvm: Introduce kvm_has_intx_set_mask Jan Kiszka 2012-08-27 6:28 ` [Qemu-devel] " Jan Kiszka 2012-08-27 6:28 ` [PATCH 3/4] kvm: i386: Add services required for PCI device assignment Jan Kiszka 2012-08-27 6:28 ` [Qemu-devel] " Jan Kiszka 2012-08-27 6:28 ` [PATCH 4/4] kvm: i386: Add classic " Jan Kiszka 2012-08-27 6:28 ` [Qemu-devel] " Jan Kiszka 2012-08-27 12:07 ` Andreas Färber 2012-08-27 12:07 ` Andreas Färber 2012-08-27 12:15 ` Jan Kiszka 2012-08-27 12:15 ` [Qemu-devel] " Jan Kiszka 2012-08-28 21:26 ` Peter Maydell 2012-08-28 21:26 ` [Qemu-devel] " Peter Maydell 2012-08-29 8:47 ` Jan Kiszka 2012-08-29 8:47 ` [Qemu-devel] " Jan Kiszka 2012-08-29 8:49 ` Peter Maydell 2012-08-29 8:49 ` Peter Maydell 2012-08-29 8:50 ` Jan Kiszka 2012-08-29 8:50 ` Jan Kiszka 2012-09-03 15:59 ` Avi Kivity 2012-09-03 15:59 ` Avi Kivity 2012-09-04 3:31 ` Alex Williamson 2012-09-04 3:31 ` [Qemu-devel] " Alex Williamson 2012-08-28 12:57 ` Anthony Liguori 2012-08-28 12:57 ` Anthony Liguori 2012-08-29 14:08 ` Andreas Färber 2012-08-29 14:08 ` Andreas Färber 2012-08-29 18:32 ` Anthony Liguori 2012-08-29 18:32 ` [Qemu-devel] " Anthony Liguori 2012-09-04 21:00 ` Anthony Liguori 2012-09-04 21:00 ` [Qemu-devel] " Anthony Liguori 2012-09-05 15:26 ` Avi Kivity 2012-09-05 15:26 ` [Qemu-devel] " Avi Kivity 2012-09-05 15:29 ` Michael S. Tsirkin 2012-09-05 15:29 ` Michael S. Tsirkin 2012-09-05 15:41 ` Anthony Liguori 2012-09-05 15:41 ` Anthony Liguori 2012-09-05 15:52 ` Avi Kivity 2012-09-05 15:52 ` Avi Kivity 2012-09-05 19:04 ` Blue Swirl 2012-09-05 19:04 ` Blue Swirl 2012-09-05 19:22 ` Anthony Liguori 2012-09-05 19:22 ` Anthony Liguori 2012-09-05 19:38 ` Blue Swirl 2012-09-05 19:38 ` Blue Swirl 2012-09-05 20:46 ` Anthony Liguori 2012-09-05 20:46 ` [Qemu-devel] " Anthony Liguori 2012-09-10 15:33 ` Andreas Färber 2012-09-10 15:33 ` Andreas Färber 2012-09-06 3:42 ` [Qemu-ppc] " Alexander Graf 2012-09-06 3:42 ` [Qemu-devel] [Qemu-ppc] " Alexander Graf 2012-09-08 7:54 ` [Qemu-ppc] [Qemu-devel] " Blue Swirl 2012-09-08 7:54 ` [Qemu-devel] [Qemu-ppc] " Blue Swirl 2012-09-05 19:24 ` Eric Blake 2012-09-05 19:24 ` [Qemu-devel] " Eric Blake 2012-09-05 19:43 ` Blue Swirl 2012-09-05 19:43 ` Blue Swirl 2012-09-06 8:44 ` Avi Kivity 2012-09-06 8:44 ` Avi Kivity 2012-09-08 8:06 ` Blue Swirl 2012-09-08 8:06 ` [Qemu-devel] " Blue Swirl 2012-09-08 9:28 ` [Qemu-ppc] " Alexander Graf 2012-09-08 9:28 ` [Qemu-devel] " Alexander Graf 2012-09-08 10:16 ` [Qemu-ppc] [Qemu-devel] " Blue Swirl 2012-09-08 10:16 ` [Qemu-devel] [Qemu-ppc] " Blue Swirl 2012-09-08 12:13 ` Alexander Graf 2012-09-08 12:13 ` [Qemu-devel] " Alexander Graf 2012-09-08 12:30 ` Blue Swirl 2012-09-08 12:30 ` [Qemu-devel] " Blue Swirl 2012-09-08 14:59 ` Alexander Graf 2012-09-08 14:59 ` [Qemu-devel] " Alexander Graf 2012-08-27 18:56 ` Blue Swirl 2012-08-27 18:56 ` [Qemu-devel] " Blue Swirl 2012-08-27 19:01 ` Michael S. Tsirkin 2012-08-27 19:01 ` Michael S. Tsirkin 2012-08-27 19:06 ` Blue Swirl 2012-08-27 19:06 ` [Qemu-devel] " Blue Swirl 2012-08-28 0:30 ` Jan Kiszka 2012-08-28 0:30 ` Jan Kiszka 2012-09-03 16:06 ` Avi Kivity 2012-09-03 16:06 ` Avi Kivity 2012-08-28 7:35 ` Michael Tokarev 2012-08-28 7:35 ` Michael Tokarev 2012-08-28 17:01 ` Blue Swirl 2012-08-28 17:01 ` Blue Swirl 2012-08-28 17:28 ` Michael S. Tsirkin 2012-08-28 17:28 ` Michael S. Tsirkin 2012-08-28 17:38 ` Blue Swirl 2012-08-28 17:38 ` Blue Swirl 2012-08-28 19:31 ` Anthony Liguori 2012-08-28 19:31 ` [Qemu-devel] " Anthony Liguori 2012-08-28 19:49 ` malc 2012-08-28 19:49 ` [Qemu-devel] " malc 2012-08-28 20:06 ` Blue Swirl 2012-08-28 20:06 ` Blue Swirl 2012-08-28 21:51 ` Anthony Liguori 2012-08-28 21:51 ` Anthony Liguori 2012-09-01 9:20 ` Blue Swirl [this message] 2012-09-01 9:20 ` Blue Swirl 2012-08-29 8:27 ` Markus Armbruster 2012-08-29 8:27 ` [Qemu-devel] " Markus Armbruster 2012-09-03 16:14 ` Avi Kivity 2012-09-03 16:14 ` [Qemu-devel] " Avi Kivity 2012-09-03 19:32 ` Blue Swirl 2012-09-03 19:32 ` [Qemu-devel] " Blue Swirl 2012-09-04 8:32 ` Avi Kivity 2012-09-04 8:32 ` Avi Kivity 2012-09-04 19:27 ` Blue Swirl 2012-09-04 19:27 ` Blue Swirl 2012-09-04 21:28 ` Michael S. Tsirkin 2012-09-04 21:28 ` [Qemu-devel] " Michael S. Tsirkin 2012-09-05 19:09 ` Blue Swirl 2012-09-05 19:09 ` Blue Swirl 2012-08-28 11:02 ` [PATCH v2 " Jan Kiszka 2012-08-28 11:02 ` [Qemu-devel] " Jan Kiszka 2012-08-28 21:49 ` Michael S. Tsirkin 2012-08-28 21:49 ` [Qemu-devel] " Michael S. Tsirkin 2012-08-29 8:44 ` Jan Kiszka 2012-08-29 8:44 ` [Qemu-devel] " Jan Kiszka 2012-08-29 10:35 ` Michael S. Tsirkin 2012-08-29 10:35 ` [Qemu-devel] " Michael S. Tsirkin 2012-08-30 18:30 ` [PATCH v3 " Jan Kiszka 2012-08-30 18:30 ` [Qemu-devel] " Jan Kiszka 2012-09-06 8:44 ` Jan Kiszka 2012-09-06 8:44 ` [Qemu-devel] " Jan Kiszka 2012-09-06 8:49 ` Michael S. Tsirkin 2012-09-06 8:49 ` [Qemu-devel] " Michael S. Tsirkin 2012-09-06 16:06 ` Andreas Färber 2012-09-06 16:06 ` [Qemu-devel] " Andreas Färber 2012-09-06 16:16 ` Jan Kiszka 2012-09-06 16:16 ` [Qemu-devel] " Jan Kiszka 2012-09-08 7:55 ` Blue Swirl 2012-09-08 7:55 ` [Qemu-devel] " Blue Swirl 2012-09-09 14:13 ` Avi Kivity 2012-09-09 14:13 ` [Qemu-devel] " Avi Kivity 2012-09-10 9:26 ` Jan Kiszka 2012-09-10 9:26 ` [Qemu-devel] " Jan Kiszka 2012-09-10 12:30 ` Avi Kivity 2012-09-10 12:30 ` [Qemu-devel] " Avi Kivity 2012-08-28 15:04 ` [PATCH " Michael S. Tsirkin 2012-08-28 15:04 ` [Qemu-devel] " Michael S. Tsirkin 2012-08-29 10:50 ` Jan Kiszka 2012-08-29 10:50 ` [Qemu-devel] " Jan Kiszka
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='CAAu8pHueSeuNHoOYQx42gKkp5DpV2ij=+Sj=jtKxsrVHK_ZZEg@mail.gmail.com' \ --to=blauwirbel@gmail.com \ --cc=alex.williamson@redhat.com \ --cc=anthony@codemonkey.ws \ --cc=avi@redhat.com \ --cc=jan.kiszka@web.de \ --cc=kvm@vger.kernel.org \ --cc=mjt@tls.msk.ru \ --cc=mst@redhat.com \ --cc=mtosatti@redhat.com \ --cc=qemu-devel@nongnu.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: linkBe 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.