From: Xuebing wang <xbing6@gmail.com>
To: "Andreas Färber" <afaerber@suse.de>, qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Eduardo Habkost <ehabkost@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [Discussion 00/10] about API hierarchy
Date: Tue, 04 Mar 2014 13:37:42 +0800 [thread overview]
Message-ID: <531566A6.7060302@gmail.com> (raw)
In-Reply-To: <53154C75.9040506@suse.de>
Hi Andreas, thank you very much for your reply.
Would you please help review/correct doc/api-hierarchy too?
On 03/04/2014 11:45 AM, Andreas Färber wrote:
> Hi Xuebing,
>
> Am 04.03.2014 03:47, schrieb Xuebing Wang:
>> Q2) Does it make sense to remove NEED_CPU_H from qemu-common.h?
> IMO not in this way. Work has been ongoing to obsolete NEED_CPU_H by
> introducing CPUState in addition to CPUArchState and moving fields into
> CPUState, so that less files need to include target-xxx/cpu.h. Your
> approach seems to be rather spreading it to more and different files.
IMHO, CPUArchState is NOT the only data structure that is
target-specific, thus needs "cpu.h".
target_ulong is a define, thus can NOT be moved into CPUState. And there
are TARGET_LONG_BITS, TARGET_PAGE_BITS, etc
More importantly, their derivatives (for lack of a better word) need
"cpu.h" too. 'git grep -nw target_ulong include/' lists the derivatives
of target_ulong. And there could be derivatives of the derivatives.
After this patchset, excluding folders (bsd/user, disas/, hw/,
include/hw, target-xxx/), only a few files need "cpu.h"
> Please explain in more detail: Why is code being moved from qom/cpu.h to
> vmstate.h for target-alpha?
target alpha and openrisc use VMSTATE_CPU(), for alpha-linuxuser
VMSTATE_CPU() uses vmstate_cpu_common and vmstate_dummy, and
vmstate_dummy is declared in include/migration/vmstate.h. Currently,
vmstate.h is NOT included in qom/cpu.h
Considering API hierarchy (and their dependencies), I'd consider vmstate
to depend on qom/cpu, rather than conversely. Do you agree?
> Concerning gdbstub.h, have you investigated replacing remaining
> CPUArchState usages with CPUState, like I started in a previous series?
Yes, I did. I even tried to replace CPUArchState with CPUState for other
subsystems, to make them architecture-independent. But, it involves
changing too many places. :-)
>
> Concerning memory_mapping.h, have you checked the mailing list archives
> for reasons why I didn't use my vaddr there myself? Pointing me to my
> HACKING entry does not answer that. ;) (Either vaddr didn't exist yet at
> the time or there was some reason not to use it, I would hope!)
"target_ulong virt_addr" was there before the born of vaddr. vaddr was
introduced in your commit 577f42c0e11a5bfb462ff3a217701cd5c4356fb4 dated
Jul 6 2013. :-)
At this moment, do you think we better use vaddr to make memory_mapping
target-independent?
>
> An important thing to watch out for when moving includes around is
> avoiding (more) circular dependencies. CC'ing Eduardo.
Thanks for reminding. Yes, I keep avoiding circular dependencies in
mind, that's the reason I wrote document docs/api-hierarchy.
Do you agree that in general, strictly following api hierarchy is a good
approach to avoid circular dependencies?
>
> Also note that I still haven't fully rebased my qom-cpu-13 branch yet,
> which includes a number of field movements and is likely to clash with
> some of your refactorings in CPU/exec/translate files.
Thanks for reminding.
>
> Your observation is correct that not all things are in the best shape.
> The question is in which way and in which order to address them.
> To better judge, what are the immediate gains of your proposals? For
> example, I don't spot any Makefile changes in your diffstat that benefit
> from a dropped cpu.h include somewhere in terms of build dependencies.
> Nor does your series include a proof of concept that something becomes
> possible that wasn't before. Understanding the exact advantages would
> help me in determining what priority to assign such changes. Thanks.
My idea of the immediate gains is to circulate the api-hierarchy, and
watch out dependencies while we adding new features. That's why I name
this discussion "about API hierarchy"
Here is a quote from Anthony's "kvm forum 2011" keynote (slide 3):
We're growing so fast, and are so popular, that we simply don't have
time to exercise and eat healthy.
http://www.linux-kvm.org/wiki/images/5/57/2011-forum-qemu-keynote-liguori.pdf
I hope api-hierarchy and removing NEED_CPU_H from qemu-common.h is the
low-hanging fruit, in the sense of "exercise". :-)
>
> Regards,
> Andreas
>
--
Thanks,
Xuebing Wang
prev parent reply other threads:[~2014-03-04 5:38 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-04 2:47 [Qemu-devel] [Discussion 00/10] about API hierarchy Xuebing Wang
2014-03-04 2:47 ` [Qemu-devel] [Discussion 01/10] docs: add docs/api-hierarchy.txt Xuebing Wang
2014-03-04 9:42 ` Stefan Hajnoczi
2014-03-04 9:58 ` Xuebing wang
2014-03-04 11:57 ` Stefan Hajnoczi
2014-03-04 2:47 ` [Qemu-devel] [Discussion 02/10] NEED_CPU_H: remove '#include "cpu.h"' from include/qemu-common.h Xuebing Wang
2014-03-04 10:19 ` Paolo Bonzini
2014-03-04 11:54 ` Xuebing wang
2014-03-04 12:02 ` Xuebing wang
2014-03-04 12:09 ` Paolo Bonzini
2014-03-04 12:09 ` Xuebing wang
2014-03-04 12:34 ` Peter Maydell
2014-03-04 12:40 ` Xuebing wang
2014-03-04 12:19 ` Xuebing wang
2014-03-04 12:23 ` Paolo Bonzini
2014-03-04 12:26 ` Xuebing wang
2014-03-04 12:29 ` Paolo Bonzini
2014-03-04 2:47 ` [Qemu-devel] [Discussion 03/10] NEED_CPU_H: remove unnecessary use of NEED_CPU_H Xuebing Wang
2014-03-04 10:20 ` Paolo Bonzini
2014-03-04 2:47 ` [Qemu-devel] [Discussion 04/10] memory_mapping: make this architecture-independent Xuebing Wang
2014-03-04 10:22 ` Paolo Bonzini
2014-03-04 11:05 ` Peter Maydell
2014-03-04 2:47 ` [Qemu-devel] [Discussion 05/10] NEED_CPU_H: remove unnecessary inclusion of "cpu.h" in root Xuebing Wang
2014-03-04 10:24 ` Paolo Bonzini
2014-03-04 2:47 ` [Qemu-devel] [Discussion 06/10] memory: move contents in include/exec/address-spaces.h => memory.h Xuebing Wang
2014-03-04 10:26 ` Paolo Bonzini
2014-03-04 2:47 ` [Qemu-devel] [Discussion 07/10] memory: remove file include/exec/address-spaces.h Xuebing Wang
2014-03-04 2:47 ` [Qemu-devel] [Discussion 08/10] exec: move TranslationBlock API from exec-all.h => translate.h Xuebing Wang
2014-03-04 10:27 ` Paolo Bonzini
2014-03-04 2:47 ` [Qemu-devel] [Discussion 09/10] exec: remove the unnecessary include of "exec-all.h" Xuebing Wang
2014-03-04 10:27 ` Paolo Bonzini
2014-03-04 11:11 ` Peter Maydell
2014-03-04 11:16 ` Peter Maydell
2014-03-04 2:47 ` [Qemu-devel] [Discussion 10/10] translate: remove file translate-all.h Xuebing Wang
2014-03-04 10:29 ` Paolo Bonzini
2014-03-04 3:45 ` [Qemu-devel] [Discussion 00/10] about API hierarchy Andreas Färber
2014-03-04 5:37 ` Xuebing wang [this message]
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=531566A6.7060302@gmail.com \
--to=xbing6@gmail.com \
--cc=afaerber@suse.de \
--cc=ehabkost@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@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 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.