[PATCH V4] watchdog: mtk: support dual mode when the bark irq is available

2021-04-19 Thread Wang Qing
Support using irq handling wdt bark first instead of directly resetting.

When the watchdog timer expires in Dual mode, an interrupt will be
triggered first, then the timing restarts. The reset signal will be
initiated when the timer expires, to prevent the system is stuck hard.

The dual mode is disabled by default.

V2:
- panic() by default if WATCHDOG_PRETIMEOUT_GOV is not enabled.

V3:
- Modify the pretimeout behavior, manually reset after the pretimeout
- is processed and wait until timeout.

V4:
- Remove pretimeout related processing. 
- Add dual mode control separately.

Signed-off-by: Wang Qing 
---
 drivers/watchdog/mtk_wdt.c | 33 +++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
index 97ca993..a1f34b5
--- a/drivers/watchdog/mtk_wdt.c
+++ b/drivers/watchdog/mtk_wdt.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define WDT_MAX_TIMEOUT31
 #define WDT_MIN_TIMEOUT1
@@ -57,6 +58,7 @@
 
 static bool nowayout = WATCHDOG_NOWAYOUT;
 static unsigned int timeout;
+static bool dual_mode;
 
 struct mtk_wdt_dev {
struct watchdog_device wdt_dev;
@@ -239,13 +241,23 @@ static int mtk_wdt_start(struct watchdog_device *wdt_dev)
return ret;
 
reg = ioread32(wdt_base + WDT_MODE);
-   reg &= ~(WDT_MODE_IRQ_EN | WDT_MODE_DUAL_EN);
+   if (dual_mode)
+   reg |= (WDT_MODE_IRQ_EN | WDT_MODE_DUAL_EN);
+   else
+   reg &= ~(WDT_MODE_IRQ_EN | WDT_MODE_DUAL_EN);
reg |= (WDT_MODE_EN | WDT_MODE_KEY);
iowrite32(reg, wdt_base + WDT_MODE);
 
return 0;
 }
 
+static irqreturn_t mtk_wdt_isr(int irq, void *arg)
+{
+   panic("wdt bark!\n");
+
+   return IRQ_HANDLED;
+}
+
 static const struct watchdog_info mtk_wdt_info = {
.identity   = DRV_NAME,
.options= WDIOF_SETTIMEOUT |
@@ -267,7 +279,7 @@ static int mtk_wdt_probe(struct platform_device *pdev)
struct device *dev = >dev;
struct mtk_wdt_dev *mtk_wdt;
const struct mtk_wdt_data *wdt_data;
-   int err;
+   int err, irq;
 
mtk_wdt = devm_kzalloc(dev, sizeof(*mtk_wdt), GFP_KERNEL);
if (!mtk_wdt)
@@ -279,6 +291,20 @@ static int mtk_wdt_probe(struct platform_device *pdev)
if (IS_ERR(mtk_wdt->wdt_base))
return PTR_ERR(mtk_wdt->wdt_base);
 
+   if (dual_mode) {
+   irq = platform_get_irq(pdev, 0);
+   if (irq > 0) {
+   err = devm_request_irq(>dev, irq, mtk_wdt_isr, 0, 
"wdt_bark",
+   
_wdt->wdt_dev);
+   if (err)
+   return err;
+   } else {
+   dual_mode = 0;
+   dev_err(>dev,
+   "couldn't get wdt irq, set dual_mode = 0\n");
+   }
+   }
+
mtk_wdt->wdt_dev.info = _wdt_info;
mtk_wdt->wdt_dev.ops = _wdt_ops;
mtk_wdt->wdt_dev.timeout = WDT_MAX_TIMEOUT;
@@ -368,6 +394,9 @@ module_param(nowayout, bool, 0);
 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
+module_param(dual_mode, bool, 0);
+MODULE_PARM_DESC(dual_mode, "Watchdog dual mode triggers irq before 
reset(default=0)");
+
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Matthias Brugger ");
 MODULE_DESCRIPTION("Mediatek WatchDog Timer Driver");
-- 
2.7.4



[PATCH V3] watchdog: mtk: support pre-timeout when the bark irq is available

2021-04-14 Thread Wang Qing
Use the bark interrupt as the pretimeout notifier if available.

By default, the pretimeout notification shall occur one second earlier
than the timeout.

V2:
- panic() by default if WATCHDOG_PRETIMEOUT_GOV is not enabled.

V3:
- Modify the pretimeout behavior, manually reset after the pretimeout
- is processed and wait until timeout.

Signed-off-by: Wang Qing 
---
 drivers/watchdog/mtk_wdt.c | 62 ++
 1 file changed, 57 insertions(+), 5 deletions(-)

diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
index 97ca993..7bef1e3
--- a/drivers/watchdog/mtk_wdt.c
+++ b/drivers/watchdog/mtk_wdt.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define WDT_MAX_TIMEOUT31
 #define WDT_MIN_TIMEOUT1
@@ -234,18 +235,46 @@ static int mtk_wdt_start(struct watchdog_device *wdt_dev)
void __iomem *wdt_base = mtk_wdt->wdt_base;
int ret;
 
-   ret = mtk_wdt_set_timeout(wdt_dev, wdt_dev->timeout);
+   ret = mtk_wdt_set_timeout(wdt_dev, wdt_dev->timeout - 
wdt_dev->pretimeout);
if (ret < 0)
return ret;
 
reg = ioread32(wdt_base + WDT_MODE);
-   reg &= ~(WDT_MODE_IRQ_EN | WDT_MODE_DUAL_EN);
+   reg &= ~WDT_MODE_IRQ_EN;
+   if (wdt_dev->pretimeout)
+   reg |= WDT_MODE_IRQ_EN;
+   else
+   reg &= ~WDT_MODE_IRQ_EN;
reg |= (WDT_MODE_EN | WDT_MODE_KEY);
iowrite32(reg, wdt_base + WDT_MODE);
 
return 0;
 }
 
+static int mtk_wdt_set_pretimeout(struct watchdog_device *wdd,
+  unsigned int timeout)
+{
+   wdd->pretimeout = timeout;
+   return mtk_wdt_start(wdd);
+}
+
+static irqreturn_t mtk_wdt_isr(int irq, void *arg)
+{
+   struct watchdog_device *wdd = arg;
+   struct mtk_wdt_dev *mtk_wdt = watchdog_get_drvdata(wdd);
+   void __iomem *wdt_base = mtk_wdt->wdt_base;
+
+   watchdog_notify_pretimeout(wdd);
+   /*
+* Guaranteed to be reset when the timeout
+* expires under any situations
+*/
+   mdelay(1000*wdd->pretimeout);
+   writel(WDT_SWRST_KEY, wdt_base + WDT_SWRST);
+
+   return IRQ_HANDLED;
+}
+
 static const struct watchdog_info mtk_wdt_info = {
.identity   = DRV_NAME,
.options= WDIOF_SETTIMEOUT |
@@ -253,12 +282,21 @@ static const struct watchdog_info mtk_wdt_info = {
  WDIOF_MAGICCLOSE,
 };
 
+static const struct watchdog_info mtk_wdt_pt_info = {
+   .identity   = DRV_NAME,
+   .options= WDIOF_SETTIMEOUT |
+ WDIOF_PRETIMEOUT |
+ WDIOF_KEEPALIVEPING |
+ WDIOF_MAGICCLOSE,
+};
+
 static const struct watchdog_ops mtk_wdt_ops = {
.owner  = THIS_MODULE,
.start  = mtk_wdt_start,
.stop   = mtk_wdt_stop,
.ping   = mtk_wdt_ping,
.set_timeout= mtk_wdt_set_timeout,
+   .set_pretimeout = mtk_wdt_set_pretimeout,
.restart= mtk_wdt_restart,
 };
 
@@ -267,7 +305,7 @@ static int mtk_wdt_probe(struct platform_device *pdev)
struct device *dev = >dev;
struct mtk_wdt_dev *mtk_wdt;
const struct mtk_wdt_data *wdt_data;
-   int err;
+   int err, irq;
 
mtk_wdt = devm_kzalloc(dev, sizeof(*mtk_wdt), GFP_KERNEL);
if (!mtk_wdt)
@@ -279,7 +317,22 @@ static int mtk_wdt_probe(struct platform_device *pdev)
if (IS_ERR(mtk_wdt->wdt_base))
return PTR_ERR(mtk_wdt->wdt_base);
 
-   mtk_wdt->wdt_dev.info = _wdt_info;
+   irq = platform_get_irq(pdev, 0);
+   if (irq > 0) {
+   err = devm_request_irq(>dev, irq, mtk_wdt_isr, 0, 
"wdt_bark",
+   _wdt->wdt_dev);
+   if (err)
+   return err;
+
+   mtk_wdt->wdt_dev.info = _wdt_pt_info;
+   mtk_wdt->wdt_dev.pretimeout = 1;
+   } else {
+   if (irq == -EPROBE_DEFER)
+   return -EPROBE_DEFER;
+
+   mtk_wdt->wdt_dev.info = _wdt_info;
+   }
+
mtk_wdt->wdt_dev.ops = _wdt_ops;
mtk_wdt->wdt_dev.timeout = WDT_MAX_TIMEOUT;
mtk_wdt->wdt_dev.max_hw_heartbeat_ms = WDT_MAX_TIMEOUT * 1000;
@@ -360,7 +413,6 @@ static struct platform_driver mtk_wdt_driver = {
 };
 
 module_platform_driver(mtk_wdt_driver);
-
 module_param(timeout, uint, 0);
 MODULE_PARM_DESC(timeout, "Watchdog heartbeat in seconds");
 
-- 
2.7.4



[PATCH V2] watchdog: mtk: support pre-timeout when the bark irq is available

2021-04-14 Thread Wang Qing
Use the bark interrupt as the pretimeout notifier if available.

By default, the pretimeout notification shall occur one second earlier
than the timeout.

V2:
- panic() by default if WATCHDOG_PRETIMEOUT_GOV is not enabled

Signed-off-by: Wang Qing 
---
 drivers/watchdog/mtk_wdt.c | 57 ++
 1 file changed, 52 insertions(+), 5 deletions(-)

diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
index 97ca993..b0ec933
--- a/drivers/watchdog/mtk_wdt.c
+++ b/drivers/watchdog/mtk_wdt.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define WDT_MAX_TIMEOUT31
 #define WDT_MIN_TIMEOUT1
@@ -234,18 +235,41 @@ static int mtk_wdt_start(struct watchdog_device *wdt_dev)
void __iomem *wdt_base = mtk_wdt->wdt_base;
int ret;
 
-   ret = mtk_wdt_set_timeout(wdt_dev, wdt_dev->timeout);
+   ret = mtk_wdt_set_timeout(wdt_dev, wdt_dev->timeout - 
wdt_dev->pretimeout);
if (ret < 0)
return ret;
 
reg = ioread32(wdt_base + WDT_MODE);
-   reg &= ~(WDT_MODE_IRQ_EN | WDT_MODE_DUAL_EN);
+   reg &= ~WDT_MODE_IRQ_EN;
+   if (wdt_dev->pretimeout)
+   reg |= WDT_MODE_IRQ_EN;
+   else
+   reg &= ~WDT_MODE_IRQ_EN;
reg |= (WDT_MODE_EN | WDT_MODE_KEY);
iowrite32(reg, wdt_base + WDT_MODE);
 
return 0;
 }
 
+static int mtk_wdt_set_pretimeout(struct watchdog_device *wdd,
+  unsigned int timeout)
+{
+   wdd->pretimeout = timeout;
+   return mtk_wdt_start(wdd);
+}
+
+static irqreturn_t mtk_wdt_isr(int irq, void *arg)
+{
+   struct watchdog_device *wdd = arg;
+if (IS_ENABLED(CONFIG_WATCHDOG_PRETIMEOUT_GOV))
+   watchdog_notify_pretimeout(wdd);
+else
+   //panic by decault instead of WDT_SWRST;
+   panic("MTk Watchdog bark!\n");
+
+   return IRQ_HANDLED;
+}
+
 static const struct watchdog_info mtk_wdt_info = {
.identity   = DRV_NAME,
.options= WDIOF_SETTIMEOUT |
@@ -253,12 +277,21 @@ static const struct watchdog_info mtk_wdt_info = {
  WDIOF_MAGICCLOSE,
 };
 
+static const struct watchdog_info mtk_wdt_pt_info = {
+   .identity   = DRV_NAME,
+   .options= WDIOF_SETTIMEOUT |
+ WDIOF_PRETIMEOUT |
+ WDIOF_KEEPALIVEPING |
+ WDIOF_MAGICCLOSE,
+};
+
 static const struct watchdog_ops mtk_wdt_ops = {
.owner  = THIS_MODULE,
.start  = mtk_wdt_start,
.stop   = mtk_wdt_stop,
.ping   = mtk_wdt_ping,
.set_timeout= mtk_wdt_set_timeout,
+   .set_pretimeout = mtk_wdt_set_pretimeout,
.restart= mtk_wdt_restart,
 };
 
@@ -267,7 +300,7 @@ static int mtk_wdt_probe(struct platform_device *pdev)
struct device *dev = >dev;
struct mtk_wdt_dev *mtk_wdt;
const struct mtk_wdt_data *wdt_data;
-   int err;
+   int err, irq;
 
mtk_wdt = devm_kzalloc(dev, sizeof(*mtk_wdt), GFP_KERNEL);
if (!mtk_wdt)
@@ -279,7 +312,22 @@ static int mtk_wdt_probe(struct platform_device *pdev)
if (IS_ERR(mtk_wdt->wdt_base))
return PTR_ERR(mtk_wdt->wdt_base);
 
-   mtk_wdt->wdt_dev.info = _wdt_info;
+   irq = platform_get_irq(pdev, 0);
+   if (irq > 0) {
+   err = devm_request_irq(>dev, irq, mtk_wdt_isr, 0, 
"wdt_bark",
+   
_wdt->wdt_dev);
+   if (err)
+   return err;
+
+   mtk_wdt->wdt_dev.info = _wdt_pt_info;
+   mtk_wdt->wdt_dev.pretimeout = 1;
+   } else {
+   if (irq == -EPROBE_DEFER)
+   return -EPROBE_DEFER;
+
+   mtk_wdt->wdt_dev.info = _wdt_info;
+   }
+
mtk_wdt->wdt_dev.ops = _wdt_ops;
mtk_wdt->wdt_dev.timeout = WDT_MAX_TIMEOUT;
mtk_wdt->wdt_dev.max_hw_heartbeat_ms = WDT_MAX_TIMEOUT * 1000;
@@ -360,7 +408,6 @@ static struct platform_driver mtk_wdt_driver = {
 };
 
 module_platform_driver(mtk_wdt_driver);
-
 module_param(timeout, uint, 0);
 MODULE_PARM_DESC(timeout, "Watchdog heartbeat in seconds");
 
-- 
2.7.4



[PATCH] watchdog: mtk: support pre-timeout when the bark irq is available

2021-04-09 Thread Wang Qing
Use the bark interrupt as the pretimeout notifier if available.

By default, the pretimeout notification shall occur one second earlier
than the timeout.

Signed-off-by: Wang Qing 
---
 drivers/watchdog/mtk_wdt.c | 47 +++---
 1 file changed, 44 insertions(+), 3 deletions(-)

diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
index 97ca993..8b919cc
--- a/drivers/watchdog/mtk_wdt.c
+++ b/drivers/watchdog/mtk_wdt.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define WDT_MAX_TIMEOUT31
 #define WDT_MIN_TIMEOUT1
@@ -234,18 +235,35 @@ static int mtk_wdt_start(struct watchdog_device *wdt_dev)
void __iomem *wdt_base = mtk_wdt->wdt_base;
int ret;
 
-   ret = mtk_wdt_set_timeout(wdt_dev, wdt_dev->timeout);
+   ret = mtk_wdt_set_timeout(wdt_dev, wdt_dev->timeout - 
wdt_dev->pretimeout);
if (ret < 0)
return ret;
 
reg = ioread32(wdt_base + WDT_MODE);
reg &= ~(WDT_MODE_IRQ_EN | WDT_MODE_DUAL_EN);
+   if (wdt_dev->pretimeout)
+   reg |= WDT_MODE_IRQ_EN;
reg |= (WDT_MODE_EN | WDT_MODE_KEY);
iowrite32(reg, wdt_base + WDT_MODE);
 
return 0;
 }
 
+static int mtk_wdt_set_pretimeout(struct watchdog_device *wdd,
+  unsigned int timeout)
+{
+   wdd->pretimeout = timeout;
+   return mtk_wdt_start(wdd);
+}
+
+static irqreturn_t mtk_wdt_isr(int irq, void *arg)
+{
+   struct watchdog_device *wdd = arg;
+   watchdog_notify_pretimeout(wdd);
+
+   return IRQ_HANDLED;
+}
+
 static const struct watchdog_info mtk_wdt_info = {
.identity   = DRV_NAME,
.options= WDIOF_SETTIMEOUT |
@@ -253,12 +271,21 @@ static const struct watchdog_info mtk_wdt_info = {
  WDIOF_MAGICCLOSE,
 };
 
+static const struct watchdog_info mtk_wdt_pt_info = {
+   .identity   = DRV_NAME,
+   .options= WDIOF_SETTIMEOUT |
+ WDIOF_PRETIMEOUT |
+ WDIOF_KEEPALIVEPING |
+ WDIOF_MAGICCLOSE,
+};
+
 static const struct watchdog_ops mtk_wdt_ops = {
.owner  = THIS_MODULE,
.start  = mtk_wdt_start,
.stop   = mtk_wdt_stop,
.ping   = mtk_wdt_ping,
.set_timeout= mtk_wdt_set_timeout,
+   .set_pretimeout = mtk_wdt_set_pretimeout,
.restart= mtk_wdt_restart,
 };
 
@@ -267,7 +294,7 @@ static int mtk_wdt_probe(struct platform_device *pdev)
struct device *dev = >dev;
struct mtk_wdt_dev *mtk_wdt;
const struct mtk_wdt_data *wdt_data;
-   int err;
+   int err,irq;
 
mtk_wdt = devm_kzalloc(dev, sizeof(*mtk_wdt), GFP_KERNEL);
if (!mtk_wdt)
@@ -279,7 +306,21 @@ static int mtk_wdt_probe(struct platform_device *pdev)
if (IS_ERR(mtk_wdt->wdt_base))
return PTR_ERR(mtk_wdt->wdt_base);
 
-   mtk_wdt->wdt_dev.info = _wdt_info;
+   irq = platform_get_irq(pdev, 0);
+   if (irq > 0) {
+   err = devm_request_irq(>dev, irq, mtk_wdt_isr, 0, 
"wdt_bark", _wdt->wdt_dev);
+   if (err)
+   return err;
+
+   mtk_wdt->wdt_dev.info = _wdt_pt_info;
+   mtk_wdt->wdt_dev.pretimeout = 1;
+   } else {
+   if (irq == -EPROBE_DEFER)
+   return -EPROBE_DEFER;
+
+   mtk_wdt->wdt_dev.info = _wdt_info;
+   }
+
mtk_wdt->wdt_dev.ops = _wdt_ops;
mtk_wdt->wdt_dev.timeout = WDT_MAX_TIMEOUT;
mtk_wdt->wdt_dev.max_hw_heartbeat_ms = WDT_MAX_TIMEOUT * 1000;
-- 
2.7.4



[PATCH] softdog: make pretimeout available when SOFT_WATCHDOG_PRETIMEOUT enabled

2021-04-06 Thread Wang Qing
Although softdog supports pretimeout, there is no way to set pretimeout, 
so pretimeout will never be processed in softdog_ping(). 

Here add the configuration mechanism for pretimeout and the default value
is 1 second, so when CONFIG_SOFT_WATCHDOG_PRETIMEOUT is enabled, the 
pretimeout function defaults available.

Signed-off-by: Wang Qing 
---
 drivers/watchdog/softdog.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c
index 7a10962..79e52791
--- a/drivers/watchdog/softdog.c
+++ b/drivers/watchdog/softdog.c
@@ -35,6 +35,14 @@ MODULE_PARM_DESC(soft_margin,
"Watchdog soft_margin in seconds. (0 < soft_margin < 65536, default="
__MODULE_STRING(TIMER_MARGIN) ")");
 
+#ifdef CONFIG_SOFT_WATCHDOG_PRETIMEOUT
+#define PRE_TIMER_MARGIN   1   /* Default is 1 seconds */
+static unsigned int soft_pretimeout = PRE_TIMER_MARGIN;/* in seconds */
+module_param(soft_pretimeout, uint, 0);
+MODULE_PARM_DESC(soft_pretimeout,
+   "Watchdog soft_pretimeout in seconds. (0 < soft_pretimeout < 
soft_margin, default=1)");
+#endif
+
 static bool nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, bool, 0);
 MODULE_PARM_DESC(nowayout,
@@ -177,6 +185,9 @@ static struct watchdog_device softdog_dev = {
.min_timeout = 1,
.max_timeout = 65535,
.timeout = TIMER_MARGIN,
+#ifdef CONFIG_SOFT_WATCHDOG_PRETIMEOUT
+   .pretimeout = PRE_TIMER_MARGIN,
+#endif
 };
 
 static int __init softdog_init(void)
-- 
2.7.4



[PATCH V2 4/4] doc: watchdog: Modify the doc related to "watchdog/%u"

2021-03-31 Thread Wang Qing
"watchdog/%u" threads has be replaced by cpu_stop_work. The current 
description is extremely misleading.
---
 Documentation/admin-guide/sysctl/kernel.rst | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Documentation/admin-guide/sysctl/kernel.rst 
b/Documentation/admin-guide/sysctl/kernel.rst
index 1d56a6b..32b0791
--- a/Documentation/admin-guide/sysctl/kernel.rst
+++ b/Documentation/admin-guide/sysctl/kernel.rst
@@ -1282,11 +1282,11 @@ This parameter can be used to control the soft lockup 
detector.
 = =
 
 The soft lockup detector monitors CPUs for threads that are hogging the CPUs
-without rescheduling voluntarily, and thus prevent the 'watchdog/N' threads
-from running. The mechanism depends on the CPUs ability to respond to timer
-interrupts which are needed for the 'watchdog/N' threads to be woken up by
-the watchdog timer function, otherwise the NMI watchdog — if enabled — can
-detect a hard lockup condition.
+without rescheduling voluntarily, and thus prevent the 'migration/N' threads
+from running, causing the watchdog work fail to execute. The mechanism depends
+on the CPUs ability to respond to timer interrupts which are needed for the
+watchdog work to be queued by the watchdog timer function, otherwise the NMI
+watchdog — if enabled — can detect a hard lockup condition.
 
 
 stack_erasing
-- 
2.7.4



[PATCH V2 3/4] doc: watchdog: Modify the explanation related to watchdog thread

2021-03-31 Thread Wang Qing
"watchdog/%u" threads has be replaced by cpu_stop_work. The current 
description is extremely misleading.

Signed-off-by: Wang Qing 
---
 Documentation/admin-guide/lockup-watchdogs.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/admin-guide/lockup-watchdogs.rst 
b/Documentation/admin-guide/lockup-watchdogs.rst
index 290840c..3e09284
--- a/Documentation/admin-guide/lockup-watchdogs.rst
+++ b/Documentation/admin-guide/lockup-watchdogs.rst
@@ -39,7 +39,7 @@ in principle, they should work in any architecture where these
 subsystems are present.
 
 A periodic hrtimer runs to generate interrupts and kick the watchdog
-task. An NMI perf event is generated every "watchdog_thresh"
+job. An NMI perf event is generated every "watchdog_thresh"
 (compile-time initialized to 10 and configurable through sysctl of the
 same name) seconds to check for hardlockups. If any CPU in the system
 does not receive any hrtimer interrupt during that time the
@@ -47,7 +47,7 @@ does not receive any hrtimer interrupt during that time the
 generate a kernel warning or call panic, depending on the
 configuration.
 
-The watchdog task is a high priority kernel thread that updates a
+The watchdog job runs in a stop scheduling thread that updates a
 timestamp every time it is scheduled. If that timestamp is not updated
 for 2*watchdog_thresh seconds (the softlockup threshold) the
 'softlockup detector' (coded inside the hrtimer callback function)
-- 
2.7.4



[PATCH V2 1/4] kernel: watchdog: Modify the explanation related to watchdog thread

2021-03-31 Thread Wang Qing
The watchdog thread has been replaced by cpu_stop_work, modify the 
explanation related.

Signed-off-by: Wang Qing 
---
 kernel/watchdog.c | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 7110906..d7fb4fb
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -92,7 +92,7 @@ __setup("nmi_watchdog=", hardlockup_panic_setup);
  * own hardlockup detector.
  *
  * watchdog_nmi_enable/disable can be implemented to start and stop when
- * softlockup watchdog threads start and stop. The arch must select the
+ * softlockup watchdog start and stop. The arch must select the
  * SOFTLOCKUP_DETECTOR Kconfig.
  */
 int __weak watchdog_nmi_enable(unsigned int cpu)
@@ -322,7 +322,7 @@ static DEFINE_PER_CPU(struct completion, 
softlockup_completion);
 static DEFINE_PER_CPU(struct cpu_stop_work, softlockup_stop_work);
 
 /*
- * The watchdog thread function - touches the timestamp.
+ * The watchdog feed function - touches the timestamp.
  *
  * It only runs once every sample_period seconds (4 seconds by
  * default) to reset the softlockup timestamp. If this gets delayed
@@ -551,11 +551,7 @@ static void lockup_detector_reconfigure(void)
 }
 
 /*
- * Create the watchdog thread infrastructure and configure the detector(s).
- *
- * The threads are not unparked as watchdog_allowed_mask is empty.  When
- * the threads are successfully initialized, take the proper locks and
- * unpark the threads in the watchdog_cpumask if the watchdog is enabled.
+ * Create the watchdog infrastructure and configure the detector(s).
  */
 static __init void lockup_detector_setup(void)
 {
@@ -621,7 +617,7 @@ void lockup_detector_soft_poweroff(void)
 
 #ifdef CONFIG_SYSCTL
 
-/* Propagate any changes to the watchdog threads */
+/* Propagate any changes to the watchdog infrastructure */
 static void proc_watchdog_update(void)
 {
/* Remove impossible cpus to keep sysctl output clean. */
-- 
2.7.4



[PATCH V2 0/4] kernel/watchdog: Modify the explanation and doc related to watchdog thread

2021-03-31 Thread Wang Qing
"watchdog/%u" threads has be replaced by cpu_stop_work. The current 
description is extremely misleading, so we need to modify the 
explanation and documentation related to this.

Wang Qing (4):
  kernel: watchdog: Modify the explanation related to watchdog thread
  doc: watchdog: Delete the explanation about "watchdog/%u".
  doc: watchdog: Modify the explanation related to watchdog thread
  doc: watchdog: Modify the doc related to "watchdog/%u"

 .../admin-guide/kernel-per-CPU-kthreads.rst  | 20 
 Documentation/admin-guide/lockup-watchdogs.rst   |  4 ++--
 Documentation/admin-guide/sysctl/kernel.rst  | 10 +-
 kernel/watchdog.c| 12 
 4 files changed, 11 insertions(+), 35 deletions(-)

-- 
2.7.4



[PATCH V2 2/4] doc: watchdog: Delete the explanation about "watchdog/%u".

2021-03-31 Thread Wang Qing
"watchdog/%u" threads has be replaced by cpu_stop_work. The current description
is extremely misleading, so delete the explanation about "watchdog/%u".

Signed-off-by: Wang Qing 
---
 .../admin-guide/kernel-per-CPU-kthreads.rst  | 20 
 1 file changed, 20 deletions(-)

diff --git a/Documentation/admin-guide/kernel-per-CPU-kthreads.rst 
b/Documentation/admin-guide/kernel-per-CPU-kthreads.rst
index 531f689..5e51ee5
--- a/Documentation/admin-guide/kernel-per-CPU-kthreads.rst
+++ b/Documentation/admin-guide/kernel-per-CPU-kthreads.rst
@@ -332,23 +332,3 @@ To reduce its OS jitter, do at least one of the following:
kthreads from being created in the first place.  However, please
note that this will not eliminate OS jitter, but will instead
shift it to RCU_SOFTIRQ.
-
-Name:
-  watchdog/%u
-
-Purpose:
-  Detect software lockups on each CPU.
-
-To reduce its OS jitter, do at least one of the following:
-
-1. Build with CONFIG_LOCKUP_DETECTOR=n, which will prevent these
-   kthreads from being created in the first place.
-2. Boot with "nosoftlockup=0", which will also prevent these kthreads
-   from being created.  Other related watchdog and softlockup boot
-   parameters may be found in 
Documentation/admin-guide/kernel-parameters.rst
-   and Documentation/watchdog/watchdog-parameters.rst.
-3. Echo a zero to /proc/sys/kernel/watchdog to disable the
-   watchdog timer.
-4. Echo a large number of /proc/sys/kernel/watchdog_thresh in
-   order to reduce the frequency of OS jitter due to the watchdog
-   timer down to a level that is acceptable for your workload.
-- 
2.7.4



[PATCH 6/6] net/decnet: Delete obsolete TODO file

2021-03-30 Thread Wang Qing
The TODO file here has not been updated from 2005, and the function 
development described in the file have been implemented or abandoned.

Its existence will mislead developers seeking to view outdated information.

Signed-off-by: Wang Qing 
---
 net/decnet/TODO | 40 
 1 file changed, 40 deletions(-)
 delete mode 100644 net/decnet/TODO

diff --git a/net/decnet/TODO b/net/decnet/TODO
deleted file mode 100644
index 358e9eb..000
--- a/net/decnet/TODO
+++ /dev/null
@@ -1,40 +0,0 @@
-Steve's quick list of things that need finishing off:
-[they are in no particular order and range from the trivial to the long winded]
-
- o Proper timeouts on each neighbour (in routing mode) rather than
-   just the 60 second On-Ethernet cache value.
-
- o Support for X.25 linklayer
-
- o Support for DDCMP link layer
-
- o The DDCMP device itself
-
- o PPP support (rfc1762)
-
- o Lots of testing with real applications
-
- o Verify errors etc. against POSIX 1003.1g (draft)
-
- o Using send/recvmsg() to get at connect/disconnect data (POSIX 1003.1g)
-   [maybe this should be done at socket level... the control data in the
-send/recvmsg() calls should simply be a vector of set/getsockopt()
-calls]
-
- o check MSG_CTRUNC is set where it should be.
-
- o Find all the commonality between DECnet and IPv4 routing code and extract
-   it into a small library of routines. [probably a project for 2.7.xx]
-
- o Add perfect socket hashing - an idea suggested by Paul Koning. Currently
-   we have a half-way house scheme which seems to work reasonably well, but
-   the full scheme is still worth implementing, its not not top of my list
-   right now.
-
- o Add session control message flow control
-
- o Add NSP message flow control
-
- o DECnet sendpages() function
-
- o AIO for DECnet
-- 
2.7.4



[PATCH 4/6] fs/jffs2: Delete obsolete TODO file

2021-03-30 Thread Wang Qing
The TODO file here has not been updated for 14 years, and the function 
development described in the file have been implemented or abandoned.

Its existence will mislead developers seeking to view outdated information.

Signed-off-by: Wang Qing 
---
 fs/jffs2/TODO | 37 -
 1 file changed, 37 deletions(-)
 delete mode 100644 fs/jffs2/TODO

diff --git a/fs/jffs2/TODO b/fs/jffs2/TODO
deleted file mode 100644
index ca28964..000
--- a/fs/jffs2/TODO
+++ /dev/null
@@ -1,37 +0,0 @@
-
- - support asynchronous operation -- add a per-fs 'reserved_space' count,
-   let each outstanding write reserve the _maximum_ amount of physical
-   space it could take. Let GC flush the outstanding writes because the
-   reservations will necessarily be pessimistic. With this we could even
-   do shared writable mmap, if we can have a fs hook for do_wp_page() to
-   make the reservation.
- - disable compression in commit_write()?
- - fine-tune the allocation / GC thresholds
- - chattr support - turning on/off and tuning compression per-inode
- - checkpointing (do we need this? scan is quite fast)
- - make the scan code populate real inodes so read_inode just after 
-   mount doesn't have to read the flash twice for large files.
-   Make this a per-inode option, changeable with chattr, so you can
-   decide which inodes should be in-core immediately after mount.
- - test, test, test
-
- - NAND flash support:
-   - almost done :)
-   - use bad block check instead of the hardwired byte check
-
- - Optimisations:
-   - Split writes so they go to two separate blocks rather than just 
c->nextblock.
-   By writing _new_ nodes to one block, and garbage-collected REF_PRISTINE
-   nodes to a different one, we can separate clean nodes from those which
-   are likely to become dirty, and end up with blocks which are each far
-   closer to 100% or 0% clean, hence speeding up later GC progress 
dramatically.
-   - Stop keeping name in-core with struct jffs2_full_dirent. If we keep the 
hash in 
- the full dirent, we only need to go to the flash in lookup() when we 
think we've
- got a match, and in readdir(). 
-   - Doubly-linked next_in_ino list to allow us to free obsoleted 
raw_node_refs immediately?
-   - Remove size from jffs2_raw_node_frag. 
-
-dedekind:
-1. __jffs2_flush_wbuf() has a strange 'pad' parameter. Eliminate.
-2. get_sb()->build_fs()->scan() path... Why get_sb() removes scan()'s crap in
-   case of failure? scan() does not clean everything. Fix.
-- 
2.7.4



[PATCH 5/6] net/ax25: Delete obsolete TODO file

2021-03-30 Thread Wang Qing
The TODO file here has not been updated for 13 years, and the function 
development described in the file have been implemented or abandoned.

Its existence will mislead developers seeking to view outdated information.

Signed-off-by: Wang Qing 
---
 net/ax25/TODO | 20 
 1 file changed, 20 deletions(-)
 delete mode 100644 net/ax25/TODO

diff --git a/net/ax25/TODO b/net/ax25/TODO
deleted file mode 100644
index 69fb4e3..000
--- a/net/ax25/TODO
+++ /dev/null
@@ -1,20 +0,0 @@
-Do the ax25_list_lock, ax25_dev_lock, linkfail_lockreally, ax25_frag_lock and
-listen_lock have to be bh-safe?
-
-Do the netrom and rose locks have to be bh-safe?
-
-A device might be deleted after lookup in the SIOCADDRT ioctl but before it's
-being used.
-
-Routes to a device being taken down might be deleted by ax25_rt_device_down
-but added by somebody else before the device has been deleted fully.
-
-The ax25_rt_find_route synopsys is pervert but I somehow had to deal with
-the race caused by the static variable in it's previous implementation.
-
-Implement proper socket locking in netrom and rose.
-
-Check socket locking when ax25_rcv is sending to raw sockets.  In particular
-ax25_send_to_raw() seems fishy.  Heck - ax25_rcv is fishy.
-
-Handle XID and TEST frames properly.
-- 
2.7.4



[PATCH 2/6] scsi/aacraid: Delete obsolete TODO file

2021-03-30 Thread Wang Qing
The TODO file here has not been updated from 2.6.12 for more than 15 years.
Its existence will mislead developers seeking to view outdated information.

Signed-off-by: Wang Qing 
---
 drivers/scsi/aacraid/TODO | 3 ---
 1 file changed, 3 deletions(-)
 delete mode 100644 drivers/scsi/aacraid/TODO

diff --git a/drivers/scsi/aacraid/TODO b/drivers/scsi/aacraid/TODO
deleted file mode 100644
index 78dc863..000
--- a/drivers/scsi/aacraid/TODO
+++ /dev/null
@@ -1,3 +0,0 @@
-o  Testing
-o  More testing
-o  I/O size increase
-- 
2.7.4



[PATCH 3/6] fs/befs: Delete obsolete TODO file

2021-03-30 Thread Wang Qing
The TODO file here has not been updated from 2005, and the function 
development described in the file have been implemented or abandoned.

Its existence will mislead developers seeking to view outdated information.

Signed-off-by: Wang Qing 
---
 fs/befs/TODO | 14 --
 1 file changed, 14 deletions(-)
 delete mode 100644 fs/befs/TODO

diff --git a/fs/befs/TODO b/fs/befs/TODO
deleted file mode 100644
index 3250921..000
--- a/fs/befs/TODO
+++ /dev/null
@@ -1,14 +0,0 @@
-TODO
-==
-
-* Convert comments to the Kernel-Doc format.
-
-* Befs_fs.h has gotten big and messy. No reason not to break it up into 
-   smaller peices.
-
-* See if Alexander Viro's option parser made it into the kernel tree. 
-   Use that if we can. (include/linux/parser.h)
-
-* See if we really need separate types for on-disk and in-memory 
-   representations of the superblock and inode.
-
-- 
2.7.4



[PATCH 1/6] mips/sgi-ip27: Delete obsolete TODO file

2021-03-30 Thread Wang Qing
The TODO file here has not been updated for 15 years, and the function 
development described in the file have been implemented or abandoned.

Its existence will mislead developers seeking to view outdated information.

Signed-off-by: Wang Qing 
---
 arch/mips/sgi-ip27/TODO | 19 ---
 1 file changed, 19 deletions(-)
 delete mode 100644 arch/mips/sgi-ip27/TODO

diff --git a/arch/mips/sgi-ip27/TODO b/arch/mips/sgi-ip27/TODO
deleted file mode 100644
index 160857ff..000
--- a/arch/mips/sgi-ip27/TODO
+++ /dev/null
@@ -1,19 +0,0 @@
-1. Need to figure out why PCI writes to the IOC3 hang, and if it is okay
-not to write to the IOC3 ever.
-2. Need to figure out RRB allocation in bridge_startup().
-3. Need to figure out why address swaizzling is needed in inw/outw for
-Qlogic scsi controllers.
-4. Need to integrate ip27-klconfig.c:find_lboard and
-ip27-init.c:find_lbaord_real. DONE
-5. Is it okay to set calias space on all nodes as 0, instead of 8k as
-in irix?
-6. Investigate why things do not work without the setup_test() call
-being invoked on all nodes in ip27-memory.c.
-8. Too many do_page_faults invoked - investigate.
-9. start_thread must turn off UX64 ... and define tlb_refill_debug.
-10. Need a bad pmd table, bad pte table. __bad_pmd_table/__bad_pagetable
-does not agree with pgd_bad/pmd_bad.
-11. All intrs (ip27_do_irq handlers) are targeted at cpu A on the node.
-This might need to change later. Only the timer intr is set up to be
-received on both Cpu A and B. (ip27_do_irq()/bridge_startup())
-13. Cache flushing (specially the SMP version) has to be investigated.
-- 
2.7.4



[PATCH 0/6] Clean up obsolete TODO files

2021-03-30 Thread Wang Qing
It is mentioned in the official documents of the Linux Foundation and WIKI 
that you can participate in its development according to the TODO files of 
each module.

But the TODO files here has not been updated for 15 years, and the function 
development described in the file have been implemented or abandoned.

Its existence will mislead developers seeking to view outdated information.

Wang Qing (6):
  mips/sgi-ip27: Delete obsolete TODO file
  scsi/aacraid: Delete obsolete TODO file
  fs/befs: Delete obsolete TODO file
  fs/jffs2: Delete obsolete TODO file
  net/ax25: Delete obsolete TODO file
  net/decnet: Delete obsolete TODO file

 arch/mips/sgi-ip27/TODO   | 19 ---
 drivers/scsi/aacraid/TODO |  3 ---
 fs/befs/TODO  | 14 --
 fs/jffs2/TODO | 37 -
 net/ax25/TODO | 20 
 net/decnet/TODO   | 40 
 6 files changed, 133 deletions(-)
 delete mode 100644 arch/mips/sgi-ip27/TODO
 delete mode 100644 drivers/scsi/aacraid/TODO
 delete mode 100644 fs/befs/TODO
 delete mode 100644 fs/jffs2/TODO
 delete mode 100644 net/ax25/TODO
 delete mode 100644 net/decnet/TODO

-- 
2.7.4



[PATCH V3,RESEND] workqueue/watchdog: Make unbound workqueues aware of touch_softlockup_watchdog()

2021-03-24 Thread Wang Qing
There are two workqueue-specific watchdog timestamps:

+ @wq_watchdog_touched_cpu (per-CPU) updated by
  touch_softlockup_watchdog()

+ @wq_watchdog_touched (global) updated by
  touch_all_softlockup_watchdogs()

watchdog_timer_fn() checks only the global @wq_watchdog_touched for
unbound workqueues. As a result, unbound workqueues are not aware
of touch_softlockup_watchdog(). The watchdog might report a stall
even when the unbound workqueues are blocked by a known slow code.

Solution:
touch_softlockup_watchdog() must touch also the global @wq_watchdog_touched 
timestamp.

The global timestamp can not longer be used for bound workqueues
because it is updated on all CPUs. Instead, bound workqueues
have to check only @wq_watchdog_touched_cpu and these timestamp
has to be updated for all CPUs in touch_all_softlockup_watchdogs().

Beware:
The change might cause the opposite problem. An unbound workqueue
might get blocked on CPU A because of a real softlockup. The workqueue
watchdog would miss it when the timestamp got touched on CPU B.

It is acceptable because softlockups are detected by softlockup
watchdog. The workqueue watchdog is there to detect stalls where
a work never finishes, for example, because of dependencies of works
queued into the same workqueue.

V3:
- Modify the commit message clearly according to Petr's suggestion.

Signed-off-by: Wang Qing 
---
 kernel/watchdog.c  |  5 +++--
 kernel/workqueue.c | 17 ++---
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 7110906..107bc38
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -278,9 +278,10 @@ void touch_all_softlockup_watchdogs(void)
 * update as well, the only side effect might be a cycle delay for
 * the softlockup check.
 */
-   for_each_cpu(cpu, _allowed_mask)
+   for_each_cpu(cpu, _allowed_mask) {
per_cpu(watchdog_touch_ts, cpu) = SOFTLOCKUP_RESET;
-   wq_watchdog_touch(-1);
+   wq_watchdog_touch(cpu);
+   }
 }
 
 void touch_softlockup_watchdog_sync(void)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 0d150da..be08295
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5787,22 +5787,17 @@ static void wq_watchdog_timer_fn(struct timer_list 
*unused)
continue;
 
/* get the latest of pool and touched timestamps */
+   if (pool->cpu >= 0)
+   touched = READ_ONCE(per_cpu(wq_watchdog_touched_cpu, 
pool->cpu));
+   else
+   touched = READ_ONCE(wq_watchdog_touched);
pool_ts = READ_ONCE(pool->watchdog_ts);
-   touched = READ_ONCE(wq_watchdog_touched);
 
if (time_after(pool_ts, touched))
ts = pool_ts;
else
ts = touched;
 
-   if (pool->cpu >= 0) {
-   unsigned long cpu_touched =
-   READ_ONCE(per_cpu(wq_watchdog_touched_cpu,
- pool->cpu));
-   if (time_after(cpu_touched, ts))
-   ts = cpu_touched;
-   }
-
/* did we stall? */
if (time_after(jiffies, ts + thresh)) {
lockup_detected = true;
@@ -5826,8 +5821,8 @@ notrace void wq_watchdog_touch(int cpu)
 {
if (cpu >= 0)
per_cpu(wq_watchdog_touched_cpu, cpu) = jiffies;
-   else
-   wq_watchdog_touched = jiffies;
+
+   wq_watchdog_touched = jiffies;
 }
 
 static void wq_watchdog_set_thresh(unsigned long thresh)
-- 
2.7.4



[PATCH V3] workqueue/watchdog: Make unbound workqueues aware of

2021-03-24 Thread Wang Qing
There are two workqueue-specific watchdog timestamps:

+ @wq_watchdog_touched_cpu (per-CPU) updated by
  touch_softlockup_watchdog()

+ @wq_watchdog_touched (global) updated by
  touch_all_softlockup_watchdogs()

watchdog_timer_fn() checks only the global @wq_watchdog_touched for
unbound workqueues. As a result, unbound workqueues are not aware
of touch_softlockup_watchdog(). The watchdog might report a stall
even when the unbound workqueues are blocked by a known slow code.

Solution:
touch_softlockup_watchdog() must touch also the global @wq_watchdog_touched 
timestamp.

The global timestamp can not longer be used for bound workqueues
because it is updated on all CPUs. Instead, bound workqueues
have to check only @wq_watchdog_touched_cpu and these timestamp
has to be updated for all CPUs in touch_all_softlockup_watchdogs().

Beware:
The change might cause the opposite problem. An unbound workqueue
might get blocked on CPU A because of a real softlockup. The workqueue
watchdog would miss it when the timestamp got touched on CPU B.

It is acceptable because softlockups are detected by softlockup
watchdog. The workqueue watchdog is there to detect stalls where
a work never finishes, for example, because of dependencies of works
queued into the same workqueue.

V3:
- Modify the commit message clearly according to Petr's suggestion.

Signed-off-by: Wang Qing 
---
 kernel/watchdog.c  |  5 +++--
 kernel/workqueue.c | 17 ++---
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 7110906..107bc38
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -278,9 +278,10 @@ void touch_all_softlockup_watchdogs(void)
 * update as well, the only side effect might be a cycle delay for
 * the softlockup check.
 */
-   for_each_cpu(cpu, _allowed_mask)
+   for_each_cpu(cpu, _allowed_mask) {
per_cpu(watchdog_touch_ts, cpu) = SOFTLOCKUP_RESET;
-   wq_watchdog_touch(-1);
+   wq_watchdog_touch(cpu);
+   }
 }
 
 void touch_softlockup_watchdog_sync(void)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 0d150da..be08295
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5787,22 +5787,17 @@ static void wq_watchdog_timer_fn(struct timer_list 
*unused)
continue;
 
/* get the latest of pool and touched timestamps */
+   if (pool->cpu >= 0)
+   touched = READ_ONCE(per_cpu(wq_watchdog_touched_cpu, 
pool->cpu));
+   else
+   touched = READ_ONCE(wq_watchdog_touched);
pool_ts = READ_ONCE(pool->watchdog_ts);
-   touched = READ_ONCE(wq_watchdog_touched);
 
if (time_after(pool_ts, touched))
ts = pool_ts;
else
ts = touched;
 
-   if (pool->cpu >= 0) {
-   unsigned long cpu_touched =
-   READ_ONCE(per_cpu(wq_watchdog_touched_cpu,
- pool->cpu));
-   if (time_after(cpu_touched, ts))
-   ts = cpu_touched;
-   }
-
/* did we stall? */
if (time_after(jiffies, ts + thresh)) {
lockup_detected = true;
@@ -5826,8 +5821,8 @@ notrace void wq_watchdog_touch(int cpu)
 {
if (cpu >= 0)
per_cpu(wq_watchdog_touched_cpu, cpu) = jiffies;
-   else
-   wq_watchdog_touched = jiffies;
+
+   wq_watchdog_touched = jiffies;
 }
 
 static void wq_watchdog_set_thresh(unsigned long thresh)
-- 
2.7.4



[PATCH] Modify the explanation and documentation related to watchdog thread

2021-03-23 Thread Wang Qing
"watchdog/%u" threads has be replaced by cpu_stop_work, So we need to modify 
the explanation and documentation related to this.

Signed-off-by: Wang Qing 
---
 .../admin-guide/kernel-per-CPU-kthreads.rst  | 20 
 kernel/watchdog.c| 12 
 2 files changed, 4 insertions(+), 28 deletions(-)

diff --git a/Documentation/admin-guide/kernel-per-CPU-kthreads.rst 
b/Documentation/admin-guide/kernel-per-CPU-kthreads.rst
index 531f689..5e51ee5
--- a/Documentation/admin-guide/kernel-per-CPU-kthreads.rst
+++ b/Documentation/admin-guide/kernel-per-CPU-kthreads.rst
@@ -332,23 +332,3 @@ To reduce its OS jitter, do at least one of the following:
kthreads from being created in the first place.  However, please
note that this will not eliminate OS jitter, but will instead
shift it to RCU_SOFTIRQ.
-
-Name:
-  watchdog/%u
-
-Purpose:
-  Detect software lockups on each CPU.
-
-To reduce its OS jitter, do at least one of the following:
-
-1. Build with CONFIG_LOCKUP_DETECTOR=n, which will prevent these
-   kthreads from being created in the first place.
-2. Boot with "nosoftlockup=0", which will also prevent these kthreads
-   from being created.  Other related watchdog and softlockup boot
-   parameters may be found in 
Documentation/admin-guide/kernel-parameters.rst
-   and Documentation/watchdog/watchdog-parameters.rst.
-3. Echo a zero to /proc/sys/kernel/watchdog to disable the
-   watchdog timer.
-4. Echo a large number of /proc/sys/kernel/watchdog_thresh in
-   order to reduce the frequency of OS jitter due to the watchdog
-   timer down to a level that is acceptable for your workload.
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 7110906..d7fb4fb
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -92,7 +92,7 @@ __setup("nmi_watchdog=", hardlockup_panic_setup);
  * own hardlockup detector.
  *
  * watchdog_nmi_enable/disable can be implemented to start and stop when
- * softlockup watchdog threads start and stop. The arch must select the
+ * softlockup watchdog start and stop. The arch must select the
  * SOFTLOCKUP_DETECTOR Kconfig.
  */
 int __weak watchdog_nmi_enable(unsigned int cpu)
@@ -322,7 +322,7 @@ static DEFINE_PER_CPU(struct completion, 
softlockup_completion);
 static DEFINE_PER_CPU(struct cpu_stop_work, softlockup_stop_work);
 
 /*
- * The watchdog thread function - touches the timestamp.
+ * The watchdog feed function - touches the timestamp.
  *
  * It only runs once every sample_period seconds (4 seconds by
  * default) to reset the softlockup timestamp. If this gets delayed
@@ -551,11 +551,7 @@ static void lockup_detector_reconfigure(void)
 }
 
 /*
- * Create the watchdog thread infrastructure and configure the detector(s).
- *
- * The threads are not unparked as watchdog_allowed_mask is empty.  When
- * the threads are successfully initialized, take the proper locks and
- * unpark the threads in the watchdog_cpumask if the watchdog is enabled.
+ * Create the watchdog infrastructure and configure the detector(s).
  */
 static __init void lockup_detector_setup(void)
 {
@@ -621,7 +617,7 @@ void lockup_detector_soft_poweroff(void)
 
 #ifdef CONFIG_SYSCTL
 
-/* Propagate any changes to the watchdog threads */
+/* Propagate any changes to the watchdog infrastructure */
 static void proc_watchdog_update(void)
 {
/* Remove impossible cpus to keep sysctl output clean. */
-- 
2.7.4



[PATCH V2] workqueue: watchdog: update wq_watchdog_touched for unbound lockup checking

2021-03-19 Thread Wang Qing
When touch_softlockup_watchdog() is called, only wq_watchdog_touched_cpu 
updated, while the unbound worker_pool running on its core uses 
wq_watchdog_touched to determine whether locked up. This may be mischecked.

My suggestion is to update both when touch_softlockup_watchdog() is called, 
use wq_watchdog_touched_cpu to check bound, and use wq_watchdog_touched 
to check unbound worker_pool.

Signed-off-by: Wang Qing 
---
 kernel/watchdog.c  |  5 +++--
 kernel/workqueue.c | 17 ++---
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index 7110906..107bc38
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -278,9 +278,10 @@ void touch_all_softlockup_watchdogs(void)
 * update as well, the only side effect might be a cycle delay for
 * the softlockup check.
 */
-   for_each_cpu(cpu, _allowed_mask)
+   for_each_cpu(cpu, _allowed_mask) {
per_cpu(watchdog_touch_ts, cpu) = SOFTLOCKUP_RESET;
-   wq_watchdog_touch(-1);
+   wq_watchdog_touch(cpu);
+   }
 }
 
 void touch_softlockup_watchdog_sync(void)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 0d150da..be08295
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5787,22 +5787,17 @@ static void wq_watchdog_timer_fn(struct timer_list 
*unused)
continue;
 
/* get the latest of pool and touched timestamps */
+   if (pool->cpu >= 0)
+   touched = READ_ONCE(per_cpu(wq_watchdog_touched_cpu, 
pool->cpu));
+   else
+   touched = READ_ONCE(wq_watchdog_touched);
pool_ts = READ_ONCE(pool->watchdog_ts);
-   touched = READ_ONCE(wq_watchdog_touched);
 
if (time_after(pool_ts, touched))
ts = pool_ts;
else
ts = touched;
 
-   if (pool->cpu >= 0) {
-   unsigned long cpu_touched =
-   READ_ONCE(per_cpu(wq_watchdog_touched_cpu,
- pool->cpu));
-   if (time_after(cpu_touched, ts))
-   ts = cpu_touched;
-   }
-
/* did we stall? */
if (time_after(jiffies, ts + thresh)) {
lockup_detected = true;
@@ -5826,8 +5821,8 @@ notrace void wq_watchdog_touch(int cpu)
 {
if (cpu >= 0)
per_cpu(wq_watchdog_touched_cpu, cpu) = jiffies;
-   else
-   wq_watchdog_touched = jiffies;
+
+   wq_watchdog_touched = jiffies;
 }
 
 static void wq_watchdog_set_thresh(unsigned long thresh)
-- 
2.7.4



[PATCH] workqueue: update wq_watchdog_touched for unbound lockup checking

2021-03-19 Thread Wang Qing
When touch_softlockup_watchdog() is called, only wq_watchdog_touched_cpu 
updated, while the unbound worker_pool running on its core uses 
wq_watchdog_touched to determine whether locked up. This may be mischecked.

My suggestion is to update both when touch_softlockup_watchdog() is called, 
use wq_watchdog_touched_cpu to check bound, and use wq_watchdog_touched 
to check unbound worker_pool.

Signed-off-by: Wang Qing 
---
 kernel/workqueue.c | 17 ++---
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 0d150da..be08295
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5787,22 +5787,17 @@ static void wq_watchdog_timer_fn(struct timer_list 
*unused)
continue;
 
/* get the latest of pool and touched timestamps */
+   if (pool->cpu >= 0)
+   touched = READ_ONCE(per_cpu(wq_watchdog_touched_cpu, 
pool->cpu));
+   else
+   touched = READ_ONCE(wq_watchdog_touched);
pool_ts = READ_ONCE(pool->watchdog_ts);
-   touched = READ_ONCE(wq_watchdog_touched);
 
if (time_after(pool_ts, touched))
ts = pool_ts;
else
ts = touched;
 
-   if (pool->cpu >= 0) {
-   unsigned long cpu_touched =
-   READ_ONCE(per_cpu(wq_watchdog_touched_cpu,
- pool->cpu));
-   if (time_after(cpu_touched, ts))
-   ts = cpu_touched;
-   }
-
/* did we stall? */
if (time_after(jiffies, ts + thresh)) {
lockup_detected = true;
@@ -5826,8 +5821,8 @@ notrace void wq_watchdog_touch(int cpu)
 {
if (cpu >= 0)
per_cpu(wq_watchdog_touched_cpu, cpu) = jiffies;
-   else
-   wq_watchdog_touched = jiffies;
+
+   wq_watchdog_touched = jiffies;
 }
 
 static void wq_watchdog_set_thresh(unsigned long thresh)
-- 
2.7.4



[PATCH] futex: use wake_up_process() instead of wake_up_state()

2021-03-18 Thread Wang Qing
Using wake_up_process() is more simpler and friendly, 
and it is more convenient for analysis and statistics

Signed-off-by: Wang Qing 
---
 kernel/futex.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/futex.c b/kernel/futex.c
index e68db77..078a1f9
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1820,7 +1820,7 @@ void requeue_pi_wake_futex(struct futex_q *q, union 
futex_key *key,
 
q->lock_ptr = >lock;
 
-   wake_up_state(q->task, TASK_NORMAL);
+   wake_up_process(q->task);
 }
 
 /**
-- 
2.7.4



[PATCH] dma-buf: use wake_up_process() instead of wake_up_state()

2021-03-18 Thread Wang Qing
Using wake_up_process() is more simpler and friendly, 
and it is more convenient for analysis and statistics

Signed-off-by: Wang Qing 
---
 drivers/dma-buf/dma-fence.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
index 7475e09..de51326
--- a/drivers/dma-buf/dma-fence.c
+++ b/drivers/dma-buf/dma-fence.c
@@ -655,7 +655,7 @@ dma_fence_default_wait_cb(struct dma_fence *fence, struct 
dma_fence_cb *cb)
struct default_wait_cb *wait =
container_of(cb, struct default_wait_cb, base);
 
-   wake_up_state(wait->task, TASK_NORMAL);
+   wake_up_process(wait->task);
 }
 
 /**
-- 
2.7.4



[PATCH] sched: rename __prepare_to_swait() to add_swait_queue_locked()

2021-03-16 Thread Wang Qing
This function just puts wait into queue, and does not do an operation similar 
to prepare_to_wait() in wait.c. 
And during the operation, the caller needs to hold the lock to protect.

Signed-off-by: Wang Qing 
---
 kernel/sched/completion.c | 2 +-
 kernel/sched/sched.h  | 2 +-
 kernel/sched/swait.c  | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/kernel/sched/completion.c b/kernel/sched/completion.c
index a778554..3d28a5a
--- a/kernel/sched/completion.c
+++ b/kernel/sched/completion.c
@@ -79,7 +79,7 @@ do_wait_for_common(struct completion *x,
timeout = -ERESTARTSYS;
break;
}
-   __prepare_to_swait(>wait, );
+   add_swait_queue_locked(>wait, );
__set_current_state(state);
raw_spin_unlock_irq(>wait.lock);
timeout = action(timeout);
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 10a1522..0516f50
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -2719,4 +2719,4 @@ static inline bool is_per_cpu_kthread(struct task_struct 
*p)
 #endif
 
 void swake_up_all_locked(struct swait_queue_head *q);
-void __prepare_to_swait(struct swait_queue_head *q, struct swait_queue *wait);
+void add_swait_queue_locked(struct swait_queue_head *q, struct swait_queue 
*wait);
diff --git a/kernel/sched/swait.c b/kernel/sched/swait.c
index 7a24925..f48a544
--- a/kernel/sched/swait.c
+++ b/kernel/sched/swait.c
@@ -82,7 +82,7 @@ void swake_up_all(struct swait_queue_head *q)
 }
 EXPORT_SYMBOL(swake_up_all);
 
-void __prepare_to_swait(struct swait_queue_head *q, struct swait_queue *wait)
+void add_swait_queue_locked(struct swait_queue_head *q, struct swait_queue 
*wait)
 {
wait->task = current;
if (list_empty(>task_list))
@@ -94,7 +94,7 @@ void prepare_to_swait_exclusive(struct swait_queue_head *q, 
struct swait_queue *
unsigned long flags;
 
raw_spin_lock_irqsave(>lock, flags);
-   __prepare_to_swait(q, wait);
+   add_swait_queue_locked(q, wait);
set_current_state(state);
raw_spin_unlock_irqrestore(>lock, flags);
 }
@@ -114,7 +114,7 @@ long prepare_to_swait_event(struct swait_queue_head *q, 
struct swait_queue *wait
list_del_init(>task_list);
ret = -ERESTARTSYS;
} else {
-   __prepare_to_swait(q, wait);
+   add_swait_queue_locked(q, wait);
set_current_state(state);
}
raw_spin_unlock_irqrestore(>lock, flags);
-- 
2.7.4



[PATCH] sched: swait: use wake_up_process() instead of wake_up_state()

2021-03-16 Thread Wang Qing
Why not just use wake_up_process().

Signed-off-by: Wang Qing 
---
 kernel/sched/swait.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/swait.c b/kernel/sched/swait.c
index e1c655f..7a24925
--- a/kernel/sched/swait.c
+++ b/kernel/sched/swait.c
@@ -69,7 +69,7 @@ void swake_up_all(struct swait_queue_head *q)
while (!list_empty()) {
curr = list_first_entry(, typeof(*curr), task_list);
 
-   wake_up_state(curr->task, TASK_NORMAL);
+   wake_up_process(curr->task);
list_del_init(>task_list);
 
if (list_empty())
-- 
2.7.4



[PATCH] sched: completion: Reinterpret the meaning of completion_done()

2021-03-16 Thread Wang Qing
The most intuitive meaning of completion_done() is to see if a completion has 
been done, done=0 can only indicate that someone may be waiting.

Signed-off-by: Wang Qing 
---
 kernel/sched/completion.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/completion.c b/kernel/sched/completion.c
index a778554f9dad..c8ea7575cc41
--- a/kernel/sched/completion.c
+++ b/kernel/sched/completion.c
@@ -304,10 +304,10 @@ bool try_wait_for_completion(struct completion *x)
 EXPORT_SYMBOL(try_wait_for_completion);
 
 /**
- * completion_done - Test to see if a completion has any waiters
+ * completion_done - Test to see if a completion has been done
  * @x: completion structure
  *
- * Return: 0 if there are waiters (wait_for_completion() in progress)
+ * Return: 0 if there may be waiters (wait_for_completion() in progress)
  *  1 if there are no waiters.
  *
  * Note, this will always return true if complete_all() was called on @X.
-- 
2.27.0



[PATCH] doc: admin-guide: remove explanation of "watchdog/%u"

2021-03-15 Thread Wang Qing
"watchdog/%u" threads has be replaced by cpu_stop_work, 
which will mislead the reader.

Signed-off-by: Wang Qing 
---
 .../admin-guide/kernel-per-CPU-kthreads.rst  | 20 
 1 file changed, 20 deletions(-)

diff --git a/Documentation/admin-guide/kernel-per-CPU-kthreads.rst 
b/Documentation/admin-guide/kernel-per-CPU-kthreads.rst
index 531f689..5e51ee5
--- a/Documentation/admin-guide/kernel-per-CPU-kthreads.rst
+++ b/Documentation/admin-guide/kernel-per-CPU-kthreads.rst
@@ -332,23 +332,3 @@ To reduce its OS jitter, do at least one of the following:
kthreads from being created in the first place.  However, please
note that this will not eliminate OS jitter, but will instead
shift it to RCU_SOFTIRQ.
-
-Name:
-  watchdog/%u
-
-Purpose:
-  Detect software lockups on each CPU.
-
-To reduce its OS jitter, do at least one of the following:
-
-1. Build with CONFIG_LOCKUP_DETECTOR=n, which will prevent these
-   kthreads from being created in the first place.
-2. Boot with "nosoftlockup=0", which will also prevent these kthreads
-   from being created.  Other related watchdog and softlockup boot
-   parameters may be found in 
Documentation/admin-guide/kernel-parameters.rst
-   and Documentation/watchdog/watchdog-parameters.rst.
-3. Echo a zero to /proc/sys/kernel/watchdog to disable the
-   watchdog timer.
-4. Echo a large number of /proc/sys/kernel/watchdog_thresh in
-   order to reduce the frequency of OS jitter due to the watchdog
-   timer down to a level that is acceptable for your workload.
-- 
2.7.4


[PATCH V3] ata: sata_highbank: delete redundant print and fix return value

2021-03-14 Thread Wang Qing
platform_get_irq() has already checked and printed the return value, 
the printing here is nothing special, and should corrected to < 0.

Also, thhe return value should return a real error.

Signed-off-by: Wang Qing 
---
 drivers/ata/sata_highbank.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/ata/sata_highbank.c b/drivers/ata/sata_highbank.c
index 64b2ef1..4438ee6
--- a/drivers/ata/sata_highbank.c
+++ b/drivers/ata/sata_highbank.c
@@ -469,10 +469,8 @@ static int ahci_highbank_probe(struct platform_device 
*pdev)
}
 
irq = platform_get_irq(pdev, 0);
-   if (irq <= 0) {
-   dev_err(dev, "no irq\n");
-   return -EINVAL;
-   }
+   if (irq < 0)
+   return irq;
 
hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL);
if (!hpriv) {
-- 
2.7.4



[PATCH V2] ata: sata_highbank: delete redundant print and fix return value

2021-03-14 Thread Wang Qing
platform_get_irq() has already checked and printed the return value, 
the printing here is nothing special, and should corrected to < 0.

Also, thhe return value should return a real error.

Signed-off-by: Wang Qing 
---
 drivers/ata/sata_highbank.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/ata/sata_highbank.c b/drivers/ata/sata_highbank.c
index 64b2ef1..a43d42a
--- a/drivers/ata/sata_highbank.c
+++ b/drivers/ata/sata_highbank.c
@@ -469,10 +469,8 @@ static int ahci_highbank_probe(struct platform_device 
*pdev)
}
 
irq = platform_get_irq(pdev, 0);
-   if (irq <= 0) {
-   dev_err(dev, "no irq\n");
+   if (irq < 0)
return irq;
-   }
 
hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL);
if (!hpriv) {
-- 
2.7.4



[PATCH] sound: soc: fsl: Remove unnecessary THIS_MODULE

2021-03-13 Thread Wang Qing
As THIS_MODULE has been set in module_platform_driver(), so remove it.

Signed-off-by: Wang Qing 
---
 sound/soc/fsl/imx-hdmi.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sound/soc/fsl/imx-hdmi.c b/sound/soc/fsl/imx-hdmi.c
index dbbb761..cd0235a
--- a/sound/soc/fsl/imx-hdmi.c
+++ b/sound/soc/fsl/imx-hdmi.c
@@ -223,7 +223,6 @@ MODULE_DEVICE_TABLE(of, imx_hdmi_dt_ids);
 static struct platform_driver imx_hdmi_driver = {
.driver = {
.name = "imx-hdmi",
-   .owner = THIS_MODULE,
.pm = _soc_pm_ops,
.of_match_table = imx_hdmi_dt_ids,
},
-- 
2.7.4



[PATCH] sound: soc: codecs: Remove unnecessary THIS_MODULE

2021-03-13 Thread Wang Qing
As THIS_MODULE has been set in module_platform_driver(), so remove it.

Signed-off-by: Wang Qing 
---
 sound/soc/codecs/lpass-rx-macro.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sound/soc/codecs/lpass-rx-macro.c 
b/sound/soc/codecs/lpass-rx-macro.c
index c9c21d22..5b9d4e9
--- a/sound/soc/codecs/lpass-rx-macro.c
+++ b/sound/soc/codecs/lpass-rx-macro.c
@@ -3585,7 +3585,6 @@ static const struct of_device_id rx_macro_dt_match[] = {
 static struct platform_driver rx_macro_driver = {
.driver = {
.name = "rx_macro",
-   .owner = THIS_MODULE,
.of_match_table = rx_macro_dt_match,
.suppress_bind_attrs = true,
},
-- 
2.7.4



[PATCH] mailbox: Remove unnecessary THIS_MODULE

2021-03-13 Thread Wang Qing
As THIS_MODULE has been set in platform_create_bundle(), so remove it.

Signed-off-by: Wang Qing 
---
 drivers/mailbox/pcc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c
index ef9ecd1..4b1a2d2
--- a/drivers/mailbox/pcc.c
+++ b/drivers/mailbox/pcc.c
@@ -577,7 +577,6 @@ static struct platform_driver pcc_mbox_driver = {
.probe = pcc_mbox_probe,
.driver = {
.name = "PCCT",
-   .owner = THIS_MODULE,
},
 };
 
-- 
2.7.4



[PATCH] gpu: drm: mediatek: delete redundant printing of return value

2021-03-12 Thread Wang Qing
platform_get_irq() has already checked and printed the return value, 
the printing here is nothing special, it is not necessary at all.

Signed-off-by: Wang Qing 
---
 drivers/gpu/drm/mediatek/mtk_dpi.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c 
b/drivers/gpu/drm/mediatek/mtk_dpi.c
index b05f900..0ac4962
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -751,10 +751,8 @@ static int mtk_dpi_probe(struct platform_device *pdev)
}
 
dpi->irq = platform_get_irq(pdev, 0);
-   if (dpi->irq <= 0) {
-   dev_err(dev, "Failed to get irq: %d\n", dpi->irq);
+   if (dpi->irq <= 0)
return -EINVAL;
-   }
 
ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0,
  NULL, >next_bridge);
-- 
2.7.4



[PATCH] tty: serial: 8250: delete redundant printing of return value

2021-03-12 Thread Wang Qing
platform_get_irq() has already checked and printed the return value, 
the printing here is nothing special, it is not necessary at all.

Signed-off-by: Wang Qing 
---
 drivers/tty/serial/8250/8250_fsl.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_fsl.c 
b/drivers/tty/serial/8250/8250_fsl.c
index fbcc90c..cd19400
--- a/drivers/tty/serial/8250/8250_fsl.c
+++ b/drivers/tty/serial/8250/8250_fsl.c
@@ -104,11 +104,8 @@ static int fsl8250_acpi_probe(struct platform_device *pdev)
}
 
irq = platform_get_irq(pdev, 0);
-   if (irq < 0) {
-   if (irq != -EPROBE_DEFER)
-   dev_err(dev, "cannot get irq\n");
+   if (irq < 0)
return irq;
-   }
 
memset(, 0, sizeof(port8250));
 
-- 
2.7.4



[PATCH] char: hw_random: delete redundant printing of return value

2021-03-12 Thread Wang Qing
platform_get_irq() has already checked and printed the return value, 
the printing here is nothing special, it is not necessary at all.

Signed-off-by: Wang Qing 
---
 drivers/char/hw_random/cctrng.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/char/hw_random/cctrng.c b/drivers/char/hw_random/cctrng.c
index 7a293f2..1e551e3
--- a/drivers/char/hw_random/cctrng.c
+++ b/drivers/char/hw_random/cctrng.c
@@ -527,10 +527,8 @@ static int cctrng_probe(struct platform_device *pdev)
 
/* Then IRQ */
irq = platform_get_irq(pdev, 0);
-   if (irq < 0) {
-   dev_err(dev, "Failed getting IRQ resource\n");
+   if (irq < 0)
return irq;
-   }
 
/* parse sampling rate from device tree */
rc = cc_trng_parse_sampling_ratio(drvdata);
-- 
2.7.4



[PATCH 1/2] ata: delete redundant printing of return value

2021-03-12 Thread Wang Qing
platform_get_irq() has already checked and printed the return value, 
the printing here is nothing special, it is not necessary at all.

Signed-off-by: Wang Qing 
---
 drivers/ata/sata_highbank.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/ata/sata_highbank.c b/drivers/ata/sata_highbank.c
index 64b2ef1..a43d42a
--- a/drivers/ata/sata_highbank.c
+++ b/drivers/ata/sata_highbank.c
@@ -469,10 +469,8 @@ static int ahci_highbank_probe(struct platform_device 
*pdev)
}
 
irq = platform_get_irq(pdev, 0);
-   if (irq <= 0) {
-   dev_err(dev, "no irq\n");
+   if (irq <= 0)
return -EINVAL;
-   }
 
hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL);
if (!hpriv) {
-- 
2.7.4



[PATCH 1/2] ata: delete redundant printing of return value

2021-03-12 Thread Wang Qing
platform_get_irq() has already checked and printed the return value, 
the printing here is nothing special, it is not necessary at all.

Signed-off-by: Wang Qing 
---
 drivers/ata/libahci_platform.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
index de638da..2e7ea75
--- a/drivers/ata/libahci_platform.c
+++ b/drivers/ata/libahci_platform.c
@@ -582,11 +582,8 @@ int ahci_platform_init_host(struct platform_device *pdev,
int i, irq, n_ports, rc;
 
irq = platform_get_irq(pdev, 0);
-   if (irq <= 0) {
-   if (irq != -EPROBE_DEFER)
-   dev_err(dev, "no irq\n");
+   if (irq <= 0)
return irq;
-   }
 
hpriv->irq = irq;
 
-- 
2.7.4



[PATCH] mips: kernel: use DEFINE_DEBUGFS_ATTRIBUTE with debugfs_create_file_unsafe()

2021-03-12 Thread Wang Qing
debugfs_create_file_unsafe does not protect the fops handed to it
against file removal. DEFINE_DEBUGFS_ATTRIBUTE makes the fops aware of
the file lifetime and thus protects it against removal.

Signed-off-by: Wang Qing 
---
 arch/mips/kernel/spinlock_test.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/mips/kernel/spinlock_test.c b/arch/mips/kernel/spinlock_test.c
index ab4e3e1..90f53e0
--- a/arch/mips/kernel/spinlock_test.c
+++ b/arch/mips/kernel/spinlock_test.c
@@ -35,7 +35,7 @@ static int ss_get(void *data, u64 *val)
return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(fops_ss, ss_get, NULL, "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(fops_ss, ss_get, NULL, "%llu\n");
 
 
 
@@ -114,13 +114,13 @@ static int multi_get(void *data, u64 *val)
return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(fops_multi, multi_get, NULL, "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(fops_multi, multi_get, NULL, "%llu\n");
 
 static int __init spinlock_test(void)
 {
-   debugfs_create_file("spin_single", S_IRUGO, mips_debugfs_dir, NULL,
+   debugfs_create_file_unsafe("spin_single", S_IRUGO, mips_debugfs_dir, 
NULL,
_ss);
-   debugfs_create_file("spin_multi", S_IRUGO, mips_debugfs_dir, NULL,
+   debugfs_create_file_unsafe("spin_multi", S_IRUGO, mips_debugfs_dir, 
NULL,
_multi);
return 0;
 }
-- 
2.7.4



[PATCH] soc: ti: Replace DEFINE_SIMPLE_ATTRIBUTE with DEFINE_DEBUGFS_ATTRIBUTE

2021-03-12 Thread Wang Qing
Fix the following coccicheck warning:
WARNING:pm_sr_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE.

Signed-off-by: Wang Qing 
---
 drivers/soc/ti/smartreflex.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/ti/smartreflex.c b/drivers/soc/ti/smartreflex.c
index 5376f3d..b3c7460
--- a/drivers/soc/ti/smartreflex.c
+++ b/drivers/soc/ti/smartreflex.c
@@ -817,7 +817,7 @@ static int omap_sr_autocomp_store(void *data, u64 val)
return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(pm_sr_fops, omap_sr_autocomp_show,
+DEFINE_DEBUGFS_ATTRIBUTE(pm_sr_fops, omap_sr_autocomp_show,
omap_sr_autocomp_store, "%llu\n");
 
 static int omap_sr_probe(struct platform_device *pdev)
-- 
2.7.4



[PATCH] usb: cdns3: delete repeated clear operations

2021-03-12 Thread Wang Qing
dma_alloc_coherent already zeroes out memory, so memset is not needed.

Signed-off-by: Wang Qing 
---
 drivers/usb/cdns3/cdnsp-mem.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/cdns3/cdnsp-mem.c b/drivers/usb/cdns3/cdnsp-mem.c
index 7a84e92..1d1b9a4
--- a/drivers/usb/cdns3/cdnsp-mem.c
+++ b/drivers/usb/cdns3/cdnsp-mem.c
@@ -1231,7 +1231,6 @@ int cdnsp_mem_init(struct cdnsp_device *pdev)
if (!pdev->dcbaa)
return -ENOMEM;
 
-   memset(pdev->dcbaa, 0, sizeof(*pdev->dcbaa));
pdev->dcbaa->dma = dma;
 
cdnsp_write_64(dma, >op_regs->dcbaa_ptr);
-- 
2.7.4



[PATCH] scsi: qla2xxx: use dma_pool_zalloc instead

2021-03-12 Thread Wang Qing
use dma_pool_zalloc instead of dma_pool_alloc and memset

Signed-off-by: Wang Qing 
---
 drivers/scsi/qla2xxx/qla_os.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 0743925..ac5e954
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -4238,11 +4238,10 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t 
req_len, uint16_t rsp_len,
 
/* Get consistent memory allocated for Special Features-CB. */
if (IS_QLA27XX(ha) || IS_QLA28XX(ha)) {
-   ha->sf_init_cb = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL,
+   ha->sf_init_cb = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL,
>sf_init_cb_dma);
if (!ha->sf_init_cb)
goto fail_sf_init_cb;
-   memset(ha->sf_init_cb, 0, sizeof(struct init_sf_cb));
ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0199,
   "sf_init_cb=%p.\n", ha->sf_init_cb);
}
-- 
2.7.4



[PATCH] rdma: delete the useless casting value returned

2021-03-11 Thread Wang Qing
Fix the following coccicheck warning:
WARNING: casting value returned by memory allocation function is useless.

Signed-off-by: Wang Qing 
---
 include/rdma/ib_verbs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index ca28fca..f4d24d8
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -2259,7 +2259,7 @@ struct iw_cm_conn_param;
  struct ib_struct)))
 
 #define rdma_zalloc_drv_obj_gfp(ib_dev, ib_type, gfp) \
-   ((struct ib_type *)kzalloc(ib_dev->ops.size_##ib_type, gfp))
+   kzalloc(ib_dev->ops.size_##ib_type, gfp)
 
 #define rdma_zalloc_drv_obj(ib_dev, ib_type)   
\
rdma_zalloc_drv_obj_gfp(ib_dev, ib_type, GFP_KERNEL)
-- 
2.7.4



[PATCH] include: fix inconsistent indenting in dma_alloc_coherent()

2021-03-11 Thread Wang Qing
fix inconsistent indenting in dma_alloc_coherent()

Signed-off-by: Wang Qing 
---
 include/linux/dma-mapping.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index fbfa3f5..6e4d513
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -401,7 +401,6 @@ static inline void dma_sync_sgtable_for_device(struct 
device *dev,
 static inline void *dma_alloc_coherent(struct device *dev, size_t size,
dma_addr_t *dma_handle, gfp_t gfp)
 {
-
return dma_alloc_attrs(dev, size, dma_handle, gfp,
(gfp & __GFP_NOWARN) ? DMA_ATTR_NO_WARN : 0);
 }
-- 
2.7.4



[PATCH] scsi: ibmvscsi: delete the useless casting value returned

2021-03-11 Thread Wang Qing
Fix the following coccicheck warning:
WARNING: casting value returned by memory allocation function is useless.

Signed-off-by: Wang Qing 
---
 drivers/scsi/ibmvscsi/ibmvscsi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
index 29fcc44..f084ca10
--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
+++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
@@ -717,8 +717,7 @@ static int map_sg_data(struct scsi_cmnd *cmd,
 
/* get indirect table */
if (!evt_struct->ext_list) {
-   evt_struct->ext_list = (struct srp_direct_buf *)
-   dma_alloc_coherent(dev,
+   evt_struct->ext_list = dma_alloc_coherent(dev,
   SG_ALL * sizeof(struct 
srp_direct_buf),
   _struct->ext_list_token, 0);
if (!evt_struct->ext_list) {
-- 
2.7.4



[PATCH] scsi: fnic: delete the useless casting value returned

2021-03-11 Thread Wang Qing
Fix the following coccicheck warning:
WARNING: casting value returned by memory allocation function is useless.

Signed-off-by: Wang Qing 
---
 drivers/scsi/fnic/fnic_debugfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/fnic/fnic_debugfs.c b/drivers/scsi/fnic/fnic_debugfs.c
index 6c04936..e732650
--- a/drivers/scsi/fnic/fnic_debugfs.c
+++ b/drivers/scsi/fnic/fnic_debugfs.c
@@ -58,8 +58,7 @@ int fnic_debugfs_init(void)
fnic_trace_debugfs_root);
 
/* Allocate memory to structure */
-   fc_trc_flag = (struct fc_trace_flag_type *)
-   vmalloc(sizeof(struct fc_trace_flag_type));
+   fc_trc_flag = vmalloc(sizeof(struct fc_trace_flag_type));
 
if (fc_trc_flag) {
fc_trc_flag->fc_row_file = 0;
-- 
2.7.4



[PATCH] message: fusion: delete the useless casting value returned

2021-03-11 Thread Wang Qing
Fix the following coccicheck warning:
WARNING: casting value returned by memory allocation function is useless.

Signed-off-by: Wang Qing 
---
 drivers/message/fusion/mptbase.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 549797d..fa9b122
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -4974,7 +4974,7 @@ GetLanConfigPages(MPT_ADAPTER *ioc)
 
if (hdr.PageLength > 0) {
data_sz = hdr.PageLength * 4;
-   ppage0_alloc = (LANPage0_t *) pci_alloc_consistent(ioc->pcidev, 
data_sz, _dma);
+   ppage0_alloc = pci_alloc_consistent(ioc->pcidev, data_sz, 
_dma);
rc = -ENOMEM;
if (ppage0_alloc) {
memset((u8 *)ppage0_alloc, 0, data_sz);
@@ -5020,7 +5020,7 @@ GetLanConfigPages(MPT_ADAPTER *ioc)
 
data_sz = hdr.PageLength * 4;
rc = -ENOMEM;
-   ppage1_alloc = (LANPage1_t *) pci_alloc_consistent(ioc->pcidev, 
data_sz, _dma);
+   ppage1_alloc = pci_alloc_consistent(ioc->pcidev, data_sz, _dma);
if (ppage1_alloc) {
memset((u8 *)ppage1_alloc, 0, data_sz);
cfg.physAddr = page1_dma;
@@ -5321,7 +5321,7 @@ GetIoUnitPage2(MPT_ADAPTER *ioc)
/* Read the config page */
data_sz = hdr.PageLength * 4;
rc = -ENOMEM;
-   ppage_alloc = (IOUnitPage2_t *) pci_alloc_consistent(ioc->pcidev, 
data_sz, _dma);
+   ppage_alloc = pci_alloc_consistent(ioc->pcidev, data_sz, _dma);
if (ppage_alloc) {
memset((u8 *)ppage_alloc, 0, data_sz);
cfg.physAddr = page_dma;
-- 
2.7.4



[PATCH] video: fbdev: delete redundant printing of return value

2021-03-11 Thread Wang Qing
platform_get_irq() has already checked and printed the return value, 
the printing here is nothing special, it is not necessary at all.

Signed-off-by: Wang Qing 
---
 drivers/video/fbdev/vt8500lcdfb.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/video/fbdev/vt8500lcdfb.c 
b/drivers/video/fbdev/vt8500lcdfb.c
index c614762..4cacff6
--- a/drivers/video/fbdev/vt8500lcdfb.c
+++ b/drivers/video/fbdev/vt8500lcdfb.c
@@ -373,7 +373,6 @@ static int vt8500lcd_probe(struct platform_device *pdev)
 
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
-   dev_err(>dev, "no IRQ defined\n");
ret = -ENODEV;
goto failed_free_palette;
}
-- 
2.7.4



[PATCH] video: fbdev: delete redundant printing of return value

2021-03-11 Thread Wang Qing
platform_get_irq() has already checked and printed the return value, 
the printing here is nothing special, it is not necessary at all.

Signed-off-by: Wang Qing 
---
 drivers/video/fbdev/s3c2410fb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/video/fbdev/s3c2410fb.c b/drivers/video/fbdev/s3c2410fb.c
index d8ae525..72dd092
--- a/drivers/video/fbdev/s3c2410fb.c
+++ b/drivers/video/fbdev/s3c2410fb.c
@@ -847,10 +847,8 @@ static int s3c24xxfb_probe(struct platform_device *pdev,
display = mach_info->displays + mach_info->default_display;
 
irq = platform_get_irq(pdev, 0);
-   if (irq < 0) {
-   dev_err(>dev, "no irq for device\n");
+   if (irq < 0)
return -ENOENT;
-   }
 
fbinfo = framebuffer_alloc(sizeof(struct s3c2410fb_info), >dev);
if (!fbinfo)
-- 
2.7.4



[PATCH] video: fbdev: delete redundant printing of return value

2021-03-11 Thread Wang Qing
platform_get_irq() has already checked and printed the return value, 
the printing here is nothing special, it is not necessary at all.

Signed-off-by: Wang Qing 
---
 drivers/video/fbdev/pxafb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c
index f1551e0..780ac1f
--- a/drivers/video/fbdev/pxafb.c
+++ b/drivers/video/fbdev/pxafb.c
@@ -2326,11 +2326,9 @@ static int pxafb_probe(struct platform_device *dev)
}
 
irq = platform_get_irq(dev, 0);
-   if (irq < 0) {
-   dev_err(>dev, "no IRQ defined\n");
+   if (irq < 0)
ret = -ENODEV;
goto failed_free_mem;
-   }
 
ret = devm_request_irq(>dev, irq, pxafb_handle_irq, 0, "LCD", fbi);
if (ret) {
-- 
2.7.4



[PATCH] video: fbdev: delete redundant printing of return value

2021-03-11 Thread Wang Qing
platform_get_irq() has already checked and printed the return value, 
the printing here is nothing special, it is not necessary at all.

Signed-off-by: Wang Qing 
---
 drivers/video/fbdev/pxa3xx-gcu.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/video/fbdev/pxa3xx-gcu.c b/drivers/video/fbdev/pxa3xx-gcu.c
index 4279e13..9d2aed7
--- a/drivers/video/fbdev/pxa3xx-gcu.c
+++ b/drivers/video/fbdev/pxa3xx-gcu.c
@@ -613,10 +613,8 @@ static int pxa3xx_gcu_probe(struct platform_device *pdev)
 
/* request the IRQ */
irq = platform_get_irq(pdev, 0);
-   if (irq < 0) {
-   dev_err(dev, "no IRQ defined: %d\n", irq);
+   if (irq < 0)
return irq;
-   }
 
ret = devm_request_irq(dev, irq, pxa3xx_gcu_handle_irq,
   0, DRV_NAME, priv);
-- 
2.7.4



[PATCH] video: fbdev: delete redundant printing of return value

2021-03-11 Thread Wang Qing
platform_get_irq() has already checked and printed the return value, 
the printing here is nothing special, it is not necessary at all.

Signed-off-by: Wang Qing 
---
 drivers/video/fbdev/pxa168fb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/video/fbdev/pxa168fb.c b/drivers/video/fbdev/pxa168fb.c
index 47e6a1d..e4fe6a4
--- a/drivers/video/fbdev/pxa168fb.c
+++ b/drivers/video/fbdev/pxa168fb.c
@@ -618,10 +618,8 @@ static int pxa168fb_probe(struct platform_device *pdev)
}
 
irq = platform_get_irq(pdev, 0);
-   if (irq < 0) {
-   dev_err(>dev, "no IRQ defined\n");
+   if (irq < 0)
return -ENOENT;
-   }
 
info = framebuffer_alloc(sizeof(struct pxa168fb_info), >dev);
if (info == NULL) {
-- 
2.7.4



[PATCH] drivers: tty: serial: fix spelling typo of 'wheter'

2021-03-09 Thread Wang Qing
wheter -> whether

Signed-off-by: Wang Qing 
---
 drivers/tty/serial/sh-sci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index e1179e7..e3af97a
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -2124,7 +2124,7 @@ static void sci_break_ctl(struct uart_port *port, int 
break_state)
unsigned short scscr, scsptr;
unsigned long flags;
 
-   /* check wheter the port has SCSPTR */
+   /* check whether the port has SCSPTR */
if (!sci_getreg(port, SCSPTR)->size) {
/*
 * Not supported by hardware. Most parts couple break and rx
-- 
2.7.4



[PATCH] net: ethernet: chelsiofix: spelling typo of 'rewriteing'

2021-03-09 Thread Wang Qing
rewriteing -> rewriting

Signed-off-by: Wang Qing 
---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c 
b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
index 83b4644..b1cae5a
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
@@ -979,7 +979,7 @@ void clear_filter(struct adapter *adap, struct filter_entry 
*f)
 {
struct port_info *pi = netdev_priv(f->dev);
 
-   /* If the new or old filter have loopback rewriteing rules then we'll
+   /* If the new or old filter have loopback rewriting rules then we'll
 * need to free any existing L2T, SMT, CLIP entries of filter
 * rule.
 */
-- 
2.7.4



[PATCH] drivers: isdn: mISDN: fix spelling typo of 'wheter'

2021-03-09 Thread Wang Qing
wheter -> whether

Signed-off-by: Wang Qing 
---
 drivers/isdn/mISDN/l1oip_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/isdn/mISDN/l1oip_core.c b/drivers/isdn/mISDN/l1oip_core.c
index b57dcb8..facbd88
--- a/drivers/isdn/mISDN/l1oip_core.c
+++ b/drivers/isdn/mISDN/l1oip_core.c
@@ -200,7 +200,7 @@
 
  The complete socket opening and closing is done by a thread.
  When the thread opened a socket, the hc->socket descriptor is set. Whenever a
- packet shall be sent to the socket, the hc->socket must be checked wheter not
+ packet shall be sent to the socket, the hc->socket must be checked whether not
  NULL. To prevent change in socket descriptor, the hc->socket_lock must be 
used.
  To change the socket, a recall of l1oip_socket_open() will safely kill the
  socket process and create a new one.
-- 
2.7.4



[Resend]Re: [PATCH] [v26,1/4] scsi: ufs: Introduce HPB feature

2021-03-08 Thread Wang Qing
>The Following is experiment environment:
> - kernel version: 4.4.0
> - RAM: 8GB
> - UFS 2.1 (64GB)
>
>Result:
>+---+--+--+---+
>| cycle | baseline | with HPB | diff  |
>+---+--+--+---+
>| 1 | 272.4| 264.9| -7.5  |
>| 2 | 250.4| 248.2| -2.2  |
>| 3 | 226.2| 215.6| -10.6 |
>| 4 | 230.6| 214.8| -15.8 |
>| 5 | 232.0| 218.1| -13.9 |
>| 6 | 231.9| 212.6| -19.3 |
>+---+--+--+---+
>
>We also measured HPB performance using iozone.
>Here is my iozone script:
>iozone -r 4k -+n -i2 -ecI -t 16 -l 16 -u 16
>-s $IO_RANGE/16 -F mnt/tmp_1 mnt/tmp_2 mnt/tmp_3 mnt/tmp_4 mnt/tmp_5
>mnt/tmp_6 mnt/tmp_7 mnt/tmp_8 mnt/tmp_9 mnt/tmp_10 mnt/tmp_11 mnt/tmp_12
>mnt/tmp_13 mnt/tmp_14 mnt/tmp_15 mnt/tmp_16
>
>Result:
>+--++-+
>| IO range | HPB on | HPB off |
>+--++-+
>|   1 GB   | 294.8  | 300.87  |
>|   4 GB   | 293.51 | 179.35  |
>|   8 GB   | 294.85 | 162.52  |
>|  16 GB   | 293.45 | 156.26  |
>|  32 GB   | 277.4  | 153.25  |
>+--++-+

According to Samsung's iozone test result, HPB is going to boost random 
performance of rom on mobile, we believe it will help our customers on 
several occasions.

WangQing


Re: [PATCH] [v26,1/4] scsi: ufs: Introduce HPB feature

2021-03-08 Thread Wang Qing
According to Samsung's iozone test result, HPB is going to boost random 
performance of rom on mobile, we believe it will help our customers on 
several occasions.


Re: [PATCH] [v26,1/4] scsi: ufs: Introduce HPB feature

2021-03-08 Thread Wang Qing


[PATCH] mm: delete bool "migrated"

2021-03-01 Thread Wang Qing
Smatch gives the warning:
do_numa_page() warn: assigning (-11) to unsigned variable 'migrated'

Signed-off-by: Wang Qing 
---
 mm/memory.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index 784249f..d8125df
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -4102,7 +4102,6 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
int page_nid = NUMA_NO_NODE;
int last_cpupid;
int target_nid;
-   bool migrated = false;
pte_t pte, old_pte;
bool was_writable = pte_savedwrite(vmf->orig_pte);
int flags = 0;
@@ -4172,8 +4171,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
}
 
/* Migrate to the requested node */
-   migrated = migrate_misplaced_page(page, vma, target_nid);
-   if (migrated) {
+   if (migrate_misplaced_page(page, vma, target_nid)) {
page_nid = target_nid;
flags |= TNF_MIGRATED;
} else
-- 
2.7.4



[PATCH] mm: Return -EFAULT if copy_to_user() fails

2021-03-01 Thread Wang Qing
The copy_to_user() function returns the number of bytes remaining to be
copied, but we want to return -EFAULT if the copy doesn't complete.

Signed-off-by: Wang Qing 
---
 mm/mempolicy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index ab51132..a116e56
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1667,7 +1667,7 @@ COMPAT_SYSCALL_DEFINE5(get_mempolicy, int __user *, 
policy,
if (!err && nmask) {
unsigned long copy_size;
copy_size = min_t(unsigned long, sizeof(bm), alloc_size);
-   err = copy_from_user(bm, nm, copy_size);
+   err = copy_from_user(bm, nm, copy_size) ? -EFAULT : 0;
/* ensure entire bitmap is zeroed */
err |= clear_user(nmask, ALIGN(maxnode-1, 8) / 8);
err |= compat_put_bitmap(nmask, bm, nr_bits);
-- 
2.7.4



[PATCH] s390: crypto: Return -EFAULT if copy_to_user() fails

2021-03-01 Thread Wang Qing
The copy_to_user() function returns the number of bytes remaining to be
copied, but we want to return -EFAULT if the copy doesn't complete.

Signed-off-by: Wang Qing 
---
 drivers/s390/crypto/vfio_ap_ops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/crypto/vfio_ap_ops.c 
b/drivers/s390/crypto/vfio_ap_ops.c
index 41fc2e413..1ffdd41
--- a/drivers/s390/crypto/vfio_ap_ops.c
+++ b/drivers/s390/crypto/vfio_ap_ops.c
@@ -1286,7 +1286,7 @@ static int vfio_ap_mdev_get_device_info(unsigned long arg)
info.num_regions = 0;
info.num_irqs = 0;
 
-   return copy_to_user((void __user *)arg, , minsz);
+   return copy_to_user((void __user *)arg, , minsz) ? -EFAULT : 0;
 }
 
 static ssize_t vfio_ap_mdev_ioctl(struct mdev_device *mdev,
-- 
2.7.4



[PATCH] arc: kernel: Return -EFAULT if copy_to_user() fails

2021-03-01 Thread Wang Qing
The copy_to_user() function returns the number of bytes remaining to be
copied, but we want to return -EFAULT if the copy doesn't complete.

Signed-off-by: Wang Qing 
---
 arch/arc/kernel/signal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c
index a78d8f7..fdbe06c
--- a/arch/arc/kernel/signal.c
+++ b/arch/arc/kernel/signal.c
@@ -96,7 +96,7 @@ stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs 
*regs,
 sizeof(sf->uc.uc_mcontext.regs.scratch));
err |= __copy_to_user(>uc.uc_sigmask, set, sizeof(sigset_t));
 
-   return err;
+   return err ? -EFAULT : 0;
 }
 
 static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user 
*sf)
@@ -110,7 +110,7 @@ static int restore_usr_regs(struct pt_regs *regs, struct 
rt_sigframe __user *sf)
&(sf->uc.uc_mcontext.regs.scratch),
sizeof(sf->uc.uc_mcontext.regs.scratch));
if (err)
-   return err;
+   return -EFAULT;
 
set_current_blocked();
regs->bta   = uregs.scratch.bta;
-- 
2.7.4



[PATCH] s390: cio: Return -EFAULT if copy_to_user() fails

2021-03-01 Thread Wang Qing
The copy_to_user() function returns the number of bytes remaining to be
copied, but we want to return -EFAULT if the copy doesn't complete.

Signed-off-by: Wang Qing 
---
 drivers/s390/cio/vfio_ccw_ops.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/s390/cio/vfio_ccw_ops.c b/drivers/s390/cio/vfio_ccw_ops.c
index 68106be..557d0b8
--- a/drivers/s390/cio/vfio_ccw_ops.c
+++ b/drivers/s390/cio/vfio_ccw_ops.c
@@ -543,7 +543,7 @@ static ssize_t vfio_ccw_mdev_ioctl(struct mdev_device *mdev,
if (ret)
return ret;
 
-   return copy_to_user((void __user *)arg, , minsz);
+   return copy_to_user((void __user *)arg, , minsz) ? -EFAULT 
: 0;
}
case VFIO_DEVICE_GET_REGION_INFO:
{
@@ -561,7 +561,7 @@ static ssize_t vfio_ccw_mdev_ioctl(struct mdev_device *mdev,
if (ret)
return ret;
 
-   return copy_to_user((void __user *)arg, , minsz);
+   return copy_to_user((void __user *)arg, , minsz) ? -EFAULT 
: 0;
}
case VFIO_DEVICE_GET_IRQ_INFO:
{
-- 
2.7.4



[PATCH] kernel: Return -EFAULT if copy_to_user() fails

2021-03-01 Thread Wang Qing
The copy_to_user() function returns the number of bytes remaining to be
copied, but we want to return -EFAULT if the copy doesn't complete.

Signed-off-by: Wang Qing 
---
 kernel/sys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sys.c b/kernel/sys.c
index 8bb46e5..d97a84a
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1247,7 +1247,7 @@ static int override_release(char __user *release, size_t 
len)
copy = scnprintf(buf, copy, "2.6.%u%s", v, rest);
ret = copy_to_user(release, buf, copy + 1);
}
-   return ret;
+   return ret ? -EFAULT : 0;
 }
 
 SYSCALL_DEFINE1(newuname, struct new_utsname __user *, name)
-- 
2.7.4



[PATCH] fs: Return -EFAULT if copy_to_user() fails

2021-03-01 Thread Wang Qing
The copy_to_user() function returns the number of bytes remaining to be
copied, but we want to return -EFAULT if the copy doesn't complete.

Signed-off-by: Wang Qing 
---
 fs/select.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/select.c b/fs/select.c
index 37aaa83..93cd35b
--- a/fs/select.c
+++ b/fs/select.c
@@ -400,7 +400,7 @@ static inline unsigned long __must_check
 set_fd_set(unsigned long nr, void __user *ufdset, unsigned long *fdset)
 {
if (ufdset)
-   return __copy_to_user(ufdset, fdset, FDS_BYTES(nr));
+   return __copy_to_user(ufdset, fdset, FDS_BYTES(nr)) ? -EFAULT : 
0;
return 0;
 }
 
-- 
2.7.4



[PATCH] arch: mips: sibyte: Return -EFAULT if copy_to_user() fails

2021-02-28 Thread Wang Qing
The copy_to_user() function returns the number of bytes remaining to be
copied, but we want to return -EFAULT if the copy doesn't complete.

Signed-off-by: Wang Qing 
---
 arch/mips/sibyte/common/sb_tbprof.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/sibyte/common/sb_tbprof.c 
b/arch/mips/sibyte/common/sb_tbprof.c
index f80d7a7..eac125f
--- a/arch/mips/sibyte/common/sb_tbprof.c
+++ b/arch/mips/sibyte/common/sb_tbprof.c
@@ -465,7 +465,7 @@ static ssize_t sbprof_tb_read(struct file *filp, char *buf,
if (err) {
*offp = cur_off + cur_count - err;
mutex_unlock();
-   return err;
+   return -EFAULT;
}
pr_debug(DEVNAME ": read from sample %d, %d bytes\n",
 cur_sample, cur_count);
-- 
2.7.4



[PATCH] lib: fix inconsistent indenting in process_bit1()

2021-02-28 Thread Wang Qing
Smatch gives the warning:
lib/decompress_unlzma.c:395 process_bit1() warn: inconsistent indenting

Signed-off-by: Wang Qing 
---
 lib/decompress_unlzma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/decompress_unlzma.c b/lib/decompress_unlzma.c
index 1cf409e..20a8580
--- a/lib/decompress_unlzma.c
+++ b/lib/decompress_unlzma.c
@@ -391,7 +391,7 @@ static inline int INIT process_bit0(struct writer *wr, 
struct rc *rc,
 static inline int INIT process_bit1(struct writer *wr, struct rc *rc,
struct cstate *cst, uint16_t *p,
int pos_state, uint16_t *prob) {
-  int offset;
+   int offset;
uint16_t *prob_len;
int num_bits;
int len;
-- 
2.7.4



[tip: core/rcu] locking: Remove duplicate include of percpu-rwsem.h

2021-02-12 Thread tip-bot2 for Wang Qing
The following commit has been merged into the core/rcu branch of tip:

Commit-ID: c5586e32dfe258925c5dbb599bea3eadf34e79c1
Gitweb:
https://git.kernel.org/tip/c5586e32dfe258925c5dbb599bea3eadf34e79c1
Author:Wang Qing 
AuthorDate:Sat, 07 Nov 2020 16:24:03 +08:00
Committer: Paul E. McKenney 
CommitterDate: Mon, 04 Jan 2021 15:54:49 -08:00

locking: Remove duplicate include of percpu-rwsem.h

This commit removes an unnecessary #include.

Signed-off-by: Wang Qing 
Signed-off-by: Paul E. McKenney 
---
 kernel/locking/locktorture.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c
index 62d215b..af99e9c 100644
--- a/kernel/locking/locktorture.c
+++ b/kernel/locking/locktorture.c
@@ -27,7 +27,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 MODULE_LICENSE("GPL");


[PATCH] nfs: Only include nfs42.h when NFS_V4_2 enable

2020-11-20 Thread Wang Qing
Remove duplicate header unnecessary.
Only include nfs42.h when NFS_V4_2 enable.

Signed-off-by: Wang Qing 
---
 fs/nfs/nfs4proc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 9e0ca9b..a1321a5 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -67,7 +67,6 @@
 #include "nfs4idmap.h"
 #include "nfs4session.h"
 #include "fscache.h"
-#include "nfs42.h"
 
 #include "nfs4trace.h"
 
-- 
2.7.4



[tip: x86/cleanups] x86/head64: Remove duplicate include

2020-11-20 Thread tip-bot2 for Wang Qing
The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID: 61b39ad9a7d26fe14a2f5f23e5e940e7f9664d41
Gitweb:
https://git.kernel.org/tip/61b39ad9a7d26fe14a2f5f23e5e940e7f9664d41
Author:Wang Qing 
AuthorDate:Mon, 09 Nov 2020 11:45:41 +08:00
Committer: Borislav Petkov 
CommitterDate: Fri, 20 Nov 2020 17:43:15 +01:00

x86/head64: Remove duplicate include

Remove duplicate header include.

Signed-off-by: Wang Qing 
Signed-off-by: Borislav Petkov 
Link: 
https://lkml.kernel.org/r/1604893542-20961-1-git-send-email-wangq...@vivo.com
---
 arch/x86/kernel/head64.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 05e1171..5e9beb7 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -37,7 +37,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 


[PATCH doc] doc: zh_CN: add tmpfs to index tree

2020-11-15 Thread Wang Qing
Add temfs to the index tree while adding tempfs translation.

Signed-off-by: Wang Qing 
---
 Documentation/translations/zh_CN/filesystems/index.rst | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/translations/zh_CN/filesystems/index.rst 
b/Documentation/translations/zh_CN/filesystems/index.rst
index 186501d..9f2a8b0
--- a/Documentation/translations/zh_CN/filesystems/index.rst
+++ b/Documentation/translations/zh_CN/filesystems/index.rst
@@ -25,4 +25,5 @@ Linux Kernel中的文件系统
 
virtiofs
debugfs
+   tmpfs
 
-- 
2.7.4



[PATCH V4 net-bugfixs] net/ethernet: Update ret when ptp_clock is ERROR

2020-11-11 Thread Wang Qing
We always have to update the value of ret, otherwise the error value
 may be the previous one. And ptp_clock_register() never return NULL
 when PTP_1588_CLOCK enable.

Signed-off-by: Wang Qing 
---
 drivers/net/ethernet/ti/am65-cpts.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/ti/am65-cpts.c 
b/drivers/net/ethernet/ti/am65-cpts.c
index 75056c1..b319d45
--- a/drivers/net/ethernet/ti/am65-cpts.c
+++ b/drivers/net/ethernet/ti/am65-cpts.c
@@ -1001,8 +1001,7 @@ struct am65_cpts *am65_cpts_create(struct device *dev, 
void __iomem *regs,
if (IS_ERR_OR_NULL(cpts->ptp_clock)) {
dev_err(dev, "Failed to register ptp clk %ld\n",
PTR_ERR(cpts->ptp_clock));
-   if (!cpts->ptp_clock)
-   ret = -ENODEV;
+   ret = PTR_ERR(cpts->ptp_clock);
goto refclk_disable;
}
cpts->phc_index = ptp_clock_index(cpts->ptp_clock);
-- 
2.7.4



[PATCH V3] sched/rt, powerpc: Prepare for PREEMPT_RT

2020-11-10 Thread Wang Qing
PREEMPT_RT is a separate preemption model, CONFIG_PREEMPT will
 be disabled when CONFIG_PREEMPT_RT is enabled,  so we need
to add CONFIG_PREEMPT_RT output to __die().

Signed-off-by: Wang Qing 

Changes in v3:
 - Fix typo issue.

Changes in v2:
 - Modify as Christophe suggested.
---
 arch/powerpc/kernel/traps.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 5006dcb..dec7b81
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -262,10 +262,11 @@ static int __die(const char *str, struct pt_regs *regs, 
long err)
 {
printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter);
 
-   printk("%s PAGE_SIZE=%luK%s%s%s%s%s%s %s\n",
+   printk("%s PAGE_SIZE=%luK%s%s%s%s%s%s%s %s\n",
   IS_ENABLED(CONFIG_CPU_LITTLE_ENDIAN) ? "LE" : "BE",
   PAGE_SIZE / 1024, get_mmu_str(),
   IS_ENABLED(CONFIG_PREEMPT) ? " PREEMPT" : "",
+  IS_ENABLED(CONFIG_PREEMPT_RT) ? " PREEMPT_RT" : "",
   IS_ENABLED(CONFIG_SMP) ? " SMP" : "",
   IS_ENABLED(CONFIG_SMP) ? (" NR_CPUS=" __stringify(NR_CPUS)) : "",
   debug_pagealloc_enabled() ? " DEBUG_PAGEALLOC" : "",
-- 
2.7.4



[PATCH V2] sched/rt, powerpc: Prepare for PREEMPT_RT

2020-11-10 Thread Wang Qing
PREEMPT_RT is a separate preemption model, CONFIG_PRTTMPT will
 be disabled when CONFIG_PREEMPT_RT is enabled,  so you need
to add CONFIG_PREEMPT_RT judgments to __die().

Signed-off-by: Wang Qing 

Changes in v2:
 - Modify as Christophe suggested.
---
 arch/powerpc/kernel/traps.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 5006dcb..dec7b81
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -262,10 +262,11 @@ static int __die(const char *str, struct pt_regs *regs, 
long err)
 {
printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter);
 
-   printk("%s PAGE_SIZE=%luK%s%s%s%s%s%s %s\n",
+   printk("%s PAGE_SIZE=%luK%s%s%s%s%s%s%s %s\n",
   IS_ENABLED(CONFIG_CPU_LITTLE_ENDIAN) ? "LE" : "BE",
   PAGE_SIZE / 1024, get_mmu_str(),
   IS_ENABLED(CONFIG_PREEMPT) ? " PREEMPT" : "",
+  IS_ENABLED(CONFIG_PREEMPT_RT) ? " PREEMPT_RT" : "",
   IS_ENABLED(CONFIG_SMP) ? " SMP" : "",
   IS_ENABLED(CONFIG_SMP) ? (" NR_CPUS=" __stringify(NR_CPUS)) : "",
   debug_pagealloc_enabled() ? " DEBUG_PAGEALLOC" : "",
-- 
2.7.4



[PATCH] x86: remove duplicate include

2020-11-08 Thread Wang Qing
Remove duplicate header which is included twice.

Signed-off-by: Wang Qing 
---
 arch/x86/kernel/head64.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 05e1171..5e9beb7
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -37,7 +37,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
2.7.4



[PATCH] touchscreen: use kobj_to_dev() API

2020-11-08 Thread Wang Qing
Use kobj_to_dev() instead of container_of().

Signed-off-by: Wang Qing 
---
 drivers/input/touchscreen/ads7846.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/ads7846.c 
b/drivers/input/touchscreen/ads7846.c
index 8fd7fc3..ee74da2
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -481,7 +481,7 @@ SHOW(in1_input, vbatt, vbatt_adjust)
 static umode_t ads7846_is_visible(struct kobject *kobj, struct attribute *attr,
  int index)
 {
-   struct device *dev = container_of(kobj, struct device, kobj);
+   struct device *dev = kobj_to_dev(kobj);
struct ads7846 *ts = dev_get_drvdata(dev);
 
if (ts->model == 7843 && index < 2) /* in0, in1 */
-- 
2.7.4



[PATCH] sched/rt, powerpc: Prepare for PREEMPT_RT

2020-11-08 Thread Wang Qing
Add PREEMPT_RT output to die().

Signed-off-by: Wang Qing 
---
 arch/powerpc/kernel/traps.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 5006dcb..6dfe567
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -258,6 +258,14 @@ static char *get_mmu_str(void)
return "";
 }
 
+#ifdef CONFIG_PREEMPT
+#define S_PREEMPT " PREEMPT"
+#elif defined(CONFIG_PREEMPT_RT)
+#define S_PREEMPT " PREEMPT_RT"
+#else
+#define S_PREEMPT ""
+#endif
+
 static int __die(const char *str, struct pt_regs *regs, long err)
 {
printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter);
@@ -265,7 +273,7 @@ static int __die(const char *str, struct pt_regs *regs, 
long err)
printk("%s PAGE_SIZE=%luK%s%s%s%s%s%s %s\n",
   IS_ENABLED(CONFIG_CPU_LITTLE_ENDIAN) ? "LE" : "BE",
   PAGE_SIZE / 1024, get_mmu_str(),
-  IS_ENABLED(CONFIG_PREEMPT) ? " PREEMPT" : "",
+  S_PREEMPT,
   IS_ENABLED(CONFIG_SMP) ? " SMP" : "",
   IS_ENABLED(CONFIG_SMP) ? (" NR_CPUS=" __stringify(NR_CPUS)) : "",
   debug_pagealloc_enabled() ? " DEBUG_PAGEALLOC" : "",
-- 
2.7.4



[PATCH] arch: sh: remove duplicate include

2020-11-08 Thread Wang Qing
Remove duplicate header which is included twice.

Signed-off-by: Wang Qing 
---
 arch/sh/kernel/cpu/sh3/entry.S | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/sh/kernel/cpu/sh3/entry.S b/arch/sh/kernel/cpu/sh3/entry.S
index 25eb809..e48b3dd
--- a/arch/sh/kernel/cpu/sh3/entry.S
+++ b/arch/sh/kernel/cpu/sh3/entry.S
@@ -14,7 +14,6 @@
 #include 
 #include 
 #include 
-#include 
 
 ! NOTE:
 ! GNU as (as of 2.9.1) changes bf/s into bt/s and bra, when the address
-- 
2.7.4



[PATCH] scsi: use kobj_to_dev() instead

2020-11-08 Thread Wang Qing
Use kobj_to_dev() instead of container_of().

Signed-off-by: Wang Qing 
---
 drivers/scsi/3w-sas.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/3w-sas.c b/drivers/scsi/3w-sas.c
index dda6fa8..7cde82e
--- a/drivers/scsi/3w-sas.c
+++ b/drivers/scsi/3w-sas.c
@@ -99,7 +99,7 @@ static ssize_t twl_sysfs_aen_read(struct file *filp, struct 
kobject *kobj,
  struct bin_attribute *bin_attr,
  char *outbuf, loff_t offset, size_t count)
 {
-   struct device *dev = container_of(kobj, struct device, kobj);
+   struct device *dev = kobj_to_dev(kobj);
struct Scsi_Host *shost = class_to_shost(dev);
TW_Device_Extension *tw_dev = (TW_Device_Extension *)shost->hostdata;
unsigned long flags = 0;
@@ -130,7 +130,7 @@ static ssize_t twl_sysfs_compat_info(struct file *filp, 
struct kobject *kobj,
 struct bin_attribute *bin_attr,
 char *outbuf, loff_t offset, size_t count)
 {
-   struct device *dev = container_of(kobj, struct device, kobj);
+   struct device *dev = kobj_to_dev(kobj);
struct Scsi_Host *shost = class_to_shost(dev);
TW_Device_Extension *tw_dev = (TW_Device_Extension *)shost->hostdata;
unsigned long flags = 0;
-- 
2.7.4



[PATCH] sh: mach-sh03: remove duplicate include

2020-11-08 Thread Wang Qing
Remove duplicate header which is included twice.

Signed-off-by: Wang Qing 
---
 arch/sh/boards/mach-sh03/rtc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/sh/boards/mach-sh03/rtc.c b/arch/sh/boards/mach-sh03/rtc.c
index 8b23ed7..7fb4748 100644
--- a/arch/sh/boards/mach-sh03/rtc.c
+++ b/arch/sh/boards/mach-sh03/rtc.c
@@ -11,7 +11,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
2.7.4



[PATCH V3 net] net/ethernet: Fix error return when ptp_clock is ERROR

2020-11-08 Thread Wang Qing
We always have to update the value of ret, otherwise the error value
 may be the previous one. And ptp_clock_register() never return NULL
 when PTP_1588_CLOCK enable.

Signed-off-by: Wang Qing 
---
 drivers/net/ethernet/ti/am65-cpts.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/ti/am65-cpts.c 
b/drivers/net/ethernet/ti/am65-cpts.c
index 75056c1..b319d45
--- a/drivers/net/ethernet/ti/am65-cpts.c
+++ b/drivers/net/ethernet/ti/am65-cpts.c
@@ -1001,8 +1001,7 @@ struct am65_cpts *am65_cpts_create(struct device *dev, 
void __iomem *regs,
if (IS_ERR_OR_NULL(cpts->ptp_clock)) {
dev_err(dev, "Failed to register ptp clk %ld\n",
PTR_ERR(cpts->ptp_clock));
-   if (!cpts->ptp_clock)
-   ret = -ENODEV;
+   ret = PTR_ERR(cpts->ptp_clock);
goto refclk_disable;
}
cpts->phc_index = ptp_clock_index(cpts->ptp_clock);
-- 
2.7.4



[PATCH V4 DOC] doc: zh_CN: add translatation for tmpfs

2020-11-08 Thread Wang Qing
Translate Documentation/filesystems/tmpfs.rst into Chinese.

Signed-off-by: Wang Qing 

Changes in v4:
 - Modify as Alex required.
 
Changes in v3:
 - Fix patch format issue.
---
 .../translations/zh_CN/filesystems/tmpfs.rst   | 146 +
 1 file changed, 146 insertions(+)
 create mode 100644 Documentation/translations/zh_CN/filesystems/tmpfs.rst

diff --git a/Documentation/translations/zh_CN/filesystems/tmpfs.rst 
b/Documentation/translations/zh_CN/filesystems/tmpfs.rst
new file mode 100644
index 000..28f0d09
--- /dev/null
+++ b/Documentation/translations/zh_CN/filesystems/tmpfs.rst
@@ -0,0 +1,146 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+.. include:: ../disclaimer-zh_CN.rst
+
+:Original: :ref:`Documentation/filesystems/tmpfs.rst `
+
+translated by Wang Qing
+
+=
+Tmpfs
+=
+
+Tmpfs是一个将所有文件都保存在虚拟内存中的文件系统。
+
+tmpfs中的所有内容都是临时的,也就是说没有任何文件会在硬盘上创建。
+如果卸载tmpfs实例,所有保存在其中的文件都会丢失。
+
+tmpfs将所有文件保存在内核缓存中,随着文件内容增长或缩小可以将不需要的
+页面swap出去。它具有最大限制,可以通过“mount -o remount ...”调整。
+
+和ramfs(创建tmpfs的模板)相比,tmpfs包含交换和限制检查。和tmpfs相似的另
+一个东西是RAM磁盘(/dev/ram*),可以在物理RAM中模拟固定大小的硬盘,并在
+此之上创建一个普通的文件系统。Ramdisks无法swap,因此无法调整它们的大小。
+
+由于tmpfs完全保存于页面缓存和swap中,因此所有tmpfs页面将在/proc/meminfo
+中显示为“Shmem”,而在free(1)中显示为“Shared”。请注意,这些计数还包括
+共享内存(shmem,请参阅ipcs(1))。获得计数的最可靠方法是使用df(1)和du(1)。
+
+tmpfs具有以下用途:
+
+1) 内核总有一个无法看到的内部挂载,用于共享匿名映射和SYSV共享内存。
+
+   挂载不依赖于CONFIG_TMPFS。如果CONFIG_TMPFS未设置,tmpfs对用户不可见。
+   但是内部机制始终存在。
+
+2) glibc 2.2及更高版本期望将tmpfs挂载在/dev/shm上以用于POSIX共享内存
+   (shm_open,shm_unlink)。添加内容到/etc/fstab应注意如下:
+
+   tmpfs   /dev/shmtmpfs   defaults0 0
+
+   使用时需要记住创建挂载tmpfs的目录。
+
+   SYSV共享内存无需挂载,内部已默认支持。(在2.3内核版本中,必须挂载
+   tmpfs的前身(shm fs)才能使用SYSV共享内存)
+
+3) 很多人(包括我)都觉的在/tmp和/var/tmp上挂载非常方便,并具有较大的
+   swap分区。目前循环挂载tmpfs可以正常工作,所以大多数发布都应当可以
+   使用mkinitrd通过/tmp访问/tmp。
+
+4) 也许还有更多我不知道的地方:-)
+
+
+tmpfs有三个用于调整大小的挂载选项:
+
+=  ===
+size   tmpfs实例分配的字节数限制。默认值是不swap时物理RAM的一半。
+   如果tmpfs实例过大,机器将死锁,因为OOM处理将无法释放该内存。
+nr_blocks  与size相同,但以PAGE_SIZE为单位。
+nr_inodes  tmpfs实例的最大inode个数。默认值是物理内存页数的一半,或者
+   (有高端内存的机器)低端内存RAM的页数,二者以较低者为准。
+=  ===
+
+这些参数接受后缀k,m或g表示千,兆和千兆字节,可以在remount时更改。
+size参数也接受后缀%用来限制tmpfs实例占用物理RAM的百分比:
+未指定size或nr_blocks时,默认值为size=50%
+
+如果nr_blocks=0(或size=0),block个数将不受限制;如果nr_inodes=0,
+inode个数将不受限制。这样挂载通常是不明智的,因为它允许任何具有写权限的
+用户通过访问tmpfs耗尽机器上的所有内存;但同时这样做也会增强在多个CPU的
+场景下的访问。
+
+tmpfs具有为所有文件设置NUMA内存分配策略挂载选项(如果启用了CONFIG_NUMA),
+可以通过“mount -o remount ...”调整
+
+ =
+mpol=default 采用进程分配策略
+ (请参阅 set_mempolicy(2))
+mpol=prefer:Node 倾向从给定的节点分配
+mpol=bind:NodeList   只允许从指定的链表分配
+mpol=interleave  倾向于依次从每个节点分配
+mpol=interleave:NodeList 依次从每个节点分配
+mpol=local   优先本地节点分配内存
+ =
+
+NodeList格式是以逗号分隔的十进制数字表示大小和范围,最大和最小范围是用-
+分隔符的十进制数来表示。例如,mpol=bind0-3,5,7,9-15
+
+带有有效NodeList的内存策略将按指定格式保存,在创建文件时使用。当任务在该
+文件系统上创建文件时,会使用到挂载时的内存策略NodeList选项,如果设置的话,
+由调用任务的cpuset[请参见Documentation/admin-guide/cgroup-v1/cpusets.rst]
+以及下面列出的可选标志约束。如果NodeLists为设置为空集,则文件的内存策略将
+恢复为“默认”策略。
+
+NUMA内存分配策略有可选标志,可以用于模式结合。在挂载tmpfs时指定这些可选
+标志可以在NodeList之前生效。
+Documentation/admin-guide/mm/numa_memory_policy.rst列出所有可用的内存
+分配策略模式标志及其对内存策略。
+
+::
+
+   =static 相当于 MPOL_F_STATIC_NODES
+   =relative   相当于 MPOL_F_RELATIVE_NODES
+
+例如,mpol=bind=staticNodeList相当于MPOL_BIND|MPOL_F_STATIC_NODES的分配策略
+
+请注意,如果内核不支持NUMA,那么使用mpol选项挂载tmpfs将会失败;nodelist指定不
+在线的节点也会失败。如果您的系统依赖于此,但内核会运行不带NUMA功能(也许是安全
+revocery内核),或者具有较少的节点在线,建议从自动模式中省略mpol选项挂载选项。
+可以在以后通过“mount -o remount,mpol=Policy:NodeList MountPoint”添加到挂载点。
+
+要指定初始根目录,可以使用如下挂载选项:
+
+   
+模式 权限用八进制数字表示
+uid用户ID
+gid组ID
+   
+
+这些选项对remount没有任何影响。您可以通过chmod(1),chown(1)和chgrp(1)的更改
+已经挂载的参数。
+
+tmpfs具有选择32位还是64位inode的挂载选项:
+
+===   =
+inode64   使用64位inode
+inode32   使用32位inode
+===   =
+
+在32位内核上,默认是inode32,挂载时指定inode64会被拒绝。
+在64位内核上,默认配置是CONFIG_TMPFS_INODE64。inode64避免了单个设备上可能有多个
+具有相同inode编号的文件;比如32位应用程序使用glibc如果长期访问tmpfs,一旦达到33
+位inode编号,就有EOVERFLOW失败的危险,无法打开大于2GiB的文件,并返回EINVAL。
+
+所以'mount -t tmpfs -o size=10G,nr_inodes=10k,mode=700 tmpfs /mytmpfs'将在
+/mytmpfs上挂载tmpfs实例,分配只能由root用户访问的10GB RAM/SWAP,可以有10240个
+inode的实例。
+
+
+:作者:
+   Christoph Rohland , 1.12.01
+:更新:
+   Hugh Dickins, 4 June 2007
+:更新:
+   KOSAKI Motohiro, 16 Mar 2010
+:更新:
+   Chris Down, 13 July 2020
-- 
2.7.4



[PATCH] arm: mach-sa1100: remove duplicate include

2020-11-07 Thread Wang Qing
Remove duplicate header which is included twice.

Signed-off-by: Wang Qing 
---
 arch/arm/mach-sa1100/hackkit.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/mach-sa1100/hackkit.c b/arch/arm/mach-sa1100/hackkit.c
index 3085f1c..3fe34ee
--- a/arch/arm/mach-sa1100/hackkit.c
+++ b/arch/arm/mach-sa1100/hackkit.c
@@ -18,7 +18,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
2.7.4



[PATCH] tool: selftests: fix spelling typo of 'writting'

2020-11-07 Thread Wang Qing
writting -> writing

Signed-off-by: Wang Qing 
---
 tools/testing/selftests/vm/userfaultfd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/vm/userfaultfd.c 
b/tools/testing/selftests/vm/userfaultfd.c
index 9b0912a..9132fae7
--- a/tools/testing/selftests/vm/userfaultfd.c
+++ b/tools/testing/selftests/vm/userfaultfd.c
@@ -894,7 +894,7 @@ static int faulting_process(int signal_test)
count_verify[nr]);
}
/*
-* Trigger write protection if there is by writting
+* Trigger write protection if there is by writing
 * the same value back.
 */
*area_count(area_dst, nr) = count;
@@ -922,7 +922,7 @@ static int faulting_process(int signal_test)
count_verify[nr]); exit(1);
}
/*
-* Trigger write protection if there is by writting
+* Trigger write protection if there is by writing
 * the same value back.
 */
*area_count(area_dst, nr) = count;
-- 
2.7.4



[PATCH] arm: mm: remove duplicate include

2020-11-07 Thread Wang Qing
Remove duplicate header which is included twice.

Signed-off-by: Wang Qing 
---
 arch/arm/mm/mmu.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index ab69250..4963e1c
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -33,7 +33,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "fault.h"
 #include "mm.h"
-- 
2.7.4



[PATCH V3] doc: zh_CN: add translatation for tmpfs

2020-11-07 Thread Wang Qing
Translate Documentation/filesystems/tmpfs.rst into Chinese.

Signed-off-by: Wang Qing 

Changes in v3:
 - Fix patch format issue.
---
 .../translations/zh_CN/filesystems/tmpfs.rst   | 146 +
 1 file changed, 146 insertions(+)
 create mode 100644 Documentation/translations/zh_CN/filesystems/tmpfs.rst

diff --git a/Documentation/translations/zh_CN/filesystems/tmpfs.rst 
b/Documentation/translations/zh_CN/filesystems/tmpfs.rst
new file mode 100644
index 000..28f0d09
--- /dev/null
+++ b/Documentation/translations/zh_CN/filesystems/tmpfs.rst
@@ -0,0 +1,146 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+.. include:: ../disclaimer-zh_CN.rst
+
+:Original: :ref:`Documentation/filesystems/tmpfs.rst `
+
+translated by Wang Qing
+
+=
+Tmpfs
+=
+
+Tmpfs是一个将所有文件都保存在虚拟内存中的文件系统。
+
+tmpfs中的所有内容都是临时的,也就是说没有任何文件会在硬盘上创建。
+如果卸载tmpfs实例,所有保存在其中的文件都会丢失。
+
+tmpfs将所有文件保存在内核缓存中,随着文件内容增长或缩小可以将不需要的
+页面swap出去。它具有最大限制,可以通过“mount -o remount ...”调整。
+
+和ramfs(创建tmpfs的模板)相比,tmpfs包含交换和限制检查。和tmpfs相似的另
+一个东西是RAM磁盘(/dev/ram*),可以在物理RAM中模拟固定大小的硬盘,并在
+此之上创建一个普通的文件系统。Ramdisks无法swap,因此无法调整它们的大小。
+
+由于tmpfs完全保存于页面缓存和swap中,因此所有tmpfs页面将在/proc/meminfo
+中显示为“Shmem”,而在free(1)中显示为“Shared”。请注意,这些计数还包括
+共享内存(shmem,请参阅ipcs(1))。获得计数的最可靠方法是使用df(1)和du(1)。
+
+tmpfs具有以下用途:
+
+1) 内核总有一个无法看到的内部挂载,用于共享匿名映射和SYSV共享内存。
+
+   挂载不依赖于CONFIG_TMPFS。如果CONFIG_TMPFS未设置,tmpfs对用户不可见。
+   但是内部机制始终存在。
+
+2) glibc 2.2及更高版本期望将tmpfs挂载在/dev/shm上以用于POSIX共享内存
+   (shm_open,shm_unlink)。添加内容到/etc/fstab应注意如下:
+
+   tmpfs   /dev/shmtmpfs   defaults0 0
+
+   使用时需要记住创建挂载tmpfs的目录。
+
+   SYSV共享内存无需挂载,内部已默认支持。(在2.3内核版本中,必须挂载
+   tmpfs的前身(shm fs)才能使用SYSV共享内存)
+
+3) 很多人(包括我)都觉的在/tmp和/var/tmp上挂载非常方便,并具有较大的
+   swap分区。目前循环挂载tmpfs可以正常工作,所以大多数发布都应当可以
+   使用mkinitrd通过/tmp访问/tmp。
+
+4) 也许还有更多我不知道的地方:-)
+
+
+tmpfs有三个用于调整大小的挂载选项:
+
+=  
+size   tmpfs实例分配的字节数限制。默认值是不swap时物理RAM的一半。
+   如果tmpfs实例过大,机器将死锁,因为OOM处理将无法释放该内存。
+nr_blocks  与size相同,但以PAGE_SIZE为单位。
+nr_inodes  tmpfs实例的最大inode个数。默认值是物理内存页数的一半,或者
+   (有高端内存的机器)低端内存RAM的页数,二者以较低者为准。
+=  
+
+这些参数接受后缀k,m或g表示千,兆和千兆字节,可以在remount时更改。
+size参数也接受后缀%用来限制tmpfs实例占用物理RAM的百分比:
+未指定size或nr_blocks时,默认值为size=50%
+
+如果nr_blocks=0(或size=0),block个数将不受限制;如果nr_inodes=0,
+inode个数将不受限制。这样挂载通常是不明智的,因为它允许任何具有写权限的
+用户通过访问tmpfs耗尽机器上的所有内存;但同时这样做也会增强在多个CPU的
+场景下的访问。
+
+tmpfs具有为所有文件设置NUMA内存分配策略挂载选项(如果启用了CONFIG_NUMA),
+可以通过“mount -o remount ...”调整
+
+ ==
+mpol=default 采用进程分配策略
+ (请参阅 set_mempolicy(2))
+mpol=prefer:Node 倾向从给定的节点分配
+mpol=bind:NodeList   只允许从指定的链表分配
+mpol=interleave  倾向于依次从每个节点分配
+mpol=interleave:NodeList 依次从每个节点分配
+mpol=local  prefers 从本地节点分配内存
+ ==
+
+NodeList格式是以逗号分隔的十进制数字表示大小和范围,最大和最小范围是用-
+分隔符的十进制数来表示。例如,mpol=bind0-3,5,7,9-15
+
+带有有效NodeList的内存策略将按指定格式保存,在创建文件时使用。当任务在该
+文件系统上创建文件时,会使用到挂载时的内存策略NodeList选项,如果设置的话,
+由调用任务的cpuset[请参见Documentation/admin-guide/cgroup-v1/cpusets.rst]
+以及下面列出的可选标志约束。如果NodeLists为设置为空集,则文件的内存策略将
+恢复为“默认”策略。
+
+NUMA内存分配策略有可选标志,可以用于模式结合。在挂载tmpfs时指定这些可选
+标志可以在NodeList之前生效。
+Documentation/admin-guide/mm/numa_memory_policy.rst列出所有可用的内存
+分配策略模式标志及其对内存策略。
+
+::
+
+   =static 相当于 MPOL_F_STATIC_NODES
+   =relative   相当于 MPOL_F_RELATIVE_NODES
+
+例如,mpol=bind=staticNodeList相当于MPOL_BIND|MPOL_F_STATIC_NODES的分配策略
+
+请注意,如果内核不支持NUMA,那么使用mpol选项挂载tmpfs将会失败;nodelist指定不
+在线的节点也会失败。如果您的系统依赖于此,但内核会运行不带NUMA功能(也许是安全
+revocery内核),或者具有较少的节点在线,建议从自动模式中省略mpol选项挂载选项。
+可以在以后通过“mount -o remount,mpol=Policy:NodeList MountPoint”添加到挂载点。
+
+要指定初始根目录,可以使用如下挂载选项:
+
+   ==
+模式 权限用八进制数字表示
+uid应用ID
+gid组ID
+   ==
+
+这些选项对remount没有任何影响。您可以通过chmod(1),chown(1)和chgrp(1)的更改
+已经挂载的参数。
+
+tmpfs具有选择32位还是64位inode的挂载选项:
+
+===   
+inode64   Use 64-bit inode numbers
+inode32   Use 32-bit inode numbers
+===   
+
+在32位内核上,默认是inode32,挂载时指定inode64会被拒绝。
+在64位内核上,默认配置是CONFIG_TMPFS_INODE64。inode64避免了单个设备上可能有多个
+具有相同inode编号的文件;比如32位应用程序使用glibc如果长期访问tmpfs,一旦达到33
+位inode编号,就有EOVERFLOW失败的危险,无法打开大于2GiB的文件,并返回EINVAL。
+
+所以'mount -t tmpfs -o size=10G,nr_inodes=10k,mode=700 tmpfs /mytmpfs'将在
+/mytmpfs上挂载tmpfs实例,分配只能由root用户访问的10GB RAM/SWAP,可以有10240个
+inode的实例。
+
+
+:作者:
+   Christoph Rohland , 1.12.01
+:更新:
+   Hugh Dickins, 4 June 2007
+:更新:
+   KOSAKI Motohiro, 16 Mar 2010
+:更新:
+   Chris Down, 13 July 2020
-- 
2.7.4



[PATCH] wireless: realtek: fix spelling typo of workaround

2020-11-07 Thread Wang Qing
workarould -> workaround

Signed-off-by: Wang Qing 
---
 drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
index f41a764..b4628b4
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c
@@ -62,7 +62,7 @@ static void rtl8812ae_fixspur(struct ieee80211_hw *hw,
rtl_set_bbreg(hw, RRFMOD, 0xC00, 0x2);
/* 0x8AC[11:10] = 2'b10*/
 
-   /* <20120914, Kordan> A workarould to resolve
+   /* <20120914, Kordan> A workaround to resolve
 * 2480Mhz spur by setting ADC clock as 160M. (Asked by Binson)
 */
if (band_width == HT_CHANNEL_WIDTH_20 &&
@@ -82,7 +82,7 @@ static void rtl8812ae_fixspur(struct ieee80211_hw *hw,
/*0x8C4[30] = 0*/
}
} else if (rtlhal->hw_type == HARDWARE_TYPE_RTL8812AE) {
-   /* <20120914, Kordan> A workarould to resolve
+   /* <20120914, Kordan> A workaround to resolve
 * 2480Mhz spur by setting ADC clock as 160M.
 */
if (band_width == HT_CHANNEL_WIDTH_20 &&
-- 
2.7.4



[PATCH] sched: remove duplicate include unnecessary

2020-11-07 Thread Wang Qing
Remove duplicate header include which is unnecessary.

Signed-off-by: Wang Qing 
---
 kernel/sched/sched.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index df80bfc..dd91a8b
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -351,7 +351,6 @@ extern bool dl_cpu_busy(unsigned int cpu);
 #ifdef CONFIG_CGROUP_SCHED
 
 #include 
-#include 
 
 struct cfs_rq;
 struct rt_rq;
-- 
2.7.4



[PATCH] locking: remove duplicate include of percpu-rwsem.h

2020-11-07 Thread Wang Qing
Remove duplicate header include which is unnecessary.

Signed-off-by: Wang Qing 
---
 kernel/locking/locktorture.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/locking/locktorture.c b/kernel/locking/locktorture.c
index 62d215b..af99e9c 100644
--- a/kernel/locking/locktorture.c
+++ b/kernel/locking/locktorture.c
@@ -27,7 +27,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 MODULE_LICENSE("GPL");
-- 
2.7.4



[PATCH] firmware: fix spelling typo of 'wtih'

2020-11-07 Thread Wang Qing
wtih -> with

Signed-off-by: Wang Qing 
---
 drivers/firmware/raspberrypi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c
index 2371d08..30259dc
--- a/drivers/firmware/raspberrypi.c
+++ b/drivers/firmware/raspberrypi.c
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
- * Defines interfaces for interacting wtih the Raspberry Pi firmware's
+ * Defines interfaces for interacting with the Raspberry Pi firmware's
  * property channel.
  *
  * Copyright © 2015 Broadcom
-- 
2.7.4



[PATCH] bpf: remove duplicate include

2020-11-07 Thread Wang Qing
Remove duplicate header which is included twice.

Signed-off-by: Wang Qing 
---
 kernel/bpf/btf.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index ed7d02e..6324de8
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -22,7 +22,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 /* BTF (BPF Type Format) is the meta data format which describes
-- 
2.7.4



[PATCH v3 bpf] trace: bpf: Fix passing zero to PTR_ERR()

2020-11-06 Thread Wang Qing
There is a bug when passing zero to PTR_ERR() and return.
Fix smatch err.

Signed-off-by: Wang Qing 
---
 kernel/trace/bpf_trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index 4517c8b..5113fd4
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -1198,7 +1198,7 @@ static int bpf_btf_printf_prepare(struct btf_ptr *ptr, 
u32 btf_ptr_size,
*btf = bpf_get_btf_vmlinux();
 
if (IS_ERR_OR_NULL(*btf))
-   return PTR_ERR(*btf);
+   return IS_ERR(*btf) ? PTR_ERR(*btf) : -EINVAL;
 
if (ptr->type_id > 0)
*btf_id = ptr->type_id;
-- 
2.7.4



[V2] trace: Fix passing zero to PTR_ERR()

2020-11-06 Thread Wang Qing
There is a bug when passing zero to PTR_ERR() and return.
Fix smatch err.

Signed-off-by: Wang Qing 
---
 kernel/trace/bpf_trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index 4517c8b..5113fd4
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -1198,7 +1198,7 @@ static int bpf_btf_printf_prepare(struct btf_ptr *ptr, 
u32 btf_ptr_size,
*btf = bpf_get_btf_vmlinux();
 
if (IS_ERR_OR_NULL(*btf))
-   return PTR_ERR(*btf);
+   return IS_ERR(*btf) ? PTR_ERR(*btf) : -EINVAL;
 
if (ptr->type_id > 0)
*btf_id = ptr->type_id;
-- 
2.7.4



[V2] [PATCH] net/ethernet: update ret when ptp_clock is ERROR

2020-11-06 Thread Wang Qing
We always have to update the value of ret, otherwise the error value
 may be the previous one. And ptp_clock_register() never return NULL
 when PTP_1588_CLOCK enable, so we use IS_ERR here.

Signed-off-by: Wang Qing 
---
 drivers/net/ethernet/ti/am65-cpts.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/ti/am65-cpts.c 
b/drivers/net/ethernet/ti/am65-cpts.c
index 75056c1..ec8e56d
--- a/drivers/net/ethernet/ti/am65-cpts.c
+++ b/drivers/net/ethernet/ti/am65-cpts.c
@@ -998,11 +998,10 @@ struct am65_cpts *am65_cpts_create(struct device *dev, 
void __iomem *regs,
am65_cpts_settime(cpts, ktime_to_ns(ktime_get_real()));
 
cpts->ptp_clock = ptp_clock_register(>ptp_info, cpts->dev);
-   if (IS_ERR_OR_NULL(cpts->ptp_clock)) {
+   if (IS_ERR(cpts->ptp_clock)) {
dev_err(dev, "Failed to register ptp clk %ld\n",
PTR_ERR(cpts->ptp_clock));
-   if (!cpts->ptp_clock)
-   ret = -ENODEV;
+   ret = PTR_ERR(cpts->ptp_clock);
goto refclk_disable;
}
cpts->phc_index = ptp_clock_index(cpts->ptp_clock);
-- 
2.7.4



[PATCH] pcp_clock: return EOPNOTSUPP if !CONFIG_PTP_1588_CLOCK

2020-11-06 Thread Wang Qing
pcp_clock_register() is checked with IS_ERR(), and will crash if !PTP,
change return value to ERR_PTR(-EOPNOTSUPP) for the !CONFIG_PTP_1588_CLOCK
 and so question resolved.

Signed-off-by: Wang Qing 
---
 include/linux/ptp_clock_kernel.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h
index d3e8ba5..05db40c
--- a/include/linux/ptp_clock_kernel.h
+++ b/include/linux/ptp_clock_kernel.h
@@ -276,7 +276,7 @@ void ptp_cancel_worker_sync(struct ptp_clock *ptp);
 #else
 static inline struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
   struct device *parent)
-{ return NULL; }
+{ return ERR_PTR(-EOPNOTSUPP); }
 static inline int ptp_clock_unregister(struct ptp_clock *ptp)
 { return 0; }
 static inline void ptp_clock_event(struct ptp_clock *ptp,
-- 
2.7.4



[V2] drm: msm: adreno: use IS_ERR() instead of null pointer check

2020-11-06 Thread Wang Qing
a6xx_gmu_get_mmio() never return null in case of error, but ERR_PTR(), so 
we should use IS_ERR() instead of null pointer check and IS_ERR_OR_NULL().

Signed-off-by: Wang Qing 
---
 drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index 491fee4..82420f7
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -492,7 +492,7 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)
void __iomem *seqptr = a6xx_gmu_get_mmio(pdev, "gmu_pdc_seq");
uint32_t pdc_address_offset;
 
-   if (!pdcptr || !seqptr)
+   if (IS_ERR(pdcptr) || IS_ERR(seqptr))
goto err;
 
if (adreno_is_a618(adreno_gpu) || adreno_is_a640(adreno_gpu))
@@ -580,9 +580,9 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)
wmb();
 
 err:
-   if (!IS_ERR_OR_NULL(pdcptr))
+   if (!IS_ERR(pdcptr))
iounmap(pdcptr);
-   if (!IS_ERR_OR_NULL(seqptr))
+   if (!IS_ERR(seqptr))
iounmap(seqptr);
 }
 
-- 
2.7.4



[PATCH] ntb: idt: fix error check in ntb_hw_idt.c

2020-11-06 Thread Wang Qing
idt_create_dev never return NULL and fix smatch warning.

Signed-off-by: Wang Qing 
---
 drivers/ntb/hw/idt/ntb_hw_idt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ntb/hw/idt/ntb_hw_idt.c b/drivers/ntb/hw/idt/ntb_hw_idt.c
index d54261f..e7a4c2a
--- a/drivers/ntb/hw/idt/ntb_hw_idt.c
+++ b/drivers/ntb/hw/idt/ntb_hw_idt.c
@@ -2511,7 +2511,7 @@ static int idt_init_dbgfs(struct idt_ntb_dev *ndev)
/* If the top directory is not created then do nothing */
if (IS_ERR_OR_NULL(dbgfs_topdir)) {
dev_info(>ntb.pdev->dev, "Top DebugFS directory absent");
-   return PTR_ERR(dbgfs_topdir);
+   return PTR_ERR_OR_ZERO(dbgfs_topdir);
}
 
/* Create the info file node */
@@ -2756,7 +2756,7 @@ static int idt_pci_probe(struct pci_dev *pdev,
 
/* Allocate the memory for IDT NTB device data */
ndev = idt_create_dev(pdev, id);
-   if (IS_ERR_OR_NULL(ndev))
+   if (IS_ERR(ndev))
return PTR_ERR(ndev);
 
/* Initialize the basic PCI subsystem of the device */
-- 
2.7.4



[PATCH] arm: fix a typo

2020-11-06 Thread Wang Qing
withing should be within.

Signed-off-by: Wang Qing 
---
 arch/c6x/platforms/megamod-pic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/c6x/platforms/megamod-pic.c b/arch/c6x/platforms/megamod-pic.c
index 56189e5..adac7ac
--- a/arch/c6x/platforms/megamod-pic.c
+++ b/arch/c6x/platforms/megamod-pic.c
@@ -165,7 +165,7 @@ static void __init set_megamod_mux(struct megamod_pic *pic, 
int src, int output)
  * The MUX map is an array of up to 12 cells; one for each usable core priority
  * interrupt. The value of a given cell is the megamodule interrupt source
  * which is to me MUXed to the output corresponding to the cell position
- * withing the array. The first cell in the array corresponds to priority
+ * within the array. The first cell in the array corresponds to priority
  * 4 and the last (12th) cell corresponds to priority 15. The allowed
  * values are 4 - ((NR_COMBINERS * 32) - 1). Note that the combined interrupt
  * sources (0 - 3) are not allowed to be mapped through this property. They
-- 
2.7.4



[PATCH] crypto: Fix return value check in aead_crypt()

2020-11-06 Thread Wang Qing
Fix passing zero to 'PTR_ERR' warning

Signed-off-by: Wang Qing 
---
 drivers/crypto/caam/caamalg_qi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/caam/caamalg_qi.c b/drivers/crypto/caam/caamalg_qi.c
index 66f60d7..add60e8
--- a/drivers/crypto/caam/caamalg_qi.c
+++ b/drivers/crypto/caam/caamalg_qi.c
@@ -1166,7 +1166,7 @@ static inline int aead_crypt(struct aead_request *req, 
bool encrypt)
/* allocate extended descriptor */
edesc = aead_edesc_alloc(req, encrypt);
if (IS_ERR_OR_NULL(edesc))
-   return PTR_ERR(edesc);
+   return PTR_ERR_OR_ZERO(edesc);
 
/* Create and submit job descriptor */
ret = caam_qi_enqueue(ctx->qidev, >drv_req);
-- 
2.7.4



[PATCH] trace: Fix passing zero to 'PTR_ERR' warning

2020-11-06 Thread Wang Qing
Fix smatch warning.

Signed-off-by: Wang Qing 
---
 kernel/trace/bpf_trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index 4517c8b..2cb9c45
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -1198,7 +1198,7 @@ static int bpf_btf_printf_prepare(struct btf_ptr *ptr, 
u32 btf_ptr_size,
*btf = bpf_get_btf_vmlinux();
 
if (IS_ERR_OR_NULL(*btf))
-   return PTR_ERR(*btf);
+   return PTR_ERR_OR_ZERO(*btf);
 
if (ptr->type_id > 0)
*btf_id = ptr->type_id;
-- 
2.7.4



  1   2   >