Linux Kernel knowledge

Source: Internet
Author: User

1. Change the Linux version number in Android in the version. c file in the init folder!

2. the SPI clock is changed when the SPI reception is not ideal!

3. Single-CPU kernel and lock
On a single CPU machine, the spin lock does not exist for kernels that neither enable config_smp nor config_preempt during compilation. This is an outstanding design strategy

: Since no one else can execute the lock at the same time, there is no reason to lock it.

If both config_smp and config_preempt are enabled during compilation, the spin lock only disables preemption, which is enough to prevent any competing states. In most cases,

We can equate preemptible with SMP to consider the possible competition issues, so we don't have to deal with it separately.

When the lock is testedCodeEven if you do not have an SMP test environment, you should always turn on the config_smp and config_preempt options, because this will reproduce some types of bugs about the lock.

Semaphores still exist because they are introduced to synchronize user context. We will immediately see this.

4. BUG: Scheduling while atomic

If the spin lock contains a sleep function, the above error may occur.

There are three solutions: 1. Disable the preemption feature of the kernel.
2. Move the sleep function after the spin_unlock_irq (& SPI-> lock)
3. Use semaphores instead

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.