On Tue, 20 Mar 2018, Thomas Lindroth wrote: > On 03/20/2018 04:16 PM, Masahiro Yamada wrote: > >> Some filesystems have timestamps with coarse precision that may allow > >> for a recently built object file to have the same timestamp as the > >> updated time on one of its dependency files. When that happens, the > >> object file doesn't get rebuilt as it should. > >> > >> This is especially the case on filesystems that don't have sub-second > >> time precision, such as ext3 or Ext4 with 128B inodes. > >> > >> Let's prevent that by making sure updated dependency files have a newer > >> timestamp than the first file we created (i.e. autoksyms.h.tmpnew). > >> > >> Reported-by: Thomas Lindroth <thomas.lindroth@xxxxxxxxx> > >> Signed-off-by: Nicolas Pitre <nico@xxxxxxxxxx> > >> > >> diff --git a/scripts/adjust_autoksyms.sh b/scripts/adjust_autoksyms.sh > >> index 513da1a4a2..d67830e6e3 100755 > >> --- a/scripts/adjust_autoksyms.sh > >> +++ b/scripts/adjust_autoksyms.sh > >> @@ -84,6 +84,13 @@ while read sympath; do > >> depfile="include/config/ksym/${sympath}.h" > >> mkdir -p "$(dirname "$depfile")" > >> touch "$depfile" > >> + # Filesystems with coarse time precision may create timestamps > >> + # equal to the one from a file that was very recently built and that > >> + # needs to be rebuild. Let's guard against that by making sure our > >> + # dep files are always newer than the first file we created here. > >> + while [ ! "$depfile" -nt "$new_ksyms_file" ]; do > >> + touch "$depfile" > >> + done > >> echo $((count += 1)) > >> done | tail -1 ) > >> changed=${changed:-0} > > > > > > Does this patch solve your problem? > > I guess so, but I want you to test it just in case. > > Yes, it solves the build problem but I'm still experiencing the original > problem with vfio forwarded pci device even with this patch. All this patch pretends to do is fix the build race issue. So it should probably be applied for that reason alone. > The problem is the same as before. A kvm based VM fails to initialize > a pci device assigned using vfio if TRIM_UNUSED_KSYMS is on but works > fine with it off. > > I don't feel like spending time debugging that problem myself. > TRIM_UNUSED_KSYMS sounded useful at first but the build time increased > so much I probably won't use it anyway. If you manage to figure out > what the problem is I'm willing to test patches. If you could give me simple step by step reproduction instructions for the issue then I'll have a look. Nicolas -- To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html