* [PATCH] x86/pci: Annotate 'pci_root_ops' with __ro_after_init
@ 2018-11-05 20:17 Zubin Mithra
2018-11-05 21:38 ` Thomas Gleixner
2018-11-05 21:57 ` Christoph Hellwig
0 siblings, 2 replies; 3+ messages in thread
From: Zubin Mithra @ 2018-11-05 20:17 UTC (permalink / raw)
To: tglx, mingo, bp, hpa, linux-kernel, linux-pci; +Cc: groeck, keescook, zsm
When CONFIG_X86_INTEL_MID is set pci_root_ops is written to inside
intel_mid_pci_init(which is marked __init) and not modified after. This
makes pci_root_ops a suitable candidate for annotating as
__ro_after_init.
Signed-off-by: Zubin Mithra <zsm@chromium.org>
---
arch/x86/pci/common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index d4ec117c1142..204ee80cfa63 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -67,7 +67,7 @@ static int pci_write(struct pci_bus *bus, unsigned int devfn, int where, int siz
devfn, where, size, value);
}
-struct pci_ops pci_root_ops = {
+struct pci_ops pci_root_ops __ro_after_init = {
.read = pci_read,
.write = pci_write,
};
--
2.19.1.930.g4563a0d9d0-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] x86/pci: Annotate 'pci_root_ops' with __ro_after_init
2018-11-05 20:17 [PATCH] x86/pci: Annotate 'pci_root_ops' with __ro_after_init Zubin Mithra
@ 2018-11-05 21:38 ` Thomas Gleixner
2018-11-05 21:57 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Gleixner @ 2018-11-05 21:38 UTC (permalink / raw)
To: Zubin Mithra
Cc: mingo, Borislav Petkov, H. Peter Anvin, LKML, linux-pci, groeck,
Kees Cook, Bjorn Helgaas
On Mon, 5 Nov 2018, Zubin Mithra wrote:
Cc+: Bjorn
> When CONFIG_X86_INTEL_MID is set pci_root_ops is written to inside
> intel_mid_pci_init(which is marked __init) and not modified after. This
> makes pci_root_ops a suitable candidate for annotating as
> __ro_after_init.
This is confusing. What about CONFIG_X86_INTEL_MID=n?
What you want to say is:
pci_root_ops is only modified from intel_mid_pci_init() which is a init
function, so it can be made __ro_after_init.
or something like this. Hmm?
Other than the nitpick above:
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Zubin Mithra <zsm@chromium.org>
> ---
> arch/x86/pci/common.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
> index d4ec117c1142..204ee80cfa63 100644
> --- a/arch/x86/pci/common.c
> +++ b/arch/x86/pci/common.c
> @@ -67,7 +67,7 @@ static int pci_write(struct pci_bus *bus, unsigned int devfn, int where, int siz
> devfn, where, size, value);
> }
>
> -struct pci_ops pci_root_ops = {
> +struct pci_ops pci_root_ops __ro_after_init = {
> .read = pci_read,
> .write = pci_write,
> };
> --
> 2.19.1.930.g4563a0d9d0-goog
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86/pci: Annotate 'pci_root_ops' with __ro_after_init
2018-11-05 20:17 [PATCH] x86/pci: Annotate 'pci_root_ops' with __ro_after_init Zubin Mithra
2018-11-05 21:38 ` Thomas Gleixner
@ 2018-11-05 21:57 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2018-11-05 21:57 UTC (permalink / raw)
To: Zubin Mithra
Cc: tglx, mingo, bp, hpa, linux-kernel, linux-pci, groeck, keescook
On Mon, Nov 05, 2018 at 12:17:35PM -0800, Zubin Mithra wrote:
> When CONFIG_X86_INTEL_MID is set pci_root_ops is written to inside
> intel_mid_pci_init(which is marked __init) and not modified after. This
> makes pci_root_ops a suitable candidate for annotating as
> __ro_after_init.
Yikes. pci_root_ops really should be const to start with, and we
should use a separate struct for MID. Having structures that contain
function pointers not marked const is generally a bad idea to start with.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-11-05 21:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-05 20:17 [PATCH] x86/pci: Annotate 'pci_root_ops' with __ro_after_init Zubin Mithra
2018-11-05 21:38 ` Thomas Gleixner
2018-11-05 21:57 ` Christoph Hellwig
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.