All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yasunori Goto <y-goto@jp.fujitsu.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: "linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Subject: Re: Panic when make check for ndctl
Date: Wed, 14 Jun 2017 11:41:58 +0900	[thread overview]
Message-ID: <20170614114155.6D1E.E1E9C6FF@jp.fujitsu.com> (raw)
In-Reply-To: <20170607093328.BE75.E1E9C6FF@jp.fujitsu.com>

Hi, Dan-san, Linda-san,

I had chased the root cause of this panic problem, and maybe I found it.

> > > Hmmm, though I made Fedora 25 environment, this panic still occurs...
> > > I'll attach syslog and .config again.
> > >
> > >
> > [..]
> > > [  117.804948] general protection fault: 0000 [#1] SMP
> > [..]
> > > [  117.820866] Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011
> > [..]
> > > [  117.843262] Call Trace:
> > > [  117.843985]  release_nodes+0x76/0x260
> > > [  117.845062]  devres_release_all+0x3c/0x50
> > > [  117.846225]  device_release_driver_internal+0x159/0x200
> > > [  117.847748]  device_release_driver+0x12/0x20
> > > [  117.849029]  bus_remove_device+0xfd/0x170
> > > [  117.850192]  device_del+0x1e8/0x330
> > > [  117.851284]  platform_device_del+0x28/0x90
> > > [  117.852485]  platform_device_unregister+0x12/0x30
> > > [  117.853846]  nfit_test_exit+0x2a/0x93b [nfit_test]
> > > [  117.855219]  SyS_delete_module+0x171/0x250
> > > [  117.856403]  entry_SYSCALL_64_fastpath+0x1a/0xa5
> > 
> > Can you also attach the qemu-kvm command line you are using?
> > 
> >     ps aux | grep qemu


The cause of this problem is the num_pm of nfit_test1 is wrong.
Though 1 is specified for num_pm at nfit_test_init(), it must be 2.

----
static __init int nfit_test_init(void)
{
        int rc, i;
        :
        :
                case 1:
                        nfit_test->num_pm = 1;            <---- !!!
                        nfit_test->dcr_idx = NUM_DCR;
-----

The num_pm affects size of devm_kcalloc() at nfit_test_probe().

----
static int nfit_test_probe(struct platform_device *pdev)
{
        if (nfit_test->num_pm) {
                int num = nfit_test->num_pm;   <----!!!

                nfit_test->spa_set = devm_kcalloc(dev, num, sizeof(void *),
                                GFP_KERNEL);   <---!!!!
                nfit_test->spa_set_dma = devm_kcalloc(dev, num,   
                                sizeof(dma_addr_t), GFP_KERNEL);
-----

However,  spa_set[] array needs 2 elements at nfit_test1_alloc().

---
static int nfit_test1_alloc(struct nfit_test *t)
{
               :
        t->spa_set[0] = test_alloc(t, SPA2_SIZE, &t->spa_set_dma[0]);  <--- first element
        if (!t->spa_set[0])
                return -ENOMEM;
               :

       t->spa_set[1] = test_alloc(t, SPA_VCD_SIZE, &t->spa_set_dma[1]);  <---- The second element!!!!
-----

This breaks other area, and the area is often the link list of devres.
As a result, the panic occured on release_nodes().

I confirmed that this panic never occurred with the following patch.

---
diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c
index c218717..548b6d4 100644
--- a/tools/testing/nvdimm/test/nfit.c
+++ b/tools/testing/nvdimm/test/nfit.c
@@ -1943,7 +1943,7 @@ static __init int nfit_test_init(void)
                        nfit_test->setup = nfit_test0_setup;
                        break;
                case 1:
-                       nfit_test->num_pm = 1;
+                       nfit_test->num_pm = 2;
                        nfit_test->dcr_idx = NUM_DCR;
                        nfit_test->num_dcr = 2;
                        nfit_test->alloc = nfit_test1_alloc;
----

Thanks,
Yasunori Goto


_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  reply	other threads:[~2017-06-14  2:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170529155643.5848.E1E9C6FF@jp.fujitsu.com>
2017-05-29 14:21 ` Fwd: Fw: Panic when make check for ndctl Yasunori Goto
2017-05-29 23:04   ` Dan Williams
2017-05-30  7:34     ` Yasunori Goto
2017-05-30 11:44       ` Dan Williams
2017-06-06  5:51       ` Yasunori Goto
2017-06-06 13:32         ` Linda Knippers
2017-06-06 16:42         ` Dan Williams
2017-06-07  0:33           ` Yasunori Goto
2017-06-14  2:41             ` Yasunori Goto [this message]
2017-06-14  3:05               ` Dan Williams
2017-06-14 15:31                 ` Linda Knippers
2017-06-14 16:06               ` Dan Williams
2017-06-15  5:04                 ` Yasunori Goto
2017-06-15 21:29                   ` Dan Williams

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=20170614114155.6D1E.E1E9C6FF@jp.fujitsu.com \
    --to=y-goto@jp.fujitsu.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.