RE: efi_pstore: question about how to remove create_sysfs_entry()from a write callback.

From: Seiji Aguchi
Date: Tue Aug 14 2012 - 15:29:49 EST


Mike,

Previous pseudo code was not correct.
More precisely, it is as follows.
But, we still need to alloc memory dynamically in the part of <Save information about new entry>
because a workqueue can't know how many new entries in advance.

spin_lock_irqsave(&efivars_lock);

do {
get_next_variable();
if (found new entry)
<Save information about new entry>

} while()

spin_lock_irqrestore(&efivars_lock);

efivars_create_sysfs_entries();

Seiji

> -----Original Message-----
> From: linux-kernel-owner@xxxxxxxxxxxxxxx [mailto:linux-kernel-owner@xxxxxxxxxxxxxxx] On Behalf Of Seiji Aguchi
> Sent: Tuesday, August 14, 2012 2:52 PM
> To: Mike Waychison
> Cc: linux-kernel@xxxxxxxxxxxxxxx; Luck, Tony (tony.luck@xxxxxxxxx); Matthew Garrett (mjg@xxxxxxxxxx); dzickus@xxxxxxxxxx; dle-
> develop@xxxxxxxxxxxxxxxxxxxxx; Satoru Moriya
> Subject: RE: efi_pstore: question about how to remove create_sysfs_entry() from a write callback.
>
> > Can we not serialize this with &efivars->lock if it is updated to
> > disable interrupts? A loop in the workqueue that locks, iterates
> > through
> > ->get_next_variable, and compares against searches in
> > efivars->list should work, no?
>
> If my understanding is correct, your pseudo code is as follows.
>
> spin_lock_irqsave(&efivars_lock);
>
> do {
> get_next_variable();
> if (found new entry)
> efivars_create_sysfs_entries();
>
> } while()
>
> spin_lock_irqrestore(&efivars_lock);
>
> But, memory is allocated dynamically with kzalloc() in efivars_create_sysfs_entries().
> I don't want to allocate memory while holding spin_lock.
>
> Please let me know if I'm missing something.
>
> Seiji
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More
> majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/