lkml.org 
[lkml]   [2023]   [Jun]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v12 07/22] x86/virt/tdx: Add skeleton to enable TDX on demand
Date
On Tue, 2023-06-27 at 12:50 +0300, kirill.shutemov@linux.intel.com wrote:
> On Tue, Jun 27, 2023 at 02:12:37AM +1200, Kai Huang wrote:
> > + /*
> > + * The TDX module global initialization only needs to be done
> > + * once on any cpu.
> > + */
> > + raw_spin_lock_irqsave(&tdx_global_init_lock, flags);
>
> I don't understand how the comment justifies using raw spin lock.
>

This comment is for using lock in general. The reason to use raw_ version is
because this function gets called in IRQ context, and for PREEMPT_RT kernel the
normal spinlock is converted to sleeping lock.

Dave suggested to comment on the function rather than comment on the
raw_spin_lock directly, e.g., no other kernel code does that:

https://lore.kernel.org/linux-mm/d2b3bc5e-1371-0c50-8ecb-64fc70917d42@intel.com/

So I commented the function in this version:

+/*
+ * Do the module global initialization if not done yet.
+ * It's always called with interrupts and preemption disabled.
+ */
\
 
 \ /
  Last update: 2023-06-27 12:34    [W:1.207 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site