* [PATCH] gpio: mpc8xxx: Add shutdown function.
@ 2020-04-09 9:02 Hui Song
2020-04-09 9:37 ` Russell King - ARM Linux admin
2020-04-21 5:44 ` kbuild test robot
0 siblings, 2 replies; 5+ messages in thread
From: Hui Song @ 2020-04-09 9:02 UTC (permalink / raw)
To: Shawn Guo, Li Yang, Rob Herring, Mark Rutland, Linus Walleij,
Bartosz Golaszewski
Cc: linux-arm-kernel, devicetree, linux-kernel, linux-gpio, Song Hui
From: Song Hui <hui.song_1@nxp.com>
When the kexec command is executed, the memory area will be re-paginated.
The shutdown function needed to make interrupt handler to be NULL.If
not, an interrupt will be generated during this period. When the interrupt
handler is executed,the handler function address changed and crash will
occur.
Signed-off-by: Song Hui <hui.song_1@nxp.com>
---
drivers/gpio/gpio-mpc8xxx.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
index 604dfec..a24e6c5 100644
--- a/drivers/gpio/gpio-mpc8xxx.c
+++ b/drivers/gpio/gpio-mpc8xxx.c
@@ -446,9 +446,21 @@ static int mpc8xxx_remove(struct platform_device *pdev)
return 0;
}
+static int mpc8xxx_shutdown(struct platform_device *pdev)
+{
+ struct mpc8xxx_gpio_chip *mpc8xxx_gc = platform_get_drvdata(pdev);
+
+ if (mpc8xxx_gc->irq) {
+ irq_set_chained_handler_and_data(mpc8xxx_gc->irqn, NULL, NULL);
+ irq_domain_remove(mpc8xxx_gc->irq);
+ }
+
+ return 0;
+}
static struct platform_driver mpc8xxx_plat_driver = {
.probe = mpc8xxx_probe,
.remove = mpc8xxx_remove,
+ .shutdown = mpc8xxx_shutdown,
.driver = {
.name = "gpio-mpc8xxx",
.of_match_table = mpc8xxx_gpio_ids,
--
2.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] gpio: mpc8xxx: Add shutdown function.
2020-04-09 9:02 [PATCH] gpio: mpc8xxx: Add shutdown function Hui Song
@ 2020-04-09 9:37 ` Russell King - ARM Linux admin
2020-04-21 5:44 ` kbuild test robot
1 sibling, 0 replies; 5+ messages in thread
From: Russell King - ARM Linux admin @ 2020-04-09 9:37 UTC (permalink / raw)
To: Hui Song
Cc: Shawn Guo, Li Yang, Rob Herring, Mark Rutland, Linus Walleij,
Bartosz Golaszewski, devicetree, linux-kernel, linux-arm-kernel,
linux-gpio
On Thu, Apr 09, 2020 at 05:02:59PM +0800, Hui Song wrote:
> From: Song Hui <hui.song_1@nxp.com>
>
> When the kexec command is executed, the memory area will be re-paginated.
> The shutdown function needed to make interrupt handler to be NULL.If
> not, an interrupt will be generated during this period. When the interrupt
> handler is executed,the handler function address changed and crash will
> occur.
I still don't think this is adequate.
When kexec takes effect, the existing kernel is shutdown and replaced
with the new kernel, and it completely takes over the system. The
dynamically allocated structures (which include pointers for the parent
interrupt for mpc8xxx) are irrelevant, as they will need to be
reallocated. It feels like you're just putting a band-aid over a real
problem.
I think rather than producing a patch, you need to give details of the
crash you are seeing. Probably having the kernel message log across
the kexec and into the new kernel up to the point where the crash occurs
would be a good idea.
>
> Signed-off-by: Song Hui <hui.song_1@nxp.com>
> ---
> drivers/gpio/gpio-mpc8xxx.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
> index 604dfec..a24e6c5 100644
> --- a/drivers/gpio/gpio-mpc8xxx.c
> +++ b/drivers/gpio/gpio-mpc8xxx.c
> @@ -446,9 +446,21 @@ static int mpc8xxx_remove(struct platform_device *pdev)
> return 0;
> }
>
> +static int mpc8xxx_shutdown(struct platform_device *pdev)
> +{
> + struct mpc8xxx_gpio_chip *mpc8xxx_gc = platform_get_drvdata(pdev);
> +
> + if (mpc8xxx_gc->irq) {
> + irq_set_chained_handler_and_data(mpc8xxx_gc->irqn, NULL, NULL);
> + irq_domain_remove(mpc8xxx_gc->irq);
> + }
> +
> + return 0;
> +}
> static struct platform_driver mpc8xxx_plat_driver = {
> .probe = mpc8xxx_probe,
> .remove = mpc8xxx_remove,
> + .shutdown = mpc8xxx_shutdown,
> .driver = {
> .name = "gpio-mpc8xxx",
> .of_match_table = mpc8xxx_gpio_ids,
> --
> 2.9.5
>
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 10.2Mbps down 587kbps up
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gpio: mpc8xxx: Add shutdown function.
2020-04-09 9:02 [PATCH] gpio: mpc8xxx: Add shutdown function Hui Song
2020-04-09 9:37 ` Russell King - ARM Linux admin
@ 2020-04-21 5:44 ` kbuild test robot
1 sibling, 0 replies; 5+ messages in thread
From: kbuild test robot @ 2020-04-21 5:44 UTC (permalink / raw)
To: Hui Song, Shawn Guo, Li Yang, Rob Herring, Mark Rutland,
Linus Walleij, Bartosz Golaszewski, linux-arm-kernel, devicetree,
linux-kernel, linux-gpio
Cc: kbuild-all, linux-arm-kernel, devicetree, linux-kernel, linux-gpio
[-- Attachment #1: Type: text/plain, Size: 2355 bytes --]
Hi Hui,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on gpio/for-next]
[also build test ERROR on v5.7-rc2 next-20200420]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Hui-Song/gpio-mpc8xxx-Add-shutdown-function/20200410-000846
base: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next
config: arm64-defconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
>> drivers/gpio/gpio-mpc8xxx.c:463:14: error: initialization of 'void (*)(struct platform_device *)' from incompatible pointer type 'int (*)(struct platform_device *)' [-Werror=incompatible-pointer-types]
463 | .shutdown = mpc8xxx_shutdown,
| ^~~~~~~~~~~~~~~~
drivers/gpio/gpio-mpc8xxx.c:463:14: note: (near initialization for 'mpc8xxx_plat_driver.shutdown')
cc1: some warnings being treated as errors
vim +463 drivers/gpio/gpio-mpc8xxx.c
448
449 static int mpc8xxx_shutdown(struct platform_device *pdev)
450 {
451 struct mpc8xxx_gpio_chip *mpc8xxx_gc = platform_get_drvdata(pdev);
452
453 if (mpc8xxx_gc->irq) {
454 irq_set_chained_handler_and_data(mpc8xxx_gc->irqn, NULL, NULL);
455 irq_domain_remove(mpc8xxx_gc->irq);
456 }
457
458 return 0;
459 }
460 static struct platform_driver mpc8xxx_plat_driver = {
461 .probe = mpc8xxx_probe,
462 .remove = mpc8xxx_remove,
> 463 .shutdown = mpc8xxx_shutdown,
464 .driver = {
465 .name = "gpio-mpc8xxx",
466 .of_match_table = mpc8xxx_gpio_ids,
467 },
468 };
469
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 48226 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] gpio: mpc8xxx: Add shutdown function.
@ 2020-04-09 8:49 Hui Song
0 siblings, 0 replies; 5+ messages in thread
From: Hui Song @ 2020-04-09 8:49 UTC (permalink / raw)
To: Shawn Guo, Li Yang, Rob Herring, Mark Rutland, Linus Walleij,
Bartosz Golaszewski
Cc: linux-arm-kernel, devicetree, linux-kernel, linux-gpio, Song Hui
From: Song Hui <hui.song_1@nxp.com>
When the kexec command is executed, the memory area will be re-paginated.
The shutdown function needed to make interrupt handler to be NULL.If
not, an interrupt will be generated during this period. When the interrupt
handler is executed,the handler function address changed and crash will
occur.
Signed-off-by: Song Hui <hui.song_1@nxp.com>
---
drivers/gpio/gpio-mpc8xxx.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
index 604dfec..a24e6c5 100644
--- a/drivers/gpio/gpio-mpc8xxx.c
+++ b/drivers/gpio/gpio-mpc8xxx.c
@@ -446,9 +446,21 @@ static int mpc8xxx_remove(struct platform_device *pdev)
return 0;
}
+static int mpc8xxx_shutdown(struct platform_device *pdev)
+{
+ struct mpc8xxx_gpio_chip *mpc8xxx_gc = platform_get_drvdata(pdev);
+
+ if (mpc8xxx_gc->irq) {
+ irq_set_chained_handler_and_data(mpc8xxx_gc->irqn, NULL, NULL);
+ irq_domain_remove(mpc8xxx_gc->irq);
+ }
+
+ return 0;
+}
static struct platform_driver mpc8xxx_plat_driver = {
.probe = mpc8xxx_probe,
.remove = mpc8xxx_remove,
+ .shutdown = mpc8xxx_shutdown,
.driver = {
.name = "gpio-mpc8xxx",
.of_match_table = mpc8xxx_gpio_ids,
--
2.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v1] gpio: mpc8xxx: Add shutdown function.
@ 2020-04-08 10:21 Hui Song
2020-04-08 10:21 ` [PATCH] " Hui Song
0 siblings, 1 reply; 5+ messages in thread
From: Hui Song @ 2020-04-08 10:21 UTC (permalink / raw)
To: Shawn Guo, Li Yang, Rob Herring, Mark Rutland, Linus Walleij,
Bartosz Golaszewski
Cc: linux-arm-kernel, devicetree, linux-kernel, linux-gpio, Song Hui
From: Song Hui <hui.song_1@nxp.com>
The shutdown function needed to make interrupt handler to be NULL
when kexec execute.
Signed-off-by: Song Hui <hui.song_1@nxp.com>
---
drivers/gpio/gpio-mpc8xxx.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
index 604dfec..a24e6c5 100644
--- a/drivers/gpio/gpio-mpc8xxx.c
+++ b/drivers/gpio/gpio-mpc8xxx.c
@@ -446,9 +446,21 @@ static int mpc8xxx_remove(struct platform_device *pdev)
return 0;
}
+static int mpc8xxx_shutdown(struct platform_device *pdev)
+{
+ struct mpc8xxx_gpio_chip *mpc8xxx_gc = platform_get_drvdata(pdev);
+
+ if (mpc8xxx_gc->irq) {
+ irq_set_chained_handler_and_data(mpc8xxx_gc->irqn, NULL, NULL);
+ irq_domain_remove(mpc8xxx_gc->irq);
+ }
+
+ return 0;
+}
static struct platform_driver mpc8xxx_plat_driver = {
.probe = mpc8xxx_probe,
.remove = mpc8xxx_remove,
+ .shutdown = mpc8xxx_shutdown,
.driver = {
.name = "gpio-mpc8xxx",
.of_match_table = mpc8xxx_gpio_ids,
--
2.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] gpio: mpc8xxx: Add shutdown function.
2020-04-08 10:21 [PATCH v1] " Hui Song
@ 2020-04-08 10:21 ` Hui Song
0 siblings, 0 replies; 5+ messages in thread
From: Hui Song @ 2020-04-08 10:21 UTC (permalink / raw)
To: Shawn Guo, Li Yang, Rob Herring, Mark Rutland, Linus Walleij,
Bartosz Golaszewski
Cc: linux-arm-kernel, devicetree, linux-kernel, linux-gpio, Song Hui
From: Song Hui <hui.song_1@nxp.com>
The shutdown function needed to make interrupt handler to be NULL
when kexec execute.
Signed-off-by: Song Hui <hui.song_1@nxp.com>
---
drivers/gpio/gpio-mpc8xxx.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
index 604dfec..a24e6c5 100644
--- a/drivers/gpio/gpio-mpc8xxx.c
+++ b/drivers/gpio/gpio-mpc8xxx.c
@@ -446,9 +446,21 @@ static int mpc8xxx_remove(struct platform_device *pdev)
return 0;
}
+static int mpc8xxx_shutdown(struct platform_device *pdev)
+{
+ struct mpc8xxx_gpio_chip *mpc8xxx_gc = platform_get_drvdata(pdev);
+
+ if (mpc8xxx_gc->irq) {
+ irq_set_chained_handler_and_data(mpc8xxx_gc->irqn, NULL, NULL);
+ irq_domain_remove(mpc8xxx_gc->irq);
+ }
+
+ return 0;
+}
static struct platform_driver mpc8xxx_plat_driver = {
.probe = mpc8xxx_probe,
.remove = mpc8xxx_remove,
+ .shutdown = mpc8xxx_shutdown,
.driver = {
.name = "gpio-mpc8xxx",
.of_match_table = mpc8xxx_gpio_ids,
--
2.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-04-21 5:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-09 9:02 [PATCH] gpio: mpc8xxx: Add shutdown function Hui Song
2020-04-09 9:37 ` Russell King - ARM Linux admin
2020-04-21 5:44 ` kbuild test robot
-- strict thread matches above, loose matches on Subject: below --
2020-04-09 8:49 Hui Song
2020-04-08 10:21 [PATCH v1] " Hui Song
2020-04-08 10:21 ` [PATCH] " Hui Song
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).