* [PATCH 1/4] KVM: PPC: Book3S HV: Make struct kernel_param_ops definition const
2020-10-04 0:18 [PATCH 0/4] treewide: Make definitions of struct kernel_param_ops const Joe Perches
@ 2020-10-04 0:18 ` Joe Perches
2020-10-04 0:18 ` [PATCH 2/4] kvm x86/mmu: Make struct kernel_param_ops definitions const Joe Perches
` (3 subsequent siblings)
4 siblings, 0 replies; 19+ messages in thread
From: Joe Perches @ 2020-10-04 0:18 UTC (permalink / raw)
To: Paul Mackerras
Cc: Michael Ellerman, Benjamin Herrenschmidt, Paolo Bonzini,
Sean Christopherson, Ram Pai, Bharata B Rao, Laurent Dufour,
Nicholas Piggin, Athira Rajeev, Tianjia Zhang, Davidlohr Bueso,
kvm-ppc, linuxppc-dev, linux-kernel
This should be const, so make it so.
Signed-off-by: Joe Perches <joe@perches.com>
---
arch/powerpc/kvm/book3s_hv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 4ba06a2a306c..2b215852cdc9 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -111,7 +111,7 @@ module_param(one_vm_per_core, bool, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(one_vm_per_core, "Only run vCPUs from the same VM on a core (requires indep_threads_mode=N)");
#ifdef CONFIG_KVM_XICS
-static struct kernel_param_ops module_param_ops = {
+static const struct kernel_param_ops module_param_ops = {
.set = param_set_int,
.get = param_get_int,
};
--
2.26.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [PATCH 1/4] KVM: PPC: Book3S HV: Make struct kernel_param_ops definition const
@ 2020-10-04 0:18 ` Joe Perches
0 siblings, 0 replies; 19+ messages in thread
From: Joe Perches @ 2020-10-04 0:18 UTC (permalink / raw)
To: Paul Mackerras
Cc: kvm-ppc, Athira Rajeev, Tianjia Zhang, Ram Pai, linux-kernel,
Sean Christopherson, Bharata B Rao, Davidlohr Bueso,
Nicholas Piggin, Paolo Bonzini, Laurent Dufour, linuxppc-dev
This should be const, so make it so.
Signed-off-by: Joe Perches <joe@perches.com>
---
arch/powerpc/kvm/book3s_hv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 4ba06a2a306c..2b215852cdc9 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -111,7 +111,7 @@ module_param(one_vm_per_core, bool, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(one_vm_per_core, "Only run vCPUs from the same VM on a core (requires indep_threads_mode=N)");
#ifdef CONFIG_KVM_XICS
-static struct kernel_param_ops module_param_ops = {
+static const struct kernel_param_ops module_param_ops = {
.set = param_set_int,
.get = param_get_int,
};
--
2.26.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 1/4] KVM: PPC: Book3S HV: Make struct kernel_param_ops definition const
2020-10-04 0:18 ` Joe Perches
@ 2020-10-19 16:01 ` Paolo Bonzini
-1 siblings, 0 replies; 19+ messages in thread
From: Paolo Bonzini @ 2020-10-19 16:01 UTC (permalink / raw)
To: Joe Perches, Paul Mackerras
Cc: Michael Ellerman, Benjamin Herrenschmidt, Sean Christopherson,
Ram Pai, Bharata B Rao, Laurent Dufour, Nicholas Piggin,
Athira Rajeev, Tianjia Zhang, Davidlohr Bueso, kvm-ppc,
linuxppc-dev, linux-kernel
On 04/10/20 02:18, Joe Perches wrote:
> This should be const, so make it so.
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> arch/powerpc/kvm/book3s_hv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index 4ba06a2a306c..2b215852cdc9 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -111,7 +111,7 @@ module_param(one_vm_per_core, bool, S_IRUGO | S_IWUSR);
> MODULE_PARM_DESC(one_vm_per_core, "Only run vCPUs from the same VM on a core (requires indep_threads_mode=N)");
>
> #ifdef CONFIG_KVM_XICS
> -static struct kernel_param_ops module_param_ops = {
> +static const struct kernel_param_ops module_param_ops = {
> .set = param_set_int,
> .get = param_get_int,
> };
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 1/4] KVM: PPC: Book3S HV: Make struct kernel_param_ops definition const
@ 2020-10-19 16:01 ` Paolo Bonzini
0 siblings, 0 replies; 19+ messages in thread
From: Paolo Bonzini @ 2020-10-19 16:01 UTC (permalink / raw)
To: Joe Perches, Paul Mackerras
Cc: kvm-ppc, Athira Rajeev, Tianjia Zhang, Ram Pai, linux-kernel,
Sean Christopherson, Bharata B Rao, Davidlohr Bueso,
Nicholas Piggin, Laurent Dufour, linuxppc-dev
On 04/10/20 02:18, Joe Perches wrote:
> This should be const, so make it so.
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> arch/powerpc/kvm/book3s_hv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index 4ba06a2a306c..2b215852cdc9 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -111,7 +111,7 @@ module_param(one_vm_per_core, bool, S_IRUGO | S_IWUSR);
> MODULE_PARM_DESC(one_vm_per_core, "Only run vCPUs from the same VM on a core (requires indep_threads_mode=N)");
>
> #ifdef CONFIG_KVM_XICS
> -static struct kernel_param_ops module_param_ops = {
> +static const struct kernel_param_ops module_param_ops = {
> .set = param_set_int,
> .get = param_get_int,
> };
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 2/4] kvm x86/mmu: Make struct kernel_param_ops definitions const
2020-10-04 0:18 [PATCH 0/4] treewide: Make definitions of struct kernel_param_ops const Joe Perches
2020-10-04 0:18 ` Joe Perches
@ 2020-10-04 0:18 ` Joe Perches
2020-10-05 17:14 ` Ben Gardon
2020-10-04 0:18 ` [PATCH 3/4] rcu/tree: " Joe Perches
` (2 subsequent siblings)
4 siblings, 1 reply; 19+ messages in thread
From: Joe Perches @ 2020-10-04 0:18 UTC (permalink / raw)
To: Paolo Bonzini, Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li,
Jim Mattson, Joerg Roedel
Cc: Thomas Gleixner, Borislav Petkov, x86, H. Peter Anvin,
Ben Gardon, kvm, linux-kernel
These should be const, so make it so.
Signed-off-by: Joe Perches <joe@perches.com>
---
arch/x86/kvm/mmu/mmu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
index 71aa3da2a0b7..6500dd681750 100644
--- a/arch/x86/kvm/mmu/mmu.c
+++ b/arch/x86/kvm/mmu/mmu.c
@@ -64,12 +64,12 @@ static uint __read_mostly nx_huge_pages_recovery_ratio = 60;
static int set_nx_huge_pages(const char *val, const struct kernel_param *kp);
static int set_nx_huge_pages_recovery_ratio(const char *val, const struct kernel_param *kp);
-static struct kernel_param_ops nx_huge_pages_ops = {
+static const struct kernel_param_ops nx_huge_pages_ops = {
.set = set_nx_huge_pages,
.get = param_get_bool,
};
-static struct kernel_param_ops nx_huge_pages_recovery_ratio_ops = {
+static const struct kernel_param_ops nx_huge_pages_recovery_ratio_ops = {
.set = set_nx_huge_pages_recovery_ratio,
.get = param_get_uint,
};
--
2.26.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 2/4] kvm x86/mmu: Make struct kernel_param_ops definitions const
2020-10-04 0:18 ` [PATCH 2/4] kvm x86/mmu: Make struct kernel_param_ops definitions const Joe Perches
@ 2020-10-05 17:14 ` Ben Gardon
2020-10-19 15:50 ` Paolo Bonzini
0 siblings, 1 reply; 19+ messages in thread
From: Ben Gardon @ 2020-10-05 17:14 UTC (permalink / raw)
To: Joe Perches
Cc: Paolo Bonzini, Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li,
Jim Mattson, Joerg Roedel, Thomas Gleixner, Borislav Petkov, x86,
H. Peter Anvin, kvm, LKML
On Sat, Oct 3, 2020 at 5:18 PM Joe Perches <joe@perches.com> wrote:
>
> These should be const, so make it so.
>
> Signed-off-by: Joe Perches <joe@perches.com>
Reviewed-by: Ben Gardon <bgardon@google.com>
> ---
> arch/x86/kvm/mmu/mmu.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index 71aa3da2a0b7..6500dd681750 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -64,12 +64,12 @@ static uint __read_mostly nx_huge_pages_recovery_ratio = 60;
> static int set_nx_huge_pages(const char *val, const struct kernel_param *kp);
> static int set_nx_huge_pages_recovery_ratio(const char *val, const struct kernel_param *kp);
>
> -static struct kernel_param_ops nx_huge_pages_ops = {
> +static const struct kernel_param_ops nx_huge_pages_ops = {
> .set = set_nx_huge_pages,
> .get = param_get_bool,
> };
>
> -static struct kernel_param_ops nx_huge_pages_recovery_ratio_ops = {
> +static const struct kernel_param_ops nx_huge_pages_recovery_ratio_ops = {
> .set = set_nx_huge_pages_recovery_ratio,
> .get = param_get_uint,
> };
> --
> 2.26.0
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH 2/4] kvm x86/mmu: Make struct kernel_param_ops definitions const
2020-10-05 17:14 ` Ben Gardon
@ 2020-10-19 15:50 ` Paolo Bonzini
0 siblings, 0 replies; 19+ messages in thread
From: Paolo Bonzini @ 2020-10-19 15:50 UTC (permalink / raw)
To: Ben Gardon, Joe Perches
Cc: Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
Joerg Roedel, Thomas Gleixner, Borislav Petkov, x86,
H. Peter Anvin, kvm, LKML
On 05/10/20 19:14, Ben Gardon wrote:
> Reviewed-by: Ben Gardon <bgardon@google.com>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 3/4] rcu/tree: Make struct kernel_param_ops definitions const
2020-10-04 0:18 [PATCH 0/4] treewide: Make definitions of struct kernel_param_ops const Joe Perches
2020-10-04 0:18 ` Joe Perches
2020-10-04 0:18 ` [PATCH 2/4] kvm x86/mmu: Make struct kernel_param_ops definitions const Joe Perches
@ 2020-10-04 0:18 ` Joe Perches
2020-10-04 15:54 ` Paul E. McKenney
2020-10-04 0:18 ` [PATCH 4/4] mm/zswap: " Joe Perches
2020-10-04 1:19 ` Joe Perches
4 siblings, 1 reply; 19+ messages in thread
From: Joe Perches @ 2020-10-04 0:18 UTC (permalink / raw)
To: Paul E. McKenney, Josh Triplett, Steven Rostedt,
Mathieu Desnoyers, Lai Jiangshan, Joel Fernandes
Cc: Uladzislau Rezki (Sony),
Peter Zijlstra, Thomas Gleixner, Byungchul Park, rcu,
linux-kernel
These should be const, so make it so.
Signed-off-by: Joe Perches <joe@perches.com>
---
kernel/rcu/tree.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index f78ee759af9c..c4732bb80818 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -552,12 +552,12 @@ static int param_set_next_fqs_jiffies(const char *val, const struct kernel_param
return ret;
}
-static struct kernel_param_ops first_fqs_jiffies_ops = {
+static const struct kernel_param_ops first_fqs_jiffies_ops = {
.set = param_set_first_fqs_jiffies,
.get = param_get_ulong,
};
-static struct kernel_param_ops next_fqs_jiffies_ops = {
+static const struct kernel_param_ops next_fqs_jiffies_ops = {
.set = param_set_next_fqs_jiffies,
.get = param_get_ulong,
};
--
2.26.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [PATCH 3/4] rcu/tree: Make struct kernel_param_ops definitions const
2020-10-04 0:18 ` [PATCH 3/4] rcu/tree: " Joe Perches
@ 2020-10-04 15:54 ` Paul E. McKenney
0 siblings, 0 replies; 19+ messages in thread
From: Paul E. McKenney @ 2020-10-04 15:54 UTC (permalink / raw)
To: Joe Perches
Cc: Josh Triplett, Steven Rostedt, Mathieu Desnoyers, Lai Jiangshan,
Joel Fernandes, Uladzislau Rezki (Sony),
Peter Zijlstra, Thomas Gleixner, Byungchul Park, rcu,
linux-kernel
On Sat, Oct 03, 2020 at 05:18:08PM -0700, Joe Perches wrote:
> These should be const, so make it so.
>
> Signed-off-by: Joe Perches <joe@perches.com>
Queued for testing and review, thank you!
Thanx, Paul
> ---
> kernel/rcu/tree.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index f78ee759af9c..c4732bb80818 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -552,12 +552,12 @@ static int param_set_next_fqs_jiffies(const char *val, const struct kernel_param
> return ret;
> }
>
> -static struct kernel_param_ops first_fqs_jiffies_ops = {
> +static const struct kernel_param_ops first_fqs_jiffies_ops = {
> .set = param_set_first_fqs_jiffies,
> .get = param_get_ulong,
> };
>
> -static struct kernel_param_ops next_fqs_jiffies_ops = {
> +static const struct kernel_param_ops next_fqs_jiffies_ops = {
> .set = param_set_next_fqs_jiffies,
> .get = param_get_ulong,
> };
> --
> 2.26.0
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH 4/4] mm/zswap: Make struct kernel_param_ops definitions const
2020-10-04 0:18 [PATCH 0/4] treewide: Make definitions of struct kernel_param_ops const Joe Perches
` (2 preceding siblings ...)
2020-10-04 0:18 ` [PATCH 3/4] rcu/tree: " Joe Perches
@ 2020-10-04 0:18 ` Joe Perches
2020-10-04 1:19 ` Joe Perches
4 siblings, 0 replies; 19+ messages in thread
From: Joe Perches @ 2020-10-04 0:18 UTC (permalink / raw)
To: Seth Jennings, Dan Streetman, Vitaly Wool, Andrew Morton
Cc: Maciej S. Szmigiero, Dan Carpenter, linux-mm, linux-kernel
These should be const, so make it so.
Signed-off-by: Joe Perches <joe@perches.com>
---
mm/zswap.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mm/zswap.c b/mm/zswap.c
index fbb782924ccc..1eced701b3bd 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -81,7 +81,7 @@ static bool zswap_pool_reached_full;
static bool zswap_enabled = IS_ENABLED(CONFIG_ZSWAP_DEFAULT_ON);
static int zswap_enabled_param_set(const char *,
const struct kernel_param *);
-static struct kernel_param_ops zswap_enabled_param_ops = {
+static const struct kernel_param_ops zswap_enabled_param_ops = {
.set = zswap_enabled_param_set,
.get = param_get_bool,
};
@@ -91,7 +91,7 @@ module_param_cb(enabled, &zswap_enabled_param_ops, &zswap_enabled, 0644);
static char *zswap_compressor = CONFIG_ZSWAP_COMPRESSOR_DEFAULT;
static int zswap_compressor_param_set(const char *,
const struct kernel_param *);
-static struct kernel_param_ops zswap_compressor_param_ops = {
+static const struct kernel_param_ops zswap_compressor_param_ops = {
.set = zswap_compressor_param_set,
.get = param_get_charp,
.free = param_free_charp,
@@ -102,7 +102,7 @@ module_param_cb(compressor, &zswap_compressor_param_ops,
/* Compressed storage zpool to use */
static char *zswap_zpool_type = CONFIG_ZSWAP_ZPOOL_DEFAULT;
static int zswap_zpool_param_set(const char *, const struct kernel_param *);
-static struct kernel_param_ops zswap_zpool_param_ops = {
+static const struct kernel_param_ops zswap_zpool_param_ops = {
.set = zswap_zpool_param_set,
.get = param_get_charp,
.free = param_free_charp,
--
2.26.0
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Where is the declaration of buffer used in kernel_param_ops .get functions?
2020-10-04 0:18 [PATCH 0/4] treewide: Make definitions of struct kernel_param_ops const Joe Perches
2020-10-04 0:18 ` Joe Perches
@ 2020-10-04 1:19 ` Joe Perches
2020-10-04 0:18 ` [PATCH 3/4] rcu/tree: " Joe Perches
` (2 subsequent siblings)
4 siblings, 0 replies; 19+ messages in thread
From: Joe Perches @ 2020-10-04 1:19 UTC (permalink / raw)
To: Greg KH; +Cc: linuxppc-dev, linux-kernel, kvm-ppc, kvm, rcu, linux-mm
These patches came up because I was looking for
the location of the declaration of the buffer used
in kernel/params.c struct kernel_param_ops .get
functions.
I didn't find it.
I want to see if it's appropriate to convert the
sprintf family of functions used in these .get
functions to sysfs_emit.
Patches submitted here:
https://lore.kernel.org/lkml/5d606519698ce4c8f1203a2b35797d8254c6050a.1600285923.git.joe@perches.com/T/
Anyone know if it's appropriate to change the
sprintf-like uses in these functions to sysfs_emit
and/or sysfs_emit_at?
^ permalink raw reply [flat|nested] 19+ messages in thread
* Where is the declaration of buffer used in kernel_param_ops .get functions?
@ 2020-10-04 1:19 ` Joe Perches
0 siblings, 0 replies; 19+ messages in thread
From: Joe Perches @ 2020-10-04 1:19 UTC (permalink / raw)
To: Greg KH; +Cc: kvm, linux-kernel, kvm-ppc, rcu, linux-mm, linuxppc-dev
These patches came up because I was looking for
the location of the declaration of the buffer used
in kernel/params.c struct kernel_param_ops .get
functions.
I didn't find it.
I want to see if it's appropriate to convert the
sprintf family of functions used in these .get
functions to sysfs_emit.
Patches submitted here:
https://lore.kernel.org/lkml/5d606519698ce4c8f1203a2b35797d8254c6050a.1600285923.git.joe@perches.com/T/
Anyone know if it's appropriate to change the
sprintf-like uses in these functions to sysfs_emit
and/or sysfs_emit_at?
^ permalink raw reply [flat|nested] 19+ messages in thread
* Where is the declaration of buffer used in kernel_param_ops .get functions?
@ 2020-10-04 1:19 ` Joe Perches
0 siblings, 0 replies; 19+ messages in thread
From: Joe Perches @ 2020-10-04 1:19 UTC (permalink / raw)
To: Greg KH; +Cc: linuxppc-dev, linux-kernel, kvm-ppc, kvm, rcu, linux-mm
These patches came up because I was looking for
the location of the declaration of the buffer used
in kernel/params.c struct kernel_param_ops .get
functions.
I didn't find it.
I want to see if it's appropriate to convert the
sprintf family of functions used in these .get
functions to sysfs_emit.
Patches submitted here:
https://lore.kernel.org/lkml/5d606519698ce4c8f1203a2b35797d8254c6050a.1600285923.git.joe@perches.com/T/
Anyone know if it's appropriate to change the
sprintf-like uses in these functions to sysfs_emit
and/or sysfs_emit_at?
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Where is the declaration of buffer used in kernel_param_ops .get functions?
2020-10-04 1:19 ` Joe Perches
@ 2020-10-04 1:36 ` Matthew Wilcox
-1 siblings, 0 replies; 19+ messages in thread
From: Matthew Wilcox @ 2020-10-04 1:36 UTC (permalink / raw)
To: Joe Perches
Cc: Greg KH, linuxppc-dev, linux-kernel, kvm-ppc, kvm, rcu, linux-mm
On Sat, Oct 03, 2020 at 06:19:18PM -0700, Joe Perches wrote:
> These patches came up because I was looking for
> the location of the declaration of the buffer used
> in kernel/params.c struct kernel_param_ops .get
> functions.
>
> I didn't find it.
>
> I want to see if it's appropriate to convert the
> sprintf family of functions used in these .get
> functions to sysfs_emit.
>
> Patches submitted here:
> https://lore.kernel.org/lkml/5d606519698ce4c8f1203a2b35797d8254c6050a.1600285923.git.joe@perches.com/T/
>
> Anyone know if it's appropriate to change the
> sprintf-like uses in these functions to sysfs_emit
> and/or sysfs_emit_at?
There's a lot of preprocessor magic to wade through.
I'm pretty sure this comes through include/linux/moduleparam.h
and kernel/module.c.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Where is the declaration of buffer used in kernel_param_ops .get functions?
@ 2020-10-04 1:36 ` Matthew Wilcox
0 siblings, 0 replies; 19+ messages in thread
From: Matthew Wilcox @ 2020-10-04 1:36 UTC (permalink / raw)
To: Joe Perches
Cc: kvm, Greg KH, linux-kernel, kvm-ppc, rcu, linux-mm, linuxppc-dev
On Sat, Oct 03, 2020 at 06:19:18PM -0700, Joe Perches wrote:
> These patches came up because I was looking for
> the location of the declaration of the buffer used
> in kernel/params.c struct kernel_param_ops .get
> functions.
>
> I didn't find it.
>
> I want to see if it's appropriate to convert the
> sprintf family of functions used in these .get
> functions to sysfs_emit.
>
> Patches submitted here:
> https://lore.kernel.org/lkml/5d606519698ce4c8f1203a2b35797d8254c6050a.1600285923.git.joe@perches.com/T/
>
> Anyone know if it's appropriate to change the
> sprintf-like uses in these functions to sysfs_emit
> and/or sysfs_emit_at?
There's a lot of preprocessor magic to wade through.
I'm pretty sure this comes through include/linux/moduleparam.h
and kernel/module.c.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Where is the declaration of buffer used in kernel_param_ops .get functions?
2020-10-04 1:36 ` Matthew Wilcox
(?)
@ 2020-10-04 2:11 ` Joe Perches
-1 siblings, 0 replies; 19+ messages in thread
From: Joe Perches @ 2020-10-04 2:11 UTC (permalink / raw)
To: Matthew Wilcox
Cc: Greg KH, linuxppc-dev, linux-kernel, kvm-ppc, kvm, rcu, linux-mm
On Sun, 2020-10-04 at 02:36 +0100, Matthew Wilcox wrote:
> On Sat, Oct 03, 2020 at 06:19:18PM -0700, Joe Perches wrote:
> > These patches came up because I was looking for
> > the location of the declaration of the buffer used
> > in kernel/params.c struct kernel_param_ops .get
> > functions.
> >
> > I didn't find it.
> >
> > I want to see if it's appropriate to convert the
> > sprintf family of functions used in these .get
> > functions to sysfs_emit.
> >
> > Patches submitted here:
> > https://lore.kernel.org/lkml/5d606519698ce4c8f1203a2b35797d8254c6050a.1600285923.git.joe@perches.com/T/
> >
> > Anyone know if it's appropriate to change the
> > sprintf-like uses in these functions to sysfs_emit
> > and/or sysfs_emit_at?
>
> There's a lot of preprocessor magic to wade through.
>
> I'm pretty sure this comes through include/linux/moduleparam.h
> and kernel/module.c.
Dunno, looked there, still can't find it.
btw:
The __module_param_call macro looks very dodgy
as it uses both __used and __attribute__((unused))
and likely one of them should be removed (unused?)
It looks like the comes from varying definitions of
__attribute_used__ eventually converted to __used
for old gcc versions 2, 3, and 4.
1da177e4c3f4:include/linux/compiler-gcc2.h:#define __attribute_used__ __attribute__((__unused__))
1da177e4c3f4:include/linux/compiler-gcc3.h:# define __attribute_used__ __attribute__((__used__))
1da177e4c3f4:include/linux/compiler-gcc3.h:# define __attribute_used__ __attribute__((__unused__))
1da177e4c3f4:include/linux/compiler-gcc4.h:#define __attribute_used__ __attribute__((__used__))
Maybe:
---
include/linux/moduleparam.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 47879fc7f75e..fc820b27fb00 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -288,10 +288,10 @@ struct kparam_array
/* Default value instead of permissions? */ \
static const char __param_str_##name[] = prefix #name; \
static struct kernel_param __moduleparam_const __param_##name \
- __used \
- __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
- = { __param_str_##name, THIS_MODULE, ops, \
- VERIFY_OCTAL_PERMISSIONS(perm), level, flags, { arg } }
+ __used __section("__param") __aligned(sizeof(void *)) = { \
+ __param_str_##name, THIS_MODULE, ops, \
+ VERIFY_OCTAL_PERMISSIONS(perm), level, flags, { arg } \
+ }
/* Obsolete - use module_param_cb() */
#define module_param_call(name, _set, _get, arg, perm) \
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: Where is the declaration of buffer used in kernel_param_ops .get functions?
@ 2020-10-04 2:11 ` Joe Perches
0 siblings, 0 replies; 19+ messages in thread
From: Joe Perches @ 2020-10-04 2:11 UTC (permalink / raw)
To: Matthew Wilcox
Cc: kvm, Greg KH, linux-kernel, kvm-ppc, rcu, linux-mm, linuxppc-dev
On Sun, 2020-10-04 at 02:36 +0100, Matthew Wilcox wrote:
> On Sat, Oct 03, 2020 at 06:19:18PM -0700, Joe Perches wrote:
> > These patches came up because I was looking for
> > the location of the declaration of the buffer used
> > in kernel/params.c struct kernel_param_ops .get
> > functions.
> >
> > I didn't find it.
> >
> > I want to see if it's appropriate to convert the
> > sprintf family of functions used in these .get
> > functions to sysfs_emit.
> >
> > Patches submitted here:
> > https://lore.kernel.org/lkml/5d606519698ce4c8f1203a2b35797d8254c6050a.1600285923.git.joe@perches.com/T/
> >
> > Anyone know if it's appropriate to change the
> > sprintf-like uses in these functions to sysfs_emit
> > and/or sysfs_emit_at?
>
> There's a lot of preprocessor magic to wade through.
>
> I'm pretty sure this comes through include/linux/moduleparam.h
> and kernel/module.c.
Dunno, looked there, still can't find it.
btw:
The __module_param_call macro looks very dodgy
as it uses both __used and __attribute__((unused))
and likely one of them should be removed (unused?)
It looks like the comes from varying definitions of
__attribute_used__ eventually converted to __used
for old gcc versions 2, 3, and 4.
1da177e4c3f4:include/linux/compiler-gcc2.h:#define __attribute_used__ __attribute__((__unused__))
1da177e4c3f4:include/linux/compiler-gcc3.h:# define __attribute_used__ __attribute__((__used__))
1da177e4c3f4:include/linux/compiler-gcc3.h:# define __attribute_used__ __attribute__((__unused__))
1da177e4c3f4:include/linux/compiler-gcc4.h:#define __attribute_used__ __attribute__((__used__))
Maybe:
---
include/linux/moduleparam.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 47879fc7f75e..fc820b27fb00 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -288,10 +288,10 @@ struct kparam_array
/* Default value instead of permissions? */ \
static const char __param_str_##name[] = prefix #name; \
static struct kernel_param __moduleparam_const __param_##name \
- __used \
- __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
- = { __param_str_##name, THIS_MODULE, ops, \
- VERIFY_OCTAL_PERMISSIONS(perm), level, flags, { arg } }
+ __used __section("__param") __aligned(sizeof(void *)) = { \
+ __param_str_##name, THIS_MODULE, ops, \
+ VERIFY_OCTAL_PERMISSIONS(perm), level, flags, { arg } \
+ }
/* Obsolete - use module_param_cb() */
#define module_param_call(name, _set, _get, arg, perm) \
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: Where is the declaration of buffer used in kernel_param_ops .get functions?
@ 2020-10-04 2:11 ` Joe Perches
0 siblings, 0 replies; 19+ messages in thread
From: Joe Perches @ 2020-10-04 2:11 UTC (permalink / raw)
To: Matthew Wilcox
Cc: Greg KH, linuxppc-dev, linux-kernel, kvm-ppc, kvm, rcu, linux-mm
On Sun, 2020-10-04 at 02:36 +0100, Matthew Wilcox wrote:
> On Sat, Oct 03, 2020 at 06:19:18PM -0700, Joe Perches wrote:
> > These patches came up because I was looking for
> > the location of the declaration of the buffer used
> > in kernel/params.c struct kernel_param_ops .get
> > functions.
> >
> > I didn't find it.
> >
> > I want to see if it's appropriate to convert the
> > sprintf family of functions used in these .get
> > functions to sysfs_emit.
> >
> > Patches submitted here:
> > https://lore.kernel.org/lkml/5d606519698ce4c8f1203a2b35797d8254c6050a.1600285923.git.joe@perches.com/T/
> >
> > Anyone know if it's appropriate to change the
> > sprintf-like uses in these functions to sysfs_emit
> > and/or sysfs_emit_at?
>
> There's a lot of preprocessor magic to wade through.
>
> I'm pretty sure this comes through include/linux/moduleparam.h
> and kernel/module.c.
Dunno, looked there, still can't find it.
btw:
The __module_param_call macro looks very dodgy
as it uses both __used and __attribute__((unused))
and likely one of them should be removed (unused?)
It looks like the comes from varying definitions of
__attribute_used__ eventually converted to __used
for old gcc versions 2, 3, and 4.
1da177e4c3f4:include/linux/compiler-gcc2.h:#define __attribute_used__ __attribute__((__unused__))
1da177e4c3f4:include/linux/compiler-gcc3.h:# define __attribute_used__ __attribute__((__used__))
1da177e4c3f4:include/linux/compiler-gcc3.h:# define __attribute_used__ __attribute__((__unused__))
1da177e4c3f4:include/linux/compiler-gcc4.h:#define __attribute_used__ __attribute__((__used__))
Maybe:
---
include/linux/moduleparam.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h
index 47879fc7f75e..fc820b27fb00 100644
--- a/include/linux/moduleparam.h
+++ b/include/linux/moduleparam.h
@@ -288,10 +288,10 @@ struct kparam_array
/* Default value instead of permissions? */ \
static const char __param_str_##name[] = prefix #name; \
static struct kernel_param __moduleparam_const __param_##name \
- __used \
- __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \
- = { __param_str_##name, THIS_MODULE, ops, \
- VERIFY_OCTAL_PERMISSIONS(perm), level, flags, { arg } }
+ __used __section("__param") __aligned(sizeof(void *)) = { \
+ __param_str_##name, THIS_MODULE, ops, \
+ VERIFY_OCTAL_PERMISSIONS(perm), level, flags, { arg } \
+ }
/* Obsolete - use module_param_cb() */
#define module_param_call(name, _set, _get, arg, perm) \
^ permalink raw reply related [flat|nested] 19+ messages in thread