lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
 <IA0PR12MB76994BA493127004B569F2AEDC832@IA0PR12MB7699.namprd12.prod.outlook.com>
Date: Wed, 30 Apr 2025 14:18:34 +0000
From: "Mahapatra, Amit Kumar" <amit.kumar-mahapatra@....com>
To: Miquel Raynal <miquel.raynal@...tlin.com>
CC: "richard@....at" <richard@....at>, "vigneshr@...com" <vigneshr@...com>,
	"robh@...nel.org" <robh@...nel.org>, "krzk+dt@...nel.org"
	<krzk+dt@...nel.org>, "conor+dt@...nel.org" <conor+dt@...nel.org>,
	"linux-mtd@...ts.infradead.org" <linux-mtd@...ts.infradead.org>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, "git
 (AMD-Xilinx)" <git@....com>, "amitrkcian2002@...il.com"
	<amitrkcian2002@...il.com>, Bernhard Frauendienst <kernel@...pam.obeliks.de>
Subject: RE: [PATCH v12 3/3] mtd: Add driver for concatenating devices

[AMD Official Use Only - AMD Internal Distribution Only]

Hello Miquel,

> -----Original Message-----
> From: Miquel Raynal <miquel.raynal@...tlin.com>
> Sent: Tuesday, March 18, 2025 9:23 PM
> To: Mahapatra, Amit Kumar <amit.kumar-mahapatra@....com>
> Cc: richard@....at; vigneshr@...com; robh@...nel.org; krzk+dt@...nel.org;
> conor+dt@...nel.org; linux-mtd@...ts.infradead.org; devicetree@...r.kernel.org;
> linux-kernel@...r.kernel.org; git (AMD-Xilinx) <git@....com>;
> amitrkcian2002@...il.com; Bernhard Frauendienst <kernel@...pam.obeliks.de>
> Subject: Re: [PATCH v12 3/3] mtd: Add driver for concatenating devices
>
> On 05/02/2025 at 19:07:30 +0530, Amit Kumar Mahapatra <amit.kumar-
> mahapatra@....com> wrote:
>
>
...

> > +static int __init mtd_virt_concat_create_join(void) {
> > +   struct mtd_virt_concat_node *item;
> > +   struct mtd_concat *concat;
> > +   struct mtd_info *mtd;
> > +   ssize_t name_sz;
> > +   char *name;
> > +   int ret;
> > +
> > +   list_for_each_entry(item, &concat_node_list, head) {
> > +           concat = item->concat;
> > +           mtd = &concat->mtd;
> > +           /* Create the virtual device */
> > +           name_sz = snprintf(NULL, 0, "%s-%s%s-concat",
> > +                              concat->subdev[0]->name,
> > +                              concat->subdev[1]->name,
> > +                              concat->num_subdev > MIN_DEV_PER_CONCAT
> ?
> > +                              "-+" : "");
> > +           name = kmalloc(name_sz + 1, GFP_KERNEL);
> > +           if (!name) {
> > +                   mtd_virt_concat_put_mtd_devices(concat);
> > +                   return -ENOMEM;
> > +           }
> > +
> > +           sprintf(name, "%s-%s%s-concat",
> > +                   concat->subdev[0]->name,
> > +                   concat->subdev[1]->name,
> > +                   concat->num_subdev > MIN_DEV_PER_CONCAT ?
> > +                   "-+" : "");
> > +
> > +           mtd = mtd_concat_create(concat->subdev, concat->num_subdev,
> name);
> > +           if (!mtd) {
> > +                   kfree(name);
> > +                   return -ENXIO;
> > +           }
> > +
> > +           /* Arbitrary set the first device as parent */
>
> Here we may face runtime PM issues. At some point the device model expects a
> single parent per struct device, but here we have two. I do not have any hints at the
> moment on how we could solve that.
>
> > +           mtd->dev.parent = concat->subdev[0]->dev.parent;
> > +           mtd->dev = concat->subdev[0]->dev;
> > +
> > +           /* Register the platform device */
> > +           ret = mtd_device_register(mtd, NULL, 0);
> > +           if (ret)
> > +                   goto destroy_concat;
> > +   }
> > +
> > +   return 0;
> > +
> > +destroy_concat:
> > +   mtd_concat_destroy(mtd);
> > +
> > +   return ret;
> > +}
> > +
> > +late_initcall(mtd_virt_concat_create_join);
>
> The current implementation does not support probe deferrals, I believe it should be
> handled.

I see that the parse_mtd_partitions() API can return -EPROBE_DEFER during
MTD device registration, but this behavior is specific to the
parse_qcomsmem_part parser. None of the other parsers appear to support
probe deferral. As discussed in RFC [1], the virtual concat feature is
purely a fixed-partition capability, and based on my understanding, the
fixed-partition parser does not support probe deferral.
Please let me know if you can think of any other probe deferral scenarios
that might impact the virtual concat driver.

[1] https://lore.kernel.org/all/87sermxme1.fsf@bootlin.com/

Regards,
Amit
...
> > +
> >     /* Prefer parsed partitions over driver-provided fallback */
> >     ret = parse_mtd_partitions(mtd, types, parser_data);
> >     if (ret == -EPROBE_DEFER)
>
> Thanks,
> Miquèl

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ