All of lore.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: "Ghannam, Yazen" <Yazen.Ghannam@amd.com>
Cc: "linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>,
	Tony Luck <tony.luck@intel.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/3] x86/mce/AMD: Define a list_head for threshold blocks outside the list
Date: Tue, 30 May 2017 15:56:33 +0200	[thread overview]
Message-ID: <20170530135633.y2hbkpc2ak3zkgtw@pd.tnic> (raw)
In-Reply-To: <BN6PR1201MB01317D2D25E2A5F3FFBA5411F8F00@BN6PR1201MB0131.namprd12.prod.outlook.com>

On Tue, May 30, 2017 at 12:39:03PM +0000, Ghannam, Yazen wrote:
> 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.

I believe the whole hierarchy here is done a bit differently: the list
starts at threshold_bank->blocks which points to the first threshold
block. So when iterating, you need to look at threshold_bank->blocks
first, which is the first element and then traverse the list.

This is basically how the list gets built:

allocate_threshold_blocks:

	...

        if (per_cpu(threshold_banks, cpu)[bank]->blocks)
                list_add(&b->miscj, &per_cpu(threshold_banks, cpu)[bank]->blocks->miscj);
        else
                per_cpu(threshold_banks, cpu)[bank]->blocks = b;

per_cpu(threshold_banks, cpu)[bank]->blocks is the first element as
it points to a struct threshold_block and then the ..->blocks->miscj
contains any further threshold blocks present on this bank and we queue
them there if ->blocks is not NULL.

HTH.

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

WARNING: multiple messages have this Message-ID (diff)
From: Borislav Petkov <bp@alien8.de>
To: "Ghannam, Yazen" <Yazen.Ghannam@amd.com>
Cc: "linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>,
	Tony Luck <tony.luck@intel.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [2/3] x86/mce/AMD: Define a list_head for threshold blocks outside the list
Date: Tue, 30 May 2017 15:56:33 +0200	[thread overview]
Message-ID: <20170530135633.y2hbkpc2ak3zkgtw@pd.tnic> (raw)

On Tue, May 30, 2017 at 12:39:03PM +0000, Ghannam, Yazen wrote:
> 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.

I believe the whole hierarchy here is done a bit differently: the list
starts at threshold_bank->blocks which points to the first threshold
block. So when iterating, you need to look at threshold_bank->blocks
first, which is the first element and then traverse the list.

This is basically how the list gets built:

allocate_threshold_blocks:

	...

        if (per_cpu(threshold_banks, cpu)[bank]->blocks)
                list_add(&b->miscj, &per_cpu(threshold_banks, cpu)[bank]->blocks->miscj);
        else
                per_cpu(threshold_banks, cpu)[bank]->blocks = b;

per_cpu(threshold_banks, cpu)[bank]->blocks is the first element as
it points to a struct threshold_block and then the ..->blocks->miscj
contains any further threshold blocks present on this bank and we queue
them there if ->blocks is not NULL.

HTH.

  reply	other threads:[~2017-05-30 13:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-24 20:41 [PATCH 1/3] x86/mce/AMD: Use msr_stat when clearing MCA_STATUS Yazen Ghannam
2017-05-24 20:41 ` [1/3] " Yazen Ghannam
2017-05-24 20:41 ` [PATCH 2/3] x86/mce/AMD: Define a list_head for threshold blocks outside the list Yazen Ghannam
2017-05-24 20:41   ` [2/3] " Yazen Ghannam
2017-05-28 17:22   ` [PATCH 2/3] " Borislav Petkov
2017-05-28 17:22     ` [2/3] " Borislav Petkov
2017-05-30 12:39     ` [PATCH 2/3] " Ghannam, Yazen
2017-05-30 12:39       ` [2/3] " Yazen Ghannam
2017-05-30 13:56       ` Borislav Petkov [this message]
2017-05-30 13:56         ` Borislav Petkov
2017-05-30 14:06         ` [PATCH 2/3] " Ghannam, Yazen
2017-05-30 14:06           ` [2/3] " Yazen Ghannam
2017-05-30 14:10           ` [PATCH 2/3] " Borislav Petkov
2017-05-30 14:10             ` [2/3] " Borislav Petkov
2017-05-24 20:41 ` [PATCH 3/3] x86/mce/AMD: Use saved threshold block info in interrupt handler Yazen Ghannam
2017-05-24 20:41   ` [3/3] " Yazen Ghannam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170530135633.y2hbkpc2ak3zkgtw@pd.tnic \
    --to=bp@alien8.de \
    --cc=Yazen.Ghannam@amd.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.