Re: [PATCH v6 3/6] x86/e820: Refactor range_update and range_remove

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Martin,

On Tue, Feb 08, 2022 at 06:01:21PM -0300, Martin Fernandez wrote:
> On 2/8/22, Mike Rapoport <rppt@xxxxxxxxxx> wrote:
> > On Mon, Feb 07, 2022 at 01:45:40PM -0800, Kees Cook wrote:
> >> On Thu, Feb 03, 2022 at 01:43:25PM -0300, Martin Fernandez wrote:
> >> > __e820__range_update and e820__range_remove had a very similar
> >> > implementation with a few lines different from each other, the lines
> >> > that actually perform the modification over the e820_table. The
> >> > similiraties were found in the checks for the different cases on how
> >> > each entry intersects with the given range (if it does at all). These
> >> > checks were very presice and error prone so it was not a good idea to
> >> > have them in both places.
> >>
> >> Yay removing copy/paste code! :)
> >
> > Removing copy/paste is nice but diffstat of
> >
> >  arch/x86/kernel/e820.c | 383 ++++++++++++++++++++++++++++++-----------
> >  1 file changed, 283 insertions(+), 100 deletions(-)
> >
> > does not look nice even accounting for lots of comments :(
> >
> > I didn't look closely, but diffstat clues that the refactoring making
> > things much more complex.
> >
> 
> Yes, that diffstat surprised me as well.
> 
> I have to mention that 110 of those lines are kerneldocs and blank
> lines, which is quite a lot. Also you have to take into account that I
> expanded most of the function definitions for better formatting, which
> also took some space.

At last I had time to look more closely and I think that using a set of
callbacks is over-complicated.

I think this can be done way simpler, e.g like this (untested) draft:

https://git.kernel.org/rppt/h/x86/e820-update-range


> And as I was able to focus the "hard" part of the problem into a
> single function, testing can be done easily as Kees suggested and I'm
> planning to do so in the next patch.



-- 
Sincerely yours,
Mike.



[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux