From: Anthony Liguori <anthony@codemonkey.ws>
To: Jes Sorensen <Jes.Sorensen@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>, Alexander Graf <agraf@suse.de>,
Avi Kivity <avi@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
kvm@vger.kernel.org
Subject: Re: [PATCH kvm-unit-tests 2/4] Introduce a C++ wrapper for the kvm APIs
Date: Wed, 24 Nov 2010 10:53:14 -0600 [thread overview]
Message-ID: <4CED42FA.8040402@codemonkey.ws> (raw)
In-Reply-To: <4CED3FE6.50900@redhat.com>
On 11/24/2010 10:40 AM, Jes Sorensen wrote:
> Well the problem here is that the i8042 is in the i440fx.c file, it
> shouldn't be there in the first place. The gluing together things in
> silicon is really just a way to shorten the wires and make it easier,
> they are still separate devices and as long as the i8042 requires ISA
> access, and to be treated like an ISA device, we should glue it onto the
> virtual ISA bus within QEMU.
>
Nope. The PC is much, much uglier than everyone seems to realize.
Part of the reason the PIIX3 implements the i8042 (and the i440fx
implements the PIIX3) is because the i8042 is needed to lower the a20
line. IOW, the i8042 has to signal to the memory controller to modify
accesses to memory addresses from the CPU.
It's not just a statement of cost savings. One of the reasons
everything's in the same piece of silicon is because of the horribly
incestuous nature of the PC architecture. It's not a nice tree of
parent busses and children devices. It's an interbreeding group of
devices who's parent's are their siblings and brother's are their uncles.
>> I think it's a lot of abstraction for very little gain and leads to
>> bizarreness like treating any platform device as an ISA device.
>>
>> An RTC is *not* an ISA device. It may sit *behind* an ISA bus because
>> the SuperIO chip happens to be on the ISA bus. But on modern systems,
>> the ISA bus has disappeared in favor of the LPC but that doesn't
>> fundamentally change what the RTC is.
>>
>> The problem with what you describe is that there are far fewer devices
>> that actually sit on busses than what QEMU tries to model today.
>>
> A PCI device is mapped on a PCI bus as a PCI function etc. If the device
> is hard wired to a fixed address, or worse a fixed IO port, then it is
> an ISA device.
>
Wrong. The PCI controller sends all port and memory I/O operations
over the bus. Any PCI device can select to handle any address they want
by simply issuing a DEVSEL. The ability to do switching wasn't
introduced until PCI-X.
The way a PCI-to-ISA bridge works is by waiting for a full bus cycle to
see that no device has issued a DEVSEL, and then issuing a DEVSEL. This
is called subtractive decoding. It then forwards the I/O request over
the ISA bus and roughly the same thing happens on the ISA bus.
>>> That is if you are using code as data. With other design you actually
>>> read I440FX configuration from file and build it from smaller parts.
>>> You see C++ doesn't stop us from arguing what design is correct.
>>>
>>>
>> That's fair. I think 90% of what we need is better design. I think a
>> better language only gives us 10%.
>>
> Well the problem is the 10% you are talking about is another 30% loss
> because the code is now practically unreadable, plus you open up the can
> of worms that people will start using some of the totally broken
> features of C++.
Did you look at my code or Avi's code?
Look at my code and then tell me it's practically unreadable.
http://git.qemu.org/qemupp.git/tree/test/test-mc146818a.cpp
> Sure you can try hard to make sure they don't sneak in,
> but down the line they will, and at that point the codebase is totally
> ruined.
>
> Avi's unittest code is a perfect example of code that is unreadable for
> a C programmer. Or to quote a smart man 'the code is clear as perl!'.
> So you have now lost or at least crippled half your developer base,
> making it way harder for them to contribute something useful.
>
> This is a big step in the wrong direction :(
>
I wouldn't have written the unittest code to use classes or exceptions
at all. I don't think it's a good fit.
Regards,
Anthony Liguori
> Jes
>
next prev parent reply other threads:[~2010-11-24 16:53 UTC|newest]
Thread overview: 130+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-24 10:52 [PATCH kvm-unit-tests 0/4] API test framework Avi Kivity
2010-11-24 10:52 ` [PATCH kvm-unit-tests 1/4] Makefile: add support for C++ Avi Kivity
2010-11-24 10:52 ` [PATCH kvm-unit-tests 2/4] Introduce a C++ wrapper for the kvm APIs Avi Kivity
2010-11-24 12:59 ` Alexander Graf
2010-11-24 13:33 ` Gleb Natapov
2010-11-24 14:18 ` Anthony Liguori
2010-11-24 14:24 ` Anthony Liguori
2010-11-24 14:32 ` Avi Kivity
2010-11-24 14:31 ` Avi Kivity
2010-11-24 14:41 ` Anthony Liguori
2010-11-24 15:40 ` Gleb Natapov
2010-11-24 15:50 ` Anthony Liguori
2010-11-24 16:10 ` Avi Kivity
2010-12-02 13:52 ` Mike Day
2010-11-24 16:12 ` [PATCH kvm-unit-tests 2/4] " Gleb Natapov
2010-11-24 16:14 ` Avi Kivity
2010-11-24 16:21 ` Gleb Natapov
2010-11-24 16:25 ` Avi Kivity
2010-11-24 16:29 ` Gleb Natapov
2010-11-24 16:33 ` Avi Kivity
2010-11-24 16:52 ` Gleb Natapov
2010-11-24 16:56 ` Avi Kivity
2010-11-24 17:02 ` Gleb Natapov
2010-11-24 17:07 ` Avi Kivity
2010-11-24 17:10 ` Jes Sorensen
2010-11-24 17:12 ` Avi Kivity
2010-11-24 17:14 ` Anthony Liguori
2010-11-24 16:43 ` Anthony Liguori
2010-11-24 16:48 ` Gleb Natapov
2010-11-24 16:56 ` Anthony Liguori
2010-11-24 17:04 ` Gleb Natapov
2010-11-24 16:40 ` Anthony Liguori
2010-11-24 17:33 ` Gleb Natapov
2010-11-24 17:39 ` Avi Kivity
2010-11-24 17:41 ` Gleb Natapov
2010-11-24 17:50 ` Avi Kivity
2010-11-24 18:23 ` Gleb Natapov
2010-11-24 18:50 ` Avi Kivity
2010-11-24 18:17 ` Anthony Liguori
2010-11-24 18:34 ` Gleb Natapov
2010-11-24 18:53 ` Anthony Liguori
2010-11-25 8:35 ` Gleb Natapov
2010-11-24 16:40 ` Jes Sorensen
2010-11-24 16:47 ` Avi Kivity
2010-11-24 16:51 ` Jes Sorensen
2010-11-24 16:57 ` Anthony Liguori
2010-11-24 17:29 ` Avi Kivity
2010-11-24 16:59 ` Avi Kivity
2010-11-24 17:06 ` Jes Sorensen
2010-11-24 17:11 ` Avi Kivity
2010-11-24 17:17 ` Jes Sorensen
2010-11-24 17:25 ` Avi Kivity
2010-11-24 17:28 ` Jes Sorensen
2010-11-24 17:31 ` Avi Kivity
2010-11-24 17:36 ` Gleb Natapov
2010-11-24 17:41 ` Avi Kivity
2010-11-24 17:27 ` Anthony Liguori
2010-11-24 17:35 ` Avi Kivity
2010-11-24 17:36 ` Jes Sorensen
2010-11-24 17:41 ` Avi Kivity
2010-11-24 17:43 ` Gleb Natapov
2010-11-24 17:50 ` Avi Kivity
2010-11-24 18:10 ` Gleb Natapov
2010-11-24 18:55 ` Avi Kivity
2010-11-24 19:29 ` Jes Sorensen
2010-11-24 19:33 ` Avi Kivity
2010-11-24 17:43 ` Jes Sorensen
2010-11-24 17:51 ` Avi Kivity
2010-11-24 17:43 ` Anthony Liguori
2010-11-24 17:45 ` Jes Sorensen
2010-11-24 17:51 ` Avi Kivity
2010-11-24 18:01 ` Anthony Liguori
2010-11-24 18:56 ` Avi Kivity
2010-11-24 16:55 ` Gleb Natapov
2010-11-24 17:01 ` Avi Kivity
2010-11-24 17:16 ` Gleb Natapov
2010-11-24 17:26 ` Avi Kivity
2010-11-24 16:53 ` Anthony Liguori [this message]
2010-11-24 17:03 ` Jes Sorensen
2010-11-28 12:27 ` Michael S. Tsirkin
2010-11-28 22:04 ` Anthony Liguori
2010-11-28 22:28 ` Michael S. Tsirkin
2010-11-28 23:13 ` Anthony Liguori
2010-11-29 8:04 ` Michael S. Tsirkin
2010-11-29 13:44 ` Anthony Liguori
2010-11-29 13:48 ` Avi Kivity
2010-11-24 16:29 ` Jes Sorensen
2010-11-24 16:34 ` Avi Kivity
2010-11-24 16:44 ` Jes Sorensen
2010-11-24 16:49 ` Avi Kivity
2010-11-28 11:59 ` Michael S. Tsirkin
2010-11-28 13:02 ` Avi Kivity
2010-11-28 13:57 ` Michael S. Tsirkin
2010-11-28 14:34 ` Avi Kivity
2010-11-28 16:57 ` Michael S. Tsirkin
2010-11-29 9:22 ` Avi Kivity
2010-11-29 10:47 ` Michael S. Tsirkin
2010-11-29 10:52 ` Avi Kivity
2010-11-29 11:26 ` Michael S. Tsirkin
2010-11-29 13:38 ` Anthony Liguori
2010-11-24 14:10 ` Anthony Liguori
2010-11-24 14:29 ` Avi Kivity
2010-11-24 14:45 ` Anthony Liguori
2010-11-24 14:53 ` Avi Kivity
2010-11-24 14:55 ` Anthony Liguori
2010-11-25 16:32 ` Avi Kivity
2010-11-26 10:16 ` Michael S. Tsirkin
[not found] ` <4CF0CB9A.5060403@redhat.com>
2010-11-28 8:58 ` Michael S. Tsirkin
2010-11-28 9:31 ` Avi Kivity
2010-11-28 9:50 ` Michael S. Tsirkin
2010-11-28 9:54 ` Avi Kivity
2010-11-28 11:44 ` Michael S. Tsirkin
2010-11-28 13:14 ` Avi Kivity
2010-11-28 14:40 ` Michael S. Tsirkin
2010-11-28 22:12 ` Anthony Liguori
2010-11-29 9:30 ` Avi Kivity
2010-11-28 11:49 ` Michael S. Tsirkin
2010-11-28 13:15 ` Avi Kivity
2010-11-28 14:49 ` Michael S. Tsirkin
2010-11-29 9:30 ` Avi Kivity
2010-11-24 10:52 ` [PATCH kvm-unit-tests 3/4] Add support for calling a function in guest mode Avi Kivity
2010-11-26 14:17 ` Michael S. Tsirkin
[not found] ` <4CF0CC26.8030407@redhat.com>
2010-11-28 8:59 ` Michael S. Tsirkin
2010-11-28 9:22 ` Avi Kivity
2010-11-24 10:52 ` [PATCH kvm-unit-tests 4/4] Add sample test using the api test harness Avi Kivity
2010-11-26 14:17 ` Michael S. Tsirkin
[not found] ` <4CF0CC4A.8070100@redhat.com>
2010-11-28 9:04 ` Michael S. Tsirkin
2010-11-28 9:21 ` Avi Kivity
2010-11-29 16:09 ` [PATCH kvm-unit-tests 0/4] API test framework Marcelo Tosatti
2010-12-01 10:38 ` Avi Kivity
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=4CED42FA.8040402@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=Jes.Sorensen@redhat.com \
--cc=agraf@suse.de \
--cc=avi@redhat.com \
--cc=gleb@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.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