There can be only one The unified x86 architecture Glauber Costa - - PowerPoint PPT Presentation

there can be only one the unified x86 architecture
SMART_READER_LITE
LIVE PREVIEW

There can be only one The unified x86 architecture Glauber Costa - - PowerPoint PPT Presentation

History Towards unification Good integration vs Bad Integration Analysis There can be only one The unified x86 architecture Glauber Costa glommer@redhat.com Red Hat Inc. October 9th, 2008 Glauber Costa glommer@redhat.com Red Hat Inc.


slide-1
SLIDE 1

History Towards unification Good integration vs Bad Integration Analysis

There can be only one The unified x86 architecture

Glauber Costa glommer@redhat.com

Red Hat Inc.

October 9th, 2008

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-2
SLIDE 2

History Towards unification Good integration vs Bad Integration Analysis

There Can Be Only One Immortalizing the Linux Kernel

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-3
SLIDE 3

History Towards unification Good integration vs Bad Integration Analysis

There Can Be Only One Getting a head ahead

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-4
SLIDE 4

History Towards unification Good integration vs Bad Integration Analysis

There Can Be Only One McLeod is Busy so I did it

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-5
SLIDE 5

History Towards unification Good integration vs Bad Integration Analysis

Roadmap

1 History 2 Towards unification 3 Good integration vs Bad Integration 4 Analysis

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-6
SLIDE 6

History Towards unification Good integration vs Bad Integration Analysis

Brothers torn apart

Linux had two ports for x86: i386 and x86_64

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-7
SLIDE 7

History Towards unification Good integration vs Bad Integration Analysis

Brothers torn apart

Linux had two ports for x86: i386 and x86_64 i386 is creepy crappy, x86_64 not much better.

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-8
SLIDE 8

History Towards unification Good integration vs Bad Integration Analysis

Brothers torn apart

Linux had two ports for x86: i386 and x86_64 i386 is creepy crappy, x86_64 not much better. Lots of code duplication

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-9
SLIDE 9

History Towards unification Good integration vs Bad Integration Analysis

Tales of the pre-unification era

Makefiles hack, like this: obj-o += ../../i386/kernel/myfile.c

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-10
SLIDE 10

History Towards unification Good integration vs Bad Integration Analysis

Tales of the pre-unification era

Makefiles hack, like this: obj-o += ../../i386/kernel/myfile.c Sharing happening under the hood.

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-11
SLIDE 11

History Towards unification Good integration vs Bad Integration Analysis

Tales of the pre-unification era

Makefiles hack, like this: obj-o += ../../i386/kernel/myfile.c Sharing happening under the hood. Bugs were raised, and in a lot of times, not noticed.

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-12
SLIDE 12

History Towards unification Good integration vs Bad Integration Analysis

Tales of the pre-unification era

Makefiles hack, like this: obj-o += ../../i386/kernel/myfile.c Sharing happening under the hood. Bugs were raised, and in a lot of times, not noticed. “Uhmm, lemme use this unsigned long in this arch/i386/kernel file, to represent a 32-bit quantity”

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-13
SLIDE 13

History Towards unification Good integration vs Bad Integration Analysis

Flow is made difficult

Bugs fixed in i386 would not always reach x86_64 and vice-versa

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-14
SLIDE 14

History Towards unification Good integration vs Bad Integration Analysis

Flow is made difficult

Bugs fixed in i386 would not always reach x86_64 and vice-versa Or they can be ported with errors.

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-15
SLIDE 15

History Towards unification Good integration vs Bad Integration Analysis

Flow is made difficult

Bugs fixed in i386 would not always reach x86_64 and vice-versa Or they can be ported with errors. Flow of code is prejudiced. It creates walls that shouldn’t be there

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-16
SLIDE 16

History Towards unification Good integration vs Bad Integration Analysis

What would you do if you had a wall like this?

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-17
SLIDE 17

History Towards unification Good integration vs Bad Integration Analysis

Don’t tell, let me guess...

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-18
SLIDE 18

History Towards unification Good integration vs Bad Integration Analysis

The paravirt example

paravirt_ops: x86_64 is different in a lot of ways, needs a lot of testing and a good PoC, but...

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-19
SLIDE 19

History Towards unification Good integration vs Bad Integration Analysis

The paravirt example

paravirt_ops: x86_64 is different in a lot of ways, needs a lot of testing and a good PoC, but... largely equal to i386!

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-20
SLIDE 20

History Towards unification Good integration vs Bad Integration Analysis

The paravirt example

paravirt_ops: x86_64 is different in a lot of ways, needs a lot of testing and a good PoC, but... largely equal to i386! cp arch/i386/kernel/paravirt.c arch/x86_64/kernel/paravirt.c. Works, but not very wise

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-21
SLIDE 21

History Towards unification Good integration vs Bad Integration Analysis

The paravirt example

paravirt_ops: x86_64 is different in a lot of ways, needs a lot of testing and a good PoC, but... largely equal to i386! cp arch/i386/kernel/paravirt.c arch/x86_64/kernel/paravirt.c. Works, but not very wise Code duplication and more important:

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-22
SLIDE 22

History Towards unification Good integration vs Bad Integration Analysis

The paravirt example

paravirt_ops: x86_64 is different in a lot of ways, needs a lot of testing and a good PoC, but... largely equal to i386! cp arch/i386/kernel/paravirt.c arch/x86_64/kernel/paravirt.c. Works, but not very wise Code duplication and more important: bugs fixed in a version, affecting both, may not get into the other.

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-23
SLIDE 23

History Towards unification Good integration vs Bad Integration Analysis

The paravirt example

paravirt_ops: x86_64 is different in a lot of ways, needs a lot of testing and a good PoC, but... largely equal to i386! cp arch/i386/kernel/paravirt.c arch/x86_64/kernel/paravirt.c. Works, but not very wise Code duplication and more important: bugs fixed in a version, affecting both, may not get into the other. Hey! Isn’t it why we use generic constructs in the first place?

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-24
SLIDE 24

History Towards unification Good integration vs Bad Integration Analysis

Roadmap

1 History 2 Towards unification 3 Good integration vs Bad Integration 4 Analysis

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-25
SLIDE 25

History Towards unification Good integration vs Bad Integration Analysis

To arms!

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-26
SLIDE 26

History Towards unification Good integration vs Bad Integration Analysis

To arms!

Attempt 1: arch/i386, arch/x86_64

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-27
SLIDE 27

History Towards unification Good integration vs Bad Integration Analysis

To arms!

Attempt 1: arch/i386, arch/x86_64 and arch/x86

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-28
SLIDE 28

History Towards unification Good integration vs Bad Integration Analysis

To arms!

Attempt 1: arch/i386, arch/x86_64 and arch/x86 arch/x86 gets the commons

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-29
SLIDE 29

History Towards unification Good integration vs Bad Integration Analysis

To arms!

Attempt 1: arch/i386, arch/x86_64 and arch/x86 arch/x86 gets the commons If you touch a common file, you know you’re doing it.

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-30
SLIDE 30

History Towards unification Good integration vs Bad Integration Analysis

To arms!

Attempt 1: arch/i386, arch/x86_64 and arch/x86 arch/x86 gets the commons If you touch a common file, you know you’re doing it. Changes your mindset

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-31
SLIDE 31

History Towards unification Good integration vs Bad Integration Analysis

Troops march

Works, but...

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-32
SLIDE 32

History Towards unification Good integration vs Bad Integration Analysis

Troops march

Works, but... not a full solution

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-33
SLIDE 33

History Towards unification Good integration vs Bad Integration Analysis

Troops march

Works, but... not a full solution Many files aren’t equal, but could be.

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-34
SLIDE 34

History Towards unification Good integration vs Bad Integration Analysis

Troops march

Works, but... not a full solution Many files aren’t equal, but could be. The more general the design, the better.

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-35
SLIDE 35

History Towards unification Good integration vs Bad Integration Analysis

The merger

if diff returns no output: move them to arch/x86

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-36
SLIDE 36

History Towards unification Good integration vs Bad Integration Analysis

The merger

if diff returns no output: move them to arch/x86 Otherwise: arch/i386/kernel/foobar.c → arch/x86/kernel/foobar_32.c

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-37
SLIDE 37

History Towards unification Good integration vs Bad Integration Analysis

The merger

if diff returns no output: move them to arch/x86 Otherwise: arch/i386/kernel/foobar.c → arch/x86/kernel/foobar_32.c

  • Mechanical. No bugs expected. Works fine

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-38
SLIDE 38

History Towards unification Good integration vs Bad Integration Analysis

The merger

if diff returns no output: move them to arch/x86 Otherwise: arch/i386/kernel/foobar.c → arch/x86/kernel/foobar_32.c

  • Mechanical. No bugs expected. Works fine (Famous last

words) Bisection

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-39
SLIDE 39

History Towards unification Good integration vs Bad Integration Analysis

Roadmap

1 History 2 Towards unification 3 Good integration vs Bad Integration 4 Analysis

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-40
SLIDE 40

History Towards unification Good integration vs Bad Integration Analysis

Soulmatch

if the body doesn’t match, but the soul does:

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-41
SLIDE 41

History Towards unification Good integration vs Bad Integration Analysis

Soulmatch

if the body doesn’t match, but the soul does: change the shape, but vmlinux should not deviate.

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-42
SLIDE 42

History Towards unification Good integration vs Bad Integration Analysis

Soulmatch

text data bss dec hex filename 4318765 569156 618348 5506269 5404dd vmlinux.old 4318765 569156 618348 5506269 5404dd vmlinux.new

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-43
SLIDE 43

History Towards unification Good integration vs Bad Integration Analysis

Soulmatch

text data bss dec hex filename 4318765 569156 618348 5506269 5404dd vmlinux.old 4318765 569156 618348 5506269 5404dd vmlinux.new text data bss dec hex filename 4318765 569156 618348 5506269 5404dd vmlinux.old 4318797 569156 618348 5506301 5404fd vmlinux.new2 ^^^^^^^ ^^^^^^^ ^^^^^^

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-44
SLIDE 44

History Towards unification Good integration vs Bad Integration Analysis

Good integration vs Bad Integration

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-45
SLIDE 45

History Towards unification Good integration vs Bad Integration Analysis

Good integration vs Bad Integration

Tests on CONFIG_X86_XX kill baby seals.

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-46
SLIDE 46

History Towards unification Good integration vs Bad Integration Analysis

Good integration vs Bad Integration

Tests on CONFIG_X86_XX kill baby seals. With a club.

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-47
SLIDE 47

History Towards unification Good integration vs Bad Integration Analysis

Good integration vs Bad Integration

Tests on CONFIG_X86_XX kill baby seals. With a club. In the head.

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-48
SLIDE 48

History Towards unification Good integration vs Bad Integration Analysis

Good integration vs Bad Integration

Tests on CONFIG_X86_XX kill baby seals. With a club. In the head. Very Hard.

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-49
SLIDE 49

History Towards unification Good integration vs Bad Integration Analysis

Good integration vs Bad Integration

Tests on CONFIG_X86_XX kill baby seals. With a club. In the head. Very Hard. Let’s not do it.

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-50
SLIDE 50

History Towards unification Good integration vs Bad Integration Analysis

Good integration vs Bad Integration

Tests on CONFIG_X86_XX kill baby seals. With a club. In the head. Very Hard. Let’s not do it. If there is one architecture, why bother?

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-51
SLIDE 51

History Towards unification Good integration vs Bad Integration Analysis

Good integration vs Bad Integration

Tests on CONFIG_X86_XX kill baby seals. With a club. In the head. Very Hard. Let’s not do it. If there is one architecture, why bother? Tests on CONFIG_FEATURE are okay

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-52
SLIDE 52

History Towards unification Good integration vs Bad Integration Analysis

Good integration vs Bad Integration

Tests on CONFIG_X86_XX kill baby seals. With a club. In the head. Very Hard. Let’s not do it. If there is one architecture, why bother? Tests on CONFIG_FEATURE are okay CONFIG_X86_IO_APIC: All x86_64 have one, but so what?

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-53
SLIDE 53

History Towards unification Good integration vs Bad Integration Analysis

Good integration vs Bad Integration

Tests on CONFIG_X86_XX kill baby seals. With a club. In the head. Very Hard. Let’s not do it. If there is one architecture, why bother? Tests on CONFIG_FEATURE are okay CONFIG_X86_IO_APIC: All x86_64 have one, but so what? Ok for temporary steps

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-54
SLIDE 54

History Towards unification Good integration vs Bad Integration Analysis

Areas still needing attention

Search for CONFIG_X86_32,64: Usually denotes incomplete integration file

  • ccurrences

kernel/apic.c 31 kernel/io_apic.c 26 kernel/setup.c 20 kernel/cpu/common.c 20 kernel/ptrace.c 18 kernel/smpboot.c 16 kernel/cpu/amd.c 10 kernel/kprobes.c 9 kernel/i387.c 9 kernel/acpi/boot.c 9

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-55
SLIDE 55

History Towards unification Good integration vs Bad Integration Analysis

Areas still needing attention

About 100 files still have their _32 and _64 versions. Sometimes it’s the right thing to do:

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-56
SLIDE 56

History Towards unification Good integration vs Bad Integration Analysis

Areas still needing attention

About 100 files still have their _32 and _64 versions. Sometimes it’s the right thing to do: ex: page table code.

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-57
SLIDE 57

History Towards unification Good integration vs Bad Integration Analysis

Roadmap

1 History 2 Towards unification 3 Good integration vs Bad Integration 4 Analysis

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-58
SLIDE 58

History Towards unification Good integration vs Bad Integration Analysis

Analysis

More robust x86 code:

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-59
SLIDE 59

History Towards unification Good integration vs Bad Integration Analysis

Analysis

More robust x86 code: “This bug was there since RMS had no beard, and we never noticed”

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-60
SLIDE 60

History Towards unification Good integration vs Bad Integration Analysis

Analysis

More robust x86 code: “This bug was there since RMS had no beard, and we never noticed” Feature richness:

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-61
SLIDE 61

History Towards unification Good integration vs Bad Integration Analysis

Analysis

More robust x86 code: “This bug was there since RMS had no beard, and we never noticed” Feature richness: This features existed for A and not for B. All of a sudden, it exists, and inherits years of testing

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-62
SLIDE 62

History Towards unification Good integration vs Bad Integration Analysis

Analysis

More robust x86 code: “This bug was there since RMS had no beard, and we never noticed” Feature richness: This features existed for A and not for B. All of a sudden, it exists, and inherits years of testing New features:

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-63
SLIDE 63

History Towards unification Good integration vs Bad Integration Analysis

Analysis

More robust x86 code: “This bug was there since RMS had no beard, and we never noticed” Feature richness: This features existed for A and not for B. All of a sudden, it exists, and inherits years of testing New features: I have to develop this kool-aid. Don’t have to port it to the other x86 variant

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-64
SLIDE 64

History Towards unification Good integration vs Bad Integration Analysis

Analysis

More robust x86 code: “This bug was there since RMS had no beard, and we never noticed” Feature richness: This features existed for A and not for B. All of a sudden, it exists, and inherits years of testing New features: I have to develop this kool-aid. Don’t have to port it to the other x86 variant Fewer Obvious bugs:

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-65
SLIDE 65

History Towards unification Good integration vs Bad Integration Analysis

Analysis

More robust x86 code: “This bug was there since RMS had no beard, and we never noticed” Feature richness: This features existed for A and not for B. All of a sudden, it exists, and inherits years of testing New features: I have to develop this kool-aid. Don’t have to port it to the other x86 variant Fewer Obvious bugs: I do know this code is used in a mixed word-size environment, with 2, 3 or 4 levels of page tables, etc

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-66
SLIDE 66

History Towards unification Good integration vs Bad Integration Analysis

Analysis

Most bugs are regressions.

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-67
SLIDE 67

History Towards unification Good integration vs Bad Integration Analysis

Analysis

Most bugs are regressions. Sometimes, code does get more complicated.

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-68
SLIDE 68

History Towards unification Good integration vs Bad Integration Analysis

Thanks

You all, for listening

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one

slide-69
SLIDE 69

History Towards unification Good integration vs Bad Integration Analysis

Thanks

You all, for listening People from Hamburg in general, for coming up with the Hamburger.

Glauber Costa glommer@redhat.com Red Hat Inc. There can be only one