All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pinctrl: core: Make p->state in order in pinctrl_commit_state
@ 2022-10-27  6:51 Maria Yu
  2022-10-27  7:24 ` Greg KH
  2022-11-08 12:47 ` Linus Walleij
  0 siblings, 2 replies; 9+ messages in thread
From: Maria Yu @ 2022-10-27  6:51 UTC (permalink / raw)
  To: linus.walleij; +Cc: Maria Yu, linux-gpio, stable

We've got a dump that current cpu is in pinctrl_commit_state, the
old_state != p->state while the stack is still in the process of
pinmux_disable_setting. So it means even if the current p->state is
changed in new state, the settings are not yet up-to-date enabled
complete yet.

Currently p->state in different value to synchronize the
pinctrl_commit_state behaviors. The p->state will have transaction like
old_state -> NULL -> new_state. When in old_state, it will try to
disable all the all state settings. And when after new state settings
enabled, p->state will changed to the new state after that. So use
smp_mb to synchronize the p->state variable and the settings in order.
---
 drivers/pinctrl/core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 9e57f4c62e60..cd917a5b1a0a 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -1256,6 +1256,7 @@ static int pinctrl_commit_state(struct pinctrl *p, struct pinctrl_state *state)
 		}
 	}
 
+	smp_mb();
 	p->state = NULL;
 
 	/* Apply all the settings for the new state - pinmux first */
@@ -1305,6 +1306,7 @@ static int pinctrl_commit_state(struct pinctrl *p, struct pinctrl_state *state)
 			pinctrl_link_add(setting->pctldev, p->dev);
 	}
 
+	smp_mb();
 	p->state = state;
 
 	return 0;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH] pinctrl: core: Make p->state in order in pinctrl_commit_state
@ 2022-10-27  6:54 Maria Yu
  2022-11-01  4:30 ` Pavan Kondeti
  0 siblings, 1 reply; 9+ messages in thread
From: Maria Yu @ 2022-10-27  6:54 UTC (permalink / raw)
  To: linus.walleij; +Cc: Maria Yu, linux-gpio, linux-kernel

We've got a dump that current cpu is in pinctrl_commit_state, the
old_state != p->state while the stack is still in the process of
pinmux_disable_setting. So it means even if the current p->state is
changed in new state, the settings are not yet up-to-date enabled
complete yet.

Currently p->state in different value to synchronize the
pinctrl_commit_state behaviors. The p->state will have transaction like
old_state -> NULL -> new_state. When in old_state, it will try to
disable all the all state settings. And when after new state settings
enabled, p->state will changed to the new state after that. So use
smp_mb to synchronize the p->state variable and the settings in order.
---
 drivers/pinctrl/core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 9e57f4c62e60..cd917a5b1a0a 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -1256,6 +1256,7 @@ static int pinctrl_commit_state(struct pinctrl *p, struct pinctrl_state *state)
 		}
 	}
 
+	smp_mb();
 	p->state = NULL;
 
 	/* Apply all the settings for the new state - pinmux first */
@@ -1305,6 +1306,7 @@ static int pinctrl_commit_state(struct pinctrl *p, struct pinctrl_state *state)
 			pinctrl_link_add(setting->pctldev, p->dev);
 	}
 
+	smp_mb();
 	p->state = state;
 
 	return 0;
-- 
2.17.1


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

end of thread, other threads:[~2022-11-09 10:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-27  6:51 [PATCH] pinctrl: core: Make p->state in order in pinctrl_commit_state Maria Yu
2022-10-27  7:24 ` Greg KH
2022-10-27  8:43   ` Aiqun Yu (Maria)
2022-11-08 12:47 ` Linus Walleij
2022-11-08 19:20   ` Paul E. McKenney
2022-11-09 10:01     ` Aiqun(Maria) Yu
2022-10-27  6:54 Maria Yu
2022-11-01  4:30 ` Pavan Kondeti
2022-11-02  1:26   ` Aiqun(Maria) Yu

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.