mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Doug Thompson <norsk5@yahoo.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/6]  EDAC mc numbers refactor 2-of-2
Date: Tue, 27 Jun 2006 14:56:33 -0700	[thread overview]
Message-ID: <20060627145633.533bc2dc.akpm@osdl.org> (raw)
In-Reply-To: <20060626221713.42428.qmail@web50106.mail.yahoo.com>

Doug Thompson <norsk5@yahoo.com> wrote:
>
> From: Doug Thompson <norsk5@xmission.com>
> 
> This is part 2 of a 2-part patch set.
> 
> 1 Reimplement add_mc_to_global_list() with semantics that allow the caller to
>   determine the ID number for a mem_ctl_info structure.  Then modify
>   edac_mc_add_mc() so that the caller specifies the ID number for the new
>   mem_ctl_info structure.  Platform-specific code should be able to assign the
>   ID numbers in a platform-specific manner.  For instance, on Opteron it makes
>   sense to have the ID of the mem_ctl_info structure match the ID of the node
>   that the memory controller belongs to.
> 
> 2 Modify callers of edac_mc_add_mc() so they use the new semantics.
> 
> ...
>  
> +/* Return 0 on success, 1 on failure.
> + * Before calling this function, caller must
> + * assign a unique value to mci->mc_idx.
> + */
> +static int add_mc_to_global_list (struct mem_ctl_info *mci)
> +{
> +	struct list_head *item, *insert_before;
> +	struct mem_ctl_info *p;
> +
> +	insert_before = &mc_devices;
> +
> +	if (unlikely((p = find_mci_by_dev(mci->dev)) != NULL))
> +		goto fail0;
> +
> +	list_for_each(item, &mc_devices) {
> +		p = list_entry(item, struct mem_ctl_info, link);
> +
> +		if (p->mc_idx >= mci->mc_idx) {
> +			if (unlikely(p->mc_idx == mci->mc_idx))
> +				goto fail1;
> +
> +			insert_before = item;
> +			break;
> +		}
> +	}
> +
> +	list_add_tail_rcu(&mci->link, insert_before);
> +	return 0;
> +
> +fail0:
> +	edac_printk(KERN_WARNING, EDAC_MC,
> +		    "%s (%s) %s %s already assigned %d\n", p->dev->bus_id,
> +		    dev_name(p->dev), p->mod_name, p->ctl_name, p->mc_idx);
> +	return 1;
> +
> +fail1:
> +	edac_printk(KERN_WARNING, EDAC_MC,
> +		    "bug in low-level driver: attempt to assign\n"
> +		    "    duplicate mc_idx %d in %s()\n", p->mc_idx, __func__);
> +	return 1;
> +}

I assume the caller must hold some lock to prevent the list from getting
trashed, but I didn't locate it in (literally) a five-second search.  I'd
suggest that a comment describing the locking requirements be added to this
function.


  reply	other threads:[~2006-06-27 21:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-26 22:17 Doug Thompson
2006-06-27 21:56 ` Andrew Morton [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-05-24 17:47 Doug Thompson

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=20060627145633.533bc2dc.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=norsk5@yahoo.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®