From: "Andreas Färber" <afaerber@suse.de>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: peter.maydell@linaro.org, ehabkost@redhat.com, gleb@redhat.com,
jan.kiszka@siemens.com, mtosatti@redhat.com,
qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com,
blauwirbel@gmail.com, avi@redhat.com, pbonzini@redhat.com,
Igor Mammedov <imammedo@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 0/2 v3] target-i386: refactor reset handling and move it into cpu.c
Date: Wed, 01 Aug 2012 23:25:04 +0200 [thread overview]
Message-ID: <50199EB0.4040602@suse.de> (raw)
In-Reply-To: <8739467323.fsf@codemonkey.ws>
Am 01.08.2012 22:47, schrieb Anthony Liguori:
> Andreas Färber <afaerber@suse.de> writes:
>
>> Am 01.08.2012 22:02, schrieb Anthony Liguori:
>>> Devices do one of two things today:
>>>
>>> 1) register a reset callback
>>>
>>> 2) implement a reset method that is invoked through it's parent bus
>>>
>>> Since I don't expect CPUs to exist on a bus, it's not immediately clear
>>> to me that (1) isn't going to be what we do for quite some time.
>>
>> Err, I thought devices implement a function assigned to a
>> DeviceClass::reset, no? That would be (2) on your list and we've been
>> working on ripping out (1) for devices, on sPAPR for instance.
>> (2) is what we already have with CPUClass::reset.
>
> Something has to call DeviceClass::reset. That's done through a
> BusState. Whenever a bus is created, a qemu_register_reset() call is
> made to invoke the reset method on any device that's part of the bus.
>
> So just implementing DeviceClass::reset doesn't automatically mean the
> reset function will be called. In the short term, I think we'll need to
> still register a reset handler.
>
>> The only remaining issue is that the CPUClass::reset callback is not
>> automatically called on machine/bus reset yet.
>>
>> And what I was saying is that moving the code is NOT an improvement. It
>> is NO functional change and it is NOT a prerequisite for any change on
>> the list today. So it is not needed for the to be released 1.2.
>>
>> A very low hanging fruit for 1.2 would be to register a SINGLE central
>> reset callback that iterates through the globally available CPU list and
>> calls ->reset on each! Then we can drop the reset callbacks in most
>> machines rather than moving old code around.
>
> Relying on the CPU list for this isn't very QOM-like. A better approach
> would be to make all CPUs appear in a container and then have the reset
> propagate through container.
That doesn't work since our CPU modelling was going to be machine/SoC
specific. For x86, agreement seemed to be /machine/cpu[n]. For ARM,
Peter requested path/to/SoC/cortex/cpu[n].
I have just posted (and tested on x86_64) a really trivial patch that
avoids walking the CPU list, reuses existing infrastructure and lets us
drop the reset registration from target-i386, too. More reset callback
registrations can then be dropped as follow-ups from other machines.
Whether we walk a list or not, my point is to reduce redundancy. If it's
in one central location we can easily exchange the implementation. And I
do believe that calling my QOM method is very QOM-like rather than
besmearing my nice new CPUClass::reset concept by unnecessarily
introducing ugly old-style callbacks to my shiny QOM realize code. :)
Regards,
Andreas
>
> Reset is a complicated beast. While we model a single reset line today,
> this isn't technically correct. I believe the distinction between reset
> types start to matter with PCI-e actually.
>
> I do think any reduction in what's happening in machine is a net win.
> Even if we refactor this later, having the machine code do less and
> devices do more is an improvement.
>
> Regards,
>
> Anthony Liguori
>
>>
>> Regards,
>> Andreas
>>
>>>
>>> Regards,
>>>
>>> Anthony Liguori
>>>
>>>>
>>>> Regards,
>>>> Andreas
>>>>
>>>> --
>>>> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
>>>> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
>>>
>>
>>
>> --
>> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
>> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
>
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
next prev parent reply other threads:[~2012-08-01 21:25 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-23 13:22 [Qemu-devel] [PATCH 0/2 v3] target-i386: refactor reset handling and move it into cpu.c Igor Mammedov
2012-07-23 13:22 ` [Qemu-devel] [PATCH 1/2] target-i386: move cpu halted decision into x86_cpu_reset Igor Mammedov
2012-08-01 14:00 ` Andreas Färber
2012-08-02 10:11 ` Igor Mammedov
2012-07-23 13:22 ` [Qemu-devel] [PATCH 2/2] target-i386: move cpu_reset and reset callback to cpu.c Igor Mammedov
2012-08-01 14:09 ` Andreas Färber
2012-08-01 8:13 ` [Qemu-devel] [PATCH 0/2 v3] target-i386: refactor reset handling and move it into cpu.c Gleb Natapov
2012-08-01 15:43 ` Anthony Liguori
2012-08-01 15:50 ` Andreas Färber
2012-08-01 18:25 ` Anthony Liguori
2012-08-01 19:35 ` Andreas Färber
2012-08-01 20:02 ` Anthony Liguori
2012-08-01 20:16 ` Andreas Färber
2012-08-01 20:47 ` Anthony Liguori
2012-08-01 21:25 ` Andreas Färber [this message]
2012-08-01 21:43 ` Peter Maydell
2012-08-01 22:15 ` Andreas Färber
2012-08-02 11:19 ` Igor Mammedov
2012-08-01 20:57 ` Andreas Färber
2012-08-01 21:19 ` 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=50199EB0.4040602@suse.de \
--to=afaerber@suse.de \
--cc=aliguori@us.ibm.com \
--cc=avi@redhat.com \
--cc=blauwirbel@gmail.com \
--cc=ehabkost@redhat.com \
--cc=gleb@redhat.com \
--cc=imammedo@redhat.com \
--cc=jan.kiszka@siemens.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--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: 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.