linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kobject: Add support for default attribute groups to kobj_type
@ 2019-03-22 20:14 Kimberly Brown
  2019-03-23  6:07 ` Greg Kroah-Hartman
  2019-04-02  2:51 ` [PATCH v2 0/8] kobject: Add default group support to kobj_type and replace subsystem uses Kimberly Brown
  0 siblings, 2 replies; 26+ messages in thread
From: Kimberly Brown @ 2019-03-22 20:14 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: linux-kernel

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 <kimbrownkd@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH] kobject: Add support for default attribute groups to kobj_type
  2019-03-22 20:14 [PATCH] kobject: Add support for default attribute groups to kobj_type Kimberly Brown
@ 2019-03-23  6:07 ` Greg Kroah-Hartman
  2019-03-24  3:48   ` Kimberly Brown
  2019-04-02  2:51 ` [PATCH v2 0/8] kobject: Add default group support to kobj_type and replace subsystem uses Kimberly Brown
  1 sibling, 1 reply; 26+ messages in thread
From: Greg Kroah-Hartman @ 2019-03-23  6:07 UTC (permalink / raw)
  To: Kimberly Brown; +Cc: Rafael J. Wysocki, linux-kernel

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 <kimbrownkd@gmail.com>
> ---
>  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

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] kobject: Add support for default attribute groups to kobj_type
  2019-03-23  6:07 ` Greg Kroah-Hartman
@ 2019-03-24  3:48   ` Kimberly Brown
  2019-03-24  5:15     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 26+ messages in thread
From: Kimberly Brown @ 2019-03-24  3:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Rafael J. Wysocki, linux-kernel

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 <kimbrownkd@gmail.com>
> > ---
> >  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

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH] kobject: Add support for default attribute groups to kobj_type
  2019-03-24  3:48   ` Kimberly Brown
@ 2019-03-24  5:15     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 26+ messages in thread
From: Greg Kroah-Hartman @ 2019-03-24  5:15 UTC (permalink / raw)
  To: Kimberly Brown; +Cc: Rafael J. Wysocki, linux-kernel

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 <kimbrownkd@gmail.com>
> > > ---
> > >  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

^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH v2 0/8] kobject: Add default group support to kobj_type and replace subsystem uses
  2019-03-22 20:14 [PATCH] kobject: Add support for default attribute groups to kobj_type Kimberly Brown
  2019-03-23  6:07 ` Greg Kroah-Hartman
@ 2019-04-02  2:51 ` Kimberly Brown
  2019-04-02  2:51   ` [PATCH v2 1/8] kobject: Add support for default attribute groups to kobj_type Kimberly Brown
                     ` (9 more replies)
  1 sibling, 10 replies; 26+ messages in thread
From: Kimberly Brown @ 2019-04-02  2:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki
  Cc: Jens Axboe, linux-block, David S. Miller, netdev,
	Thomas Gleixner, Steffen Klassert, linux-crypto, Ingo Molnar,
	Peter Zijlstra, Josh Poimboeuf, Jiri Kosina, Miroslav Benes,
	Petr Mladek, Joe Lawrence, live-patching, linux-kernel

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


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCH v2 1/8] kobject: Add support for default attribute groups to kobj_type
  2019-04-02  2:51 ` [PATCH v2 0/8] kobject: Add default group support to kobj_type and replace subsystem uses Kimberly Brown
@ 2019-04-02  2:51   ` Kimberly Brown
  2019-04-02  2:51   ` [PATCH v2 2/8] samples/kobject: Replace foo_ktype's default_attrs field with groups Kimberly Brown
                     ` (8 subsequent siblings)
  9 siblings, 0 replies; 26+ messages in thread
From: Kimberly Brown @ 2019-04-02  2:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: linux-kernel

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 <kimbrownkd@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 2/8] samples/kobject: Replace foo_ktype's default_attrs field with groups
  2019-04-02  2:51 ` [PATCH v2 0/8] kobject: Add default group support to kobj_type and replace subsystem uses Kimberly Brown
  2019-04-02  2:51   ` [PATCH v2 1/8] kobject: Add support for default attribute groups to kobj_type Kimberly Brown
@ 2019-04-02  2:51   ` Kimberly Brown
  2019-04-02  2:51   ` [PATCH v2 3/8] block: Replace all ktype default_attrs " Kimberly Brown
                     ` (7 subsequent siblings)
  9 siblings, 0 replies; 26+ messages in thread
From: Kimberly Brown @ 2019-04-02  2:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: linux-kernel

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 <kimbrownkd@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 3/8] block: Replace all ktype default_attrs with groups
  2019-04-02  2:51 ` [PATCH v2 0/8] kobject: Add default group support to kobj_type and replace subsystem uses Kimberly Brown
  2019-04-02  2:51   ` [PATCH v2 1/8] kobject: Add support for default attribute groups to kobj_type Kimberly Brown
  2019-04-02  2:51   ` [PATCH v2 2/8] samples/kobject: Replace foo_ktype's default_attrs field with groups Kimberly Brown
@ 2019-04-02  2:51   ` Kimberly Brown
  2019-04-02 16:02     ` Bart Van Assche
  2019-04-02  2:51   ` [PATCH v2 4/8] net-sysfs: Replace ktype default_attrs field " Kimberly Brown
                     ` (6 subsequent siblings)
  9 siblings, 1 reply; 26+ messages in thread
From: Kimberly Brown @ 2019-04-02  2:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki
  Cc: Jens Axboe, linux-block, linux-kernel

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 <kimbrownkd@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 4/8] net-sysfs: Replace ktype default_attrs field with groups
  2019-04-02  2:51 ` [PATCH v2 0/8] kobject: Add default group support to kobj_type and replace subsystem uses Kimberly Brown
                     ` (2 preceding siblings ...)
  2019-04-02  2:51   ` [PATCH v2 3/8] block: Replace all ktype default_attrs " Kimberly Brown
@ 2019-04-02  2:51   ` Kimberly Brown
  2019-04-02  2:51   ` [PATCH v2 5/8] irqdesc: Replace irq_kobj_type's " Kimberly Brown
                     ` (5 subsequent siblings)
  9 siblings, 0 replies; 26+ messages in thread
From: Kimberly Brown @ 2019-04-02  2:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki
  Cc: David S. Miller, netdev, linux-kernel

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 <kimbrownkd@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 5/8] irqdesc: Replace irq_kobj_type's default_attrs field with groups
  2019-04-02  2:51 ` [PATCH v2 0/8] kobject: Add default group support to kobj_type and replace subsystem uses Kimberly Brown
                     ` (3 preceding siblings ...)
  2019-04-02  2:51   ` [PATCH v2 4/8] net-sysfs: Replace ktype default_attrs field " Kimberly Brown
@ 2019-04-02  2:51   ` Kimberly Brown
  2019-04-02  8:04     ` Thomas Gleixner
  2019-04-02  2:51   ` [PATCH v2 6/8] padata: Replace padata_attr_type " Kimberly Brown
                     ` (4 subsequent siblings)
  9 siblings, 1 reply; 26+ messages in thread
From: Kimberly Brown @ 2019-04-02  2:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki; +Cc: Thomas Gleixner, linux-kernel

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 <kimbrownkd@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 6/8] padata: Replace padata_attr_type default_attrs field with groups
  2019-04-02  2:51 ` [PATCH v2 0/8] kobject: Add default group support to kobj_type and replace subsystem uses Kimberly Brown
                     ` (4 preceding siblings ...)
  2019-04-02  2:51   ` [PATCH v2 5/8] irqdesc: Replace irq_kobj_type's " Kimberly Brown
@ 2019-04-02  2:51   ` Kimberly Brown
  2019-04-02  2:51   ` [PATCH v2 7/8] cpufreq: schedutil: Replace " Kimberly Brown
                     ` (3 subsequent siblings)
  9 siblings, 0 replies; 26+ messages in thread
From: Kimberly Brown @ 2019-04-02  2:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki
  Cc: Steffen Klassert, linux-crypto, linux-kernel

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 <kimbrownkd@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 7/8] cpufreq: schedutil: Replace default_attrs field with groups
  2019-04-02  2:51 ` [PATCH v2 0/8] kobject: Add default group support to kobj_type and replace subsystem uses Kimberly Brown
                     ` (5 preceding siblings ...)
  2019-04-02  2:51   ` [PATCH v2 6/8] padata: Replace padata_attr_type " Kimberly Brown
@ 2019-04-02  2:51   ` Kimberly Brown
  2019-04-02  7:56     ` Rafael J. Wysocki
  2019-04-02  8:50     ` Peter Zijlstra
  2019-04-02  2:51   ` [PATCH v2 8/8] livepatch: Replace klp_ktype_patch's default_attrs " Kimberly Brown
                     ` (2 subsequent siblings)
  9 siblings, 2 replies; 26+ messages in thread
From: Kimberly Brown @ 2019-04-02  2:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki
  Cc: Ingo Molnar, Peter Zijlstra, linux-kernel

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 <kimbrownkd@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCH v2 8/8] livepatch: Replace klp_ktype_patch's default_attrs with groups
  2019-04-02  2:51 ` [PATCH v2 0/8] kobject: Add default group support to kobj_type and replace subsystem uses Kimberly Brown
                     ` (6 preceding siblings ...)
  2019-04-02  2:51   ` [PATCH v2 7/8] cpufreq: schedutil: Replace " Kimberly Brown
@ 2019-04-02  2:51   ` Kimberly Brown
  2019-04-02 10:22     ` Jiri Kosina
                       ` (2 more replies)
  2019-04-02  6:29   ` [PATCH v2 0/8] kobject: Add default group support to kobj_type and replace subsystem uses Greg Kroah-Hartman
  2019-04-25 20:12   ` Greg Kroah-Hartman
  9 siblings, 3 replies; 26+ messages in thread
From: Kimberly Brown @ 2019-04-02  2:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki
  Cc: Josh Poimboeuf, Jiri Kosina, Miroslav Benes, Petr Mladek,
	Joe Lawrence, live-patching, linux-kernel

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 <kimbrownkd@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 0/8] kobject: Add default group support to kobj_type and replace subsystem uses
  2019-04-02  2:51 ` [PATCH v2 0/8] kobject: Add default group support to kobj_type and replace subsystem uses Kimberly Brown
                     ` (7 preceding siblings ...)
  2019-04-02  2:51   ` [PATCH v2 8/8] livepatch: Replace klp_ktype_patch's default_attrs " Kimberly Brown
@ 2019-04-02  6:29   ` Greg Kroah-Hartman
  2019-04-25 20:12   ` Greg Kroah-Hartman
  9 siblings, 0 replies; 26+ messages in thread
From: Greg Kroah-Hartman @ 2019-04-02  6:29 UTC (permalink / raw)
  To: Kimberly Brown
  Cc: Rafael J. Wysocki, Jens Axboe, linux-block, David S. Miller,
	netdev, Thomas Gleixner, Steffen Klassert, linux-crypto,
	Ingo Molnar, Peter Zijlstra, Josh Poimboeuf, Jiri Kosina,
	Miroslav Benes, Petr Mladek, Joe Lawrence, live-patching,
	linux-kernel

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

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 7/8] cpufreq: schedutil: Replace default_attrs field with groups
  2019-04-02  2:51   ` [PATCH v2 7/8] cpufreq: schedutil: Replace " Kimberly Brown
@ 2019-04-02  7:56     ` Rafael J. Wysocki
  2019-04-02  8:50     ` Peter Zijlstra
  1 sibling, 0 replies; 26+ messages in thread
From: Rafael J. Wysocki @ 2019-04-02  7:56 UTC (permalink / raw)
  To: Kimberly Brown
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Ingo Molnar,
	Peter Zijlstra, Linux Kernel Mailing List

On Tue, Apr 2, 2019 at 4:51 AM Kimberly Brown <kimbrownkd@gmail.com> 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 <kimbrownkd@gmail.com>

Ackedy-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

> ---
>  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
>

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 5/8] irqdesc: Replace irq_kobj_type's default_attrs field with groups
  2019-04-02  2:51   ` [PATCH v2 5/8] irqdesc: Replace irq_kobj_type's " Kimberly Brown
@ 2019-04-02  8:04     ` Thomas Gleixner
  0 siblings, 0 replies; 26+ messages in thread
From: Thomas Gleixner @ 2019-04-02  8:04 UTC (permalink / raw)
  To: Kimberly Brown; +Cc: Greg Kroah-Hartman, Rafael J. Wysocki, linux-kernel

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 <kimbrownkd@gmail.com>

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>

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


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 7/8] cpufreq: schedutil: Replace default_attrs field with groups
  2019-04-02  2:51   ` [PATCH v2 7/8] cpufreq: schedutil: Replace " Kimberly Brown
  2019-04-02  7:56     ` Rafael J. Wysocki
@ 2019-04-02  8:50     ` Peter Zijlstra
  1 sibling, 0 replies; 26+ messages in thread
From: Peter Zijlstra @ 2019-04-02  8:50 UTC (permalink / raw)
  To: Kimberly Brown
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Ingo Molnar, linux-kernel

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 <kimbrownkd@gmail.com>

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

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
> 

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 8/8] livepatch: Replace klp_ktype_patch's default_attrs with groups
  2019-04-02  2:51   ` [PATCH v2 8/8] livepatch: Replace klp_ktype_patch's default_attrs " Kimberly Brown
@ 2019-04-02 10:22     ` Jiri Kosina
  2019-04-03 11:51     ` Miroslav Benes
  2019-04-08 14:16     ` Petr Mladek
  2 siblings, 0 replies; 26+ messages in thread
From: Jiri Kosina @ 2019-04-02 10:22 UTC (permalink / raw)
  To: Kimberly Brown
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Josh Poimboeuf,
	Miroslav Benes, Petr Mladek, Joe Lawrence, live-patching,
	linux-kernel

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 <kimbrownkd@gmail.com>

Acked-by: Jiri Kosina <jkosina@suse.cz>

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

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 3/8] block: Replace all ktype default_attrs with groups
  2019-04-02  2:51   ` [PATCH v2 3/8] block: Replace all ktype default_attrs " Kimberly Brown
@ 2019-04-02 16:02     ` Bart Van Assche
  2019-04-02 17:46       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 26+ messages in thread
From: Bart Van Assche @ 2019-04-02 16:02 UTC (permalink / raw)
  To: Kimberly Brown, Greg Kroah-Hartman, Rafael J. Wysocki
  Cc: Jens Axboe, linux-block, linux-kernel

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 <kimbrownkd@gmail.com>
> ---
>  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.

Anyway:

Reviewed-by: Bart Van Assche <bvanassche@acm.org>


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 3/8] block: Replace all ktype default_attrs with groups
  2019-04-02 16:02     ` Bart Van Assche
@ 2019-04-02 17:46       ` Greg Kroah-Hartman
  2019-04-02 18:06         ` Bart Van Assche
  0 siblings, 1 reply; 26+ messages in thread
From: Greg Kroah-Hartman @ 2019-04-02 17:46 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Kimberly Brown, Rafael J. Wysocki, Jens Axboe, linux-block, linux-kernel

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 <kimbrownkd@gmail.com>
> > ---
> >  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 <bvanassche@acm.org>

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

greg k-h

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 3/8] block: Replace all ktype default_attrs with groups
  2019-04-02 17:46       ` Greg Kroah-Hartman
@ 2019-04-02 18:06         ` Bart Van Assche
  0 siblings, 0 replies; 26+ messages in thread
From: Bart Van Assche @ 2019-04-02 18:06 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Kimberly Brown, Rafael J. Wysocki, Jens Axboe, linux-block, linux-kernel

On Tue, 2019-04-02 at 19:46 +0200, Greg Kroah-Hartman wrote:
> 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 <kimbrownkd@gmail.com>
> > > ---
> > >  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?

Hi Greg,

Not that it matters, but I see four changes in this patch: three conversions
from default_attrs into default_groups and also the removal of default_ctx_attrs.

Thanks,

Bart.

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 8/8] livepatch: Replace klp_ktype_patch's default_attrs with groups
  2019-04-02  2:51   ` [PATCH v2 8/8] livepatch: Replace klp_ktype_patch's default_attrs " Kimberly Brown
  2019-04-02 10:22     ` Jiri Kosina
@ 2019-04-03 11:51     ` Miroslav Benes
  2019-04-08 14:16     ` Petr Mladek
  2 siblings, 0 replies; 26+ messages in thread
From: Miroslav Benes @ 2019-04-03 11:51 UTC (permalink / raw)
  To: Kimberly Brown
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Josh Poimboeuf,
	Jiri Kosina, Petr Mladek, Joe Lawrence, live-patching,
	linux-kernel

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 <kimbrownkd@gmail.com>

Acked-by: Miroslav Benes <mbenes@suse.cz>

M

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 8/8] livepatch: Replace klp_ktype_patch's default_attrs with groups
  2019-04-02  2:51   ` [PATCH v2 8/8] livepatch: Replace klp_ktype_patch's default_attrs " Kimberly Brown
  2019-04-02 10:22     ` Jiri Kosina
  2019-04-03 11:51     ` Miroslav Benes
@ 2019-04-08 14:16     ` Petr Mladek
  2 siblings, 0 replies; 26+ messages in thread
From: Petr Mladek @ 2019-04-08 14:16 UTC (permalink / raw)
  To: Kimberly Brown
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Josh Poimboeuf,
	Jiri Kosina, Miroslav Benes, Joe Lawrence, live-patching,
	linux-kernel

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 <kimbrownkd@gmail.com>

Acked-by: Petr Mladek <pmladek@suse.com>

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 0/8] kobject: Add default group support to kobj_type and replace subsystem uses
  2019-04-02  2:51 ` [PATCH v2 0/8] kobject: Add default group support to kobj_type and replace subsystem uses Kimberly Brown
                     ` (8 preceding siblings ...)
  2019-04-02  6:29   ` [PATCH v2 0/8] kobject: Add default group support to kobj_type and replace subsystem uses Greg Kroah-Hartman
@ 2019-04-25 20:12   ` Greg Kroah-Hartman
  2019-04-27  6:18     ` Kimberly Brown
  9 siblings, 1 reply; 26+ messages in thread
From: Greg Kroah-Hartman @ 2019-04-25 20:12 UTC (permalink / raw)
  To: Kimberly Brown
  Cc: Rafael J. Wysocki, Jens Axboe, linux-block, David S. Miller,
	netdev, Thomas Gleixner, Steffen Klassert, linux-crypto,
	Ingo Molnar, Peter Zijlstra, Josh Poimboeuf, Jiri Kosina,
	Miroslav Benes, Petr Mladek, Joe Lawrence, live-patching,
	linux-kernel

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

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 0/8] kobject: Add default group support to kobj_type and replace subsystem uses
  2019-04-25 20:12   ` Greg Kroah-Hartman
@ 2019-04-27  6:18     ` Kimberly Brown
  2019-04-27  6:41       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 26+ messages in thread
From: Kimberly Brown @ 2019-04-27  6:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel

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

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCH v2 0/8] kobject: Add default group support to kobj_type and replace subsystem uses
  2019-04-27  6:18     ` Kimberly Brown
@ 2019-04-27  6:41       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 26+ messages in thread
From: Greg Kroah-Hartman @ 2019-04-27  6:41 UTC (permalink / raw)
  To: Kimberly Brown; +Cc: linux-kernel

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

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2019-04-27  6:41 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-22 20:14 [PATCH] kobject: Add support for default attribute groups to kobj_type Kimberly Brown
2019-03-23  6:07 ` Greg Kroah-Hartman
2019-03-24  3:48   ` Kimberly Brown
2019-03-24  5:15     ` Greg Kroah-Hartman
2019-04-02  2:51 ` [PATCH v2 0/8] kobject: Add default group support to kobj_type and replace subsystem uses Kimberly Brown
2019-04-02  2:51   ` [PATCH v2 1/8] kobject: Add support for default attribute groups to kobj_type Kimberly Brown
2019-04-02  2:51   ` [PATCH v2 2/8] samples/kobject: Replace foo_ktype's default_attrs field with groups Kimberly Brown
2019-04-02  2:51   ` [PATCH v2 3/8] block: Replace all ktype default_attrs " Kimberly Brown
2019-04-02 16:02     ` Bart Van Assche
2019-04-02 17:46       ` Greg Kroah-Hartman
2019-04-02 18:06         ` Bart Van Assche
2019-04-02  2:51   ` [PATCH v2 4/8] net-sysfs: Replace ktype default_attrs field " Kimberly Brown
2019-04-02  2:51   ` [PATCH v2 5/8] irqdesc: Replace irq_kobj_type's " Kimberly Brown
2019-04-02  8:04     ` Thomas Gleixner
2019-04-02  2:51   ` [PATCH v2 6/8] padata: Replace padata_attr_type " Kimberly Brown
2019-04-02  2:51   ` [PATCH v2 7/8] cpufreq: schedutil: Replace " Kimberly Brown
2019-04-02  7:56     ` Rafael J. Wysocki
2019-04-02  8:50     ` Peter Zijlstra
2019-04-02  2:51   ` [PATCH v2 8/8] livepatch: Replace klp_ktype_patch's default_attrs " Kimberly Brown
2019-04-02 10:22     ` Jiri Kosina
2019-04-03 11:51     ` Miroslav Benes
2019-04-08 14:16     ` Petr Mladek
2019-04-02  6:29   ` [PATCH v2 0/8] kobject: Add default group support to kobj_type and replace subsystem uses Greg Kroah-Hartman
2019-04-25 20:12   ` Greg Kroah-Hartman
2019-04-27  6:18     ` Kimberly Brown
2019-04-27  6:41       ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).