From: Bjorn Helgaas <helgaas@kernel.org>
To: Logan Gunthorpe <logang@deltatee.com>
Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH v2 1/2] PCI: Fix issue with "pci=disable_acs_redir" parameter being ignored
Date: Fri, 12 Apr 2019 15:32:56 -0500 [thread overview]
Message-ID: <20190412203256.GF141472@google.com> (raw)
In-Reply-To: <20190410210532.4538-2-logang@deltatee.com>
On Wed, Apr 10, 2019 at 03:05:31PM -0600, Logan Gunthorpe wrote:
> In most cases, kmalloc will not be available early in boot when
> pci_setup() is called. Thus, the kstrdup call that was added to fix the
> __initdata bug with the disable_acs_redir parameter usually returns
> NULL. Thus the parameter is discarded and it does not take into effect.
>
> To fix this, we store the string that's in initdata until a initcall
> function can allocate the memory appropriately. This way we
> don't need any additional static memory.
>
> Fixes: d2fd6e81912a ("PCI: Fix __initdata issue with "pci=disable_acs_redir" parameter")
> Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
Applied to for-linus for v5.1, thanks, Logan!
> ---
> drivers/pci/pci.c | 19 +++++++++++++++++--
> 1 file changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 7c1b362f599a..766f5779db92 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -6262,8 +6262,7 @@ static int __init pci_setup(char *str)
> } else if (!strncmp(str, "pcie_scan_all", 13)) {
> pci_add_flags(PCI_SCAN_ALL_PCIE_DEVS);
> } else if (!strncmp(str, "disable_acs_redir=", 18)) {
> - disable_acs_redir_param =
> - kstrdup(str + 18, GFP_KERNEL);
> + disable_acs_redir_param = str + 18;
> } else {
> printk(KERN_ERR "PCI: Unknown option `%s'\n",
> str);
> @@ -6274,3 +6273,19 @@ static int __init pci_setup(char *str)
> return 0;
> }
> early_param("pci", pci_setup);
> +
> +/*
> + * 'disable_acs_redir_param' is initialized in pci_setup(), above, to point
> + * to data in the __initdata section which will be freed after the init
> + * sequence is complete. We can't allocate memory in pci_setup() because some
> + * architectures do not have any memory allocation service available during
> + * an early_param() call. So we allocate memory and copy the variable here
> + * before the init section is freed.
> + */
> +static int __init pci_realloc_setup_params(void)
> +{
> + disable_acs_redir_param = kstrdup(disable_acs_redir_param, GFP_KERNEL);
> +
> + return 0;
> +}
> +pure_initcall(pci_realloc_setup_params);
> --
> 2.20.1
>
next prev parent reply other threads:[~2019-04-12 20:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-10 21:05 [PATCH v2 0/2] Fix disable_acs_redir parameter Logan Gunthorpe
2019-04-10 21:05 ` [PATCH v2 1/2] PCI: Fix issue with "pci=disable_acs_redir" parameter being ignored Logan Gunthorpe
2019-04-12 20:32 ` Bjorn Helgaas [this message]
2019-04-10 21:05 ` [PATCH v2 2/2] PCI: Clean up resource_alignment parameter to not require static buffer Logan Gunthorpe
2019-04-12 20:44 ` Bjorn Helgaas
2019-04-12 20:53 ` Logan Gunthorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190412203256.GF141472@google.com \
--to=helgaas@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=logang@deltatee.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox