XenSummit: Empty per-arch files
Hello,
This wasn't a formal discussion point at XenSummit, but Oleksii pointed out that it was still a problem, hence this thread.
As we take on more architectures, it becomes more and more important for things to be handled in a mostly-common way. With that comes quite a lot of <xen/foo.h> including <asm/foo.h>, and the arch one being a stub in simple cases.
It would be nice to get rid of the stub files; they're irritating to deal with, both when refactoring and simply for the file bloat they create.
There are two options which come to mind.
1) Use __has_include(). This would be ideal, but would require us bumping the minimum GCC version to 4.9.2 as a prerequisite. I'm not aware of any way to emulate the necessary behaviour on older toolchains.
2) Have a stub "architecture" which is always last on the include path. This would reduce the number of stub files from one set per arch, to only one set.
Anything else that I've missed?
~Andrew
Quoted 19 lines · Andrew Cooper
Hello,
This wasn't a formal discussion point at XenSummit, but Oleksii pointed out that it was still a problem, hence this thread.
As we take on more architectures, it becomes more and more important for things to be handled in a mostly-common way. With that comes quite a lot of <
xen/foo.h> including <asm/foo.h>, and the arch one being a stub in simple cases.It would be nice to get rid of the stub files; they're irritating to deal with, both when refactoring and simply for the file bloat they create.
There are two options which come to mind.
1) Use __has_include(). This would be ideal, but would require us bumping the minimum GCC version to 4.9.2 as a prerequisite. I'm not aware of any way to emulate the necessary behaviour on older toolchains.
Quoted 5 lines
2) Have a stub "architecture" which is always last on the include path. This would reduce the number of stub files from one set per arch, to only one set.
Anything else that I've missed?
What about a make rule creating an empty include file if it is missing?
Juergen
Quoted 21 lines · Juergen Gross
Quoted 20 lines · Andrew Cooper
Hello,
This wasn't a formal discussion point at XenSummit, but Oleksii pointed out that it was still a problem, hence this thread.
As we take on more architectures, it becomes more and more important for things to be handled in a mostly-common way. With that comes quite a lot of <
xen/foo.h> including <asm/foo.h>, and the arch one being a stub in simple cases.It would be nice to get rid of the stub files; they're irritating to deal with, both when refactoring and simply for the file bloat they create.
There are two options which come to mind.
1) Use __has_include(). This would be ideal, but would require us bumping the minimum GCC version to 4.9.2 as a prerequisite. I'm not aware of any way to emulate the necessary behaviour on older toolchains.
Quoted 7 lines
Quoted 5 lines
2) Have a stub "architecture" which is always last on the include path. This would reduce the number of stub files from one set per arch, to only one set.
Anything else that I've missed?
What about a make rule creating an empty include file if it is missing?
Wouldn't that cause a typo'd header file name to spring into existence ?
And it would cause a build to leave the working tree dirty.
~Andrew
Quoted 26 lines · Andrew Cooper
Quoted 25 lines · Juergen Gross
Quoted 24 lines · Andrew Cooper
Hello,
This wasn't a formal discussion point at XenSummit, but Oleksii pointed out that it was still a problem, hence this thread.
As we take on more architectures, it becomes more and more important for things to be handled in a mostly-common way. With that comes quite a lot of <
xen/foo.h> including <asm/foo.h>, and the arch one being a stub in simple cases.It would be nice to get rid of the stub files; they're irritating to deal with, both when refactoring and simply for the file bloat they create.
There are two options which come to mind.
1) Use __has_include(). This would be ideal, but would require us bumping the minimum GCC version to 4.9.2 as a prerequisite. I'm not aware of any way to emulate the necessary behaviour on older toolchains.
2) Have a stub "architecture" which is always last on the include path. This would reduce the number of stub files from one set per arch, to only one set.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Anything else that I've missed?
What about a make rule creating an empty include file if it is missing?
Wouldn't that cause a typo'd header file name to spring into existence ?
And it would cause a build to leave the working tree dirty.
Depends how it is done.
There could be a file containing the allowed header names to be generated.
And the files wouldn't need to be generated in arch/<arch>/include/asm, but could be generated in e.g. include/generated/asm which would be used after the arch include path.
This would basically be the central stub variant you were mentioning, but building it dynamically.
Juergen
Hello,
Quoted 59 lines · Juergen Gross
Quoted 39 lines · Andrew Cooper
Quoted 38 lines · Juergen Gross
Quoted 36 lines · Andrew Cooper
Hello,
This wasn't a formal discussion point at XenSummit, but Oleksii pointed
out that it was still a problem, hence this thread.As we take on more architectures, it becomes more and more important for
things to be handled in a mostly-common way. With that comes quite a
lot of <xen/foo.h> including <asm/foo.h>, and the arch one being a stub
in simple cases.It would be nice to get rid of the stub files; they're irritating to
deal with, both when refactoring and simply for the file bloat they
create.There are two options which come to mind.
1) Use __has_include(). This would be ideal, but would require us
bumping the minimum GCC version to 4.9.2 as a prerequisite. I'm not
aware of any way to emulate the necessary behaviour on older toolchains.2) Have a stub "architecture" which is always last on the include path.
This would reduce the number of stub files from one set per arch, to
only one set.Anything else that I've missed?
Quoted 7 lines
Quoted 2 lines
What about a make rule creating an empty include file if it is missing?
Wouldn't that cause a typo'd header file name to spring into existence ?
And it would cause a build to leave the working tree dirty.
Depends how it is done.
There could be a file containing the allowed header names to be generated.
And the files wouldn't need to be generated in arch/<arch>/include/asm, but
could be generated in e.g.include/generated/asmwhich would be used after
the arch include path.
Quoted 3 lines
This would basically be the central stub variant you were mentioning, but
building it dynamically.
I started to analyze how many headers right now are empty, and it looks not too many for ARM and x86.
For RISC-V, when the building of common code is enabled, the number of empty headers will be around 4-5. But at the end ( when will be enough functionality to run dom0 ), the amount of empty headers is 2 (probably a little bit bigger, I don't remember and don't have access to my source code )
However, at least between ARM and RISC-V, many headers are the same ( or they can be the same after some refactoring, f.e cache.h ).
So, it would be better to use stubs instead of dynamically generated empty headers, as it looks like overkill only for a few empty headers. But who knows what will be in the future, and possible it makes sense to have a combination of stubs and dynamically created empty headers.
If no one is fine with me, I can implement that as common code will be enabled for RISC-V soon.
It may be helpful for PPC too soon.
~ Oleksii
Quoted 15 lines · Andrew Cooper
Hello,
This wasn't a formal discussion point at XenSummit, but Oleksii pointed out that it was still a problem, hence this thread.
As we take on more architectures, it becomes more and more important for things to be handled in a mostly-common way. With that comes quite a lot of <
xen/foo.h> including <asm/foo.h>, and the arch one being a stub in simple cases.It would be nice to get rid of the stub files; they're irritating to deal with, both when refactoring and simply for the file bloat they create.
There are two options which come to mind.
Quoted 7 lines
1) Use __has_include(). This would be ideal, but would require us bumping the minimum GCC version to 4.9.2 as a prerequisite. I'm not aware of any way to emulate the necessary behaviour on older toolchains.
2) Have a stub "architecture" which is always last on the include path. This would reduce the number of stub files from one set per arch, to only one set.
I'd be in favor of 2, which iirc is also how Linux does it (in certain cases, iirc; or maybe things have changed yet again there). They call it asm-generic/, which I think is slightly better than anything with "stub" in its name.
Jan
Quoted 1 line · Andrew Cooper
Hello,
Hi Andrew,
Quoted 10 lines
This wasn't a formal discussion point at XenSummit, but Oleksii pointed out that it was still a problem, hence this thread.
As we take on more architectures, it becomes more and more important for things to be handled in a mostly-common way. With that comes quite a lot of <
xen/foo.h> including <asm/foo.h>, and the arch one being a stub in simple cases.It would be nice to get rid of the stub files; they're irritating to deal with, both when refactoring and simply for the file bloat they create.
This is definitely something that would be great to see from the Power side of things, especially as we're getting to the point where we'd like to start dropping the build overrides in arch.mk and building the rest of xen/common/.
As we get to that point, I was wonder if upstream would be fine with submission of patches that add stub files for ppc in the interim, to be removed later when this proposal is finalized and a solution is decided upon. It'd obviously be best to avoid too much duplication of effort, but at the same time we'd like to avoid getting blocked on progressing.
Quoted 1 line
~Andrew
Thanks,
Shawn
Quoted 21 lines · Shawn Anastasio
Quoted 1 line · Andrew Cooper
Hello,
Hi Andrew,
Quoted 10 lines
This wasn't a formal discussion point at XenSummit, but Oleksii pointed out that it was still a problem, hence this thread.
As we take on more architectures, it becomes more and more important for things to be handled in a mostly-common way. With that comes quite a lot of <
xen/foo.h> including <asm/foo.h>, and the arch one being a stub in simple cases.It would be nice to get rid of the stub files; they're irritating to deal with, both when refactoring and simply for the file bloat they create.
This is definitely something that would be great to see from the Power side of things, especially as we're getting to the point where we'd like to start dropping the build overrides in arch.mk and building the rest of xen/common/.
Quoted 5 lines
As we get to that point, I was wonder if upstream would be fine with submission of patches that add stub files for ppc in the interim, to be removed later when this proposal is finalized and a solution is decided upon. It'd obviously be best to avoid too much duplication of effort, but at the same time we'd like to avoid getting blocked on progressing.
I see no reason why for the time being you shouldn't add stub files; you clearly shouldn't be forced to wait.
Jan