[RFC,v4,0/7] Speed booting by sorting ORC unwind tables at build time
mbox series

Message ID 20191115164539.57930-1-shile.zhang@linux.alibaba.com
Headers show
Series
  • Speed booting by sorting ORC unwind tables at build time
Related show

Message

Shile Zhang Nov. 15, 2019, 4:45 p.m. UTC
Hi,

I refactored the code, followed by Peter's suggestions in v3, thank you!
Any suggestions and comments are welcome!

Thanks!

Changelog:
==========
v3->v4:
- Code refactored for Peter's review findings and suggestions.

v2->v3:
- Discard new added sortorctable tool and related Kconfig changes.
- Refactored sortextable, makes it more readable and extendable.
- Rename 'sortextable' to 'sorttable', for more kernel tables extend.
- Add ORC unwind tables sort into sorttable.
- Remove the runtime ORC tables sort.
https://lore.kernel.org/lkml/20191115064750.47888-1-shile.zhang@linux.alibaba.com/

v1->v2:
- Removed new added Kconfig and runtime sort code, advised by Josh Poimboeuf.
- Some minor refactoring.
https://lore.kernel.org/lkml/20191108071108.72132-1-shile.zhang@linux.alibaba.com/

v1:
- Added a new sortorctable tool to sort ORC unwind tables at build time,
  same as sortextable.
- Add a new Kconfigure to control if ORC unwind tables sort at build
  time.
https://lore.kernel.org/lkml/20191107143205.206606-1-shile.zhang@linux.alibaba.com/

Shile Zhang (7):
  scripts/sortextable: Rewrite error/success handling
  scripts/sortextable: kernel coding style formating
  scripts/sortextable: Remove dead code
  scripts/sortextable: refactor do_func() function
  scripts/sorttable: rename sortextable to sorttable
  scripts/sorttable: Add ORC unwind tables sort concurrently
  x86/unwind/orc: remove run-time ORC unwind tables sort

 arch/arc/Kconfig                       |   2 +-
 arch/arm/Kconfig                       |   2 +-
 arch/arm64/Kconfig                     |   2 +-
 arch/microblaze/Kconfig                |   2 +-
 arch/mips/Kconfig                      |   2 +-
 arch/parisc/Kconfig                    |   2 +-
 arch/parisc/kernel/vmlinux.lds.S       |   2 +-
 arch/powerpc/Kconfig                   |   2 +-
 arch/s390/Kconfig                      |   2 +-
 arch/x86/Kconfig                       |   2 +-
 arch/x86/kernel/unwind_orc.c           |   8 +-
 arch/xtensa/Kconfig                    |   2 +-
 init/Kconfig                           |   2 +-
 scripts/.gitignore                     |   2 +-
 scripts/Makefile                       |  10 +-
 scripts/link-vmlinux.sh                |  10 +-
 scripts/sortextable.h                  | 209 -------------
 scripts/{sortextable.c => sorttable.c} | 299 +++++++++---------
 scripts/sorttable.h                    | 401 +++++++++++++++++++++++++
 19 files changed, 568 insertions(+), 395 deletions(-)
 delete mode 100644 scripts/sortextable.h
 rename scripts/{sortextable.c => sorttable.c} (67%)
 create mode 100644 scripts/sorttable.h

Comments

Josh Poimboeuf Nov. 15, 2019, 5:52 p.m. UTC | #1
On Sat, Nov 16, 2019 at 12:45:32AM +0800, Shile Zhang wrote:
> Hi,
> 
> I refactored the code, followed by Peter's suggestions in v3, thank you!
> Any suggestions and comments are welcome!
> 
> Thanks!
> 
> Changelog:
> ==========
> v3->v4:
> - Code refactored for Peter's review findings and suggestions.

Hi Shile,

I haven't given it a proper review yet, but one minor suggestion.  In
general it's good practice to wait at least a few business days before
posting a new version of a patch set.  That way it gives people time to
review, and it also helps to avoid flooding people's inboxes.
Shile Zhang Nov. 18, 2019, 1:57 a.m. UTC | #2
On 2019/11/16 01:52, Josh Poimboeuf wrote:
> On Sat, Nov 16, 2019 at 12:45:32AM +0800, Shile Zhang wrote:
>> Hi,
>>
>> I refactored the code, followed by Peter's suggestions in v3, thank you!
>> Any suggestions and comments are welcome!
>>
>> Thanks!
>>
>> Changelog:
>> ==========
>> v3->v4:
>> - Code refactored for Peter's review findings and suggestions.
> Hi Shile,
>
> I haven't given it a proper review yet, but one minor suggestion.  In
> general it's good practice to wait at least a few business days before
> posting a new version of a patch set.  That way it gives people time to
> review, and it also helps to avoid flooding people's inboxes.
>

Hi, Josh,

Thank you very much for your kindly reminder!
I got it and very sorry for that flooding.

Best regards!

--- Shile
H. Peter Anvin Nov. 18, 2019, 2:18 a.m. UTC | #3
On November 15, 2019 8:45:32 AM PST, Shile Zhang <shile.zhang@linux.alibaba.com> wrote:
>Hi,
>
>I refactored the code, followed by Peter's suggestions in v3, thank
>you!
>Any suggestions and comments are welcome!
>
>Thanks!
>
>Changelog:
>==========
>v3->v4:
>- Code refactored for Peter's review findings and suggestions.
>
>v2->v3:
>- Discard new added sortorctable tool and related Kconfig changes.
>- Refactored sortextable, makes it more readable and extendable.
>- Rename 'sortextable' to 'sorttable', for more kernel tables extend.
>- Add ORC unwind tables sort into sorttable.
>- Remove the runtime ORC tables sort.
>https://lore.kernel.org/lkml/20191115064750.47888-1-shile.zhang@linux.alibaba.com/
>
>v1->v2:
>- Removed new added Kconfig and runtime sort code, advised by Josh
>Poimboeuf.
>- Some minor refactoring.
>https://lore.kernel.org/lkml/20191108071108.72132-1-shile.zhang@linux.alibaba.com/
>
>v1:
>- Added a new sortorctable tool to sort ORC unwind tables at build
>time,
>  same as sortextable.
>- Add a new Kconfigure to control if ORC unwind tables sort at build
>  time.
>https://lore.kernel.org/lkml/20191107143205.206606-1-shile.zhang@linux.alibaba.com/
>
>Shile Zhang (7):
>  scripts/sortextable: Rewrite error/success handling
>  scripts/sortextable: kernel coding style formating
>  scripts/sortextable: Remove dead code
>  scripts/sortextable: refactor do_func() function
>  scripts/sorttable: rename sortextable to sorttable
>  scripts/sorttable: Add ORC unwind tables sort concurrently
>  x86/unwind/orc: remove run-time ORC unwind tables sort
>
> arch/arc/Kconfig                       |   2 +-
> arch/arm/Kconfig                       |   2 +-
> arch/arm64/Kconfig                     |   2 +-
> arch/microblaze/Kconfig                |   2 +-
> arch/mips/Kconfig                      |   2 +-
> arch/parisc/Kconfig                    |   2 +-
> arch/parisc/kernel/vmlinux.lds.S       |   2 +-
> arch/powerpc/Kconfig                   |   2 +-
> arch/s390/Kconfig                      |   2 +-
> arch/x86/Kconfig                       |   2 +-
> arch/x86/kernel/unwind_orc.c           |   8 +-
> arch/xtensa/Kconfig                    |   2 +-
> init/Kconfig                           |   2 +-
> scripts/.gitignore                     |   2 +-
> scripts/Makefile                       |  10 +-
> scripts/link-vmlinux.sh                |  10 +-
> scripts/sortextable.h                  | 209 -------------
> scripts/{sortextable.c => sorttable.c} | 299 +++++++++---------
> scripts/sorttable.h                    | 401 +++++++++++++++++++++++++
> 19 files changed, 568 insertions(+), 395 deletions(-)
> delete mode 100644 scripts/sortextable.h
> rename scripts/{sortextable.c => sorttable.c} (67%)
> create mode 100644 scripts/sorttable.h

Any actual time measurements?
Shile Zhang Nov. 18, 2019, 2:27 a.m. UTC | #4
On 2019/11/18 10:18, hpa@zytor.com wrote:
> On November 15, 2019 8:45:32 AM PST, Shile Zhang <shile.zhang@linux.alibaba.com> wrote:
>> Hi,
>>
>> I refactored the code, followed by Peter's suggestions in v3, thank
>> you!
>> Any suggestions and comments are welcome!
>>
>> Thanks!
>>
>> Changelog:
>> ==========
>> v3->v4:
>> - Code refactored for Peter's review findings and suggestions.
>>
>> v2->v3:
>> - Discard new added sortorctable tool and related Kconfig changes.
>> - Refactored sortextable, makes it more readable and extendable.
>> - Rename 'sortextable' to 'sorttable', for more kernel tables extend.
>> - Add ORC unwind tables sort into sorttable.
>> - Remove the runtime ORC tables sort.
>> https://lore.kernel.org/lkml/20191115064750.47888-1-shile.zhang@linux.alibaba.com/
>>
>> v1->v2:
>> - Removed new added Kconfig and runtime sort code, advised by Josh
>> Poimboeuf.
>> - Some minor refactoring.
>> https://lore.kernel.org/lkml/20191108071108.72132-1-shile.zhang@linux.alibaba.com/
>>
>> v1:
>> - Added a new sortorctable tool to sort ORC unwind tables at build
>> time,
>>   same as sortextable.
>> - Add a new Kconfigure to control if ORC unwind tables sort at build
>>   time.
>> https://lore.kernel.org/lkml/20191107143205.206606-1-shile.zhang@linux.alibaba.com/
>>
>> Shile Zhang (7):
>>   scripts/sortextable: Rewrite error/success handling
>>   scripts/sortextable: kernel coding style formating
>>   scripts/sortextable: Remove dead code
>>   scripts/sortextable: refactor do_func() function
>>   scripts/sorttable: rename sortextable to sorttable
>>   scripts/sorttable: Add ORC unwind tables sort concurrently
>>   x86/unwind/orc: remove run-time ORC unwind tables sort
>>
>> arch/arc/Kconfig                       |   2 +-
>> arch/arm/Kconfig                       |   2 +-
>> arch/arm64/Kconfig                     |   2 +-
>> arch/microblaze/Kconfig                |   2 +-
>> arch/mips/Kconfig                      |   2 +-
>> arch/parisc/Kconfig                    |   2 +-
>> arch/parisc/kernel/vmlinux.lds.S       |   2 +-
>> arch/powerpc/Kconfig                   |   2 +-
>> arch/s390/Kconfig                      |   2 +-
>> arch/x86/Kconfig                       |   2 +-
>> arch/x86/kernel/unwind_orc.c           |   8 +-
>> arch/xtensa/Kconfig                    |   2 +-
>> init/Kconfig                           |   2 +-
>> scripts/.gitignore                     |   2 +-
>> scripts/Makefile                       |  10 +-
>> scripts/link-vmlinux.sh                |  10 +-
>> scripts/sortextable.h                  | 209 -------------
>> scripts/{sortextable.c => sorttable.c} | 299 +++++++++---------
>> scripts/sorttable.h                    | 401 +++++++++++++++++++++++++
>> 19 files changed, 568 insertions(+), 395 deletions(-)
>> delete mode 100644 scripts/sortextable.h
>> rename scripts/{sortextable.c => sorttable.c} (67%)
>> create mode 100644 scripts/sorttable.h
> Any actual time measurements?

Sorry for missed in cover letter!

The ORC unwind tables sorting cost about 100ms in boot time on my 
2vcpu16GB VM (with 2.5GHz Xeon CPU).
After sort at build time, the sorttable needs about 70ms in host.

Thanks!