Skip to contentSkip to conversation

directory hierarchy

Qemu-devel Paolo Bonzini 9 participants 28 messages Sep 14, 2012 – Sep 24, 2012

lore
Share & tools
lore
#0 lore raw

Hi all,

here is a proposal for moving around 150 C files currently in the toplevel directory to separate, well-delimited subdirectories. Header files would be moved for now in include/, preparing for subsequent reorganization of headers.

Usually the files would keep their names, but I loathe names starting with qemu-* so I took the occasion to rename those.

This does not touch the hw/ directory, which is its own mess and worth a separate discussion. Cleaning it up may require introducing more CONFIG_* symbols and moving stuff to libhw whenever possible (for example if we want all NICs in hw/net, all RTCs in hw/rtc, etc. perhaps with some exceptions for USB).

Opinions, flames, "stop this guy"s are welcome as usual.

Paolo

block:
aes.c
aio.c
async.c
block.c
blockjob.c (with plans to move it in sysemu/block) nbd.c
qemu-progress.c block/progress.c

block/coroutine:

coroutine-gthread.c             block/coroutine/gthread.c
coroutine-sigaltstack.c         block/coroutine/sigaltstack.c
coroutine-ucontext.c            block/coroutine/ucontext.c
coroutine-win32.c               block/coroutine/win32.c
qemu-coroutine-io.c             block/coroutine/io.c
qemu-coroutine-lock.c           block/coroutine/lock.c
qemu-coroutine-sleep.c          block/coroutine/sleep.c
qemu-coroutine.c                block/coroutine/coroutine.c

block/drivers:
block/blkdebug.c
block/blkverify.c
block/bochs.c
block/cloop.c
block/cow.c
block/curl.c
block/dmg.c
block/iscsi.c
block/mirror.c
block/nbd.c
block/parallels.c
block/qcow.c
block/qcow2-cache.c
block/qcow2-cluster.c
block/qcow2-refcount.c
block/qcow2-snapshot.c
block/qcow2.c
block/qed-check.c
block/qed-cluster.c
block/qed-gencb.c
block/qed-l2-cache.c
block/qed-table.c
block/qed.c
block/raw-posix.c
block/raw-win32.c
block/raw.c
block/rbd.c
block/sheepdog.c
block/vdi.c
block/vmdk.c
block/vpc.c
block/vvfat.c
linux-aio.c
posix-aio-compat.c

exec:
cpu-exec.c
disas.c
exec.c
gdbstub.c
tci.c (note: TCI can't go in tcg/ for licensing reasons) translate-all.c

hw:
hw/dma.c hw/i8257.c
dma-helpers.c hw/dma.c

libdis:
alpha-dis.c libdis/alpha.c
arm-dis.c libdis/arm.c

cris-dis.c                      libdis/cris.c
hppa-dis.c                      libdis/hppa.c
i386-dis.c                      libdis/i386.c
ia64-dis.c                      libdis/ia64.c
lm32-dis.c                      libdis/lm32.c
m68k-dis.c                      libdis/m68k.c
microblaze-dis.c                libdis/microblaze.c
mips-dis.c                      libdis/mips.c
ppc-dis.c                       libdis/ppc.c
s390-dis.c                      libdis/s390.c
sh4-dis.c                       libdis/sh4.c
sparc-dis.c                     libdis/sparc.c
tci-dis.c                       libdis/tci.c

net:
net.c

qapi:
error.c

qga:
qemu-ga.c qga/main.c

qobject:
json-lexer.c
json-parser.c
json-streamer.c
qbool.c
qdict.c
qerror.c
qfloat.c
qint.c
qjson.c
qlist.c
qstring.c

sysemu:
arch_init.c
balloon.c
cpus.c
cputlb.c
cursor.c
device_tree.c
dump-stub.c
dump.c
ioport.c
kvm-all.c
kvm-stub.c
memory.c
memory_mapping-stub.c
memory_mapping.c
os-posix.c
os-win32.c
pflib.c
qemu-error.c sysemu/error.c
qemu-seccomp.c sysemu/seccomp.c
qtest.c
vl.c
xen-all.c
xen-mapcache.c
xen-stub.c
qemu-options.hx

sysemu/block:
block/stream.c
blockdev.c

sysemu/bt:
bt-host.c sysemu/bt/host.c
bt-vhci.c sysemu/bt/vhci.c

sysemu/char:

qemu-char.c                     sysemu/char/chardev.c
qemu-sockets.c                  sysemu/char/sockets.c
spice-qemu-char.c               sysemu/char/spice.c

sysemu/migration:
block-migration.c migration/block.c
buffered_file.c
migration-exec.c
migration-fd.c
migration-tcp.c
migration-unix.c
migration.c
page_cache.c
savevm.c

sysemu/monitor:
hmp.c
monitor.c
qmp.c
readline.c
hmp-commands.hx
qmp-commands.hx

tcg:
tcg-runtime.c tcg/runtime.c

tools:
cmd.c
qemu-bridge-helper.c
qemu-img.c
qemu-img-cmds.hx
qemu-io.c
qemu-nbd.c
qemu-tool.c tools/stub.c

ui:
console.c
input.c

user:
qemu-user.c user/stub.c
thunk.c
user-exec.c user/cpu-exec.c

util:
acl.c
bitmap.c
bitops.c
cache-utils.c
compatfd.c
cutils.c
envlist.c
event_notifier.c
host-utils.c
iohandler.c
iov.c
main-loop.c
module.c
notify.c
osdep.c
oslib-posix.c
oslib-win32.c
path.c

qemu-config.c                   util/config.c
qemu-log.c                      util/log.c
qemu-option.c                   util/option.c
qemu-thread-posix.c             util/thread-posix.c
qemu-thread-win32.c             util/thread-win32.c
qemu-timer-common.c             util/clock.c
qemu-timer.c                    util/timer.c
#1 lore raw
Quoted 2 lines · Paolo Bonzini

here is a proposal for moving around 150 C files currently in the toplevel directory to separate, well-delimited subdirectories.

No general objection (though some specific comments below). However I think it would be helpful if you could provide some descriptions of how your new subdirectories are defined. Otherwise the "well-delimited" bit is largely in your head and future new files aren't likely to respect it except by accident :-)

Quoted 3 lines

Header
files would be moved for now in include/, preparing for subsequent reorganization of headers.

Just in include/, or in include/qemu/ ? (IIRC Anthony was hoping to only move cleaned-up headers in there?)

Quoted 13 lines

Usually the files would keep their names, but I loathe names starting with qemu-* so I took the occasion to rename those.

This does not touch the hw/ directory, which is its own mess and worth a separate discussion. Cleaning it up may require introducing more CONFIG_* symbols and moving stuff to libhw whenever possible (for example if we want all NICs in hw/net, all RTCs in hw/rtc, etc. perhaps with some exceptions for USB).

Opinions, flames, "stop this guy"s are welcome as usual.

Paolo

Quoted 8 lines

block:
aes.c
aio.c
async.c
block.c
blockjob.c (with plans to move it in sysemu/block) nbd.c
qemu-progress.c block/progress.c

This should go in util/, surely?

Quoted 9 lines

block/coroutine:

coroutine-gthread.c             block/coroutine/gthread.c
coroutine-sigaltstack.c         block/coroutine/sigaltstack.c
coroutine-ucontext.c            block/coroutine/ucontext.c
coroutine-win32.c               block/coroutine/win32.c
qemu-coroutine-io.c             block/coroutine/io.c
qemu-coroutine-lock.c           block/coroutine/lock.c
qemu-coroutine-sleep.c          block/coroutine/sleep.c
qemu-coroutine.c                block/coroutine/coroutine.c

If this is accompanied by saying "no more use of coroutines outside the block drivers" then I'm cool with that. Otherwise it's not really the right place.

Quoted 36 lines

block/drivers:
block/blkdebug.c
block/blkverify.c
block/bochs.c
block/cloop.c
block/cow.c
block/curl.c
block/dmg.c
block/iscsi.c
block/mirror.c
block/nbd.c
block/parallels.c
block/qcow.c
block/qcow2-cache.c
block/qcow2-cluster.c
block/qcow2-refcount.c
block/qcow2-snapshot.c
block/qcow2.c
block/qed-check.c
block/qed-cluster.c
block/qed-gencb.c
block/qed-l2-cache.c
block/qed-table.c
block/qed.c
block/raw-posix.c
block/raw-win32.c
block/raw.c
block/rbd.c
block/sheepdog.c
block/vdi.c
block/vmdk.c
block/vpc.c
block/vvfat.c
linux-aio.c
posix-aio-compat.c

Quoted 6 lines

exec:
cpu-exec.c
disas.c
exec.c
gdbstub.c
tci.c (note: TCI can't go in tcg/ for licensing reasons)

More to the point, it shouldn't go in tcg/ because it's not a TCG backend -- this is the interpreter part.

Quoted 47 lines

translate-all.c

hw:
hw/dma.c hw/i8257.c
dma-helpers.c hw/dma.c

libdis:
alpha-dis.c libdis/alpha.c
arm-dis.c libdis/arm.c

cris-dis.c                      libdis/cris.c
hppa-dis.c                      libdis/hppa.c
i386-dis.c                      libdis/i386.c
ia64-dis.c                      libdis/ia64.c
lm32-dis.c                      libdis/lm32.c
m68k-dis.c                      libdis/m68k.c
microblaze-dis.c                libdis/microblaze.c
mips-dis.c                      libdis/mips.c
ppc-dis.c                       libdis/ppc.c
s390-dis.c                      libdis/s390.c
sh4-dis.c                       libdis/sh4.c
sparc-dis.c                     libdis/sparc.c
tci-dis.c                       libdis/tci.c

net:
net.c

qapi:
error.c

qga:
qemu-ga.c qga/main.c

qobject:
json-lexer.c
json-parser.c
json-streamer.c
qbool.c
qdict.c
qerror.c
qfloat.c
qint.c
qjson.c
qlist.c
qstring.c

Quoted 1 line

sysemu:

So, sysemu.h is one of those dumping-ground header files. What's the dividing line that means a file goes into sysemu/ and not somewhere else?

Quoted 13 lines

arch_init.c
balloon.c
cpus.c
cputlb.c
cursor.c
device_tree.c
dump-stub.c
dump.c
ioport.c
kvm-all.c
kvm-stub.c
memory.c
memory_mapping-stub.c

Quoted 8 lines

memory_mapping.c
os-posix.c
os-win32.c
pflib.c
qemu-error.c sysemu/error.c
qemu-seccomp.c sysemu/seccomp.c
qtest.c
vl.c

While we're at it is there some less bonkers name than 'vl.c' for the system emulator main file?

Quoted 37 lines

xen-all.c
xen-mapcache.c
xen-stub.c
qemu-options.hx

sysemu/block:
block/stream.c
blockdev.c

sysemu/bt:
bt-host.c sysemu/bt/host.c
bt-vhci.c sysemu/bt/vhci.c

sysemu/char:

qemu-char.c                     sysemu/char/chardev.c
qemu-sockets.c                  sysemu/char/sockets.c
spice-qemu-char.c               sysemu/char/spice.c

sysemu/migration:
block-migration.c migration/block.c
buffered_file.c
migration-exec.c
migration-fd.c
migration-tcp.c
migration-unix.c
migration.c
page_cache.c
savevm.c

sysemu/monitor:
hmp.c
monitor.c
qmp.c
readline.c
hmp-commands.hx
qmp-commands.hx

Quoted 2 lines

tcg:
tcg-runtime.c tcg/runtime.c

This is kind of breaking an existing division, where tcg/ contains the code generator, and code outside tcg provides the execution environment for that generated code. In particular tcg-runtime.c is the QEMU implementation of a bunch of runtime functions and in theory some other runtime that embedded TCG could provide its own runtime helpers. (In practice TCG isn't as neatly separated from the rest of QEMU as you might like, if for instance you wanted to do TCG unit tests.)

Quoted 18 lines

tools:
cmd.c
qemu-bridge-helper.c
qemu-img.c
qemu-img-cmds.hx
qemu-io.c
qemu-nbd.c
qemu-tool.c tools/stub.c

ui:
console.c
input.c

user:
qemu-user.c user/stub.c
thunk.c
user-exec.c user/cpu-exec.c

Quoted 13 lines

util:
acl.c
bitmap.c
bitops.c
cache-utils.c
compatfd.c
cutils.c
envlist.c
event_notifier.c
host-utils.c
iohandler.c
iov.c
main-loop.c

This file is either misnamed or shouldn't be in util/...

Quoted 6 lines

module.c
notify.c
osdep.c
oslib-posix.c
oslib-win32.c
path.c

Quoted 7 lines
qemu-config.c                   util/config.c
qemu-log.c                      util/log.c
qemu-option.c                   util/option.c
qemu-thread-posix.c             util/thread-posix.c
qemu-thread-win32.c             util/thread-win32.c
qemu-timer-common.c             util/clock.c
qemu-timer.c                    util/timer.c

-- PMM

#5 lore raw
In reply to Paolo Bonzini
Quoted 6 lines · On Fri, 14 Sep 2012 15:17:52 +0200 Paolo Bonzini <[email protected]> wrote:

Hi all,

here is a proposal for moving around 150 C files currently in the toplevel directory to separate, well-delimited subdirectories. Header files would be moved for now in include/, preparing for subsequent reorganization of headers.

That would be really nice! A few comments below.

Quoted 98 lines

Usually the files would keep their names, but I loathe names starting with qemu-* so I took the occasion to rename those.

This does not touch the hw/ directory, which is its own mess and worth a separate discussion. Cleaning it up may require introducing more CONFIG_* symbols and moving stuff to libhw whenever possible (for example if we want all NICs in hw/net, all RTCs in hw/rtc, etc. perhaps with some exceptions for USB).

Opinions, flames, "stop this guy"s are welcome as usual.

Paolo

block:
aes.c
aio.c
async.c
block.c
blockjob.c (with plans to move it in sysemu/block) nbd.c
qemu-progress.c block/progress.c

block/coroutine:

coroutine-gthread.c             block/coroutine/gthread.c
coroutine-sigaltstack.c         block/coroutine/sigaltstack.c
coroutine-ucontext.c            block/coroutine/ucontext.c
coroutine-win32.c               block/coroutine/win32.c
qemu-coroutine-io.c             block/coroutine/io.c
qemu-coroutine-lock.c           block/coroutine/lock.c
qemu-coroutine-sleep.c          block/coroutine/sleep.c
qemu-coroutine.c                block/coroutine/coroutine.c

block/drivers:
block/blkdebug.c
block/blkverify.c
block/bochs.c
block/cloop.c
block/cow.c
block/curl.c
block/dmg.c
block/iscsi.c
block/mirror.c
block/nbd.c
block/parallels.c
block/qcow.c
block/qcow2-cache.c
block/qcow2-cluster.c
block/qcow2-refcount.c
block/qcow2-snapshot.c
block/qcow2.c
block/qed-check.c
block/qed-cluster.c
block/qed-gencb.c
block/qed-l2-cache.c
block/qed-table.c
block/qed.c
block/raw-posix.c
block/raw-win32.c
block/raw.c
block/rbd.c
block/sheepdog.c
block/vdi.c
block/vmdk.c
block/vpc.c
block/vvfat.c
linux-aio.c
posix-aio-compat.c

exec:
cpu-exec.c
disas.c
exec.c
gdbstub.c
tci.c (note: TCI can't go in tcg/ for licensing reasons) translate-all.c

hw:
hw/dma.c hw/i8257.c
dma-helpers.c hw/dma.c

libdis:
alpha-dis.c libdis/alpha.c
arm-dis.c libdis/arm.c

cris-dis.c                      libdis/cris.c
hppa-dis.c                      libdis/hppa.c
i386-dis.c                      libdis/i386.c
ia64-dis.c                      libdis/ia64.c
lm32-dis.c                      libdis/lm32.c
m68k-dis.c                      libdis/m68k.c
microblaze-dis.c                libdis/microblaze.c
mips-dis.c                      libdis/mips.c
ppc-dis.c                       libdis/ppc.c
s390-dis.c                      libdis/s390.c
sh4-dis.c                       libdis/sh4.c
sparc-dis.c                     libdis/sparc.c
tci-dis.c                       libdis/tci.c
Quoted 5 lines

net:
net.c

qapi:
error.c

error.c isn't tied to a subsystem, it's really "qemu wide". If it must reside in dir (ie. it can't be in the top dir), then I'd suggest to put it in qmp.

Quoted 2 lines

qga:
qemu-ga.c qga/main.c

qga/ has several files today, not only qga/main.c. I'd suggest naming the directory qemu-ga and moving everything there, but it's better to double check with Michael.

Quoted 4 lines

qobject:
json-lexer.c
json-parser.c
json-streamer.c

Quoted 8 lines

qbool.c
qdict.c
qerror.c
qfloat.c
qint.c
qjson.c
qlist.c
qstring.c

I'd move json-* files to qmp/.

Quoted 51 lines

sysemu:
arch_init.c
balloon.c
cpus.c
cputlb.c
cursor.c
device_tree.c
dump-stub.c
dump.c
ioport.c
kvm-all.c
kvm-stub.c
memory.c
memory_mapping-stub.c
memory_mapping.c
os-posix.c
os-win32.c
pflib.c
qemu-error.c sysemu/error.c
qemu-seccomp.c sysemu/seccomp.c
qtest.c
vl.c
xen-all.c
xen-mapcache.c
xen-stub.c
qemu-options.hx

sysemu/block:
block/stream.c
blockdev.c

sysemu/bt:
bt-host.c sysemu/bt/host.c
bt-vhci.c sysemu/bt/vhci.c

sysemu/char:

qemu-char.c                     sysemu/char/chardev.c
qemu-sockets.c                  sysemu/char/sockets.c
spice-qemu-char.c               sysemu/char/spice.c

sysemu/migration:
block-migration.c migration/block.c
buffered_file.c
migration-exec.c
migration-fd.c
migration-tcp.c
migration-unix.c
migration.c
page_cache.c
savevm.c

Quoted 7 lines

sysemu/monitor:
hmp.c
monitor.c
qmp.c
readline.c
hmp-commands.hx
qmp-commands.hx

Please, move qmp.c qmp-commands.hx to qmp/.

Quoted 50 lines

tcg:
tcg-runtime.c tcg/runtime.c

tools:
cmd.c
qemu-bridge-helper.c
qemu-img.c
qemu-img-cmds.hx
qemu-io.c
qemu-nbd.c
qemu-tool.c tools/stub.c

ui:
console.c
input.c

user:
qemu-user.c user/stub.c
thunk.c
user-exec.c user/cpu-exec.c

util:
acl.c
bitmap.c
bitops.c
cache-utils.c
compatfd.c
cutils.c
envlist.c
event_notifier.c
host-utils.c
iohandler.c
iov.c
main-loop.c
module.c
notify.c
osdep.c
oslib-posix.c
oslib-win32.c
path.c

qemu-config.c                   util/config.c
qemu-log.c                      util/log.c
qemu-option.c                   util/option.c
qemu-thread-posix.c             util/thread-posix.c
qemu-thread-win32.c             util/thread-win32.c
qemu-timer-common.c             util/clock.c
qemu-timer.c                    util/timer.c
#7 lore raw
In reply to Paolo Bonzini
Quoted 6 lines · Paolo Bonzini

Hi all,

here is a proposal for moving around 150 C files currently in the toplevel directory to separate, well-delimited subdirectories. Header files would be moved for now in include/, preparing for subsequent reorganization of headers.

I tend to view usage of a separate 'include/' subdirectory as a location for public facing header files. For internal header files, IMHO, its nicer to just have them alongside the .c file which has the corresponding implementation. I know QEMU has traditionally been a bit wierd having giant header files containing decls that are then implemented across a whole set of source files. Perhaps it is worthwhile to focus on santizing the headers rather than moving them elsewhere where there's even less incentive to keep header + source filenames aligned.

Quoted 2 lines

Usually the files would keep their names, but I loathe names starting with qemu-* so I took the occasion to rename those.

Heh, I would have suggested the opposite - use a 'qemu-' prefix on every single file, mostly so that you avoid the confusion where a source-local header file happens to have same name as a public header file in /usr/include.

Quoted 7 lines

This does not touch the hw/ directory, which is its own mess and worth a separate discussion. Cleaning it up may require introducing more CONFIG_* symbols and moving stuff to libhw whenever possible (for example if we want all NICs in hw/net, all RTCs in hw/rtc, etc. perhaps with some exceptions for USB).

Opinions, flames, "stop this guy"s are welcome as usual.

I appauld your amibition to modularize the source tree layout more. Even if you disagree with my POV on the issues above, it would be an improvement.

Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#9 lore raw
In reply to Paolo Bonzini
Quoted 2 lines · Paolo Bonzini

here is a proposal for moving around 150 C files currently in the toplevel directory to separate, well-delimited subdirectories.

...oh, and it would be good to be sure we've fixed all the problems with dependencies that tend to cause 'make' to fail to DTRT going backwards and forwards across a file-move commit, before we move everything around...

-- PMM

#2 lore raw
In reply to Peter Maydell

Il 14/09/2012 15:36, Peter Maydell ha scritto:

Quoted 9 lines · Paolo Bonzini
Quoted 2 lines

here is a proposal for moving around 150 C files currently in the toplevel directory to separate, well-delimited subdirectories.

No general objection (though some specific comments below). However I think it would be helpful if you could provide some descriptions of how your new subdirectories are defined. Otherwise the "well-delimited" bit is largely in your head and future new files aren't likely to respect it except by accident :-)

Good question. I just tried to use some taste, so well-delimited is a bit of a lie. I mostly care that sysemu/, tools/, qga/ and user/ are well-delimited, i.e. executables do not have sources from other executables' directories, and similarly common/ is just for emulators.

Quoted 6 lines
Quoted 3 lines

Header
files would be moved for now in include/, preparing for subsequent reorganization of headers.

Just in include/, or in include/qemu/ ? (IIRC Anthony was hoping to only move cleaned-up headers in there?)

I dislike include/qemu, for the same reason I dislike qemu-*. :)

Moving to include/ would be to clean up the top-level directory, withour touching the source code. If something can be moved directly to one of the new source directories, that's also fine but I don't have high hopes.

Quoted 9 lines
Quoted 9 lines

Usually the files would keep their names, but I loathe names starting with qemu-* so I took the occasion to rename those.

This does not touch the hw/ directory, which is its own mess and worth a separate discussion. Cleaning it up may require introducing more CONFIG_* symbols and moving stuff to libhw whenever possible (for example if we want all NICs in hw/net, all RTCs in hw/rtc, etc. perhaps with some exceptions for USB).

Quoted 8 lines
Quoted 6 lines

Opinions, flames, "stop this guy"s are welcome as usual.

Paolo

block:
qemu-progress.c block/progress.c

This should go in util/, surely?

Yes. I considered tools/ but right now it is in block-obj-y and I haven't yet checked if the emulators depend on it. But util/ is probably better.

Quoted 6 lines
Quoted 2 lines

block/coroutine:

If this is accompanied by saying "no more use of coroutines outside the block drivers" then I'm cool with that. Otherwise it's not really the right place.

There is no use right now outside the block drivers or the block jobs. So s/more//. Let's say this would discourage using coroutines outside the block drivers, but if somebody has a really good reason it would move to util/. It's a two-line change.

Quoted 9 lines
Quoted 6 lines

exec:
cpu-exec.c
disas.c
exec.c
gdbstub.c
tci.c (note: TCI can't go in tcg/ for licensing reasons)

More to the point, it shouldn't go in tcg/ because it's not a TCG backend -- this is the interpreter part.

Ok.

Quoted 5 lines
Quoted 1 line

sysemu:

So, sysemu.h is one of those dumping-ground header files. What's the dividing line that means a file goes into sysemu/ and not somewhere else?

It must only be used by the system emulators.

Quoted 4 lines
Quoted 1 line

vl.c

While we're at it is there some less bonkers name than 'vl.c' for the system emulator main file?

I was about to do that, but I like to keep the historical name if it's just a one-off... Just some respect for Fabrice. :)

Quoted 11 lines
Quoted 2 lines

tcg:
tcg-runtime.c tcg/runtime.c

This is kind of breaking an existing division, where tcg/ contains the code generator, and code outside tcg provides the execution environment for that generated code. In particular tcg-runtime.c is the QEMU implementation of a bunch of runtime functions and in theory some other runtime that embedded TCG could provide its own runtime helpers. (In practice TCG isn't as neatly separated from the rest of QEMU as you might like, if for instance you wanted to do TCG unit tests.)

If that would mean putting it in exec/, that would be fine.

Quoted 4 lines
Quoted 2 lines

util:
main-loop.c

This file is either misnamed or shouldn't be in util/...

It implements a generic main loop based on select. It is used by system emulators, qemu-io and qemu-nbd.

Paolo

#10 lore raw
In reply to Peter Maydell

Il 14/09/2012 15:48, Peter Maydell ha scritto:

Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

here is a proposal for moving around 150 C files currently in the toplevel directory to separate, well-delimited subdirectories.

...oh, and it would be good to be sure we've fixed all the problems with dependencies that tend to cause 'make' to fail to DTRT going backwards and forwards across a file-move commit, before we move everything around...

I think we have, at least I haven't seen complaints recently. :)

Paolo

#8 lore raw
In reply to Daniel P. Berrange

Il 14/09/2012 15:47, Daniel P. Berrange ha scritto:

Quoted 8 lines · Paolo Bonzini
Quoted 6 lines

Hi all,

here is a proposal for moving around 150 C files currently in the toplevel directory to separate, well-delimited subdirectories. Header files would be moved for now in include/, preparing for subsequent reorganization of headers.

Quoted 4 lines

I tend to view usage of a separate 'include/' subdirectory as a location for public facing header files. For internal header files, IMHO, its nicer to just have them alongside the .c file which has the corresponding implementation.

Yes, me too, but unfortunately almost nothing follows this scheme in QEMU. Probably the hw/ files do, but I'm not touching those with a pole.

Quoted 7 lines
Quoted 2 lines

Usually the files would keep their names, but I loathe names starting with qemu-* so I took the occasion to rename those.

Heh, I would have suggested the opposite - use a 'qemu-' prefix on every single file, mostly so that you avoid the confusion where a source-local header file happens to have same name as a public header file in /usr/include.

Note the above quote is about C files, not headers.

For headers, I would solve the confusion by moving them all in subdirectories of include/, but not yet. I want to keep source files 100% unchanged for now.

Quoted 3 lines

I appauld your amibition to modularize the source tree layout more. Even if you disagree with my POV on the issues above, it would be an improvement.

Oh, on a fresh project I'd agree a lot. Just trying to do things piecewise.

Paolo

#11 lore raw
In reply to Paolo Bonzini
Quoted 7 lines · Paolo Bonzini

Il 14/09/2012 15:48, Peter Maydell ha scritto:

Quoted 4 lines

...oh, and it would be good to be sure we've fixed all the problems with dependencies that tend to cause 'make' to fail to DTRT going backwards and forwards across a file-move commit, before we move everything around...

I think we have, at least I haven't seen complaints recently. :)

I think people have just stopped bothering to complain. I'm pretty sure I saw breakage around commit 58f9b98f for example.

-- PMM

#6 lore raw
In reply to Luiz Capitulino

Il 14/09/2012 15:44, Luiz Capitulino ha scritto:

Quoted 5 lines
Quoted 2 lines
Quoted 2 lines

qapi:
error.c

error.c isn't tied to a subsystem, it's really "qemu wide". If it must reside in dir (ie. it can't be in the top dir), then I'd suggest to put it in qmp.

It's either qapi/ or util/. I'd rather avoid util/ as a dumping ground, and error.c (and propagation) seemed quite central to QAPI. But I can change.

There is no qmp/. There is qapi/, qobject/ and sysemu/monitor.

Since Anthony mentioned that QOM and QAPI are used together with QObject, but not tied, putting the JSON stuff in qobject/ made sense (qga uses it). Renaming qobject/ to qmp/ makes sense, I can do that.

However, it should be clear that qmp/ is for stuff shared by the emulators and qemu-ga, so qmp.c and qmp-commands.hx do not belong in there.

Paolo

#12 lore raw
In reply to Paolo Bonzini

Am 14.09.2012 15:17, schrieb Paolo Bonzini:

Quoted 16 lines

Hi all,

here is a proposal for moving around 150 C files currently in the toplevel directory to separate, well-delimited subdirectories. Header files would be moved for now in include/, preparing for subsequent reorganization of headers.

Usually the files would keep their names, but I loathe names starting with qemu-* so I took the occasion to rename those.

This does not touch the hw/ directory, which is its own mess and worth a separate discussion. Cleaning it up may require introducing more CONFIG_* symbols and moving stuff to libhw whenever possible (for example if we want all NICs in hw/net, all RTCs in hw/rtc, etc. perhaps with some exceptions for USB).

Quoted 3 lines

Opinions, flames, "stop this guy"s are welcome as usual.

Paolo

I really appreciate your proposal for a cleaner directory hierarchy.

Here are some more ideas:

* Move the target-xxx directories (currently 15) to target/xxx.

* Add host/xxx for host specific files (xxx = posix, wxx). Here the currently used win32 might be replaced by either wxx or by win as most of it also applies to w64.
An alternative solution would add host specific subdirectories to include/qemu and util.

* Move machine implementations (code which calls machine_init) to the respective architecture directories (hw/arm, ...). Meanwhile we have more than 50 machine implementations in hw. We could also replace hw/alpha, hw/arm, hw/cris, ... to hw/arch/alpha and so on.

* Move hardware implementations which are architecture specific to the architecture directories. This is sometimes less obvious than the machine implementations.

Stefan

#14 lore raw
In reply to Paolo Bonzini

Am 14.09.2012 15:17, schrieb Paolo Bonzini:

Quoted 10 lines

Hi all,

here is a proposal for moving around 150 C files currently in the toplevel directory to separate, well-delimited subdirectories. Header files would be moved for now in include/, preparing for subsequent reorganization of headers.

Usually the files would keep their names, but I loathe names starting with qemu-* so I took the occasion to rename those.

Quoted 7 lines

This does not touch the hw/ directory, which is its own mess and worth a separate discussion. Cleaning it up may require introducing more CONFIG_* symbols and moving stuff to libhw whenever possible (for example if we want all NICs in hw/net, all RTCs in hw/rtc, etc. perhaps with some exceptions for USB).

Opinions, flames, "stop this guy"s are welcome as usual.

Cleaning up the main directory is probably a good idea. However, we should be aware that renaming comes with a cost: Some git commands on a single file need additional options (git log --follow) to work well across renames, for others you need to know the old name in the commit you're looking at (I'm thinking of git blame here).

So let's try hard to move files only when we are very sure that they are in the right place afterwards, so that we don't have the pain twice.

Quoted 6 lines

Paolo

block:
aes.c
aio.c
async.c

Certainly not, BHs are used all over qemu.

Quoted 2 lines

block.c
blockjob.c (with plans to move it in sysemu/block)

I'm not sure if sysemu/block makes sense. But if it does, it shouldn't contain things that in theory are usable by tools as well. I think block jobs could make sense for qemu-img, they are basically the live versions of what qemu-img duplicates.

If anything, blockjob.c could become generic infrastructure, because as we noticed a while ago, there's not much that ties them to block devices.

Quoted 2 lines

nbd.c
qemu-progress.c block/progress.c

Probably not block specific either.

Quoted 9 lines

block/coroutine:

coroutine-gthread.c             block/coroutine/gthread.c
coroutine-sigaltstack.c         block/coroutine/sigaltstack.c
coroutine-ucontext.c            block/coroutine/ucontext.c
coroutine-win32.c               block/coroutine/win32.c
qemu-coroutine-io.c             block/coroutine/io.c
qemu-coroutine-lock.c           block/coroutine/lock.c
qemu-coroutine-sleep.c          block/coroutine/sleep.c
qemu-coroutine.c                block/coroutine/coroutine.c

Coroutines should be top-level, virtio-9p uses them.

Quoted 27 lines

block/drivers:
block/blkdebug.c
block/blkverify.c
block/bochs.c
block/cloop.c
block/cow.c
block/curl.c
block/dmg.c
block/iscsi.c
block/mirror.c
block/nbd.c
block/parallels.c
block/qcow.c
block/qcow2-cache.c
block/qcow2-cluster.c
block/qcow2-refcount.c
block/qcow2-snapshot.c
block/qcow2.c
block/qed-check.c
block/qed-cluster.c
block/qed-gencb.c
block/qed-l2-cache.c
block/qed-table.c
block/qed.c
block/raw-posix.c
block/raw-win32.c
block/raw.c

Quoted 8 lines

block/rbd.c
block/sheepdog.c
block/vdi.c
block/vmdk.c
block/vpc.c
block/vvfat.c
linux-aio.c
posix-aio-compat.c

We could consider subdirectories for qcow2, qed and raw-posix. I'm not convinced that it would be a good idea, but neither that it would be a bad one. I just know that I don't want to move them more than once. :-)

Quoted 3 lines

sysemu/block:
block/stream.c
blockdev.c

See above, I think stream.c should stay where it is; not sure if blockdev.c needs its own subdirectory.

Quoted 28 lines

sysemu/bt:
bt-host.c sysemu/bt/host.c
bt-vhci.c sysemu/bt/vhci.c

sysemu/char:

qemu-char.c                     sysemu/char/chardev.c
qemu-sockets.c                  sysemu/char/sockets.c
spice-qemu-char.c               sysemu/char/spice.c

sysemu/migration:
block-migration.c migration/block.c
buffered_file.c
migration-exec.c
migration-fd.c
migration-tcp.c
migration-unix.c
migration.c
page_cache.c
savevm.c

sysemu/monitor:
hmp.c
monitor.c
qmp.c
readline.c
hmp-commands.hx
qmp-commands.hx

Quoted 5 lines

tcg:
tcg-runtime.c tcg/runtime.c

tools:
cmd.c

Rename to something that makes it clearer that it's part of qemu-io?

Kevin

#13 lore raw
In reply to Stefan Weil

Il 14/09/2012 16:37, Stefan Weil ha scritto:

Quoted 3 lines

Here are some more ideas:

* Move the target-xxx directories (currently 15) to target/xxx.

Yes, of course.

Quoted 5 lines

* Add host/xxx for host specific files (xxx = posix, wxx). Here the currently used win32 might be replaced by either wxx or by win as most of it also applies to w64.
An alternative solution would add host specific subdirectories to include/qemu and util.

This makes sense, though it becomes more problematic as the host files are scattered around the tree.

Quoted 9 lines

* Move machine implementations (code which calls machine_init) to the respective architecture directories (hw/arm, ...). Meanwhile we have more than 50 machine implementations in hw. We could also replace hw/alpha, hw/arm, hw/cris, ... to hw/arch/alpha and so on.

* Move hardware implementations which are architecture specific to the architecture directories. This is sometimes less obvious than the machine implementations.

This I left out purposedly. :)

Paolo

#15 lore raw
In reply to Kevin Wolf

Il 14/09/2012 18:09, Kevin Wolf ha scritto:

Quoted 5 lines

Cleaning up the main directory is probably a good idea. However, we should be aware that renaming comes with a cost: Some git commands on a single file need additional options (git log --follow) to work well across renames, for others you need to know the old name in the commit you're looking at (I'm thinking of git blame here).

I think there was some magic for git blame.

Quoted 2 lines

So let's try hard to move files only when we are very sure that they are in the right place afterwards, so that we don't have the pain twice.

Yes, and that's why I'm leaving hw/ aside.

The only problem is include files, which might be moved twice if they are further refactored (first in include/, and later to subsystem-specific subdirectories).

I'll try however to look for header files that can be moved to one of the new subdirectories, and move them there.

Paolo

#16 lore raw
In reply to Paolo Bonzini
Quoted 10 lines · Paolo Bonzini

Hi all,

here is a proposal for moving around 150 C files currently in the toplevel directory to separate, well-delimited subdirectories. Header files would be moved for now in include/, preparing for subsequent reorganization of headers.

Usually the files would keep their names, but I loathe names starting with qemu-* so I took the occasion to rename those.

Quoted 7 lines

This does not touch the hw/ directory, which is its own mess and worth a separate discussion. Cleaning it up may require introducing more CONFIG_* symbols and moving stuff to libhw whenever possible (for example if we want all NICs in hw/net, all RTCs in hw/rtc, etc. perhaps with some exceptions for USB).

Opinions, flames, "stop this guy"s are welcome as usual.

Good idea.

Quoted 58 lines

Paolo

block:
aes.c
aio.c
async.c
block.c
blockjob.c (with plans to move it in sysemu/block) nbd.c
qemu-progress.c block/progress.c

block/coroutine:

coroutine-gthread.c             block/coroutine/gthread.c
coroutine-sigaltstack.c         block/coroutine/sigaltstack.c
coroutine-ucontext.c            block/coroutine/ucontext.c
coroutine-win32.c               block/coroutine/win32.c
qemu-coroutine-io.c             block/coroutine/io.c
qemu-coroutine-lock.c           block/coroutine/lock.c
qemu-coroutine-sleep.c          block/coroutine/sleep.c
qemu-coroutine.c                block/coroutine/coroutine.c

block/drivers:
block/blkdebug.c
block/blkverify.c
block/bochs.c
block/cloop.c
block/cow.c
block/curl.c
block/dmg.c
block/iscsi.c
block/mirror.c
block/nbd.c
block/parallels.c
block/qcow.c
block/qcow2-cache.c
block/qcow2-cluster.c
block/qcow2-refcount.c
block/qcow2-snapshot.c
block/qcow2.c
block/qed-check.c
block/qed-cluster.c
block/qed-gencb.c
block/qed-l2-cache.c
block/qed-table.c
block/qed.c
block/raw-posix.c
block/raw-win32.c
block/raw.c
block/rbd.c
block/sheepdog.c
block/vdi.c
block/vmdk.c
block/vpc.c
block/vvfat.c
linux-aio.c
posix-aio-compat.c

Quoted 1 line

exec:

These files need cleanup so that TCG code gets into tcg/. Maybe also TB and CPUTLB handling.

Quoted 5 lines

cpu-exec.c
disas.c
exec.c
gdbstub.c
tci.c (note: TCI can't go in tcg/ for licensing reasons)

The directory organization should not be affected by licensing issues, it's licenses of each file that counts. We could create a new directory and move code from TCG to that.

Quoted 45 lines

translate-all.c

hw:
hw/dma.c hw/i8257.c
dma-helpers.c hw/dma.c

libdis:
alpha-dis.c libdis/alpha.c
arm-dis.c libdis/arm.c

cris-dis.c                      libdis/cris.c
hppa-dis.c                      libdis/hppa.c
i386-dis.c                      libdis/i386.c
ia64-dis.c                      libdis/ia64.c
lm32-dis.c                      libdis/lm32.c
m68k-dis.c                      libdis/m68k.c
microblaze-dis.c                libdis/microblaze.c
mips-dis.c                      libdis/mips.c
ppc-dis.c                       libdis/ppc.c
s390-dis.c                      libdis/s390.c
sh4-dis.c                       libdis/sh4.c
sparc-dis.c                     libdis/sparc.c
tci-dis.c                       libdis/tci.c

net:
net.c

qapi:
error.c

qga:
qemu-ga.c qga/main.c

qobject:
json-lexer.c
json-parser.c
json-streamer.c
qbool.c
qdict.c
qerror.c
qfloat.c
qint.c
qjson.c
qlist.c
qstring.c

Quoted 12 lines

sysemu:
arch_init.c
balloon.c
cpus.c
cputlb.c
cursor.c
device_tree.c
dump-stub.c
dump.c
ioport.c
kvm-all.c
kvm-stub.c

How about kvm and xen as top level directories?

Quoted 15 lines

memory.c
memory_mapping-stub.c
memory_mapping.c
os-posix.c
os-win32.c
pflib.c
qemu-error.c sysemu/error.c
qemu-seccomp.c sysemu/seccomp.c
qtest.c
vl.c
xen-all.c
xen-mapcache.c
xen-stub.c
qemu-options.hx

Quoted 1 line

sysemu/block:

This distinction is not so clear to me. For example, why do block/ and qobject/ reside in the top level?

Quoted 23 lines

block/stream.c
blockdev.c

sysemu/bt:
bt-host.c sysemu/bt/host.c
bt-vhci.c sysemu/bt/vhci.c

sysemu/char:

qemu-char.c                     sysemu/char/chardev.c
qemu-sockets.c                  sysemu/char/sockets.c
spice-qemu-char.c               sysemu/char/spice.c

sysemu/migration:
block-migration.c migration/block.c
buffered_file.c
migration-exec.c
migration-fd.c
migration-tcp.c
migration-unix.c
migration.c
page_cache.c
savevm.c

Quoted 7 lines

sysemu/monitor:
hmp.c
monitor.c
qmp.c
readline.c
hmp-commands.hx
qmp-commands.hx

I think audio and maybe net could also fit here as subdirectories of sysemu.

Quoted 13 lines

tcg:
tcg-runtime.c tcg/runtime.c

tools:
cmd.c
qemu-bridge-helper.c
qemu-img.c
qemu-img-cmds.hx
qemu-io.c
qemu-nbd.c
qemu-tool.c tools/stub.c

Quoted 8 lines

ui:
console.c
input.c

user:
qemu-user.c user/stub.c
thunk.c
user-exec.c user/cpu-exec.c

Also user-exec.c is related to TCG. But the difference is not so interesting here since there's no KVM nor Xen for user emulators.

Quoted 20 lines

util:
acl.c
bitmap.c
bitops.c
cache-utils.c
compatfd.c
cutils.c
envlist.c
event_notifier.c
host-utils.c
iohandler.c
iov.c
main-loop.c
module.c
notify.c
osdep.c
oslib-posix.c
oslib-win32.c
path.c

Quoted 7 lines
qemu-config.c                   util/config.c
qemu-log.c                      util/log.c
qemu-option.c                   util/option.c
qemu-thread-posix.c             util/thread-posix.c
qemu-thread-win32.c             util/thread-win32.c
qemu-timer-common.c             util/clock.c
qemu-timer.c                    util/timer.c

Some of these could also go to compat/.

Quoted 2 lines
#17 lore raw

Il 14/09/2012 21:51, Blue Swirl ha scritto:

Quoted 32 lines · Paolo Bonzini
Quoted 10 lines

Hi all,

here is a proposal for moving around 150 C files currently in the toplevel directory to separate, well-delimited subdirectories. Header files would be moved for now in include/, preparing for subsequent reorganization of headers.

Usually the files would keep their names, but I loathe names starting with qemu-* so I took the occasion to rename those.

Quoted 7 lines

This does not touch the hw/ directory, which is its own mess and worth a separate discussion. Cleaning it up may require introducing more CONFIG_* symbols and moving stuff to libhw whenever possible (for example if we want all NICs in hw/net, all RTCs in hw/rtc, etc. perhaps with some exceptions for USB).

Opinions, flames, "stop this guy"s are welcome as usual.

Good idea.

Quoted 1 line

exec:

These files need cleanup so that TCG code gets into tcg/. Maybe also TB and CPUTLB handling.

Quoted 5 lines

cpu-exec.c
disas.c
exec.c
gdbstub.c
tci.c (note: TCI can't go in tcg/ for licensing reasons)

Quoted 3 lines

The directory organization should not be affected by licensing issues, it's licenses of each file that counts. We could create a new directory and move code from TCG to that.

exec/ is basically the common parts of user- and system-mode emulation.
It's unrelated to separating TCG from other accelerators.

Quoted 15 lines
Quoted 14 lines

translate-all.c

sysemu:
arch_init.c
balloon.c
cpus.c
cputlb.c
cursor.c
device_tree.c
dump-stub.c
dump.c
ioport.c
kvm-all.c
kvm-stub.c

Quoted 1 line

How about kvm and xen as top level directories?

Note sure, it's just 2-3 files each for now.

Quoted 15 lines
Quoted 15 lines

memory.c
memory_mapping-stub.c
memory_mapping.c
os-posix.c
os-win32.c
pflib.c
qemu-error.c sysemu/error.c
qemu-seccomp.c sysemu/seccomp.c
qtest.c
vl.c
xen-all.c
xen-mapcache.c
xen-stub.c
qemu-options.hx

Quoted 4 lines
Quoted 1 line

sysemu/block:

This distinction is not so clear to me. For example, why do block/ and qobject/ reside in the top level?

Because they are used by tools. sysemu/ is not going to be used by tools nor user-mode emulation.

Quoted 31 lines
Quoted 23 lines

block/stream.c
blockdev.c

sysemu/bt:
bt-host.c sysemu/bt/host.c
bt-vhci.c sysemu/bt/vhci.c

sysemu/char:

qemu-char.c                     sysemu/char/chardev.c
qemu-sockets.c                  sysemu/char/sockets.c
spice-qemu-char.c               sysemu/char/spice.c

sysemu/migration:
block-migration.c migration/block.c
buffered_file.c
migration-exec.c
migration-fd.c
migration-tcp.c
migration-unix.c
migration.c
page_cache.c
savevm.c

Quoted 7 lines

sysemu/monitor:
hmp.c
monitor.c
qmp.c
readline.c
hmp-commands.hx
qmp-commands.hx

Quoted 1 line

I think audio and maybe net could also fit here as subdirectories of sysemu.

Yes, also ui/, fsdev/, slirp/, but I omitted those for simplicity.

Paolo

#3 lore raw
In reply to Paolo Bonzini
Quoted 16 lines · Paolo Bonzini

Il 14/09/2012 15:36, Peter Maydell ha scritto:

Quoted 9 lines · Paolo Bonzini
Quoted 2 lines

here is a proposal for moving around 150 C files currently in the toplevel directory to separate, well-delimited subdirectories.

No general objection (though some specific comments below). However I think it would be helpful if you could provide some descriptions of how your new subdirectories are defined. Otherwise the "well-delimited" bit is largely in your head and future new files aren't likely to respect it except by accident :-)

Good question. I just tried to use some taste, so well-delimited is a bit of a lie. I mostly care that sysemu/, tools/, qga/ and user/ are well-delimited, i.e. executables do not have sources from other executables' directories, and similarly common/ is just for emulators.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Header
files would be moved for now in include/, preparing for subsequent reorganization of headers.

Just in include/, or in include/qemu/ ? (IIRC Anthony was hoping to only move cleaned-up headers in there?)

I dislike include/qemu, for the same reason I dislike qemu-*. :)

It's good to put includes in a single direction such that you can do -Iinclude and then:

#include "qemu/foo.h"

Which is better than:

#include "foo.h"

Because the later can create confusion/conflict with system headers whereas the former is (hopefully) completely unambiguous.

Quoted 4 lines

Moving to include/ would be to clean up the top-level directory, withour touching the source code. If something can be moved directly to one of the new source directories, that's also fine but I don't have high hopes.

I actually thinking moving to -Iinclude is a Good Thing for now because it avoids touching a bunch of .c files. In the longer term, we should continue to clean up headers and move them into qemu/ though.

Regards,

Anthony Liguori

#25 lore raw
In reply to Paolo Bonzini
Quoted 10 lines · Paolo Bonzini

Hi all,

here is a proposal for moving around 150 C files currently in the toplevel directory to separate, well-delimited subdirectories. Header files would be moved for now in include/, preparing for subsequent reorganization of headers.

Usually the files would keep their names, but I loathe names starting with qemu-* so I took the occasion to rename those.

Quoted 7 lines

This does not touch the hw/ directory, which is its own mess and worth a separate discussion. Cleaning it up may require introducing more CONFIG_* symbols and moving stuff to libhw whenever possible (for example if we want all NICs in hw/net, all RTCs in hw/rtc, etc. perhaps with some exceptions for USB).

Opinions, flames, "stop this guy"s are welcome as usual.

Thanks for doing this! I'm of the opinion that something is better than nothing here so I'll resist the urge to argue why blue is the best color for the shed.

But one concern I have: this will be a big source of rebasing. Perhaps we can schedule this?

Have you done the reorg yet? Presumably it's just some make file changes and a bunch of renames? Perhaps we can schedule it for November 1st to mark the start of the soft freeze.

Since many of us are traveling afterwards, I expect there won't be a lot of last minute merging for this release.

Regards,

Anthony Liguori

Quoted 215 lines

Paolo

block:
aes.c
aio.c
async.c
block.c
blockjob.c (with plans to move it in sysemu/block) nbd.c
qemu-progress.c block/progress.c

block/coroutine:

coroutine-gthread.c             block/coroutine/gthread.c
coroutine-sigaltstack.c         block/coroutine/sigaltstack.c
coroutine-ucontext.c            block/coroutine/ucontext.c
coroutine-win32.c               block/coroutine/win32.c
qemu-coroutine-io.c             block/coroutine/io.c
qemu-coroutine-lock.c           block/coroutine/lock.c
qemu-coroutine-sleep.c          block/coroutine/sleep.c
qemu-coroutine.c                block/coroutine/coroutine.c

block/drivers:
block/blkdebug.c
block/blkverify.c
block/bochs.c
block/cloop.c
block/cow.c
block/curl.c
block/dmg.c
block/iscsi.c
block/mirror.c
block/nbd.c
block/parallels.c
block/qcow.c
block/qcow2-cache.c
block/qcow2-cluster.c
block/qcow2-refcount.c
block/qcow2-snapshot.c
block/qcow2.c
block/qed-check.c
block/qed-cluster.c
block/qed-gencb.c
block/qed-l2-cache.c
block/qed-table.c
block/qed.c
block/raw-posix.c
block/raw-win32.c
block/raw.c
block/rbd.c
block/sheepdog.c
block/vdi.c
block/vmdk.c
block/vpc.c
block/vvfat.c
linux-aio.c
posix-aio-compat.c

exec:
cpu-exec.c
disas.c
exec.c
gdbstub.c
tci.c (note: TCI can't go in tcg/ for licensing reasons) translate-all.c

hw:
hw/dma.c hw/i8257.c
dma-helpers.c hw/dma.c

libdis:
alpha-dis.c libdis/alpha.c
arm-dis.c libdis/arm.c

cris-dis.c                      libdis/cris.c
hppa-dis.c                      libdis/hppa.c
i386-dis.c                      libdis/i386.c
ia64-dis.c                      libdis/ia64.c
lm32-dis.c                      libdis/lm32.c
m68k-dis.c                      libdis/m68k.c
microblaze-dis.c                libdis/microblaze.c
mips-dis.c                      libdis/mips.c
ppc-dis.c                       libdis/ppc.c
s390-dis.c                      libdis/s390.c
sh4-dis.c                       libdis/sh4.c
sparc-dis.c                     libdis/sparc.c
tci-dis.c                       libdis/tci.c

net:
net.c

qapi:
error.c

qga:
qemu-ga.c qga/main.c

qobject:
json-lexer.c
json-parser.c
json-streamer.c
qbool.c
qdict.c
qerror.c
qfloat.c
qint.c
qjson.c
qlist.c
qstring.c

sysemu:
arch_init.c
balloon.c
cpus.c
cputlb.c
cursor.c
device_tree.c
dump-stub.c
dump.c
ioport.c
kvm-all.c
kvm-stub.c
memory.c
memory_mapping-stub.c
memory_mapping.c
os-posix.c
os-win32.c
pflib.c
qemu-error.c sysemu/error.c
qemu-seccomp.c sysemu/seccomp.c
qtest.c
vl.c
xen-all.c
xen-mapcache.c
xen-stub.c
qemu-options.hx

sysemu/block:
block/stream.c
blockdev.c

sysemu/bt:
bt-host.c sysemu/bt/host.c
bt-vhci.c sysemu/bt/vhci.c

sysemu/char:

qemu-char.c                     sysemu/char/chardev.c
qemu-sockets.c                  sysemu/char/sockets.c
spice-qemu-char.c               sysemu/char/spice.c

sysemu/migration:
block-migration.c migration/block.c
buffered_file.c
migration-exec.c
migration-fd.c
migration-tcp.c
migration-unix.c
migration.c
page_cache.c
savevm.c

sysemu/monitor:
hmp.c
monitor.c
qmp.c
readline.c
hmp-commands.hx
qmp-commands.hx

tcg:
tcg-runtime.c tcg/runtime.c

tools:
cmd.c
qemu-bridge-helper.c
qemu-img.c
qemu-img-cmds.hx
qemu-io.c
qemu-nbd.c
qemu-tool.c tools/stub.c

ui:
console.c
input.c

user:
qemu-user.c user/stub.c
thunk.c
user-exec.c user/cpu-exec.c

util:
acl.c
bitmap.c
bitops.c
cache-utils.c
compatfd.c
cutils.c
envlist.c
event_notifier.c
host-utils.c
iohandler.c
iov.c
main-loop.c
module.c
notify.c
osdep.c
oslib-posix.c
oslib-win32.c
path.c

qemu-config.c                   util/config.c
qemu-log.c                      util/log.c
qemu-option.c                   util/option.c
qemu-thread-posix.c             util/thread-posix.c
qemu-thread-win32.c             util/thread-win32.c
qemu-timer-common.c             util/clock.c
qemu-timer.c                    util/timer.c
#4 lore raw
In reply to Anthony Liguori

Il 16/09/2012 16:40, Anthony Liguori ha scritto:

Quoted 11 lines

It's good to put includes in a single direction such that you can do -Iinclude and then:

#include "qemu/foo.h"

Which is better than:

#include "foo.h"

Because the later can create confusion/conflict with system headers whereas the former is (hopefully) completely unambiguous.

My plan for this is to only put directories in include/, which limits a lot the possibility of confusion, for example

#include <exec/cpu-all.h>
#include <qapi/qapi-types.h>

etc.

Unfortunately, this _does_ require touching every .c file.

Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

Moving to include/ would be to clean up the top-level directory, withour touching the source code. If something can be moved directly to one of the new source directories, that's also fine but I don't have high hopes.

I actually thinking moving to -Iinclude is a Good Thing for now because it avoids touching a bunch of .c files. In the longer term, we should continue to clean up headers and move them into qemu/ though.

I disagree about qemu/ vs. other directories, but yes, it is better to avoid touching .c files at the same time you're moving them.

It is not completely possible, mostly because some header files in net/ combine both private content (which should move to sysemu/net/) and public content (which should move to include/net/), but that should be the exception.

Paolo

#26 lore raw
In reply to Anthony Liguori

Il 16/09/2012 16:44, Anthony Liguori ha scritto:

Quoted 8 lines

Thanks for doing this! I'm of the opinion that something is better than nothing here so I'll resist the urge to argue why blue is the best color for the shed.

But one concern I have: this will be a big source of rebasing. Perhaps we can schedule this?

From what I've seen so far, rebase copes well with renames. But yes,

I'm willing to maintain the series until the end of October.

Quoted 1 line

Have you done the reorg yet?

I'm 90% through. I hope to post something for review, and perhaps some initial bits, in a couple of weeks or less (depending on other obviously more urgent things to do).

But if it's 1 month away, I'd probably prefer to merge the include file renaming at the same time.

Quoted 2 lines

Presumably it's just some make file
changes and a bunch of renames?

Mostly; net/ is the hairiest subsystem, otherwise it's pretty straightforward.

Paolo

#27 lore raw
Quoted 9 lines · Paolo Bonzini

Il 16/09/2012 16:44, Anthony Liguori ha scritto:

Quoted 6 lines

Thanks for doing this! I'm of the opinion that something is better than nothing here so I'll resist the urge to argue why blue is the best color for the shed.

But one concern I have: this will be a big source of rebasing. Perhaps we can schedule this?

From what I've seen so far, rebase copes well with renames.

It does, but git-am doesn't. I've never had much luck with --3way either.

Quoted 2 lines

But yes,
I'm willing to maintain the series until the end of October.

Okay, if it gets onerous to maintain, we can try to merge it earlier, but let's shoot for the end of October for now to give people a chance to get things merged.

Quoted 8 lines
Quoted 1 line

Have you done the reorg yet?

I'm 90% through. I hope to post something for review, and perhaps some initial bits, in a couple of weeks or less (depending on other obviously more urgent things to do).

But if it's 1 month away, I'd probably prefer to merge the include file renaming at the same time.

That's reasonable.

Regards,

Anthony Liguori

Quoted 8 lines
Quoted 3 lines

Presumably it's just some make file
changes and a bunch of renames?

Mostly; net/ is the hairiest subsystem, otherwise it's pretty straightforward.

Paolo

#18 lore raw
In reply to Blue Swirl
Quoted 5 lines · Blue Swirl
Quoted 2 lines

exec:

These files need cleanup so that TCG code gets into tcg/. Maybe also TB and CPUTLB handling.

Some of that could be done by adding a separate MemoryListener for tcg.

Signature · 1 line
error compiling committee.c: too many arguments to function
#19 lore raw
Quoted 8 lines · Avi Kivity
Quoted 5 lines · Blue Swirl
Quoted 2 lines

exec:

These files need cleanup so that TCG code gets into tcg/. Maybe also TB and CPUTLB handling.

Some of that could be done by adding a separate MemoryListener for tcg.

But the TBs and CPUTLB are based on virtual mappings, it would mean that MMU maps would have to be modeled using memory API. Is that fast enough?

This could have nice cleanup effects though and for example enable generic 'info vmtree' to discover VA->PA mappings for any target instead of current MMU table walkers.

Quoted 4 lines

--
error compiling committee.c: too many arguments to function

#20 lore raw
Quoted 5 lines · Blue Swirl
Quoted 4 lines · Avi Kivity
Quoted 3 lines · Blue Swirl
Quoted 2 lines

exec:

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

These files need cleanup so that TCG code gets into tcg/. Maybe also TB and CPUTLB handling.

Some of that could be done by adding a separate MemoryListener for tcg.

But the TBs and CPUTLB are based on virtual mappings, it would mean that MMU maps would have to be modeled using memory API. Is that fast enough?

No. The memory API is designed to be fast on reads at the expense of being slow on writes, and this will get worse as rcu is added.

I meant that the various calls to invalidate tcg-specific caches can use a tcg-specific MemoryListener.

Quoted 3 lines

This could have nice cleanup effects though and for example enable generic 'info vmtree' to discover VA->PA mappings for any target instead of current MMU table walkers.

How? That's in a hardware defined format that's completely invisible to the memory API.

Signature · 1 line
error compiling committee.c: too many arguments to function
#21 lore raw
Quoted 15 lines · Avi Kivity
Quoted 5 lines · Blue Swirl
Quoted 4 lines · Avi Kivity
Quoted 3 lines · Blue Swirl
Quoted 2 lines

exec:

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

These files need cleanup so that TCG code gets into tcg/. Maybe also TB and CPUTLB handling.

Some of that could be done by adding a separate MemoryListener for tcg.

But the TBs and CPUTLB are based on virtual mappings, it would mean that MMU maps would have to be modeled using memory API. Is that fast enough?

Quoted 5 lines

No. The memory API is designed to be fast on reads at the expense of being slow on writes, and this will get worse as rcu is added.

I meant that the various calls to invalidate tcg-specific caches can use a tcg-specific MemoryListener.

Maybe.

Quoted 7 lines
Quoted 4 lines

This could have nice cleanup effects though and for example enable generic 'info vmtree' to discover VA->PA mappings for any target instead of current MMU table walkers.

How? That's in a hardware defined format that's completely invisible to the memory API.

It's invisible now, but target-specific code could grab the mappings and feed them to memory API. Memory API would just see the per-CPU virtual memory as address spaces that map to physical memory address space.

For RAM backed MMU tables like x86 and Sparc32, writes to page table memory areas would need to be tracked like SMC. For in-MMU TLBs, this would not be needed.

Again, if performance would degrade, this would not be worthwhile. I'd expect VA->PA mappings to change at least at context switch rate + page fault rate + mmap/exec activity so this could amount to thousands of changes per second per CPU.

In theory KVM could use memory API as CPU type agnostic way to exchange this information, I'd expect that KVM exit rate is not nearly as big and in many cases exchange of mapping information would not be needed. It would not improve performance there either.

Quoted 3 lines

--
error compiling committee.c: too many arguments to function

#22 lore raw
Quoted 22 lines · Blue Swirl
Quoted 7 lines
Quoted 4 lines

This could have nice cleanup effects though and for example enable generic 'info vmtree' to discover VA->PA mappings for any target instead of current MMU table walkers.

How? That's in a hardware defined format that's completely invisible to the memory API.

It's invisible now, but target-specific code could grab the mappings and feed them to memory API. Memory API would just see the per-CPU virtual memory as address spaces that map to physical memory address space.

For RAM backed MMU tables like x86 and Sparc32, writes to page table memory areas would need to be tracked like SMC. For in-MMU TLBs, this would not be needed.

Again, if performance would degrade, this would not be worthwhile. I'd expect VA->PA mappings to change at least at context switch rate + page fault rate + mmap/exec activity so this could amount to thousands of changes per second per CPU.

Quoted 5 lines

In theory KVM could use memory API as CPU type agnostic way to exchange this information, I'd expect that KVM exit rate is not nearly as big and in many cases exchange of mapping information would not be needed. It would not improve performance there either.

First, the memory API does not operate at that level. It handles (guest physical) -> (host virtual | io callback) translations. These are (guest virtual) -> (guest physical translations).

Second, the memory API is machine-wide and designed for coarse maps. Processor memory maps are per-cpu and page-grained. (the memory API actually needs to efficiently support page-grained maps (for iommus) and per-cpu maps (smm), but that's another story).

Third, we know from the pre-npt/ept days that tracking all mappings destroys performance. It's much better to do this on demand.

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
#23 lore raw
Quoted 23 lines · Avi Kivity
Quoted 22 lines · Blue Swirl
Quoted 7 lines
Quoted 4 lines

This could have nice cleanup effects though and for example enable generic 'info vmtree' to discover VA->PA mappings for any target instead of current MMU table walkers.

How? That's in a hardware defined format that's completely invisible to the memory API.

It's invisible now, but target-specific code could grab the mappings and feed them to memory API. Memory API would just see the per-CPU virtual memory as address spaces that map to physical memory address space.

For RAM backed MMU tables like x86 and Sparc32, writes to page table memory areas would need to be tracked like SMC. For in-MMU TLBs, this would not be needed.

Again, if performance would degrade, this would not be worthwhile. I'd expect VA->PA mappings to change at least at context switch rate + page fault rate + mmap/exec activity so this could amount to thousands of changes per second per CPU.

Quoted 5 lines
Quoted 5 lines

In theory KVM could use memory API as CPU type agnostic way to exchange this information, I'd expect that KVM exit rate is not nearly as big and in many cases exchange of mapping information would not be needed. It would not improve performance there either.

Perhaps I was not very clear, but this was just theoretical.

Quoted 4 lines

First, the memory API does not operate at that level. It handles (guest physical) -> (host virtual | io callback) translations. These are (guest virtual) -> (guest physical translations).

I don't see why memory API could not be used also for GVA-GPA translation if we ignore performance for the sake of discussion.

Quoted 7 lines

Second, the memory API is machine-wide and designed for coarse maps. Processor memory maps are per-cpu and page-grained. (the memory API actually needs to efficiently support page-grained maps (for iommus) and per-cpu maps (smm), but that's another story).

Third, we know from the pre-npt/ept days that tracking all mappings destroys performance. It's much better to do this on demand.

Yes, performance reasons kill this idea. It would still be beautiful.

Quoted 5 lines

--
I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.

#24 lore raw
Quoted 33 lines · Blue Swirl
Quoted 23 lines · Avi Kivity
Quoted 22 lines · Blue Swirl
Quoted 7 lines
Quoted 4 lines

This could have nice cleanup effects though and for example enable generic 'info vmtree' to discover VA->PA mappings for any target instead of current MMU table walkers.

How? That's in a hardware defined format that's completely invisible to the memory API.

It's invisible now, but target-specific code could grab the mappings and feed them to memory API. Memory API would just see the per-CPU virtual memory as address spaces that map to physical memory address space.

For RAM backed MMU tables like x86 and Sparc32, writes to page table memory areas would need to be tracked like SMC. For in-MMU TLBs, this would not be needed.

Again, if performance would degrade, this would not be worthwhile. I'd expect VA->PA mappings to change at least at context switch rate + page fault rate + mmap/exec activity so this could amount to thousands of changes per second per CPU.

Quoted 5 lines
Quoted 5 lines

In theory KVM could use memory API as CPU type agnostic way to exchange this information, I'd expect that KVM exit rate is not nearly as big and in many cases exchange of mapping information would not be needed. It would not improve performance there either.

Perhaps I was not very clear, but this was just theoretical.

Quoted 1 line
Quoted 6 lines
Quoted 3 lines

First, the memory API does not operate at that level. It handles (guest physical) -> (host virtual | io callback) translations. These are (guest virtual) -> (guest physical translations).

I don't see why memory API could not be used also for GVA-GPA translation if we ignore performance for the sake of discussion.

For the reasons I mentioned. The guest doesn't issue calls into the memory API. The granularity is wrong. It is a system-wide API.

The latter two issues have to change to support IOMMUs, and then indeed the memory API will be much closer to a CPU MMU (on x86 they can even share page tables in some circumstances). It will still be the wrong API IMO.

Quoted 11 lines
Quoted 8 lines

Second, the memory API is machine-wide and designed for coarse maps. Processor memory maps are per-cpu and page-grained. (the memory API actually needs to efficiently support page-grained maps (for iommus) and per-cpu maps (smm), but that's another story).

Third, we know from the pre-npt/ept days that tracking all mappings destroys performance. It's much better to do this on demand.

Yes, performance reasons kill this idea. It would still be beautiful.

Maybe I'm missing something, but I don't see this. But as you said, it's theoretical.

Signature · 1 line
error compiling committee.c: too many arguments to function