[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN6PR1201MB01317D2D25E2A5F3FFBA5411F8F00@BN6PR1201MB0131.namprd12.prod.outlook.com>
Date: Tue, 30 May 2017 12:39:03 +0000
From: "Ghannam, Yazen" <Yazen.Ghannam@....com>
To: Borislav Petkov <bp@...en8.de>
CC: "linux-edac@...r.kernel.org" <linux-edac@...r.kernel.org>,
Borislav Petkov <bp@...e.de>, Tony Luck <tony.luck@...el.com>,
"x86@...nel.org" <x86@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 2/3] x86/mce/AMD: Define a list_head for threshold blocks
outside the list
> -----Original Message-----
> From: Borislav Petkov [mailto:bp@...en8.de]
> Sent: Sunday, May 28, 2017 1:22 PM
> To: Ghannam, Yazen <Yazen.Ghannam@....com>
> Cc: linux-edac@...r.kernel.org; Borislav Petkov <bp@...e.de>; Tony Luck
> <tony.luck@...el.com>; x86@...nel.org; linux-kernel@...r.kernel.org
> Subject: Re: [PATCH 2/3] x86/mce/AMD: Define a list_head for threshold
> blocks outside the list
>
> On Wed, May 24, 2017 at 03:41:46PM -0500, Yazen Ghannam wrote:
> > From: Yazen Ghannam <yazen.ghannam@....com>
> >
> > There needs to be a list_head outside of a linked list in order to
> > iterate over it and have access to all its elements. This is because
> > the
> > list_for_each* macros iterate starting from head->next rather than head.
> >
> > Define a list_head for the threshold blocks list in struct
> > threshold_bank
>
> struct threshold_block {
>
> ...
>
> struct list_head miscj; /*
> * List of threshold blocks
> * within a bank.
> */
>
> There's your list_head right there.
>
Like I said in the commit message, the list_head needs to be outside the
list to access all the elements using list_for_each*. Otherwise, we won't
get a reference to the "head" element since we iterate starting from
head->next and break when !head.
For example here, we use block 0 as the head and I find that I don't get a
reference to it when using list_for_each* as the code is currently. Am I
doing something wrong?
Thanks,
Yazen
Powered by blists - more mailing lists