Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1653253

Re: [PATCH 2/3] x86/mce/AMD: Define a list_head for threshold blocks outside the list

From Borislav Petkov <bp@alien8.de>
Newsgroups linux.kernel
Subject Re: [PATCH 2/3] x86/mce/AMD: Define a list_head for threshold blocks outside the list
Date 2017-05-30 16:00 +0200
Message-ID <tMPQJ-861-3@gated-at.bofh.it> (permalink)
References <tMaaR-4Wf-3@gated-at.bofh.it> <tMaaR-4Wf-5@gated-at.bofh.it> <tMaaR-4Wf-1@gated-at.bofh.it> <tMOL1-7oW-35@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View 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.

-- 
Regards/Gruss,
    Boris.

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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH 2/3] x86/mce/AMD: Define a list_head for threshold blocks  outside the list Borislav Petkov <bp@alien8.de> - 2017-05-28 19:30 +0200
  RE: [PATCH 2/3] x86/mce/AMD: Define a list_head for threshold blocks  outside the list "Ghannam, Yazen" <Yazen.Ghannam@amd.com> - 2017-05-30 14:50 +0200
    Re: [PATCH 2/3] x86/mce/AMD: Define a list_head for threshold blocks  outside the list Borislav Petkov <bp@alien8.de> - 2017-05-30 16:00 +0200
      RE: [PATCH 2/3] x86/mce/AMD: Define a list_head for threshold blocks  outside the list "Ghannam, Yazen" <Yazen.Ghannam@amd.com> - 2017-05-30 16:10 +0200
        Re: [PATCH 2/3] x86/mce/AMD: Define a list_head for threshold blocks  outside the list Borislav Petkov <bp@alien8.de> - 2017-05-30 16:20 +0200

csiph-web