Re: [PATCH v14 07/11] livepatch: Add atomic replace

From: Josh Poimboeuf
Date: Thu Jan 03 2019 - 08:37:31 EST


On Thu, Jan 03, 2019 at 01:47:40PM +0100, Petr Mladek wrote:
> On Mon 2018-12-17 16:27:41, Petr Mladek wrote:
> > On Thu 2018-12-13 16:55:28, Josh Poimboeuf wrote:
> > > On Thu, Nov 29, 2018 at 10:44:27AM +0100, Petr Mladek wrote:
> > > Side note, it would probably be useful to have a klp_for_each_patch()
> > > helper.
> >
> > Will do.
>
> Hmm, there are two possibilities:
>
> 1) #define klp_for_each_patch(patch) \
> list_for_each_entry(patch, &klp_patches, list)
>
> 2) #define klp_for_each_patch(patches, patch) \
> list_for_each_entry(patch, &patches, list)
>
> Problems:
>
> 1st variant would need to declare klp_patches in
> include/linux/livepatch.h. Josh did not like even
> kernel/livepatch/core.h.
>
> 2nd variant looks ugly to me.
>
>
> Alternative solution would be to move all klp_for_each*()
> definitions from include/linux/livepatch.h to kernel/livepatch/core.h.
> But there might be some users. I wonder if we use these
> macros when preparing the cumulative patches.
>
>
> As any solution looks controversial, I would prefer to postpone this change
> after this patchset is accepted.

I would vote #1, and just put it in core.c next to the klp_patches
definition.

But it's fine with me if you want to postpone it.

--
Josh