2019-03-22 20:17:10

by Kimberly Brown

[permalink] [raw]
Subject: [PATCH] kobject: Add support for default attribute groups to kobj_type

kobj_type currently uses a list of individual attributes to store
default attributes. Attribute groups are more flexible than a list of
attributes because groups provide support for attribute visibility. So,
add support for default attribute groups to kobj_type.

In future patches, the existing uses of kobj_type’s attribute list will
be converted to attribute groups. When that is complete, kobj_type’s
attribute list, “default_attrs”, will be removed.

Signed-off-by: Kimberly Brown <[email protected]>
---
include/linux/kobject.h | 3 ++-
lib/kobject.c | 14 ++++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 1ab0d624fb36..e2ca0a292e21 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -139,7 +139,8 @@ static inline bool kobject_has_children(struct kobject *kobj)
struct kobj_type {
void (*release)(struct kobject *kobj);
const struct sysfs_ops *sysfs_ops;
- struct attribute **default_attrs;
+ struct attribute **default_attrs; /* use default_groups instead */
+ const struct attribute_group **default_groups;
const struct kobj_ns_type_operations *(*child_ns_type)(struct kobject *kobj);
const void *(*namespace)(struct kobject *kobj);
void (*get_ownership)(struct kobject *kobj, kuid_t *uid, kgid_t *gid);
diff --git a/lib/kobject.c b/lib/kobject.c
index b72e00fd7d09..67789f34951d 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -82,6 +82,7 @@ static int populate_dir(struct kobject *kobj)

static int create_dir(struct kobject *kobj)
{
+ const struct kobj_type *ktype = get_ktype(kobj);
const struct kobj_ns_type_operations *ops;
int error;

@@ -95,6 +96,14 @@ static int create_dir(struct kobject *kobj)
return error;
}

+ if (ktype) {
+ error = sysfs_create_groups(kobj, ktype->default_groups);
+ if (error) {
+ sysfs_remove_dir(kobj);
+ return error;
+ }
+ }
+
/*
* @kobj->sd may be deleted by an ancestor going away. Hold an
* extra reference so that it stays until @kobj is gone.
@@ -584,11 +593,16 @@ EXPORT_SYMBOL_GPL(kobject_move);
void kobject_del(struct kobject *kobj)
{
struct kernfs_node *sd;
+ const struct kobj_type *ktype = get_ktype(kobj);

if (!kobj)
return;

sd = kobj->sd;
+
+ if (ktype)
+ sysfs_remove_groups(kobj, ktype->default_groups);
+
sysfs_remove_dir(kobj);
sysfs_put(sd);

--
2.17.1



2019-03-23 06:10:02

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] kobject: Add support for default attribute groups to kobj_type

On Fri, Mar 22, 2019 at 04:14:40PM -0400, Kimberly Brown wrote:
> kobj_type currently uses a list of individual attributes to store
> default attributes. Attribute groups are more flexible than a list of
> attributes because groups provide support for attribute visibility. So,
> add support for default attribute groups to kobj_type.
>
> In future patches, the existing uses of kobj_type’s attribute list will
> be converted to attribute groups. When that is complete, kobj_type’s
> attribute list, “default_attrs”, will be removed.
>
> Signed-off-by: Kimberly Brown <[email protected]>
> ---
> include/linux/kobject.h | 3 ++-
> lib/kobject.c | 14 ++++++++++++++
> 2 files changed, 16 insertions(+), 1 deletion(-)

Yes! Thanks for doing this.

But how did you test it? Did you convert any kobj_type structures to
the attribute group and see that all was the same? Ideally I'd like to
take this patch with at least one subsystem that uses the change,
otherwise this looks like unused code in the kernel.

thanks,

greg k-h

2019-03-24 03:49:54

by Kimberly Brown

[permalink] [raw]
Subject: Re: [PATCH] kobject: Add support for default attribute groups to kobj_type

On Sat, Mar 23, 2019 at 07:07:37AM +0100, Greg Kroah-Hartman wrote:
> On Fri, Mar 22, 2019 at 04:14:40PM -0400, Kimberly Brown wrote:
> > kobj_type currently uses a list of individual attributes to store
> > default attributes. Attribute groups are more flexible than a list of
> > attributes because groups provide support for attribute visibility. So,
> > add support for default attribute groups to kobj_type.
> >
> > In future patches, the existing uses of kobj_type’s attribute list will
> > be converted to attribute groups. When that is complete, kobj_type’s
> > attribute list, “default_attrs”, will be removed.
> >
> > Signed-off-by: Kimberly Brown <[email protected]>
> > ---
> > include/linux/kobject.h | 3 ++-
> > lib/kobject.c | 14 ++++++++++++++
> > 2 files changed, 16 insertions(+), 1 deletion(-)
>
> Yes! Thanks for doing this.
>
> But how did you test it? Did you convert any kobj_type structures to
> the attribute group and see that all was the same? Ideally I'd like to
> take this patch with at least one subsystem that uses the change,
> otherwise this looks like unused code in the kernel.

Yes, I tested it by converting a couple of kobj_type structures,
including one that I recently added an is_visible() function to
(vmbus_chan_ktype in the hv_vmbus driver).

I'll put together a patchset with this patch and at least one
subsystem's changes.

Thanks,
Kim

>
> thanks,
>
> greg k-h

2019-03-24 05:18:31

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] kobject: Add support for default attribute groups to kobj_type

On Sat, Mar 23, 2019 at 11:48:21PM -0400, Kimberly Brown wrote:
> On Sat, Mar 23, 2019 at 07:07:37AM +0100, Greg Kroah-Hartman wrote:
> > On Fri, Mar 22, 2019 at 04:14:40PM -0400, Kimberly Brown wrote:
> > > kobj_type currently uses a list of individual attributes to store
> > > default attributes. Attribute groups are more flexible than a list of
> > > attributes because groups provide support for attribute visibility. So,
> > > add support for default attribute groups to kobj_type.
> > >
> > > In future patches, the existing uses of kobj_type’s attribute list will
> > > be converted to attribute groups. When that is complete, kobj_type’s
> > > attribute list, “default_attrs”, will be removed.
> > >
> > > Signed-off-by: Kimberly Brown <[email protected]>
> > > ---
> > > include/linux/kobject.h | 3 ++-
> > > lib/kobject.c | 14 ++++++++++++++
> > > 2 files changed, 16 insertions(+), 1 deletion(-)
> >
> > Yes! Thanks for doing this.
> >
> > But how did you test it? Did you convert any kobj_type structures to
> > the attribute group and see that all was the same? Ideally I'd like to
> > take this patch with at least one subsystem that uses the change,
> > otherwise this looks like unused code in the kernel.
>
> Yes, I tested it by converting a couple of kobj_type structures,
> including one that I recently added an is_visible() function to
> (vmbus_chan_ktype in the hv_vmbus driver).
>
> I'll put together a patchset with this patch and at least one
> subsystem's changes.

Wonderful, I'll wait to take this when you send that series.

thanks,

greg k-h

2019-04-02 02:52:12

by Kimberly Brown

[permalink] [raw]
Subject: [PATCH v2 0/8] kobject: Add default group support to kobj_type and replace subsystem uses

This patchset adds support for default attribute groups to kobj_type.
Also, the uses of kobj_type's default_attrs field are replaced with
default_groups in the following subsystems:
- samples
- block
- net
- irq
- padata
- cpufreq
- livepatch

The subsystem maintainers and lists will be copied on the subsystem
patches.

The uses of kobj_type's default_attrs field in the other subsystems will
be replaced in future patchsets.

Changes in v2:
- Patch 1 is not changed.
- Patches 2-8 are new.


Kimberly Brown (8):
kobject: Add support for default attribute groups to kobj_type
samples/kobject: Replace foo_ktype's default_attrs field with groups
block: Replace all ktype default_attrs with groups
net-sysfs: Replace ktype default_attrs field with groups
irqdesc: Replace irq_kobj_type's default_attrs field with groups
padata: Replace padata_attr_type default_attrs field with groups
cpufreq: schedutil: Replace default_attrs field with groups
livepatch: Replace klp_ktype_patch's default_attrs with groups

block/blk-integrity.c | 3 ++-
block/blk-mq-sysfs.c | 8 ++------
block/blk-sysfs.c | 3 ++-
include/linux/kobject.h | 3 ++-
kernel/irq/irqdesc.c | 3 ++-
kernel/livepatch/core.c | 3 ++-
kernel/padata.c | 3 ++-
kernel/sched/cpufreq_schedutil.c | 5 +++--
lib/kobject.c | 14 ++++++++++++++
net/core/net-sysfs.c | 6 ++++--
samples/kobject/kset-example.c | 3 ++-
11 files changed, 37 insertions(+), 17 deletions(-)

--
2.17.1

2019-04-02 02:52:20

by Kimberly Brown

[permalink] [raw]
Subject: [PATCH v2 1/8] kobject: Add support for default attribute groups to kobj_type

kobj_type currently uses a list of individual attributes to store
default attributes. Attribute groups are more flexible than a list of
attributes because groups provide support for attribute visibility. So,
add support for default attribute groups to kobj_type.

In future patches, the existing uses of kobj_type’s attribute list will
be converted to attribute groups. When that is complete, kobj_type’s
attribute list, “default_attrs”, will be removed.

Signed-off-by: Kimberly Brown <[email protected]>
---
include/linux/kobject.h | 3 ++-
lib/kobject.c | 14 ++++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 1ab0d624fb36..e2ca0a292e21 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -139,7 +139,8 @@ static inline bool kobject_has_children(struct kobject *kobj)
struct kobj_type {
void (*release)(struct kobject *kobj);
const struct sysfs_ops *sysfs_ops;
- struct attribute **default_attrs;
+ struct attribute **default_attrs; /* use default_groups instead */
+ const struct attribute_group **default_groups;
const struct kobj_ns_type_operations *(*child_ns_type)(struct kobject *kobj);
const void *(*namespace)(struct kobject *kobj);
void (*get_ownership)(struct kobject *kobj, kuid_t *uid, kgid_t *gid);
diff --git a/lib/kobject.c b/lib/kobject.c
index aa89edcd2b63..ede40005db28 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -82,6 +82,7 @@ static int populate_dir(struct kobject *kobj)

static int create_dir(struct kobject *kobj)
{
+ const struct kobj_type *ktype = get_ktype(kobj);
const struct kobj_ns_type_operations *ops;
int error;

@@ -95,6 +96,14 @@ static int create_dir(struct kobject *kobj)
return error;
}

+ if (ktype) {
+ error = sysfs_create_groups(kobj, ktype->default_groups);
+ if (error) {
+ sysfs_remove_dir(kobj);
+ return error;
+ }
+ }
+
/*
* @kobj->sd may be deleted by an ancestor going away. Hold an
* extra reference so that it stays until @kobj is gone.
@@ -584,11 +593,16 @@ EXPORT_SYMBOL_GPL(kobject_move);
void kobject_del(struct kobject *kobj)
{
struct kernfs_node *sd;
+ const struct kobj_type *ktype = get_ktype(kobj);

if (!kobj)
return;

sd = kobj->sd;
+
+ if (ktype)
+ sysfs_remove_groups(kobj, ktype->default_groups);
+
sysfs_remove_dir(kobj);
sysfs_put(sd);

--
2.17.1

2019-04-02 02:52:27

by Kimberly Brown

[permalink] [raw]
Subject: [PATCH v2 2/8] samples/kobject: Replace foo_ktype's default_attrs field with groups

The kobj_type default_attrs field is being replaced by the
default_groups field. Replace foo_ktype's default_attrs field with
default_groups and use the ATTRIBUTE_GROUPS macro to create
foo_default_groups.

This patch was tested by loading the kset-example module and verifying
that the sysfs files for the attributes in the default group were
created.

Signed-off-by: Kimberly Brown <[email protected]>
---
samples/kobject/kset-example.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/samples/kobject/kset-example.c b/samples/kobject/kset-example.c
index 401328fd687d..c8010f126808 100644
--- a/samples/kobject/kset-example.c
+++ b/samples/kobject/kset-example.c
@@ -178,6 +178,7 @@ static struct attribute *foo_default_attrs[] = {
&bar_attribute.attr,
NULL, /* need to NULL terminate the list of attributes */
};
+ATTRIBUTE_GROUPS(foo_default);

/*
* Our own ktype for our kobjects. Here we specify our sysfs ops, the
@@ -187,7 +188,7 @@ static struct attribute *foo_default_attrs[] = {
static struct kobj_type foo_ktype = {
.sysfs_ops = &foo_sysfs_ops,
.release = foo_release,
- .default_attrs = foo_default_attrs,
+ .default_groups = foo_default_groups,
};

static struct kset *example_kset;
--
2.17.1

2019-04-02 02:52:44

by Kimberly Brown

[permalink] [raw]
Subject: [PATCH v2 4/8] net-sysfs: Replace ktype default_attrs field with groups

The kobj_type default_attrs field is being replaced by the
default_groups field. Replace the default_attrs fields in rx_queue_ktype
and netdev_queue_ktype with default_groups. Use the ATTRIBUTE_GROUPS
macro to create rx_queue_default_groups and netdev_queue_default_groups.

This patch was tested by verifying that the sysfs files for the
attributes in the default groups were created.

Signed-off-by: Kimberly Brown <[email protected]>
---
net/core/net-sysfs.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index f8f94303a1f5..bbf47dfb8a18 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -863,6 +863,7 @@ static struct attribute *rx_queue_default_attrs[] __ro_after_init = {
#endif
NULL
};
+ATTRIBUTE_GROUPS(rx_queue_default);

static void rx_queue_release(struct kobject *kobj)
{
@@ -911,7 +912,7 @@ static void rx_queue_get_ownership(struct kobject *kobj,
static struct kobj_type rx_queue_ktype __ro_after_init = {
.sysfs_ops = &rx_queue_sysfs_ops,
.release = rx_queue_release,
- .default_attrs = rx_queue_default_attrs,
+ .default_groups = rx_queue_default_groups,
.namespace = rx_queue_namespace,
.get_ownership = rx_queue_get_ownership,
};
@@ -1416,6 +1417,7 @@ static struct attribute *netdev_queue_default_attrs[] __ro_after_init = {
#endif
NULL
};
+ATTRIBUTE_GROUPS(netdev_queue_default);

static void netdev_queue_release(struct kobject *kobj)
{
@@ -1448,7 +1450,7 @@ static void netdev_queue_get_ownership(struct kobject *kobj,
static struct kobj_type netdev_queue_ktype __ro_after_init = {
.sysfs_ops = &netdev_queue_sysfs_ops,
.release = netdev_queue_release,
- .default_attrs = netdev_queue_default_attrs,
+ .default_groups = netdev_queue_default_groups,
.namespace = netdev_queue_namespace,
.get_ownership = netdev_queue_get_ownership,
};
--
2.17.1

2019-04-02 02:53:27

by Kimberly Brown

[permalink] [raw]
Subject: [PATCH v2 6/8] padata: Replace padata_attr_type default_attrs field with groups

The kobj_type default_attrs field is being replaced by the
default_groups field. Replace padata_attr_type's default_attrs field
with default_groups and use the ATTRIBUTE_GROUPS macro to create
padata_default_groups.

This patch was tested by loading the pcrypt module and verifying that
the sysfs files for the attributes in the default groups were created.

Signed-off-by: Kimberly Brown <[email protected]>
---
kernel/padata.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/padata.c b/kernel/padata.c
index 3e2633ae3bca..2d2fddbb7a4c 100644
--- a/kernel/padata.c
+++ b/kernel/padata.c
@@ -957,6 +957,7 @@ static struct attribute *padata_default_attrs[] = {
&parallel_cpumask_attr.attr,
NULL,
};
+ATTRIBUTE_GROUPS(padata_default);

static ssize_t padata_sysfs_show(struct kobject *kobj,
struct attribute *attr, char *buf)
@@ -995,7 +996,7 @@ static const struct sysfs_ops padata_sysfs_ops = {

static struct kobj_type padata_attr_type = {
.sysfs_ops = &padata_sysfs_ops,
- .default_attrs = padata_default_attrs,
+ .default_groups = padata_default_groups,
.release = padata_sysfs_release,
};

--
2.17.1

2019-04-02 02:53:41

by Kimberly Brown

[permalink] [raw]
Subject: [PATCH v2 8/8] livepatch: Replace klp_ktype_patch's default_attrs with groups

The kobj_type default_attrs field is being replaced by the
default_groups field. Replace klp_ktype_patch's default_attrs field
with default_groups and use the ATTRIBUTE_GROUPS macro to create
klp_patch_groups.

This patch was tested by loading the livepatch-sample module and
verifying that the sysfs files for the attributes in the default groups
were created.

Signed-off-by: Kimberly Brown <[email protected]>
---
kernel/livepatch/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
index eb0ee10a1981..34a8338657d2 100644
--- a/kernel/livepatch/core.c
+++ b/kernel/livepatch/core.c
@@ -419,6 +419,7 @@ static struct attribute *klp_patch_attrs[] = {
&force_kobj_attr.attr,
NULL
};
+ATTRIBUTE_GROUPS(klp_patch);

static void klp_free_object_dynamic(struct klp_object *obj)
{
@@ -546,7 +547,7 @@ static void klp_kobj_release_patch(struct kobject *kobj)
static struct kobj_type klp_ktype_patch = {
.release = klp_kobj_release_patch,
.sysfs_ops = &kobj_sysfs_ops,
- .default_attrs = klp_patch_attrs,
+ .default_groups = klp_patch_groups,
};

static void klp_kobj_release_object(struct kobject *kobj)
--
2.17.1

2019-04-02 02:54:07

by Kimberly Brown

[permalink] [raw]
Subject: [PATCH v2 5/8] irqdesc: Replace irq_kobj_type's default_attrs field with groups

The kobj_type default_attrs field is being replaced by the
default_groups field. Replace irq_kobj_type's default_attrs field with
default_groups and use the ATTRIBUTE_GROUPS macro to create irq_groups.

This patch was tested by verifying that the sysfs files for the
attributes in the default groups were created.

Signed-off-by: Kimberly Brown <[email protected]>
---
kernel/irq/irqdesc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index 13539e12cd80..bbec57bda666 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -275,11 +275,12 @@ static struct attribute *irq_attrs[] = {
&actions_attr.attr,
NULL
};
+ATTRIBUTE_GROUPS(irq);

static struct kobj_type irq_kobj_type = {
.release = irq_kobj_release,
.sysfs_ops = &kobj_sysfs_ops,
- .default_attrs = irq_attrs,
+ .default_groups = irq_groups,
};

static void irq_sysfs_add(int irq, struct irq_desc *desc)
--
2.17.1

2019-04-02 02:54:46

by Kimberly Brown

[permalink] [raw]
Subject: [PATCH v2 7/8] cpufreq: schedutil: Replace default_attrs field with groups

The kobj_type default_attrs field is being replaced by the
default_groups field. Replace sugov_tunables_ktype's default_attrs field
with default groups. Change "sugov_attributes" to "sugov_attrs" and use
the ATTRIBUTE_GROUPS macro to create sugov_groups.

This patch was tested by setting the scaling governor to schedutil and
verifying that the sysfs files for the attributes in the default groups
were created.

Signed-off-by: Kimberly Brown <[email protected]>
---
kernel/sched/cpufreq_schedutil.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index 5c41ea367422..148b60c8993d 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -598,13 +598,14 @@ rate_limit_us_store(struct gov_attr_set *attr_set, const char *buf, size_t count

static struct governor_attr rate_limit_us = __ATTR_RW(rate_limit_us);

-static struct attribute *sugov_attributes[] = {
+static struct attribute *sugov_attrs[] = {
&rate_limit_us.attr,
NULL
};
+ATTRIBUTE_GROUPS(sugov);

static struct kobj_type sugov_tunables_ktype = {
- .default_attrs = sugov_attributes,
+ .default_groups = sugov_groups,
.sysfs_ops = &governor_sysfs_ops,
};

--
2.17.1

2019-04-02 03:16:58

by Kimberly Brown

[permalink] [raw]
Subject: [PATCH v2 3/8] block: Replace all ktype default_attrs with groups

The kobj_type default_attrs field is being replaced by the
default_groups field. Replace all of the ktype default_attrs fields in
the block subsystem with default_groups and use the ATTRIBUTE_GROUPS
macro to create the default groups.

Remove default_ctx_attrs[] because it doesn't contain any attributes.

This patch was tested by verifying that the sysfs files for the
attributes in the default groups were created.

Signed-off-by: Kimberly Brown <[email protected]>
---
block/blk-integrity.c | 3 ++-
block/blk-mq-sysfs.c | 8 ++------
block/blk-sysfs.c | 3 ++-
3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/block/blk-integrity.c b/block/blk-integrity.c
index d1ab089e0919..85864c71e858 100644
--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -365,6 +365,7 @@ static struct attribute *integrity_attrs[] = {
&integrity_device_entry.attr,
NULL,
};
+ATTRIBUTE_GROUPS(integrity);

static const struct sysfs_ops integrity_ops = {
.show = &integrity_attr_show,
@@ -372,7 +373,7 @@ static const struct sysfs_ops integrity_ops = {
};

static struct kobj_type integrity_ktype = {
- .default_attrs = integrity_attrs,
+ .default_groups = integrity_groups,
.sysfs_ops = &integrity_ops,
};

diff --git a/block/blk-mq-sysfs.c b/block/blk-mq-sysfs.c
index 3f9c3f4ac44c..5315e538b3b1 100644
--- a/block/blk-mq-sysfs.c
+++ b/block/blk-mq-sysfs.c
@@ -173,10 +173,6 @@ static ssize_t blk_mq_hw_sysfs_cpus_show(struct blk_mq_hw_ctx *hctx, char *page)
return ret;
}

-static struct attribute *default_ctx_attrs[] = {
- NULL,
-};
-
static struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_nr_tags = {
.attr = {.name = "nr_tags", .mode = 0444 },
.show = blk_mq_hw_sysfs_nr_tags_show,
@@ -196,6 +192,7 @@ static struct attribute *default_hw_ctx_attrs[] = {
&blk_mq_hw_sysfs_cpus.attr,
NULL,
};
+ATTRIBUTE_GROUPS(default_hw_ctx);

static const struct sysfs_ops blk_mq_sysfs_ops = {
.show = blk_mq_sysfs_show,
@@ -214,13 +211,12 @@ static struct kobj_type blk_mq_ktype = {

static struct kobj_type blk_mq_ctx_ktype = {
.sysfs_ops = &blk_mq_sysfs_ops,
- .default_attrs = default_ctx_attrs,
.release = blk_mq_ctx_sysfs_release,
};

static struct kobj_type blk_mq_hw_ktype = {
.sysfs_ops = &blk_mq_hw_sysfs_ops,
- .default_attrs = default_hw_ctx_attrs,
+ .default_groups = default_hw_ctx_groups,
.release = blk_mq_hw_sysfs_release,
};

diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 422327089e0f..7a95a1eb27e1 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -769,6 +769,7 @@ static struct attribute *default_attrs[] = {
#endif
NULL,
};
+ATTRIBUTE_GROUPS(default);

#define to_queue(atr) container_of((atr), struct queue_sysfs_entry, attr)

@@ -890,7 +891,7 @@ static const struct sysfs_ops queue_sysfs_ops = {

struct kobj_type blk_queue_ktype = {
.sysfs_ops = &queue_sysfs_ops,
- .default_attrs = default_attrs,
+ .default_groups = default_groups,
.release = blk_release_queue,
};

--
2.17.1

2019-04-02 07:20:27

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v2 0/8] kobject: Add default group support to kobj_type and replace subsystem uses

On Mon, Apr 01, 2019 at 10:51:10PM -0400, Kimberly Brown wrote:
> This patchset adds support for default attribute groups to kobj_type.
> Also, the uses of kobj_type's default_attrs field are replaced with
> default_groups in the following subsystems:
> - samples
> - block
> - net
> - irq
> - padata
> - cpufreq
> - livepatch
>
> The subsystem maintainers and lists will be copied on the subsystem
> patches.
>
> The uses of kobj_type's default_attrs field in the other subsystems will
> be replaced in future patchsets.
>
> Changes in v2:
> - Patch 1 is not changed.
> - Patches 2-8 are new.

Thanks so much for doing this.

As all of the different subsystems depend on the first patch, I'll be
glad to merge them all through my driver-core tree, or apply the first
one and wait a release cycle so that the others can go through the
individual subsystem's tree, depending on what the subsystem maintainer
is comfortable with.

thanks,

greg k-h

2019-04-02 08:01:32

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH v2 7/8] cpufreq: schedutil: Replace default_attrs field with groups

On Tue, Apr 2, 2019 at 4:51 AM Kimberly Brown <[email protected]> wrote:
>
> The kobj_type default_attrs field is being replaced by the
> default_groups field. Replace sugov_tunables_ktype's default_attrs field
> with default groups. Change "sugov_attributes" to "sugov_attrs" and use
> the ATTRIBUTE_GROUPS macro to create sugov_groups.
>
> This patch was tested by setting the scaling governor to schedutil and
> verifying that the sysfs files for the attributes in the default groups
> were created.
>
> Signed-off-by: Kimberly Brown <[email protected]>

Ackedy-by: Rafael J. Wysocki <[email protected]>

> ---
> kernel/sched/cpufreq_schedutil.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
> index 5c41ea367422..148b60c8993d 100644
> --- a/kernel/sched/cpufreq_schedutil.c
> +++ b/kernel/sched/cpufreq_schedutil.c
> @@ -598,13 +598,14 @@ rate_limit_us_store(struct gov_attr_set *attr_set, const char *buf, size_t count
>
> static struct governor_attr rate_limit_us = __ATTR_RW(rate_limit_us);
>
> -static struct attribute *sugov_attributes[] = {
> +static struct attribute *sugov_attrs[] = {
> &rate_limit_us.attr,
> NULL
> };
> +ATTRIBUTE_GROUPS(sugov);
>
> static struct kobj_type sugov_tunables_ktype = {
> - .default_attrs = sugov_attributes,
> + .default_groups = sugov_groups,
> .sysfs_ops = &governor_sysfs_ops,
> };
>
> --
> 2.17.1
>

2019-04-02 08:05:28

by Thomas Gleixner

[permalink] [raw]
Subject: Re: [PATCH v2 5/8] irqdesc: Replace irq_kobj_type's default_attrs field with groups

On Mon, 1 Apr 2019, Kimberly Brown wrote:

> The kobj_type default_attrs field is being replaced by the
> default_groups field. Replace irq_kobj_type's default_attrs field with
> default_groups and use the ATTRIBUTE_GROUPS macro to create irq_groups.
>
> This patch was tested by verifying that the sysfs files for the
> attributes in the default groups were created.
>
> Signed-off-by: Kimberly Brown <[email protected]>

Reviewed-by: Thomas Gleixner <[email protected]>

Feel free to route it with the patch it depends on.

2019-04-02 10:21:02

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH v2 7/8] cpufreq: schedutil: Replace default_attrs field with groups

On Mon, Apr 01, 2019 at 10:51:53PM -0400, Kimberly Brown wrote:
> The kobj_type default_attrs field is being replaced by the
> default_groups field. Replace sugov_tunables_ktype's default_attrs field
> with default groups. Change "sugov_attributes" to "sugov_attrs" and use
> the ATTRIBUTE_GROUPS macro to create sugov_groups.
>
> This patch was tested by setting the scaling governor to schedutil and
> verifying that the sysfs files for the attributes in the default groups
> were created.
>
> Signed-off-by: Kimberly Brown <[email protected]>

Acked-by: Peter Zijlstra (Intel) <[email protected]>

Please route the patch as is most convenient.

> ---
> kernel/sched/cpufreq_schedutil.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
> index 5c41ea367422..148b60c8993d 100644
> --- a/kernel/sched/cpufreq_schedutil.c
> +++ b/kernel/sched/cpufreq_schedutil.c
> @@ -598,13 +598,14 @@ rate_limit_us_store(struct gov_attr_set *attr_set, const char *buf, size_t count
>
> static struct governor_attr rate_limit_us = __ATTR_RW(rate_limit_us);
>
> -static struct attribute *sugov_attributes[] = {
> +static struct attribute *sugov_attrs[] = {
> &rate_limit_us.attr,
> NULL
> };
> +ATTRIBUTE_GROUPS(sugov);
>
> static struct kobj_type sugov_tunables_ktype = {
> - .default_attrs = sugov_attributes,
> + .default_groups = sugov_groups,
> .sysfs_ops = &governor_sysfs_ops,
> };
>
> --
> 2.17.1
>

2019-04-02 11:19:40

by Jiri Kosina

[permalink] [raw]
Subject: Re: [PATCH v2 8/8] livepatch: Replace klp_ktype_patch's default_attrs with groups

On Mon, 1 Apr 2019, Kimberly Brown wrote:

> The kobj_type default_attrs field is being replaced by the
> default_groups field. Replace klp_ktype_patch's default_attrs field
> with default_groups and use the ATTRIBUTE_GROUPS macro to create
> klp_patch_groups.
>
> This patch was tested by loading the livepatch-sample module and
> verifying that the sysfs files for the attributes in the default groups
> were created.
>
> Signed-off-by: Kimberly Brown <[email protected]>

Acked-by: Jiri Kosina <[email protected]>

Greg, feel free to route this one through your tree.

--
Jiri Kosina
SUSE Labs

2019-04-02 16:05:17

by Bart Van Assche

[permalink] [raw]
Subject: Re: [PATCH v2 3/8] block: Replace all ktype default_attrs with groups

On Mon, 2019-04-01 at 22:51 -0400, Kimberly Brown wrote:
+AD4 The kobj+AF8-type default+AF8-attrs field is being replaced by the
+AD4 default+AF8-groups field. Replace all of the ktype default+AF8-attrs fields in
+AD4 the block subsystem with default+AF8-groups and use the ATTRIBUTE+AF8-GROUPS
+AD4 macro to create the default groups.
+AD4
+AD4 Remove default+AF8-ctx+AF8-attrs+AFsAXQ because it doesn't contain any attributes.
+AD4
+AD4 This patch was tested by verifying that the sysfs files for the
+AD4 attributes in the default groups were created.
+AD4
+AD4 Signed-off-by: Kimberly Brown +ADw-kimbrownkd+AEA-gmail.com+AD4
+AD4 ---
+AD4 block/blk-integrity.c +AHw 3 +-+--
+AD4 block/blk-mq-sysfs.c +AHw 8 +-+-------
+AD4 block/blk-sysfs.c +AHw 3 +-+--
+AD4 3 files changed, 6 insertions(+-), 8 deletions(-)
+AD4
+AD4 diff --git a/block/blk-integrity.c b/block/blk-integrity.c
+AD4 index d1ab089e0919..85864c71e858 100644
+AD4 --- a/block/blk-integrity.c
+AD4 +-+-+- b/block/blk-integrity.c
+AD4 +AEAAQA -365,6 +-365,7 +AEAAQA static struct attribute +ACo-integrity+AF8-attrs+AFsAXQ +AD0 +AHs
+AD4 +ACY-integrity+AF8-device+AF8-entry.attr,
+AD4 NULL,
+AD4 +AH0AOw
+AD4 +-ATTRIBUTE+AF8-GROUPS(integrity)+ADs
+AD4
+AD4 static const struct sysfs+AF8-ops integrity+AF8-ops +AD0 +AHs
+AD4 .show +AD0 +ACY-integrity+AF8-attr+AF8-show,
+AD4 +AEAAQA -372,7 +-373,7 +AEAAQA static const struct sysfs+AF8-ops integrity+AF8-ops +AD0 +AHs
+AD4 +AH0AOw
+AD4
+AD4 static struct kobj+AF8-type integrity+AF8-ktype +AD0 +AHs
+AD4 - .default+AF8-attrs +AD0 integrity+AF8-attrs,
+AD4 +- .default+AF8-groups +AD0 integrity+AF8-groups,
+AD4 .sysfs+AF8-ops +AD0 +ACY-integrity+AF8-ops,
+AD4 +AH0AOw
+AD4
+AD4 diff --git a/block/blk-mq-sysfs.c b/block/blk-mq-sysfs.c
+AD4 index 3f9c3f4ac44c..5315e538b3b1 100644
+AD4 --- a/block/blk-mq-sysfs.c
+AD4 +-+-+- b/block/blk-mq-sysfs.c
+AD4 +AEAAQA -173,10 +-173,6 +AEAAQA static ssize+AF8-t blk+AF8-mq+AF8-hw+AF8-sysfs+AF8-cpus+AF8-show(struct blk+AF8-mq+AF8-hw+AF8-ctx +ACo-hctx, char +ACo-page)
+AD4 return ret+ADs
+AD4 +AH0
+AD4
+AD4 -static struct attribute +ACo-default+AF8-ctx+AF8-attrs+AFsAXQ +AD0 +AHs
+AD4 - NULL,
+AD4 -+AH0AOw
+AD4 -
+AD4 static struct blk+AF8-mq+AF8-hw+AF8-ctx+AF8-sysfs+AF8-entry blk+AF8-mq+AF8-hw+AF8-sysfs+AF8-nr+AF8-tags +AD0 +AHs
+AD4 .attr +AD0 +AHs.name +AD0 +ACI-nr+AF8-tags+ACI, .mode +AD0 0444 +AH0,
+AD4 .show +AD0 blk+AF8-mq+AF8-hw+AF8-sysfs+AF8-nr+AF8-tags+AF8-show,
+AD4 +AEAAQA -196,6 +-192,7 +AEAAQA static struct attribute +ACo-default+AF8-hw+AF8-ctx+AF8-attrs+AFsAXQ +AD0 +AHs
+AD4 +ACY-blk+AF8-mq+AF8-hw+AF8-sysfs+AF8-cpus.attr,
+AD4 NULL,
+AD4 +AH0AOw
+AD4 +-ATTRIBUTE+AF8-GROUPS(default+AF8-hw+AF8-ctx)+ADs
+AD4
+AD4 static const struct sysfs+AF8-ops blk+AF8-mq+AF8-sysfs+AF8-ops +AD0 +AHs
+AD4 .show +AD0 blk+AF8-mq+AF8-sysfs+AF8-show,
+AD4 +AEAAQA -214,13 +-211,12 +AEAAQA static struct kobj+AF8-type blk+AF8-mq+AF8-ktype +AD0 +AHs
+AD4
+AD4 static struct kobj+AF8-type blk+AF8-mq+AF8-ctx+AF8-ktype +AD0 +AHs
+AD4 .sysfs+AF8-ops +AD0 +ACY-blk+AF8-mq+AF8-sysfs+AF8-ops,
+AD4 - .default+AF8-attrs +AD0 default+AF8-ctx+AF8-attrs,
+AD4 .release +AD0 blk+AF8-mq+AF8-ctx+AF8-sysfs+AF8-release,
+AD4 +AH0AOw
+AD4
+AD4 static struct kobj+AF8-type blk+AF8-mq+AF8-hw+AF8-ktype +AD0 +AHs
+AD4 .sysfs+AF8-ops +AD0 +ACY-blk+AF8-mq+AF8-hw+AF8-sysfs+AF8-ops,
+AD4 - .default+AF8-attrs +AD0 default+AF8-hw+AF8-ctx+AF8-attrs,
+AD4 +- .default+AF8-groups +AD0 default+AF8-hw+AF8-ctx+AF8-groups,
+AD4 .release +AD0 blk+AF8-mq+AF8-hw+AF8-sysfs+AF8-release,
+AD4 +AH0AOw
+AD4
+AD4 diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
+AD4 index 422327089e0f..7a95a1eb27e1 100644
+AD4 --- a/block/blk-sysfs.c
+AD4 +-+-+- b/block/blk-sysfs.c
+AD4 +AEAAQA -769,6 +-769,7 +AEAAQA static struct attribute +ACo-default+AF8-attrs+AFsAXQ +AD0 +AHs
+AD4 +ACM-endif
+AD4 NULL,
+AD4 +AH0AOw
+AD4 +-ATTRIBUTE+AF8-GROUPS(default)+ADs
+AD4
+AD4 +ACM-define to+AF8-queue(atr) container+AF8-of((atr), struct queue+AF8-sysfs+AF8-entry, attr)
+AD4
+AD4 +AEAAQA -890,7 +-891,7 +AEAAQA static const struct sysfs+AF8-ops queue+AF8-sysfs+AF8-ops +AD0 +AHs
+AD4
+AD4 struct kobj+AF8-type blk+AF8-queue+AF8-ktype +AD0 +AHs
+AD4 .sysfs+AF8-ops +AD0 +ACY-queue+AF8-sysfs+AF8-ops,
+AD4 - .default+AF8-attrs +AD0 default+AF8-attrs,
+AD4 +- .default+AF8-groups +AD0 default+AF8-groups,
+AD4 .release +AD0 blk+AF8-release+AF8-queue,
+AD4 +AH0AOw

I think this should have been four patches instead of one.

Anyway:

Reviewed-by: Bart Van Assche +ADw-bvanassche+AEA-acm.org+AD4

2019-04-02 18:28:22

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v2 3/8] block: Replace all ktype default_attrs with groups

On Tue, Apr 02, 2019 at 09:02:38AM -0700, Bart Van Assche wrote:
> On Mon, 2019-04-01 at 22:51 -0400, Kimberly Brown wrote:
> > The kobj_type default_attrs field is being replaced by the
> > default_groups field. Replace all of the ktype default_attrs fields in
> > the block subsystem with default_groups and use the ATTRIBUTE_GROUPS
> > macro to create the default groups.
> >
> > Remove default_ctx_attrs[] because it doesn't contain any attributes.
> >
> > This patch was tested by verifying that the sysfs files for the
> > attributes in the default groups were created.
> >
> > Signed-off-by: Kimberly Brown <[email protected]>
> > ---
> > block/blk-integrity.c | 3 ++-
> > block/blk-mq-sysfs.c | 8 ++------
> > block/blk-sysfs.c | 3 ++-
> > 3 files changed, 6 insertions(+), 8 deletions(-)
> >
> > diff --git a/block/blk-integrity.c b/block/blk-integrity.c
> > index d1ab089e0919..85864c71e858 100644
> > --- a/block/blk-integrity.c
> > +++ b/block/blk-integrity.c
> > @@ -365,6 +365,7 @@ static struct attribute *integrity_attrs[] = {
> > &integrity_device_entry.attr,
> > NULL,
> > };
> > +ATTRIBUTE_GROUPS(integrity);
> >
> > static const struct sysfs_ops integrity_ops = {
> > .show = &integrity_attr_show,
> > @@ -372,7 +373,7 @@ static const struct sysfs_ops integrity_ops = {
> > };
> >
> > static struct kobj_type integrity_ktype = {
> > - .default_attrs = integrity_attrs,
> > + .default_groups = integrity_groups,
> > .sysfs_ops = &integrity_ops,
> > };
> >
> > diff --git a/block/blk-mq-sysfs.c b/block/blk-mq-sysfs.c
> > index 3f9c3f4ac44c..5315e538b3b1 100644
> > --- a/block/blk-mq-sysfs.c
> > +++ b/block/blk-mq-sysfs.c
> > @@ -173,10 +173,6 @@ static ssize_t blk_mq_hw_sysfs_cpus_show(struct blk_mq_hw_ctx *hctx, char *page)
> > return ret;
> > }
> >
> > -static struct attribute *default_ctx_attrs[] = {
> > - NULL,
> > -};
> > -
> > static struct blk_mq_hw_ctx_sysfs_entry blk_mq_hw_sysfs_nr_tags = {
> > .attr = {.name = "nr_tags", .mode = 0444 },
> > .show = blk_mq_hw_sysfs_nr_tags_show,
> > @@ -196,6 +192,7 @@ static struct attribute *default_hw_ctx_attrs[] = {
> > &blk_mq_hw_sysfs_cpus.attr,
> > NULL,
> > };
> > +ATTRIBUTE_GROUPS(default_hw_ctx);
> >
> > static const struct sysfs_ops blk_mq_sysfs_ops = {
> > .show = blk_mq_sysfs_show,
> > @@ -214,13 +211,12 @@ static struct kobj_type blk_mq_ktype = {
> >
> > static struct kobj_type blk_mq_ctx_ktype = {
> > .sysfs_ops = &blk_mq_sysfs_ops,
> > - .default_attrs = default_ctx_attrs,
> > .release = blk_mq_ctx_sysfs_release,
> > };
> >
> > static struct kobj_type blk_mq_hw_ktype = {
> > .sysfs_ops = &blk_mq_hw_sysfs_ops,
> > - .default_attrs = default_hw_ctx_attrs,
> > + .default_groups = default_hw_ctx_groups,
> > .release = blk_mq_hw_sysfs_release,
> > };
> >
> > diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
> > index 422327089e0f..7a95a1eb27e1 100644
> > --- a/block/blk-sysfs.c
> > +++ b/block/blk-sysfs.c
> > @@ -769,6 +769,7 @@ static struct attribute *default_attrs[] = {
> > #endif
> > NULL,
> > };
> > +ATTRIBUTE_GROUPS(default);
> >
> > #define to_queue(atr) container_of((atr), struct queue_sysfs_entry, attr)
> >
> > @@ -890,7 +891,7 @@ static const struct sysfs_ops queue_sysfs_ops = {
> >
> > struct kobj_type blk_queue_ktype = {
> > .sysfs_ops = &queue_sysfs_ops,
> > - .default_attrs = default_attrs,
> > + .default_groups = default_groups,
> > .release = blk_release_queue,
> > };
>
> I think this should have been four patches instead of one.

4? I could maybe see 3, how would you make 4 patches out of this?

> Anyway:
>
> Reviewed-by: Bart Van Assche <[email protected]>

Thanks for the review, I'll queue this up in a few days.

greg k-h

2019-04-02 18:29:52

by Bart Van Assche

[permalink] [raw]
Subject: Re: [PATCH v2 3/8] block: Replace all ktype default_attrs with groups

On Tue, 2019-04-02 at 19:46 +-0200, Greg Kroah-Hartman wrote:
+AD4 On Tue, Apr 02, 2019 at 09:02:38AM -0700, Bart Van Assche wrote:
+AD4 +AD4 On Mon, 2019-04-01 at 22:51 -0400, Kimberly Brown wrote:
+AD4 +AD4 +AD4 The kobj+AF8-type default+AF8-attrs field is being replaced by the
+AD4 +AD4 +AD4 default+AF8-groups field. Replace all of the ktype default+AF8-attrs fields in
+AD4 +AD4 +AD4 the block subsystem with default+AF8-groups and use the ATTRIBUTE+AF8-GROUPS
+AD4 +AD4 +AD4 macro to create the default groups.
+AD4 +AD4 +AD4
+AD4 +AD4 +AD4 Remove default+AF8-ctx+AF8-attrs+AFsAXQ because it doesn't contain any attributes.
+AD4 +AD4 +AD4
+AD4 +AD4 +AD4 This patch was tested by verifying that the sysfs files for the
+AD4 +AD4 +AD4 attributes in the default groups were created.
+AD4 +AD4 +AD4
+AD4 +AD4 +AD4 Signed-off-by: Kimberly Brown +ADw-kimbrownkd+AEA-gmail.com+AD4
+AD4 +AD4 +AD4 ---
+AD4 +AD4 +AD4 block/blk-integrity.c +AHw 3 +-+--
+AD4 +AD4 +AD4 block/blk-mq-sysfs.c +AHw 8 +-+-------
+AD4 +AD4 +AD4 block/blk-sysfs.c +AHw 3 +-+--
+AD4 +AD4 +AD4 3 files changed, 6 insertions(+-), 8 deletions(-)
+AD4 +AD4 +AD4
+AD4 +AD4 +AD4 diff --git a/block/blk-integrity.c b/block/blk-integrity.c
+AD4 +AD4 +AD4 index d1ab089e0919..85864c71e858 100644
+AD4 +AD4 +AD4 --- a/block/blk-integrity.c
+AD4 +AD4 +AD4 +-+-+- b/block/blk-integrity.c
+AD4 +AD4 +AD4 +AEAAQA -365,6 +-365,7 +AEAAQA static struct attribute +ACo-integrity+AF8-attrs+AFsAXQ +AD0 +AHs
+AD4 +AD4 +AD4 +ACY-integrity+AF8-device+AF8-entry.attr,
+AD4 +AD4 +AD4 NULL,
+AD4 +AD4 +AD4 +AH0AOw
+AD4 +AD4 +AD4 +-ATTRIBUTE+AF8-GROUPS(integrity)+ADs
+AD4 +AD4 +AD4
+AD4 +AD4 +AD4 static const struct sysfs+AF8-ops integrity+AF8-ops +AD0 +AHs
+AD4 +AD4 +AD4 .show +AD0 +ACY-integrity+AF8-attr+AF8-show,
+AD4 +AD4 +AD4 +AEAAQA -372,7 +-373,7 +AEAAQA static const struct sysfs+AF8-ops integrity+AF8-ops +AD0 +AHs
+AD4 +AD4 +AD4 +AH0AOw
+AD4 +AD4 +AD4
+AD4 +AD4 +AD4 static struct kobj+AF8-type integrity+AF8-ktype +AD0 +AHs
+AD4 +AD4 +AD4 - .default+AF8-attrs +AD0 integrity+AF8-attrs,
+AD4 +AD4 +AD4 +- .default+AF8-groups +AD0 integrity+AF8-groups,
+AD4 +AD4 +AD4 .sysfs+AF8-ops +AD0 +ACY-integrity+AF8-ops,
+AD4 +AD4 +AD4 +AH0AOw
+AD4 +AD4 +AD4
+AD4 +AD4 +AD4 diff --git a/block/blk-mq-sysfs.c b/block/blk-mq-sysfs.c
+AD4 +AD4 +AD4 index 3f9c3f4ac44c..5315e538b3b1 100644
+AD4 +AD4 +AD4 --- a/block/blk-mq-sysfs.c
+AD4 +AD4 +AD4 +-+-+- b/block/blk-mq-sysfs.c
+AD4 +AD4 +AD4 +AEAAQA -173,10 +-173,6 +AEAAQA static ssize+AF8-t blk+AF8-mq+AF8-hw+AF8-sysfs+AF8-cpus+AF8-show(struct blk+AF8-mq+AF8-hw+AF8-ctx +ACo-hctx, char +ACo-page)
+AD4 +AD4 +AD4 return ret+ADs
+AD4 +AD4 +AD4 +AH0
+AD4 +AD4 +AD4
+AD4 +AD4 +AD4 -static struct attribute +ACo-default+AF8-ctx+AF8-attrs+AFsAXQ +AD0 +AHs
+AD4 +AD4 +AD4 - NULL,
+AD4 +AD4 +AD4 -+AH0AOw
+AD4 +AD4 +AD4 -
+AD4 +AD4 +AD4 static struct blk+AF8-mq+AF8-hw+AF8-ctx+AF8-sysfs+AF8-entry blk+AF8-mq+AF8-hw+AF8-sysfs+AF8-nr+AF8-tags +AD0 +AHs
+AD4 +AD4 +AD4 .attr +AD0 +AHs.name +AD0 +ACI-nr+AF8-tags+ACI, .mode +AD0 0444 +AH0,
+AD4 +AD4 +AD4 .show +AD0 blk+AF8-mq+AF8-hw+AF8-sysfs+AF8-nr+AF8-tags+AF8-show,
+AD4 +AD4 +AD4 +AEAAQA -196,6 +-192,7 +AEAAQA static struct attribute +ACo-default+AF8-hw+AF8-ctx+AF8-attrs+AFsAXQ +AD0 +AHs
+AD4 +AD4 +AD4 +ACY-blk+AF8-mq+AF8-hw+AF8-sysfs+AF8-cpus.attr,
+AD4 +AD4 +AD4 NULL,
+AD4 +AD4 +AD4 +AH0AOw
+AD4 +AD4 +AD4 +-ATTRIBUTE+AF8-GROUPS(default+AF8-hw+AF8-ctx)+ADs
+AD4 +AD4 +AD4
+AD4 +AD4 +AD4 static const struct sysfs+AF8-ops blk+AF8-mq+AF8-sysfs+AF8-ops +AD0 +AHs
+AD4 +AD4 +AD4 .show +AD0 blk+AF8-mq+AF8-sysfs+AF8-show,
+AD4 +AD4 +AD4 +AEAAQA -214,13 +-211,12 +AEAAQA static struct kobj+AF8-type blk+AF8-mq+AF8-ktype +AD0 +AHs
+AD4 +AD4 +AD4
+AD4 +AD4 +AD4 static struct kobj+AF8-type blk+AF8-mq+AF8-ctx+AF8-ktype +AD0 +AHs
+AD4 +AD4 +AD4 .sysfs+AF8-ops +AD0 +ACY-blk+AF8-mq+AF8-sysfs+AF8-ops,
+AD4 +AD4 +AD4 - .default+AF8-attrs +AD0 default+AF8-ctx+AF8-attrs,
+AD4 +AD4 +AD4 .release +AD0 blk+AF8-mq+AF8-ctx+AF8-sysfs+AF8-release,
+AD4 +AD4 +AD4 +AH0AOw
+AD4 +AD4 +AD4
+AD4 +AD4 +AD4 static struct kobj+AF8-type blk+AF8-mq+AF8-hw+AF8-ktype +AD0 +AHs
+AD4 +AD4 +AD4 .sysfs+AF8-ops +AD0 +ACY-blk+AF8-mq+AF8-hw+AF8-sysfs+AF8-ops,
+AD4 +AD4 +AD4 - .default+AF8-attrs +AD0 default+AF8-hw+AF8-ctx+AF8-attrs,
+AD4 +AD4 +AD4 +- .default+AF8-groups +AD0 default+AF8-hw+AF8-ctx+AF8-groups,
+AD4 +AD4 +AD4 .release +AD0 blk+AF8-mq+AF8-hw+AF8-sysfs+AF8-release,
+AD4 +AD4 +AD4 +AH0AOw
+AD4 +AD4 +AD4
+AD4 +AD4 +AD4 diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
+AD4 +AD4 +AD4 index 422327089e0f..7a95a1eb27e1 100644
+AD4 +AD4 +AD4 --- a/block/blk-sysfs.c
+AD4 +AD4 +AD4 +-+-+- b/block/blk-sysfs.c
+AD4 +AD4 +AD4 +AEAAQA -769,6 +-769,7 +AEAAQA static struct attribute +ACo-default+AF8-attrs+AFsAXQ +AD0 +AHs
+AD4 +AD4 +AD4 +ACM-endif
+AD4 +AD4 +AD4 NULL,
+AD4 +AD4 +AD4 +AH0AOw
+AD4 +AD4 +AD4 +-ATTRIBUTE+AF8-GROUPS(default)+ADs
+AD4 +AD4 +AD4
+AD4 +AD4 +AD4 +ACM-define to+AF8-queue(atr) container+AF8-of((atr), struct queue+AF8-sysfs+AF8-entry, attr)
+AD4 +AD4 +AD4
+AD4 +AD4 +AD4 +AEAAQA -890,7 +-891,7 +AEAAQA static const struct sysfs+AF8-ops queue+AF8-sysfs+AF8-ops +AD0 +AHs
+AD4 +AD4 +AD4
+AD4 +AD4 +AD4 struct kobj+AF8-type blk+AF8-queue+AF8-ktype +AD0 +AHs
+AD4 +AD4 +AD4 .sysfs+AF8-ops +AD0 +ACY-queue+AF8-sysfs+AF8-ops,
+AD4 +AD4 +AD4 - .default+AF8-attrs +AD0 default+AF8-attrs,
+AD4 +AD4 +AD4 +- .default+AF8-groups +AD0 default+AF8-groups,
+AD4 +AD4 +AD4 .release +AD0 blk+AF8-release+AF8-queue,
+AD4 +AD4 +AD4 +AH0AOw
+AD4 +AD4
+AD4 +AD4 I think this should have been four patches instead of one.
+AD4
+AD4 4? I could maybe see 3, how would you make 4 patches out of this?

Hi Greg,

Not that it matters, but I see four changes in this patch: three conversions
from default+AF8-attrs into default+AF8-groups and also the removal of default+AF8-ctx+AF8-attrs.

Thanks,

Bart.

2019-04-03 11:52:37

by Miroslav Benes

[permalink] [raw]
Subject: Re: [PATCH v2 8/8] livepatch: Replace klp_ktype_patch's default_attrs with groups

On Mon, 1 Apr 2019, Kimberly Brown wrote:

> The kobj_type default_attrs field is being replaced by the
> default_groups field. Replace klp_ktype_patch's default_attrs field
> with default_groups and use the ATTRIBUTE_GROUPS macro to create
> klp_patch_groups.
>
> This patch was tested by loading the livepatch-sample module and
> verifying that the sysfs files for the attributes in the default groups
> were created.
>
> Signed-off-by: Kimberly Brown <[email protected]>

Acked-by: Miroslav Benes <[email protected]>

M

2019-04-08 14:58:38

by Petr Mladek

[permalink] [raw]
Subject: Re: [PATCH v2 8/8] livepatch: Replace klp_ktype_patch's default_attrs with groups

On Mon 2019-04-01 22:51:58, Kimberly Brown wrote:
> The kobj_type default_attrs field is being replaced by the
> default_groups field. Replace klp_ktype_patch's default_attrs field
> with default_groups and use the ATTRIBUTE_GROUPS macro to create
> klp_patch_groups.
>
> This patch was tested by loading the livepatch-sample module and
> verifying that the sysfs files for the attributes in the default groups
> were created.
>
> Signed-off-by: Kimberly Brown <[email protected]>

Acked-by: Petr Mladek <[email protected]>

Best Regards,
Petr

2019-04-27 06:21:01

by Kimberly Brown

[permalink] [raw]
Subject: Re: [PATCH v2 0/8] kobject: Add default group support to kobj_type and replace subsystem uses

On Thu, Apr 25, 2019 at 10:12:53PM +0200, Greg Kroah-Hartman wrote:
> On Mon, Apr 01, 2019 at 10:51:10PM -0400, Kimberly Brown wrote:
> > This patchset adds support for default attribute groups to kobj_type.
> > Also, the uses of kobj_type's default_attrs field are replaced with
> > default_groups in the following subsystems:
> > - samples
> > - block
> > - net
> > - irq
> > - padata
> > - cpufreq
> > - livepatch
> >
> > The subsystem maintainers and lists will be copied on the subsystem
> > patches.
> >
> > The uses of kobj_type's default_attrs field in the other subsystems will
> > be replaced in future patchsets.
>
> Thanks for all of these, now queued up. Patches to fix up the other
> subsystems are always welcome :)
>
> greg k-h

Thanks, Greg! I'll start preparing more patches.

I know that patches should be in linux-next for some time before the
merge window opens. How long do they typically need to be in linux-next?
I'm trying to figure out if the next patches I work on could be included
in the next merge window, in which case I'll let the maintainers know
that the patch will either need to go through the driver-core tree or
wait for the next release cycle.

Thanks,
Kim

2019-04-27 06:42:28

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v2 0/8] kobject: Add default group support to kobj_type and replace subsystem uses

On Sat, Apr 27, 2019 at 02:18:56AM -0400, Kimberly Brown wrote:
> On Thu, Apr 25, 2019 at 10:12:53PM +0200, Greg Kroah-Hartman wrote:
> > On Mon, Apr 01, 2019 at 10:51:10PM -0400, Kimberly Brown wrote:
> > > This patchset adds support for default attribute groups to kobj_type.
> > > Also, the uses of kobj_type's default_attrs field are replaced with
> > > default_groups in the following subsystems:
> > > - samples
> > > - block
> > > - net
> > > - irq
> > > - padata
> > > - cpufreq
> > > - livepatch
> > >
> > > The subsystem maintainers and lists will be copied on the subsystem
> > > patches.
> > >
> > > The uses of kobj_type's default_attrs field in the other subsystems will
> > > be replaced in future patchsets.
> >
> > Thanks for all of these, now queued up. Patches to fix up the other
> > subsystems are always welcome :)
> >
> > greg k-h
>
> Thanks, Greg! I'll start preparing more patches.
>
> I know that patches should be in linux-next for some time before the
> merge window opens. How long do they typically need to be in linux-next?

It depends on the maintainer, what they feel like. I like to have a
week or so, but some like more, and others less.

Sorry there's not a single answer.

> I'm trying to figure out if the next patches I work on could be included
> in the next merge window, in which case I'll let the maintainers know
> that the patch will either need to go through the driver-core tree or
> wait for the next release cycle.

Mention that I can take them all through my tree now, as that's usually
the easiest thing for api changes like this.

thanks,

greg k-h