public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
To: Alex Chiang <achiang@hp.com>,
	Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>,
	Matthew Wilcox <matthew@wil.cx>,
	Pierre Ossman <drzeus-list@drzeus.cx>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-pci@vger.kernel.org
Subject: Re: [PATCH 0/7] Fixups for duplicate slot names
Date: Mon, 11 Aug 2008 10:19:06 +0900	[thread overview]
Message-ID: <489F938A.10302@jp.fujitsu.com> (raw)
In-Reply-To: <20080807172529.GB25902@ldl.fc.hp.com>

Alex Chiang wrote:
> * Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>:
>> Hi Alex-san,
>>
>> Thank you for patches!
>>
>> I looked at your patches and it looks good. But I have only one
>> concern about how to allocate/free memory for slot name.
>>
>> With your change, memory region for slot name will be allocated
>> by hotplug *controller* driver and it can be freed using kfree()
>> by hotplug *core* driver (not hotplug controller driver). So all
>> hotplug controller drivers including drivers implemented in the
>> future need to take it into account.
>>
>> I think it will be more robust if we can allocate and free memory
>> in the same component (maybe hotplug core driver in this case).
> 
> Hm, I didn't think this would be a problem. The sequence is:
> 
> 	- controller allocates memory for slot name
> 	- if core detects a collision:
> 		- it frees the name
> 		- it allocates new memory for name
> 		- it assigns that memory to the name parameter
> 	- controller->release will eventually free the name
> 
> So it shouldn't matter if the core frees the original name
> pointer and allocates new memory, because the core will change
> the pointer for the controller.
> 
> This is why I had to change the interface of pci_create_slot()
> from taking a const char *name to a char *name.
> 
> Is there something I'm missing?
> 
> /ac

I'm worrying about the following cases for example:

 - hotplug controller driver allocates memory for slot name using
   other than kmalloc().

 - hotplug controller driver allocates memory for slot name as
   a part of another data structure.

Thanks,
Kenji Kaneshige



      reply	other threads:[~2008-08-11  1:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-06  5:07 [PATCH 0/7] Fixups for duplicate slot names Alex Chiang
2008-08-06  5:10 ` [PATCH 1/7] acpiphp: convert to a kmalloc'ed slot name Alex Chiang
2008-08-06  5:11 ` [PATCH 2/7] fakephp: " Alex Chiang
2008-08-06  5:11 ` [PATCH 3/7] pciehp: " Alex Chiang
2008-08-06  5:11 ` [PATCH 4/7] PCI hotplug: convert skeleton code " Alex Chiang
2008-08-06  5:11 ` [PATCH 5/7] shpchp: convert " Alex Chiang
2008-08-06  5:12 ` [PATCH 6/7] pci_slot: " Alex Chiang
2008-08-06  5:12 ` [PATCH 7/7] PCI Hotplug core: fixups for duplicate slot names Alex Chiang
2008-08-07  8:43 ` [PATCH 0/7] Fixups " Kenji Kaneshige
2008-08-07 17:25   ` Alex Chiang
2008-08-11  1:19     ` Kenji Kaneshige [this message]

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=489F938A.10302@jp.fujitsu.com \
    --to=kaneshige.kenji@jp.fujitsu.com \
    --cc=achiang@hp.com \
    --cc=drzeus-list@drzeus.cx \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=matthew@wil.cx \
    /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