mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: Linux Edac Mailing List <linux-edac@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Aristeu Rozanski <arozansk@redhat.com>,
	Doug Thompson <norsk5@yahoo.com>,
	Borislav Petkov <borislav.petkov@amd.com>,
	Mark Gross <mark.gross@intel.com>,
	Jason Uhlenkott <juhlenko@akamai.com>,
	Tim Small <tim@buttersideup.com>,
	Ranganathan Desikan <ravi@jetztechnologies.com>,
	"Arvind R." <arvino55@gmail.com>, Olof Johansson <olof@lixom.net>,
	Egor Martovetsky <egor@pasemi.com>,
	Chris Metcalf <cmetcalf@tilera.com>,
	Michal Marek <mmarek@suse.cz>, Jiri Kosina <jkosina@suse.cz>,
	Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Hitoshi Mitake <h.mitake@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Shaohui Xie <Shaohui.Xie@freescale.com>,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [EDAC ABI v13 24/25] edac: change the mem allocation scheme to make Documentation/kobject.txt happy
Date: Tue, 17 Apr 2012 15:17:47 -0600	[thread overview]
Message-ID: <1334697467.3920.5.camel@joe2Laptop> (raw)
In-Reply-To: <1334608729-30803-25-git-send-email-mchehab@redhat.com>

On Mon, 2012-04-16 at 17:38 -0300, Mauro Carvalho Chehab wrote:
> Kernel kobjects have rigid rules: each container object should be
> dynamically allocated, and can't be allocated into a single kmalloc.
> 
> EDAC never obeyed this rule: it has a single malloc function that
> allocates all needed data into a single kzalloc.
> 
> As this is not accepted anymore, change the allocation schema of the
> EDAC *_info structs to enforce this Kernel standard.
[]
> diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
[]
> @@ -2228,9 +2228,9 @@ static int init_csrows(struct mem_ctl_info *mci)
>  			edac_mode = EDAC_NONE;
>  
>  		for (j = 0; j < pvt->channel_count; j++) {
> -			csrow->channels[j].dimm->mtype = mtype;
> -			csrow->channels[j].dimm->edac_mode = edac_mode;
> -			csrow->channels[j].dimm->nr_pages = nr_pages;
> +			csrow->channels[j]->dimm->mtype = mtype;
> +			csrow->channels[j]->dimm->edac_mode = edac_mode;
> +			csrow->channels[j]->dimm->nr_pages = nr_pages;

It might be better to use an automatic for
	typeof foo dimm = csrow->channels[j]->dimm;
	dimm->mtype = mtype;
	etc...
[]
> @@ -293,39 +286,56 @@ struct mem_ctl_info *edac_mc_alloc(unsigned edac_index,
>  	mci->mem_is_per_rank = per_rank;
>  
>  	/*
> -	 * Fills the csrow struct
> +	 * Alocate and fill the csrow/channels structs
>  	 */
> +	mci->csrows = kzalloc(sizeof(*mci->csrows) * tot_csrows, GFP_KERNEL);

kcalloc

[]
> +		csr->channels = kzalloc(sizeof(*csr->channels) * tot_cschannels,
> +					GFP_KERNEL);

here too

> @@ -391,7 +401,31 @@ struct mem_ctl_info *edac_mc_alloc(unsigned edac_index,
>  
>  	trace_hw_event_init("edac", (unsigned)edac_index);
>  
> +	debugf1("EDAC MCI allocated\n");
>  	return mci;
> +
> +error:
> +	debugf1("Failed to allocate one or more EDAC MCI structs\n");

Generally, it's not necessary to have specific "OOM" messages
as allocations without GFP_NOWARN do dump_stack()s



  reply	other threads:[~2012-04-18 17:17 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-16 20:38 [EDAC ABI v13 00/25] Fix EDAC userspace ABI Mauro Carvalho Chehab
2012-04-16 20:38 ` [EDAC ABI v13 01/25] edac: Initialize the dimm label with the known information Mauro Carvalho Chehab
2012-05-07 15:52   ` Borislav Petkov
2012-05-14 12:48     ` Borislav Petkov
2012-05-14 13:47       ` Mauro Carvalho Chehab
2012-04-16 20:38 ` [EDAC ABI v13 02/25] edac: Cleanup the logs for i7core and sb edac drivers Mauro Carvalho Chehab
2012-04-16 20:38 ` [EDAC ABI v13 03/25] i5400_edac: improve debug messages to better represent the filled memory Mauro Carvalho Chehab
2012-04-16 20:38 ` [EDAC ABI v13 04/25] events/hw_event: Create a Hardware Events Report Mecanism (HERM) Mauro Carvalho Chehab
2012-05-09 12:13   ` Borislav Petkov
2012-05-09 12:50     ` Mauro Carvalho Chehab
2012-05-09 13:22       ` Borislav Petkov
2012-05-09 13:51         ` Mauro Carvalho Chehab
2012-05-09 14:06           ` Borislav Petkov
2012-05-09 14:15             ` Mauro Carvalho Chehab
2012-05-09 14:24               ` Borislav Petkov
2012-05-10 13:16                 ` Mauro Carvalho Chehab
2012-05-10 13:41                   ` Borislav Petkov
2012-05-10 14:53                     ` Mauro Carvalho Chehab
2012-05-10 15:02                       ` Borislav Petkov
2012-05-10 15:08                       ` Mauro Carvalho Chehab
2012-05-10 15:12                         ` Borislav Petkov
2012-05-10 15:16                           ` Mauro Carvalho Chehab
2012-05-10 19:57                             ` [PATCH] edac: Increase version to 3.0.0 (aka: "HERM" version) Mauro Carvalho Chehab
2012-05-11 10:08                               ` Borislav Petkov
2012-05-10 15:20                           ` [EDAC ABI v13 04/25] events/hw_event: Create a Hardware Events Report Mecanism (HERM) Steven Rostedt
2012-05-10 15:27                             ` Borislav Petkov
2012-05-10 15:34                             ` Mauro Carvalho Chehab
2012-05-09 14:19           ` Steven Rostedt
2012-05-10 13:17             ` Mauro Carvalho Chehab
2012-04-16 20:38 ` [EDAC ABI v13 05/25] i5000_edac: Fix the logic that retrieves memory information Mauro Carvalho Chehab
2012-04-16 20:38 ` [EDAC ABI v13 06/25] e752x_edac: provide more info about how DIMMS/ranks are mapped Mauro Carvalho Chehab
2012-04-16 20:38 ` [EDAC ABI v13 07/25] edac: Rename the parent dev to pdev Mauro Carvalho Chehab
2012-04-16 20:38 ` [EDAC ABI v13 08/25] edac: use Documentation-nano format for some data structs Mauro Carvalho Chehab
2012-05-09 12:23   ` Borislav Petkov
2012-05-09 12:55     ` Mauro Carvalho Chehab
2012-04-16 20:38 ` [EDAC ABI v13 09/25] edac: rewrite the sysfs code to use struct device Mauro Carvalho Chehab
2012-05-09 12:34   ` Borislav Petkov
2012-05-09 13:10     ` Mauro Carvalho Chehab
2012-05-09 13:24       ` Borislav Petkov
2012-05-09 14:09         ` [PATCH v21] edac: rewrite the sysfs code to use struct device - Was: " Mauro Carvalho Chehab
2012-05-09 13:13     ` Mauro Carvalho Chehab
2012-04-16 20:38 ` [EDAC ABI v13 10/25] mpc85xx_edac: convert sysfs logic " Mauro Carvalho Chehab
2012-04-16 20:38 ` [EDAC ABI v13 11/25] amd64_edac: " Mauro Carvalho Chehab
2012-04-16 20:38 ` [EDAC ABI v13 12/25] i7core_edac: convert it " Mauro Carvalho Chehab
2012-04-16 20:38 ` [EDAC ABI v13 13/25] edac: Get rid of the old kobj's from the edac mc code Mauro Carvalho Chehab
2012-04-16 20:38 ` [EDAC ABI v13 14/25] edac: add a new per-dimm API and make the old per-virtual-rank API obsolete Mauro Carvalho Chehab
2012-04-16 20:38 ` [EDAC ABI v13 15/25] edac: add a sysfs node to report the maximum location for the system Mauro Carvalho Chehab
2012-04-16 20:38 ` [EDAC ABI v13 16/25] edac: Add debufs nodes to allow doing fake error inject Mauro Carvalho Chehab
2012-04-16 20:38 ` [EDAC ABI v13 17/25] edac: Create a per-Memory Controller bus Mauro Carvalho Chehab
2012-04-16 23:25   ` Greg K H
2012-04-16 20:38 ` [EDAC ABI v13 18/25] edac: Move grain/dtype/edac_type calculus to be out of channel loop Mauro Carvalho Chehab
2012-04-16 20:38 ` [EDAC ABI v13 19/25] i82975x_edac: Test nr_pages earlier to save a few CPU cycles Mauro Carvalho Chehab
2012-04-16 20:38 ` [EDAC ABI v13 20/25] i5100_edac: Fix a warning when compiled with 32 bits Mauro Carvalho Chehab
2012-04-16 20:38 ` [EDAC ABI v13 21/25] i7300_edac: Get rid of some wrongly-solved rebase conflict Mauro Carvalho Chehab
2012-04-16 20:38 ` [EDAC ABI v13 22/25] edac: Only expose csrows/channels on legacy API if they're populated Mauro Carvalho Chehab
2012-04-16 20:38 ` [EDAC ABI v13 23/25] edac: Fix a typo at edac_mc_sysfs Mauro Carvalho Chehab
2012-04-16 20:38 ` [EDAC ABI v13 24/25] edac: change the mem allocation scheme to make Documentation/kobject.txt happy Mauro Carvalho Chehab
2012-04-17 21:17   ` Joe Perches [this message]
2012-04-19 13:14     ` Mauro Carvalho Chehab
2012-04-22  6:37       ` Joe Perches
2012-04-19 13:21     ` [PATCH] " Mauro Carvalho Chehab
2012-04-19 15:28       ` Greg K H
2012-04-16 20:38 ` [EDAC ABI v13 25/25] i7core_edac: " Mauro Carvalho Chehab

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=1334697467.3920.5.camel@joe2Laptop \
    --to=joe@perches.com \
    --cc=Shaohui.Xie@freescale.com \
    --cc=akpm@linux-foundation.org \
    --cc=arozansk@redhat.com \
    --cc=arvino55@gmail.com \
    --cc=benh@kernel.crashing.org \
    --cc=borislav.petkov@amd.com \
    --cc=cmetcalf@tilera.com \
    --cc=dbaryshkov@gmail.com \
    --cc=egor@pasemi.com \
    --cc=h.mitake@gmail.com \
    --cc=jkosina@suse.cz \
    --cc=juhlenko@akamai.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mark.gross@intel.com \
    --cc=mchehab@redhat.com \
    --cc=mmarek@suse.cz \
    --cc=norsk5@yahoo.com \
    --cc=olof@lixom.net \
    --cc=ravi@jetztechnologies.com \
    --cc=tim@buttersideup.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

Powered by JetHome