From: Anthony Liguori <anthony@codemonkey.ws>
To: Jan Kiszka <jan.kiszka@web.de>
Cc: Gavin Shan <shangw@linux.vnet.ibm.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
Isaku Yamahata <yamahata@valinux.co.jp>,
Avi Kivity <avi@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>,
Wanpeng Li <liwp@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH 0/6] refactor PC machine, i440fx and piix3 to take advantage of QOM
Date: Mon, 26 Mar 2012 14:35:18 -0500 [thread overview]
Message-ID: <4F70C4F6.8090900@codemonkey.ws> (raw)
In-Reply-To: <4F70C3E0.4000708@web.de>
On 03/26/2012 02:30 PM, Jan Kiszka wrote:
> On 2012-03-26 19:33, Anthony Liguori wrote:
>> On 03/26/2012 07:20 AM, Jan Kiszka wrote:
>>> On 2012-03-26 04:06, Wanpeng Li wrote:
>>>> From: Anthony Liguori<aliguori@us.ibm.com>
>>>>
>>>>
>>>> This series aggressively refactors the PC machine initialization to be more
>>>> modelled and less ad-hoc. The highlights of this series are:
>>>>
>>>> 1) Things like -m and -bios-name are now device model properties
>>>>
>>>> 2) The i440fx and piix3 are now modelled in a thorough fashion
>>>>
>>>> 3) Most of the chipset features of the piix3 are modelled through composition
>>>>
>>>> 4) i440fx_init is trivialized to creating devices and setting properties
>>>>
>>>> 5) convert MemoryRegion to QOM
>>>>
>>>> 6) convert PCI host bridge to QOM
>>>>
>>>> The point (4) is the most important one. As we refactor in this fashion,
>>>> we should quickly get to the point where machine->init disappears completely in
>>>> favor of just creating a handful of devices.
>>>>
>>>> The two stage initialization of QOM is important here. instance_init() is when
>>>> composed devices are created which means that after you've created a device, all
>>>> of its children are visible in the device model. This lets you set properties
>>>> of the parent and its children.
>>>>
>>>> realize() (which is still called DeviceState::init today) will be called right
>>>> before the guest starts up for the first time.
>>>
>>> While I see the value of the overall direction, I still disagree on
>>> making internal data structures of HPET, RTC and 8254 publicly
>>> available. That's a wrong step back. I'm sure there are smarter
>>> solutions, alse as there were some proposals back then in the original
>>> thread.
>>
>> I'm not fully decided myself. A couple things are clear to me though:
>>
>> 1) We must expose type proper types in header files. We need there to be a
>> globally accessible RTCState type and functions that operate on it.
>
> I'm not sure what "proper type" means in this context, but I'm quite
> sure that there should be no need for poking into the internal of the
> class outside of mc146818rtc.c.
It needs to be at least a forward reference. So we can avoid stuff like:
int apic_accept_pic_intr(DeviceState *s);
It should be:
int apic_accept_pic_intr(APICState *s);
So we can make use of the lovely type checking provided by the compiler to us.
> We even abstracted the specifics of the
> RTC away when it is embedded into a super-IO and interacts with an HPET.
> If QOM requires such poking, then that requirement should be reassessed.
There are a couple of ways to make types private while still having forward
declarations. None of them are straight forward. That's why I suggest we save
this for another day.
>>
>> 2) We can simplify memory management by knowing the size of the type in the
>> header files too.
>
> Is this more than a malloc-free pair?
>
>>
>> Since this is an easily refactorable thing to look at later, I think we should
>> start with extracting the types.
>
> My worry is that those three refactorings set bad examples for others.
> So I'd like to avoid such back and forth if possible.
I'm not really worried about it. It's so easier to refactor this later. Why
rush it now?
Regards,
Anthony Liguori
> Jan
next prev parent reply other threads:[~2012-03-26 19:35 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-26 2:06 [Qemu-devel] [PATCH 0/6] refactor PC machine, i440fx and piix3 to take advantage of QOM Wanpeng Li
2012-03-26 2:06 ` [Qemu-devel] [PATCH 1/6] eliminate piix_pci.c and module i440fx and piix3 Wanpeng Li
2012-03-26 2:06 ` [Qemu-devel] [PATCH 2/6] convert MemoryRegion to QOM Wanpeng Li
2012-03-26 2:06 ` [Qemu-devel] [PATCH 3/6] convert pci-host " Wanpeng Li
2012-03-26 7:32 ` Stefan Hajnoczi
2012-03-26 9:22 ` Wanpeng Li
2012-03-26 14:25 ` Andreas Färber
2012-03-26 2:06 ` [Qemu-devel] [PATCH 4/6] prepare to create HPET, RTC and i8254 through composition Wanpeng Li
2012-03-26 2:06 ` [Qemu-devel] [PATCH 5/6] merge pc_piix.c to pc.c Wanpeng Li
2012-03-26 12:42 ` Avi Kivity
2012-03-26 12:47 ` Jan Kiszka
2012-03-26 17:37 ` Anthony Liguori
2012-03-26 2:06 ` [Qemu-devel] [PATCH 6/6] make some functions static Wanpeng Li
2012-03-26 12:20 ` [Qemu-devel] [PATCH 0/6] refactor PC machine, i440fx and piix3 to take advantage of QOM Jan Kiszka
2012-03-26 15:54 ` Isaku Yamahata
2012-03-26 17:29 ` Anthony Liguori
2012-03-27 10:31 ` Avi Kivity
2012-03-27 13:52 ` Anthony Liguori
2012-03-27 14:18 ` Avi Kivity
2012-03-26 17:17 ` Blue Swirl
2012-03-26 17:33 ` Anthony Liguori
2012-03-26 19:30 ` Jan Kiszka
2012-03-26 19:35 ` Anthony Liguori [this message]
2012-03-26 19:37 ` Jan Kiszka
2012-03-26 19:39 ` Anthony Liguori
2012-03-26 19:44 ` Jan Kiszka
2012-03-26 19:49 ` Anthony Liguori
2012-03-26 20:10 ` Jan Kiszka
2012-03-26 20:13 ` Anthony Liguori
2012-03-26 20:30 ` Jan Kiszka
2012-03-26 21:00 ` Anthony Liguori
2012-03-26 19:52 ` Anthony Liguori
2012-03-26 12:47 ` Andreas Färber
2012-03-26 12:57 ` Wanpeng Li
2012-03-26 17:09 ` Blue Swirl
2012-03-26 17:35 ` Anthony Liguori
2012-03-26 17:43 ` Blue Swirl
2012-03-26 17:45 ` Anthony Liguori
2012-03-26 18:01 ` Blue Swirl
2012-03-26 18:07 ` Anthony Liguori
2012-03-26 18:25 ` Blue Swirl
2012-03-26 17:25 ` Anthony Liguori
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=4F70C4F6.8090900@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=avi@redhat.com \
--cc=jan.kiszka@web.de \
--cc=liwp@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=shangw@linux.vnet.ibm.com \
--cc=yamahata@valinux.co.jp \
/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;
as well as URLs for NNTP newsgroup(s).