mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "lizhijian@fujitsu.com" <lizhijian@fujitsu.com>
To: Dan Williams <dan.j.williams@intel.com>,
	"vishal.l.verma@intel.com" <vishal.l.verma@intel.com>,
	"dave.jiang@intel.com" <dave.jiang@intel.com>,
	"ira.weiny@intel.com" <ira.weiny@intel.com>,
	"nvdimm@lists.linux.dev" <nvdimm@lists.linux.dev>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] nvdimm: nvdimm_bus_register: Avoid adding device to the unregistered bus
Date: Tue, 21 Mar 2023 02:17:36 +0000	[thread overview]
Message-ID: <cfa1a053-b99b-c22e-b80c-4b92f5f4e225@fujitsu.com> (raw)
In-Reply-To: <6418981ac577c_1dee2948f@dwillia2-mobl3.amr.corp.intel.com.notmuch>



On 21/03/2023 01:30, Dan Williams wrote:
> lizhijian@fujitsu.com wrote:
> [..]
>>>> Dan,
>>>>
>>>> Configure the kconfig with ACPI_NFIT [=m] && LIBNVDIMM [=y], and add extra kernel booting parameter
>>>> 'initcall_blacklist=libnvdimm_init'. Then kernel panic!
>>>
>>> That's expected though,
>>
>> Do you mean we just keep it as it is.
> 
> Yes.
> 
>>
>>
>>> you can't block libnvdimm_init and then expect
>>> modules that link to libnvdimm to work.
>> Ah, we would rather see it *unable to work* than panic, isn't it.
> 
> That part is true, but consider the implications of adding error
> handling to all code that can no longer depend on initcall ordering, not
> just libnvdimm. This would be a large paradigm shift.
> 
> Now I do think it would be a good idea to fail device_add() if the bus
> is not registered, but I *think* that happens now as a result of:
> 
> 5221b82d46f2 driver core: bus: bus_add/probe/remove_device() cleanups
> 
> ...can you double check if you have that commit in your tests?

Great, panic is gone after i upgraded to the upstream!


> Now I do think it would be a good idea to fail device_add() if the bus
> is not registered,

BTW, below line 369: device_add() didn't fail in practical.

  354         mutex_init(&nvdimm_bus->reconfig_mutex);
  355         badrange_init(&nvdimm_bus->badrange);
  356         nvdimm_bus->nd_desc = nd_desc;
  357         nvdimm_bus->dev.parent = parent;
  358         nvdimm_bus->dev.type = &nvdimm_bus_dev_type;
  359         nvdimm_bus->dev.groups = nd_desc->attr_groups;
  360         nvdimm_bus->dev.bus = &nvdimm_bus_type;
  361         nvdimm_bus->dev.of_node = nd_desc->of_node;
  362         device_initialize(&nvdimm_bus->dev);
  363         lockdep_set_class(&nvdimm_bus->dev.mutex, &nvdimm_bus_key);
  364         device_set_pm_not_required(&nvdimm_bus->dev);
  365         rc = dev_set_name(&nvdimm_bus->dev, "ndbus%d", nvdimm_bus->id);
  366         if (rc)
  367                 goto err;
  368
  369         rc = device_add(&nvdimm_bus->dev);
  370         dev_err(&nvdimm_bus->dev, "registration failed: %d\n", rc);

Thanks
Zhijian

  reply	other threads:[~2023-03-21  2:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-16  8:38 Li Zhijian
2023-03-16 15:54 ` Dan Williams
2023-03-17  1:42   ` lizhijian
2023-03-17  2:26     ` Dan Williams
2023-03-17  5:37       ` lizhijian
2023-03-17  5:59     ` Dan Williams
2023-03-20  2:06       ` lizhijian
2023-03-20 17:30         ` Dan Williams
2023-03-21  2:17           ` lizhijian [this message]
2023-03-21  2:38             ` Dan Williams
2023-03-21  3:19               ` lizhijian

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=cfa1a053-b99b-c22e-b80c-4b92f5f4e225@fujitsu.com \
    --to=lizhijian@fujitsu.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=ira.weiny@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nvdimm@lists.linux.dev \
    --cc=vishal.l.verma@intel.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®