1 yyyy-mm-dd <the title of the document> <security - - PowerPoint PPT Presentation

1 yyyy mm dd the title of the document security class
SMART_READER_LITE
LIVE PREVIEW

1 yyyy-mm-dd <the title of the document> <security - - PowerPoint PPT Presentation

1 yyyy-mm-dd <the title of the document> <security class> Senior Software Engineer at Sony Mobile Communications Architecture Group Chair of the CE Workgroup at the Linux Foundation Former CTO of Lineo, an early embedded Linux


slide-1
SLIDE 1

<security class> <the title of the document> yyyy-mm-dd 1

slide-2
SLIDE 2

<security class> <the title of the document> yyyy-mm-dd 2

Senior Software Engineer at Sony Mobile Communications Architecture Group Chair of the CE Workgroup at the Linux Foundation Former CTO of Lineo, an early embedded Linux company Have been doing Linux for 22 years now…

slide-3
SLIDE 3

<security class> <the title of the document> yyyy-mm-dd 3

I’ve been involved with CE Linux Forum and Linux Foundation (CE Workgroup) for over 10 years Have noticed a disturbing pattern:

Many companies that use and modify open source are not actively involved in the community

Big problem with mainline support for SoCs used in mobile products

slide-4
SLIDE 4

<security class> <the title of the document> yyyy-mm-dd 4

slide-5
SLIDE 5

<security class> <the title of the document> yyyy-mm-dd 5

CE Workgroup project to identify problem areas with mainlining, and try to address them Although companies use open source software…

If they don’t work with community, they are missing a big part of the value

Companies are working too hard when using open source

slide-6
SLIDE 6

<security class> <the title of the document> yyyy-mm-dd 6

Sony Mobile has about 200 software engineers working on the kernel We migrate about 1800 patches between product trees, every phone release That’s for one open source software component

slide-7
SLIDE 7

<security class> <the title of the document> yyyy-mm-dd 7

Sony Mobile has about 200 software engineers working on the kernel We migrate about 1800 patches between product trees, every phone release That’s for one open source software component I want to talk about ways to fix this…

slide-8
SLIDE 8

<security class> <the title of the document> yyyy-mm-dd 8

What is engagement? Identify obstacles Describe obstacles Things you should do Best Practices Why do this? Device Mainlining project

slide-9
SLIDE 9

<security class> <the title of the document> yyyy-mm-dd 9

What is engagement? Identify obstacles Describe obstacles Things you should do Best Practices Why do this? Device Mainlining project

slide-10
SLIDE 10

<security class> <the title of the document> yyyy-mm-dd 10

slide-11
SLIDE 11

<security class> <the title of the document> yyyy-mm-dd 11

More than just users of open source code More than just complying with the license by publishing your code Engagement means working within the community

Explaining requirements Interacting in forums Making modifications Upstreaming, or “mainlining” your changes Helping create the features both you and your competitors need

slide-12
SLIDE 12

<security class> <the title of the document> yyyy-mm-dd 12

More than just users of open source code More than just complying with the license by publishing your code Engagement means working within the community

Explaining requirements Interacting in forums Making modifications Upstreaming, or “mainlining” your changes Helping create the features both you and your competitors need

slide-13
SLIDE 13

<security class> <the title of the document> yyyy-mm-dd 13

Anna Karenina Principle

"Happy families are all alike; every unhappy family is unhappy in its own way"

There are lots of ways to fail, but only a few ways to succeed

Yogi Bera (American baseball player, philosopher)

“If people don’t want to come out to the ballpark, nobody’s going to stop them.”

Motivation is a key element

slide-14
SLIDE 14

<security class> <the title of the document> yyyy-mm-dd 14

slide-15
SLIDE 15

<security class> <the title of the document> yyyy-mm-dd 15

Conducted an online survey in September 2014 Goal was to find qualified kernel developers, who do NOT submit patches upstream

And determine “why not?”

slide-16
SLIDE 16

<security class> <the title of the document> yyyy-mm-dd 16

Top obstacles:

slide-17
SLIDE 17

<security class> <the title of the document> yyyy-mm-dd 17

Developer motivation:

It is important to submit change upstream: 92% I would like to submit changes upstream: 91%

Management motivation:

Management doesn’t approve: 21% Employer doesn’t provide time: 40%

Interesting non-issues: English not good enough: 9% Not my responsibility: 6% Company process too hard: 26%

slide-18
SLIDE 18

<security class> <the title of the document> yyyy-mm-dd 18

Version gap (working on older kernel) Perceived difficulty Low-quality or specialized code Dependency on non-mainlined code Not enough time

slide-19
SLIDE 19

<security class> <the title of the document> yyyy-mm-dd 19

slide-20
SLIDE 20

<security class> <the title of the document> yyyy-mm-dd 20

Many companies use a vendor tree

Particularly true for products with Android Get your kernel and distribution from your hardware supplier

Are locked in because of processor or SOC selection Some amount of patches on top of kernel.org Linux Development/Testing/Release schedules causes delay in kernel version

slide-21
SLIDE 21

<security class> <the title of the document> yyyy-mm-dd 21

Delta between Sony Mobile and mainline kernel

Sony mobile dependent on upstream supplier for Linux version (3.4 in this case) Lots of patches between Sony tree and mainline 16 kernel versions, 3 years

26,000 commits and 1.8 millions lines of code

slide-22
SLIDE 22

<security class> <the title of the document> yyyy-mm-dd 22

Kernel is continually changing The farther you are from mainline, the harder to contribute code Community can only take code against current version of the kernel

slide-23
SLIDE 23

<security class> <the title of the document> yyyy-mm-dd 23

Process is cumbersome if you are not familiar List of requirements for a contribution is long

SubmittingPatches, SubmitChecklist, CodingStyle

Good, but don’t cover a variety of social issues

Getting anything wrong can result in failure

Lots of details which maintainers take for granted

Not as strict as it used to be, and there are now tools to assist (e.g. checkpatch.pl)

slide-24
SLIDE 24

<security class> <the title of the document> yyyy-mm-dd 24

Maintainers are strict and terse due to overload

Don’t have time for malformed contributions Silly mistakes cause quick rejection, or worse, patch is ignored

Part-time contributors

Switching cost of juggling between contributing and product development is high

Similar to high-latency scheduling – results in overall poor performance

Not doing full-time contributing means that proficiency in

  • pen source methods is developed slowly

Can result in bad response time to provided feedback

slide-25
SLIDE 25

<security class> <the title of the document> yyyy-mm-dd 25

Required expertise is very high (and increasing)

Kernel is quite mature, and serves lots of markets

It requires skill to not degrade other people’s use cases

This is true for core systems, but not drivers

Proxy problem – someone other than author is contributing the code (will be discussed later)

slide-26
SLIDE 26

<security class> <the title of the document> yyyy-mm-dd 26

Low-quality

Workarounds and quick hacks

Specialized code

Handles only the specific use case for that market Attitude that code is “throwaway”, or that code is “good enough” for one embedded product release

Assumption that reuse is not needed

Not generalized for other use cases

Code written in different style than mainline

slide-27
SLIDE 27

<security class> <the title of the document> yyyy-mm-dd 27

Modifications to drivers and systems that are not upstream

Bugfixes and workarounds for code not upstream It’s unclear where to send fixes

If it’s an IP block in an SOC, who should get the fixes? SOC vendor?, IP block creator?

Example: bugfixes for synaptics touchscreen driver

Long delays getting synaptics driver upstream Impractical, and low motivation to do mainlining in place of hardware supplier

slide-28
SLIDE 28

<security class> <the title of the document> yyyy-mm-dd 28

Not enough time provided by management Product teams focused on tight delivery deadlines Causes focus on “good enough” solutions

Not unique to open source software

No time to respond to change requests I refer to this as the “product treadmill” Mainline versions are independent of any notion of product release dates

Mainline acceptance happens when it happens, not based

  • n your need
slide-29
SLIDE 29

<security class> <the title of the document> yyyy-mm-dd 29

Classic error – everyone has done this! The error:

Work on a large patch in isolation Attempt to mainline and find that major changes are needed

Community mantra: “release early and often” Input from community or internal OSS experts during the development cycle can avoid large refactoring later Original development strategy makes it much harder to contribute

slide-30
SLIDE 30

<security class> <the title of the document> yyyy-mm-dd 30

slide-31
SLIDE 31

<security class> <the title of the document> yyyy-mm-dd 31

Solution for version gap:

Get a minimal core of mainline running on your hardware Have one team working on mainline, while product engineers work on older kernel (creates the proxy problem, described later), until you catch up

Solution for product treadmill

Small team dedicated to mainline, off of product treadmill

Solution for perceived/real difficulty

Internal training, mentors Use same processes internally as upstream

Avoid re-learning upstream methods E.g. Don’t manage your kernel with perforce!! Use git.

slide-32
SLIDE 32

<security class> <the title of the document> yyyy-mm-dd 32

Solution for low-quality code

Quick hacks are sometimes appropriate from a cost/benefit standpoint Need to determine whether code should be upstreamed Keep your patches in git or quilt and don’t forward-port blindly

Solution for specialized code

Don’t use specialized hardware, unless business reason is compelling

Require mainline Linux drivers from hardware supplier Actually consider software cost in BOM (I can dream can’t I? )

Post patches to get community feedback

slide-33
SLIDE 33

<security class> <the title of the document> yyyy-mm-dd 33

Open-source-facing developers may not be experienced with the hardware or system that needs to be mainlined Is when your “proxy” tries to mainline something, and

Doesn’t have in-depth knowledge of change Can’t answer questions in a timely manner May not be able to test thoroughly

Solutions:

Original devs assist proxies in understanding and testing Proxies help original devs mainline the code

slide-34
SLIDE 34

<security class> <the title of the document> yyyy-mm-dd 34

slide-35
SLIDE 35

<security class> <the title of the document> yyyy-mm-dd 35

slide-36
SLIDE 36

<security class> <the title of the document> yyyy-mm-dd 36

See Andrew Morton’s ELC 2008 Keynote:

http://elinux.org/Session:kernel.org_development_and_the_e mbedded_world

Participate in community forums

Report problems and requirements upstream

Dedicate a few developers separate from product teams Ask the community (Andrew) for help

slide-37
SLIDE 37

<security class> <the title of the document> yyyy-mm-dd 37

Don't be arrogant

Don’t assume you know better than community developers

Release early and often

Don’t work in isolation, and then make big changes when submitting

Check for existing solutions and extend those Write general solutions Work with the community

Learn community methods Treat them as equals on your team

slide-38
SLIDE 38

<security class> <the title of the document> yyyy-mm-dd 38

Post early and often Submitting patches

Send changes - can influence direction even if not accepted Listen to reviewers, be polite, don't ignore feedback

Be open to accepting changes

Your code may be re-written or replaced Goal is not to get your patch upstream – it is to get your requirement met

slide-39
SLIDE 39

<security class> <the title of the document> yyyy-mm-dd 39

slide-40
SLIDE 40

<security class> <the title of the document> yyyy-mm-dd 40

Yogi Bera (American baseball player, philosopher)

“If people don’t want to come out to the ballpark, nobody’s going to stop them.”

slide-41
SLIDE 41

<security class> <the title of the document> yyyy-mm-dd 41

Why study this?

Sony Mobile has 1100 people who have made a patch to the kernel in the last 5 years We find ourselves applying the same changes over and over again

Would like to decrease number of kernel developers by moving stuff to mainline

OR – have them move to different tasks (power enhancement, performance, etc.)

slide-42
SLIDE 42

<security class> <the title of the document> yyyy-mm-dd 42

Reduce maintenance cost

Share maintenance and enhancement cost with others

Reduce time to market

Even more important than cost

slide-43
SLIDE 43

<security class> <the title of the document> yyyy-mm-dd 43

Improves code quality

You get immediate feedback, even if code is not accepted It gets more long-term testing

Avoids adopting a competing implementation

Have 3rd parties enhance your implementation rather than something else

It rewards your developers

They want to contribute, for a variety of reasons They become better developers through interaction with the community

It generates community goodwill

Other developers will help you

Please notice these are selfish reasons

Unselfish reasons are valid also

slide-44
SLIDE 44

<security class> <the title of the document> yyyy-mm-dd 44

Get mainline working (at least somewhat) on your hardware Have a dedicated team that works in open source Choose industry standard hardware Insist on open source drivers already mainlined

Do a ‘diff’ on your suppliers code vs. their upstream

Do specific training for:

Better motivation: Management training for business justification Open source methodology and tactics

Use open source methods internally

slide-45
SLIDE 45

<security class> <the title of the document> yyyy-mm-dd 45

Work on social element of community engagement

Meet maintainers face-to-face if possible

Linux Foundation conferences are helpful for this

Work on stuff for others, and they’ll help you Build trust with maintainers

The absolute basics:

Use an LTS kernel version!!!!

LTSI if you can!

e-mail someone to discuss your requirements or difficulties

slide-46
SLIDE 46

<security class> <the title of the document> yyyy-mm-dd 46

slide-47
SLIDE 47

<security class> <the title of the document> yyyy-mm-dd 47

Goal is to methodically analyze problems, and address them through industry collaboration Activities:

Promote best practices for corporate guidance

E.g. this talk, and the white paper

Collect and organize links to mainlining tutorials and training materials Develop and publish mainlining analysis tools

Tools and information to assist companies with mainlining-related tasks

Justify mainlining effort to management

Quantification of costs associated with out-of-tree code

Provide assistance for upstream maintainers

slide-48
SLIDE 48

<security class> <the title of the document> yyyy-mm-dd 48

Latest work is categorizing areas with particular mainlining problems

Analyzed the source from 9 phones and 5 SOCs Trying to find patterns of out-of-tree code

Tools are published, but not ready yet…

https://github.com/tbird20d/upstream-analysis-tools

slide-49
SLIDE 49

<security class> <the title of the document> yyyy-mm-dd 49

slide-50
SLIDE 50

<security class> <the title of the document> yyyy-mm-dd 50

slide-51
SLIDE 51

<security class> <the title of the document> yyyy-mm-dd 51

slide-52
SLIDE 52

<security class> <the title of the document> yyyy-mm-dd 52

Project web site:

http://elinux.org/CE_Workgroup_Device_Mainlining_Project

Mainlining talks, tutorials, tips:

http://elinux.org/Kernel_Mainlining

White paper related to this talk:

http://elinux.org/images/e/ed/Overcoming-Obstacles-to- Mainlining-White-Paper-version-0.9.pdf

slide-53
SLIDE 53

<security class> <the title of the document> yyyy-mm-dd 53

I want to hear success (and failure) stories I would like feedback on the tools and white paper Next official face-to-face meeting at ELC Europe If interested, e-mail <tim.bird@sonymobile.com>

slide-54
SLIDE 54

<security class> <the title of the document> yyyy-mm-dd 54

slide-55
SLIDE 55

<security class> <the title of the document> yyyy-mm-dd 55

See Andrew Morton’s ELC 2008 Keynote:

http://elinux.org/Session:kernel.org_development_and_the_embe dded_world

Industry should have an embedded maintainer Report problems and requirements upstream Participate in community forums Companies should dedicate a few developers separate from product teams Develop product on latest mainline kernel, freeze it at end of product development

My aside: Current nature of Android features and board support preclude this

Ask the community (Andrew) for help

slide-56
SLIDE 56

<security class> <the title of the document> yyyy-mm-dd 56

Don't be arrogant

Don’t assume you know better than community developers

Release early and often

Don’t work in isolation, and then make big changes when submitting

Do your homework

Check for existing solutions and extend those

Don't add OS abstractions (or, HALS for other OSes) Write general solutions Learn community methods Work with the community

Treat them as equals on your team

slide-57
SLIDE 57

<security class> <the title of the document> yyyy-mm-dd 57

Post early and often Submitting patches

Send changes - can influence direction even if not accepted No: multi-purpose patches - make each patch small and independent Make patch serieses bisectable Follow submission and style rules Send to correct place: MAINTAINERS, get-maintainer.pl Listen to reviewers, be polite, don't ignore feedback

Be open to accepting changes

Your code may be re-written or replaced Goal is not to get your patch upstream – it is to get your requirement met

Coding

Follow the style guidelines No multi-OS code – no HAL layers, unused parameters Should generalize existing code instead of create new code, where possible Don't break APIs to user space Don't cause regressions