Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

173
Visualizações
Is it necessary invoke rcu_read_lock in softirq context

The implement of rcu_read_lock is disable preempt and barrier. And the softirq context will not be preempted. So is it necessary to invoke the rcu_read_lock in softirq context. Is the barrier important?

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

Yes, it is necessary to use rcu_read_lock to access pointers that are under rcu protection, even in softirq context.

As you point out, some implementations (ex: TINY_RCU) of rcu_read_lock and softirqs make it so that there is no risk of corruption even if you don't delimit rcu read-side critical sections with rcu_read_lock. However, that is not a guarantee of the rcu api, only a "hack" because of the specific implementation. This hack could break with a different implementation of rcu (ex: PREEMPT_RCU).

If you wish to treat softirqs as explicit rcu read-side critical sections, you must use the RCU-sched api: Documentation/RCU/whatisRCU.txt

The following section of an article written by the main author of RCU directly addresses your question: Requirements for RCU part 1: the fundamentals - Disabling preemption does not block grace periods

I would add that code which does rcu_dereference outside of rcu_read_lock will trigger lockdep warnings if CONFIG_PROVE_RCU=y.

over 4 years ago · Santiago Trujillo Relatório

0

The rcu_read_lock is to protect some kernel resource being modify simulanteously that causes race condition error.

What a resource must to prevent is: being simultaneously use and modified by two software task/ context.

In Linux, the simultaneously modification may happens in either:

  1. context swithing from task to task,
  2. context swithing from task to IRQ context
  3. concurrent accessing from task in different VCPU cores

Event in a single core CPU environment, the 1) and 2) may still happens. On task modifying a critical resource, a software IRQ raise, enter the software IRQ context, run IRQ handler and modifying the same resource simultaneously.

over 4 years ago · Santiago Trujillo Relatório

0

It is a good idea to invoke rcu_read_lock in a softirq context for document purposes, so you and other developers know that RCU protected data is used here.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda