> Thanks, I missed your original mail on this last year. I now opened an issue > about this, with your suggested workaround: > https://github.com/cloudius-systems/osv/issues/913
I saw, thanks. > Given the vast number of compiler versions that people use, it's not > surprising that once in a while we get a miscompiled > and non-working OSv from one of them. Recently I worked around (see commit > c38806f49cd2d0610227b62ee7170983684c6987) > a bug which caused the round() function to hang in an infinite loop (which > also caused the VM to hang while using all the CPU). Understood - and I did see your round() fix and was hoping it fixed something for me - but alas not. > It would be nice if you could try whether other optimization options (e.g., > -O1) are enough to prevent this bug or -O0 is really > needed. With some experimentation/printouts/debugging I guess you can also > figure out what hangs, but I don't know how difficult > it would be. > > In your original patch (see issue 913) you changed only one source file to be > compiled without -O2, but in your latest patch, you > changed more source files - was this necessary? In your original patch, you > only changed compilation of lzloader.cc; This is a trivial > source file, and I don't mind at all to permanently compile this specific > file without optimization. However, the newer patch also changes the > compilation of > the uncompression implementation - this can have effect in boot performance, > so if needed to change that too, we would need to > measure its effect on boot speed. It does indeed seem that the original patch is sufficient. It wasn’t at one time, I’m sure - but for now I can use the single change for both debug and release images. $(call quiet, $(CXX) $(CXXFLAGS) -O0 -m32 -fno-instrument-functions -o $@ -c fastlz/lzloader.cc, CXX $<) Its such a small file, but my assembler foo is very rusty. Attached are objdumps of the two resulting compiles of lzloader.o, one with -O0 which results in a working image, and one with -O1 with results in a hang as the VM starts. -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
build/release.x64/fastlz/lzloader.o: file format elf32-i386 Disassembly of section .text: 00000000 <memset>: extern char _binary_loader_stripped_elf_lz_end; extern char _binary_loader_stripped_elf_lz_size; // std libraries used by fastlz. extern "C" void *memset(void *s, int c, size_t n) { 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 53 push %ebx 4: 83 ec 04 sub $0x4,%esp 7: e8 fc ff ff ff call 8 <memset+0x8> c: 05 01 00 00 00 add $0x1,%eax return __builtin_memset(s, c, n); 11: 83 ec 04 sub $0x4,%esp 14: ff 75 10 pushl 0x10(%ebp) 17: ff 75 0c pushl 0xc(%ebp) 1a: ff 75 08 pushl 0x8(%ebp) 1d: 89 c3 mov %eax,%ebx 1f: e8 fc ff ff ff call 20 <memset+0x20> 24: 83 c4 10 add $0x10,%esp } 27: 8b 5d fc mov -0x4(%ebp),%ebx 2a: c9 leave 2b: c3 ret 0000002c <uncompress_loader>: extern "C" void uncompress_loader() { 2c: 55 push %ebp 2d: 89 e5 mov %esp,%ebp 2f: 53 push %ebx 30: 83 ec 04 sub $0x4,%esp 33: e8 fc ff ff ff call 34 <uncompress_loader+0x8> 38: 05 01 00 00 00 add $0x1,%eax // pass a the last (maxout) parameter of fastlz_decompress. Let it // uncompress as much as it has input. The Makefile already verifies // that the uncompressed kernel doesn't overwrite this uncompression code. // Sadly, "INT_MAX" is the largest number we can pass. If we ever need // more than 2GB here, it won't work. fastlz_decompress(&_binary_loader_stripped_elf_lz_start, 3d: 8b 90 00 00 00 00 mov 0x0(%eax),%edx (size_t) &_binary_loader_stripped_elf_lz_size, BUFFER_OUT, INT_MAX); 43: 68 ff ff ff 7f push $0x7fffffff 48: 68 00 00 20 00 push $0x200000 4d: 52 push %edx 4e: 8b 90 00 00 00 00 mov 0x0(%eax),%edx 54: 52 push %edx 55: 89 c3 mov %eax,%ebx 57: e8 fc ff ff ff call 58 <uncompress_loader+0x2c> 5c: 83 c4 10 add $0x10,%esp } 5f: 90 nop 60: 8b 5d fc mov -0x4(%ebp),%ebx 63: c9 leave 64: c3 ret Disassembly of section .text.__x86.get_pc_thunk.ax: 00000000 <__x86.get_pc_thunk.ax>: { 0: 8b 04 24 mov (%esp),%eax 3: c3 ret
build/release.x64/fastlz/lzloader.o: file format elf32-i386 Disassembly of section .text: 00000000 <memset>: extern char _binary_loader_stripped_elf_lz_end; extern char _binary_loader_stripped_elf_lz_size; // std libraries used by fastlz. extern "C" void *memset(void *s, int c, size_t n) { 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 53 push %ebx 4: 83 ec 08 sub $0x8,%esp 7: e8 fc ff ff ff call 8 <memset+0x8> c: 81 c3 02 00 00 00 add $0x2,%ebx return __builtin_memset(s, c, n); 12: ff 75 10 pushl 0x10(%ebp) 15: ff 75 0c pushl 0xc(%ebp) 18: ff 75 08 pushl 0x8(%ebp) 1b: e8 fc ff ff ff call 1c <memset+0x1c> } 20: 8b 5d fc mov -0x4(%ebp),%ebx 23: c9 leave 24: c3 ret 00000025 <uncompress_loader>: extern "C" void uncompress_loader() { 25: 55 push %ebp 26: 89 e5 mov %esp,%ebp 28: 53 push %ebx 29: 83 ec 04 sub $0x4,%esp 2c: e8 fc ff ff ff call 2d <uncompress_loader+0x8> 31: 81 c3 02 00 00 00 add $0x2,%ebx // that the uncompressed kernel doesn't overwrite this uncompression code. // Sadly, "INT_MAX" is the largest number we can pass. If we ever need // more than 2GB here, it won't work. fastlz_decompress(&_binary_loader_stripped_elf_lz_start, (size_t) &_binary_loader_stripped_elf_lz_size, BUFFER_OUT, INT_MAX); 37: 68 ff ff ff 7f push $0x7fffffff 3c: 68 00 00 20 00 push $0x200000 41: ff b3 00 00 00 00 pushl 0x0(%ebx) 47: ff b3 00 00 00 00 pushl 0x0(%ebx) 4d: e8 fc ff ff ff call 4e <uncompress_loader+0x29> } 52: 83 c4 10 add $0x10,%esp 55: 8b 5d fc mov -0x4(%ebp),%ebx 58: c9 leave 59: c3 ret Disassembly of section .text.__x86.get_pc_thunk.bx: 00000000 <__x86.get_pc_thunk.bx>: { 0: 8b 1c 24 mov (%esp),%ebx 3: c3 ret
Cheers, Rick -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to osv-dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.