[PATCH tip/core/rcu 07/28] torture: Move build/run synchronization files into scenario directories

2021-03-03 Thread paulmck
From: "Paul E. McKenney" 

Currently the bN.ready and bN.wait files are placed in the
rcutorture directory, which really is not at all a good place
for run-specific files.  This commit therefore renames these
files to build.ready and build.wait and then moves them into the
scenario directories within the "res" directory, for example, into
tools/testing/selftests/rcutorture/res/2021.02.10-15.08.23/TINY01.

Signed-off-by: Paul E. McKenney 
---
 .../selftests/rcutorture/bin/kvm-test-1-run.sh | 25 +++---
 tools/testing/selftests/rcutorture/bin/kvm.sh  | 10 -
 2 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh 
b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh
index 03c0410..91578d3 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh
@@ -7,7 +7,7 @@
 # Execute this in the source tree.  Do not run it as a background task
 # because qemu does not seem to like that much.
 #
-# Usage: kvm-test-1-run.sh config builddir resdir seconds qemu-args 
boot_args_in
+# Usage: kvm-test-1-run.sh config resdir seconds qemu-args boot_args_in
 #
 # qemu-args defaults to "-enable-kvm -nographic", along with arguments
 #  specifying the number of CPUs and other options
@@ -35,8 +35,7 @@ mkdir $T
 config_template=${1}
 config_dir=`echo $config_template | sed -e 's,/[^/]*$,,'`
 title=`echo $config_template | sed -e 's/^.*\///'`
-builddir=${2}
-resdir=${3}
+resdir=${2}
 if test -z "$resdir" -o ! -d "$resdir" -o ! -w "$resdir"
 then
echo "kvm-test-1-run.sh :$resdir: Not a writable directory, cannot 
store results into it"
@@ -89,9 +88,9 @@ then
ln -s $base_resdir/Make*.out $resdir  # for kvm-recheck.sh
ln -s $base_resdir/.config $resdir  # for kvm-recheck.sh
echo Initial build failed, not running KVM, see $resdir.
-   if test -f $builddir.wait
+   if test -f $resdir/build.wait
then
-   mv $builddir.wait $builddir.ready
+   mv $resdir/build.wait $resdir/build.ready
fi
exit 1
 elif kvm-build.sh $T/KcList $resdir
@@ -118,23 +117,23 @@ else
# Build failed.
cp .config $resdir || :
echo Build failed, not running KVM, see $resdir.
-   if test -f $builddir.wait
+   if test -f $resdir/build.wait
then
-   mv $builddir.wait $builddir.ready
+   mv $resdir/build.wait $resdir/build.ready
fi
exit 1
 fi
-if test -f $builddir.wait
+if test -f $resdir/build.wait
 then
-   mv $builddir.wait $builddir.ready
+   mv $resdir/build.wait $resdir/build.ready
 fi
-while test -f $builddir.ready
+while test -f $resdir/build.ready
 do
sleep 1
 done
-seconds=$4
-qemu_args=$5
-boot_args_in=$6
+seconds=$3
+qemu_args=$4
+boot_args_in=$5
 
 if test -z "$TORTURE_BUILDONLY"
 then
diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh 
b/tools/testing/selftests/rcutorture/bin/kvm.sh
index 1de198d..7944510 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -444,7 +444,6 @@ function dump(first, pastlast, batchnum)
print "needqemurun="
jn=1
for (j = first; j < pastlast; j++) {
-   builddir=KVM "/b" j - first + 1
cpusr[jn] = cpus[j];
if (cfrep[cf[j]] == "") {
cfr[jn] = cf[j];
@@ -453,15 +452,15 @@ function dump(first, pastlast, batchnum)
cfrep[cf[j]]++;
cfr[jn] = cf[j] "." cfrep[cf[j]];
}
+   builddir=rd cfr[jn] "/build";
if (cpusr[jn] > ncpus && ncpus != 0)
ovf = "-ovf";
else
ovf = "";
print "echo ", cfr[jn], cpusr[jn] ovf ": Starting build. `date` 
| tee -a " rd "log";
-   print "rm -f " builddir ".*";
-   print "touch " builddir ".wait";
print "mkdir " rd cfr[jn] " || :";
-   print "kvm-test-1-run.sh " CONFIGDIR cf[j], builddir, rd 
cfr[jn], dur " \"" TORTURE_QEMU_ARG "\" \"" TORTURE_BOOTARGS "\" > " rd cfr[jn] 
 "/kvm-test-1-run.sh.out 2>&1 &"
+   print "touch " builddir ".wait";
+   print "kvm-test-1-run.sh " CONFIGDIR cf[j], rd cfr[jn], dur " 
\"" TORTURE_QEMU_ARG "\" \"" TORTURE_BOOTARGS "\" > " rd cfr[jn]  
"/kvm-test-1-run.sh.out 2>&1 &"
print "echo ", cfr[jn], cpusr[jn] ovf ": Waiting for build to 
complete. `date` | tee -a " rd "log";
print "while test -f " builddir ".wait"
print "do"
@@ -471,7 +470,7 @@ function dump(first, pastlast, batchnum)
jn++;
}
for (j = 1; j < jn; j++) {
-   builddir=KVM "/b" j
+   builddir=rd cfr[j] "/build";
print "rm -f " builddir 

[PATCH tip/core/rcu 11/28] torture: Reverse jittering and duration parameters for jitter.sh

2021-03-03 Thread paulmck
From: "Paul E. McKenney" 

Remote rcutorture testing requires that jitter.sh continue to be
invoked from the generated script for local runs, but that it instead
be invoked on the remote system for distributed runs.  This argues
for common jitterstart and jitterstop scripts.  But it would be good
for jitterstart and jitterstop to control the name and location of the
"jittering" file, while continuing to have the duration controlled by
the caller of these new scripts.

This commit therefore reverses the order of the jittering and duration
parameters for jitter.sh, so that the jittering parameter precedes the
duration parameter.

Signed-off-by: Paul E. McKenney 
---
 tools/testing/selftests/rcutorture/bin/jitter.sh | 6 +++---
 tools/testing/selftests/rcutorture/bin/kvm.sh| 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/jitter.sh 
b/tools/testing/selftests/rcutorture/bin/jitter.sh
index ed0ea86..ff1d3e4 100755
--- a/tools/testing/selftests/rcutorture/bin/jitter.sh
+++ b/tools/testing/selftests/rcutorture/bin/jitter.sh
@@ -5,7 +5,7 @@
 # of this script is to inflict random OS jitter on a concurrently running
 # test.
 #
-# Usage: jitter.sh me duration jittering-path [ sleepmax [ spinmax ] ]
+# Usage: jitter.sh me jittering-path duration [ sleepmax [ spinmax ] ]
 #
 # me: Random-number-generator seed salt.
 # duration: Time to run in seconds.
@@ -18,8 +18,8 @@
 # Authors: Paul E. McKenney 
 
 me=$(($1 * 1000))
-duration=$2
-jittering=$3
+jittering=$2
+duration=$3
 sleepmax=${4-100}
 spinmax=${5-1000}
 
diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh 
b/tools/testing/selftests/rcutorture/bin/kvm.sh
index de93802..a2ee3f2 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -504,7 +504,7 @@ function dump(first, pastlast, batchnum)
print "\techo  Starting kernels. `date` | tee -a " rd "log";
print "\ttouch " rd "jittering"
for (j = 0; j < njitter; j++)
-   print "\tjitter.sh " j " " dur " " rd "jittering " ja[2] " " 
ja[3] "&"
+   print "\tjitter.sh " j " " rd "jittering " dur " " ja[2] " " 
ja[3] "&"
print "\twhile ls $runfiles > /dev/null 2>&1"
print "\tdo"
print "\t\t:"
-- 
2.9.5



[PATCH tip/core/rcu 0/3] Polling RCU grace-period interfaces for v5.13

2021-03-03 Thread Paul E. McKenney
Hello!

This series provides additional polling interfaces for RCU, so that
an updater may initiate and poll for completion of an RCU grace period
despite never being invoked from a sleepable region of code.  These are
similar to the corresponding SRCU interfaces, give or take additional
restrictions to avoid deadlock with the scheduler.

1.  Provide polling interfaces for Tree RCU grace periods.

2.  Provide polling interfaces for Tiny RCU grace periods.

3.  Test start_poll_synchronize_rcu() and
poll_state_synchronize_rcu().

Thanx, Paul



 include/linux/rcutiny.h |   11 ---
 include/linux/rcutree.h |2 +
 kernel/rcu/rcutorture.c |   12 ++--
 kernel/rcu/tiny.c   |   40 +++
 kernel/rcu/tree.c   |   70 
 5 files changed, 116 insertions(+), 19 deletions(-)


[PATCH tip/core/rcu 1/3] rcu: Provide polling interfaces for Tree RCU grace periods

2021-03-03 Thread paulmck
From: "Paul E. McKenney" 

There is a need for a non-blocking polling interface for RCU grace
periods, so this commit supplies start_poll_synchronize_rcu() and
poll_state_synchronize_rcu() for this purpose.  Note that the existing
get_state_synchronize_rcu() may be used if future grace periods are
inevitable (perhaps due to a later call_rcu() invocation).  The new
start_poll_synchronize_rcu() is to be used if future grace periods
might not otherwise happen.  Finally, poll_state_synchronize_rcu()
provides a lockless check for a grace period having elapsed since
the corresponding call to either of the get_state_synchronize_rcu()
or start_poll_synchronize_rcu().

As with get_state_synchronize_rcu(), the return value from either
get_state_synchronize_rcu() or start_poll_synchronize_rcu() is passed in
to a later call to either poll_state_synchronize_rcu() or the existing
(might_sleep) cond_synchronize_rcu().

Signed-off-by: Paul E. McKenney 
---
 include/linux/rcutree.h |  2 ++
 kernel/rcu/tree.c   | 70 +
 2 files changed, 67 insertions(+), 5 deletions(-)

diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index df578b7..b89b541 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -41,6 +41,8 @@ void rcu_momentary_dyntick_idle(void);
 void kfree_rcu_scheduler_running(void);
 bool rcu_gp_might_be_stalled(void);
 unsigned long get_state_synchronize_rcu(void);
+unsigned long start_poll_synchronize_rcu(void);
+bool poll_state_synchronize_rcu(unsigned long oldstate);
 void cond_synchronize_rcu(unsigned long oldstate);
 
 void rcu_idle_enter(void);
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index da6f521..8e0a140 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -3774,8 +3774,8 @@ EXPORT_SYMBOL_GPL(synchronize_rcu);
  * get_state_synchronize_rcu - Snapshot current RCU state
  *
  * Returns a cookie that is used by a later call to cond_synchronize_rcu()
- * to determine whether or not a full grace period has elapsed in the
- * meantime.
+ * or poll_state_synchronize_rcu() to determine whether or not a full
+ * grace period has elapsed in the meantime.
  */
 unsigned long get_state_synchronize_rcu(void)
 {
@@ -3789,13 +3789,73 @@ unsigned long get_state_synchronize_rcu(void)
 EXPORT_SYMBOL_GPL(get_state_synchronize_rcu);
 
 /**
+ * start_poll_state_synchronize_rcu - Snapshot and start RCU grace period
+ *
+ * Returns a cookie that is used by a later call to cond_synchronize_rcu()
+ * or poll_state_synchronize_rcu() to determine whether or not a full
+ * grace period has elapsed in the meantime.  If the needed grace period
+ * is not already slated to start, notifies RCU core of the need for that
+ * grace period.
+ *
+ * Interrupts must be enabled for the case where it is necessary to awaken
+ * the grace-period kthread.
+ */
+unsigned long start_poll_synchronize_rcu(void)
+{
+   unsigned long flags;
+   unsigned long gp_seq = get_state_synchronize_rcu();
+   bool needwake;
+   struct rcu_data *rdp;
+   struct rcu_node *rnp;
+
+   lockdep_assert_irqs_enabled();
+   local_irq_save(flags);
+   rdp = this_cpu_ptr(_data);
+   rnp = rdp->mynode;
+   raw_spin_lock_rcu_node(rnp); // irqs already disabled.
+   needwake = rcu_start_this_gp(rnp, rdp, gp_seq);
+   raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
+   if (needwake)
+   rcu_gp_kthread_wake();
+   return gp_seq;
+}
+EXPORT_SYMBOL_GPL(start_poll_synchronize_rcu);
+
+/**
+ * poll_state_synchronize_rcu - Conditionally wait for an RCU grace period
+ *
+ * @oldstate: return from call to get_state_synchronize_rcu() or 
start_poll_synchronize_rcu()
+ *
+ * If a full RCU grace period has elapsed since the earlier call from
+ * which oldstate was obtained, return @true, otherwise return @false.
+ * Otherwise, invoke synchronize_rcu() to wait for a full grace period.
+ *
+ * Yes, this function does not take counter wrap into account.
+ * But counter wrap is harmless.  If the counter wraps, we have waited for
+ * more than 2 billion grace periods (and way more on a 64-bit system!).
+ * Those needing to keep oldstate values for very long time periods
+ * (many hours even on 32-bit systems) should check them occasionally
+ * and either refresh them or set a flag indicating that the grace period
+ * has completed.
+ */
+bool poll_state_synchronize_rcu(unsigned long oldstate)
+{
+   if (rcu_seq_done(_state.gp_seq, oldstate)) {
+   smp_mb(); /* Ensure GP ends before subsequent accesses. */
+   return true;
+   }
+   return false;
+}
+EXPORT_SYMBOL_GPL(poll_state_synchronize_rcu);
+
+/**
  * cond_synchronize_rcu - Conditionally wait for an RCU grace period
  *
  * @oldstate: return value from earlier call to get_state_synchronize_rcu()
  *
  * If a full RCU grace period has elapsed since the earlier call to
- * get_state_synchronize_rcu(), just return.  Otherwise, invoke
- * 

[PATCH tip/core/rcu 3/3] rcutorture: Test start_poll_synchronize_rcu() and poll_state_synchronize_rcu()

2021-03-03 Thread paulmck
From: "Paul E. McKenney" 

This commit causes rcutorture to test the new start_poll_synchronize_rcu()
and poll_state_synchronize_rcu() functions.  Because of the difficulty of
determining the nature of a synchronous RCU grace (expedited or not),
the test that insisted that poll_state_synchronize_rcu() detect an
intervening synchronize_rcu() had to be dropped.

Signed-off-by: Paul E. McKenney 
---
 kernel/rcu/rcutorture.c | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 99657ff..956e6bf 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -494,6 +494,8 @@ static struct rcu_torture_ops rcu_ops = {
.sync   = synchronize_rcu,
.exp_sync   = synchronize_rcu_expedited,
.get_gp_state   = get_state_synchronize_rcu,
+   .start_gp_poll  = start_poll_synchronize_rcu,
+   .poll_gp_state  = poll_state_synchronize_rcu,
.cond_sync  = cond_synchronize_rcu,
.call   = call_rcu,
.cb_barrier = rcu_barrier,
@@ -1223,14 +1225,6 @@ rcu_torture_writer(void *arg)
WARN_ON_ONCE(1);
break;
}
-   if (cur_ops->get_gp_state && cur_ops->poll_gp_state)
-   WARN_ONCE(rcu_torture_writer_state != 
RTWS_DEF_FREE &&
- !cur_ops->poll_gp_state(cookie),
- "%s: Cookie check 2 failed %s(%d) 
%lu->%lu\n",
- __func__,
- rcu_torture_writer_state_getname(),
- rcu_torture_writer_state,
- cookie, cur_ops->get_gp_state());
}
WRITE_ONCE(rcu_torture_current_version,
   rcu_torture_current_version + 1);
@@ -1589,7 +1583,7 @@ static bool rcu_torture_one_read(struct 
torture_random_state *trsp, long myid)
preempt_enable();
if (cur_ops->get_gp_state && cur_ops->poll_gp_state)
WARN_ONCE(cur_ops->poll_gp_state(cookie),
- "%s: Cookie check 3 failed %s(%d) %lu->%lu\n",
+ "%s: Cookie check 2 failed %s(%d) %lu->%lu\n",
  __func__,
  rcu_torture_writer_state_getname(),
  rcu_torture_writer_state,
-- 
2.9.5



[PATCH tip/core/rcu 2/3] rcu: Provide polling interfaces for Tiny RCU grace periods

2021-03-03 Thread paulmck
From: "Paul E. McKenney" 

There is a need for a non-blocking polling interface for RCU grace
periods, so this commit supplies start_poll_synchronize_rcu() and
poll_state_synchronize_rcu() for this purpose.  Note that the existing
get_state_synchronize_rcu() may be used if future grace periods are
inevitable (perhaps due to a later call_rcu() invocation).  The new
start_poll_synchronize_rcu() is to be used if future grace periods
might not otherwise happen.  Finally, poll_state_synchronize_rcu()
provides a lockless check for a grace period having elapsed since
the corresponding call to either of the get_state_synchronize_rcu()
or start_poll_synchronize_rcu().

As with get_state_synchronize_rcu(), the return value from either
get_state_synchronize_rcu() or start_poll_synchronize_rcu() is passed in
to a later call to either poll_state_synchronize_rcu() or the existing
(might_sleep) cond_synchronize_rcu().

Signed-off-by: Paul E. McKenney 
---
 include/linux/rcutiny.h | 11 ++-
 kernel/rcu/tiny.c   | 40 
 2 files changed, 46 insertions(+), 5 deletions(-)

diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index 2a97334..69108cf4 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -17,14 +17,15 @@
 /* Never flag non-existent other CPUs! */
 static inline bool rcu_eqs_special_set(int cpu) { return false; }
 
-static inline unsigned long get_state_synchronize_rcu(void)
-{
-   return 0;
-}
+unsigned long get_state_synchronize_rcu(void);
+unsigned long start_poll_synchronize_rcu(void);
+bool poll_state_synchronize_rcu(unsigned long oldstate);
 
 static inline void cond_synchronize_rcu(unsigned long oldstate)
 {
-   might_sleep();
+   if (poll_state_synchronize_rcu(oldstate))
+   return;
+   synchronize_rcu();
 }
 
 extern void rcu_barrier(void);
diff --git a/kernel/rcu/tiny.c b/kernel/rcu/tiny.c
index aa897c3..c8a029f 100644
--- a/kernel/rcu/tiny.c
+++ b/kernel/rcu/tiny.c
@@ -32,12 +32,14 @@ struct rcu_ctrlblk {
struct rcu_head *rcucblist; /* List of pending callbacks (CBs). */
struct rcu_head **donetail; /* ->next pointer of last "done" CB. */
struct rcu_head **curtail;  /* ->next pointer of last CB. */
+   unsigned long gp_seq;   /* Grace-period counter. */
 };
 
 /* Definition for rcupdate control block. */
 static struct rcu_ctrlblk rcu_ctrlblk = {
.donetail   = _ctrlblk.rcucblist,
.curtail= _ctrlblk.rcucblist,
+   .gp_seq = 0 - 300UL,
 };
 
 void rcu_barrier(void)
@@ -56,6 +58,7 @@ void rcu_qs(void)
rcu_ctrlblk.donetail = rcu_ctrlblk.curtail;
raise_softirq_irqoff(RCU_SOFTIRQ);
}
+   WRITE_ONCE(rcu_ctrlblk.gp_seq, rcu_ctrlblk.gp_seq + 1);
local_irq_restore(flags);
 }
 
@@ -177,6 +180,43 @@ void call_rcu(struct rcu_head *head, rcu_callback_t func)
 }
 EXPORT_SYMBOL_GPL(call_rcu);
 
+/*
+ * Return a grace-period-counter "cookie".  For more information,
+ * see the Tree RCU header comment.
+ */
+unsigned long get_state_synchronize_rcu(void)
+{
+   return READ_ONCE(rcu_ctrlblk.gp_seq);
+}
+EXPORT_SYMBOL_GPL(get_state_synchronize_rcu);
+
+/*
+ * Return a grace-period-counter "cookie" and ensure that a future grace
+ * period completes.  For more information, see the Tree RCU header comment.
+ */
+unsigned long start_poll_synchronize_rcu(void)
+{
+   unsigned long gp_seq = get_state_synchronize_rcu();
+
+   if (unlikely(is_idle_task(current))) {
+   /* force scheduling for rcu_qs() */
+   resched_cpu(0);
+   }
+   return gp_seq;
+}
+EXPORT_SYMBOL_GPL(start_poll_synchronize_rcu);
+
+/*
+ * Return true if the grace period corresponding to oldstate has completed
+ * and false otherwise.  For more information, see the Tree RCU header
+ * comment.
+ */
+bool poll_state_synchronize_rcu(unsigned long oldstate)
+{
+   return READ_ONCE(rcu_ctrlblk.gp_seq) != oldstate;
+}
+EXPORT_SYMBOL_GPL(poll_state_synchronize_rcu);
+
 void __init rcu_init(void)
 {
open_softirq(RCU_SOFTIRQ, rcu_process_callbacks);
-- 
2.9.5



Re: drivers/gpu/drm/msm/dp/dp_hpd.c:37 dp_hpd_connect() error: we previously assumed 'hpd_priv->dp_cb' could be null (see line 37)

2021-03-03 Thread abhinavk

Hi Dan

Thanks for reporting this, will submit a change to fix this.

Abhinav

On 2021-02-28 23:02, Dan Carpenter wrote:

tree:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
master
head:   fe07bfda2fb9cdef8a4d4008a409bb02f35f1bd8
commit: c943b4948b5848fc0e07f875edbd35a973879e22 drm/msm/dp: add
displayPort driver support
config: arm64-randconfig-m031-20210301 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

smatch warnings:
drivers/gpu/drm/msm/dp/dp_hpd.c:37 dp_hpd_connect() error: we
previously assumed 'hpd_priv->dp_cb' could be null (see line 37)
drivers/gpu/drm/msm/dp/dp_power.c:203 dp_power_clk_enable() warn:
inconsistent indenting

vim +37 drivers/gpu/drm/msm/dp/dp_hpd.c

c943b4948b5848 Chandan Uddaraju 2020-08-27  27  static int
dp_hpd_connect(struct dp_usbpd *dp_usbpd, bool hpd)
c943b4948b5848 Chandan Uddaraju 2020-08-27  28  {
c943b4948b5848 Chandan Uddaraju 2020-08-27  29  int rc = 0;
c943b4948b5848 Chandan Uddaraju 2020-08-27  30  struct dp_hpd_private
*hpd_priv;
c943b4948b5848 Chandan Uddaraju 2020-08-27  31
c943b4948b5848 Chandan Uddaraju 2020-08-27  32  hpd_priv =
container_of(dp_usbpd, struct dp_hpd_private,
c943b4948b5848 Chandan Uddaraju 2020-08-27  33  
dp_usbpd);
c943b4948b5848 Chandan Uddaraju 2020-08-27  34
c943b4948b5848 Chandan Uddaraju 2020-08-27  35  	dp_usbpd->hpd_high = 
hpd;

c943b4948b5848 Chandan Uddaraju 2020-08-27  36
c943b4948b5848 Chandan Uddaraju 2020-08-27 @37  if (!hpd_priv->dp_cb
&& !hpd_priv->dp_cb->configure

^^^
Probably || was intended instead of &&.  If "hpd_priv->dp_cb" is NULL
this will Oops.

c943b4948b5848 Chandan Uddaraju 2020-08-27  38  
&&
!hpd_priv->dp_cb->disconnect) {
c943b4948b5848 Chandan Uddaraju 2020-08-27  39  pr_err("hpd 
dp_cb
not initialized\n");
c943b4948b5848 Chandan Uddaraju 2020-08-27  40  return -EINVAL;
c943b4948b5848 Chandan Uddaraju 2020-08-27  41  }
c943b4948b5848 Chandan Uddaraju 2020-08-27  42  if (hpd)
c943b4948b5848 Chandan Uddaraju 2020-08-27  43
hpd_priv->dp_cb->configure(hpd_priv->dev);
c943b4948b5848 Chandan Uddaraju 2020-08-27  44  else
c943b4948b5848 Chandan Uddaraju 2020-08-27  45
hpd_priv->dp_cb->disconnect(hpd_priv->dev);
c943b4948b5848 Chandan Uddaraju 2020-08-27  46
c943b4948b5848 Chandan Uddaraju 2020-08-27  47  return rc;
c943b4948b5848 Chandan Uddaraju 2020-08-27  48  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


Re: drivers/gpu/drm/msm/dp/dp_debug.c:218 dp_debug_init() warn: passing zero to 'PTR_ERR'

2021-03-03 Thread abhinavk

Hi Dan

Thanks for reporting this, will submit a change to fix this.

Abhinav

On 2021-02-28 23:14, Dan Carpenter wrote:

tree:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
master
head:   fe07bfda2fb9cdef8a4d4008a409bb02f35f1bd8
commit: d11a93690df7e9a7e07c0784ecad019a627b1449 drm/msm/dp: add
debugfs support to DP driver
config: arm64-randconfig-m031-20210301 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 

New smatch warnings:
drivers/gpu/drm/msm/dp/dp_debug.c:218 dp_debug_init() warn: passing
zero to 'PTR_ERR'

Old smatch warnings:
drivers/gpu/drm/msm/dp/dp_debug.c:227 dp_debug_init() warn: passing
zero to 'PTR_ERR'

vim +/PTR_ERR +218 drivers/gpu/drm/msm/dp/dp_debug.c

d11a93690df7e9 Abhinav Kumar 2020-09-12  209  static int
dp_debug_init(struct dp_debug *dp_debug)
d11a93690df7e9 Abhinav Kumar 2020-09-12  210  {
d11a93690df7e9 Abhinav Kumar 2020-09-12  211int rc = 0;
d11a93690df7e9 Abhinav Kumar 2020-09-12  212struct dp_debug_private
*debug = container_of(dp_debug,
d11a93690df7e9 Abhinav Kumar 2020-09-12  213struct
dp_debug_private, dp_debug);
d11a93690df7e9 Abhinav Kumar 2020-09-12  214  	struct dentry *dir, 
*file;

d11a93690df7e9 Abhinav Kumar 2020-09-12  215
d11a93690df7e9 Abhinav Kumar 2020-09-12  216dir =
debugfs_create_dir(DEBUG_NAME, NULL);
d11a93690df7e9 Abhinav Kumar 2020-09-12  217  	if (IS_ERR_OR_NULL(dir)) 
{

d11a93690df7e9 Abhinav Kumar 2020-09-12 @218rc = PTR_ERR(dir);
d11a93690df7e9 Abhinav Kumar 2020-09-12  219DRM_ERROR("[%s]
debugfs create dir failed, rc = %d\n",
d11a93690df7e9 Abhinav Kumar 2020-09-12  220  
DEBUG_NAME, rc);
d11a93690df7e9 Abhinav Kumar 2020-09-12  221goto error;

Debugfs function never return NULL, but actually debugfs functions
aren't supposed to be checked in the normal case (the abnormal case is
where you are trying to dereference "dir" and "file" within the driver
itself, so it doesn't apply here).

So then the function becomes a lot simpler, if it's written in the
canonical way.  This should probably be documented better in the
Documentation/filesystems/debugfs.rst file...  :/

static void dp_debug_init(struct dp_debug *dp_debug)
{
struct dp_debug_private *debug = container_of(dp_debug,
  struct dp_debug_private, 
dp_debug);

debug->root = debugfs_create_dir(DEBUG_NAME, NULL);
debugfs_create_file("dp_debug", 0444, dir, debug, _debug_fops);
}

d11a93690df7e9 Abhinav Kumar 2020-09-12  222}
d11a93690df7e9 Abhinav Kumar 2020-09-12  223
d11a93690df7e9 Abhinav Kumar 2020-09-12  224file =
debugfs_create_file("dp_debug", 0444, dir,
d11a93690df7e9 Abhinav Kumar 2020-09-12  225  			debug, 
_debug_fops);
d11a93690df7e9 Abhinav Kumar 2020-09-12  226  	if 
(IS_ERR_OR_NULL(file)) {

d11a93690df7e9 Abhinav Kumar 2020-09-12  227rc = PTR_ERR(file);
d11a93690df7e9 Abhinav Kumar 2020-09-12  228DRM_ERROR("[%s]
debugfs create file failed, rc=%d\n",
d11a93690df7e9 Abhinav Kumar 2020-09-12  229  
DEBUG_NAME, rc);
d11a93690df7e9 Abhinav Kumar 2020-09-12  230goto error_remove_dir;
d11a93690df7e9 Abhinav Kumar 2020-09-12  231}
d11a93690df7e9 Abhinav Kumar 2020-09-12  232
d11a93690df7e9 Abhinav Kumar 2020-09-12  233debug->root = dir;
d11a93690df7e9 Abhinav Kumar 2020-09-12  234return rc;
d11a93690df7e9 Abhinav Kumar 2020-09-12  235   error_remove_dir:
d11a93690df7e9 Abhinav Kumar 2020-09-12  236debugfs_remove(dir);
d11a93690df7e9 Abhinav Kumar 2020-09-12  237   error:
d11a93690df7e9 Abhinav Kumar 2020-09-12  238return rc;
d11a93690df7e9 Abhinav Kumar 2020-09-12  239  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


[PATCH tip/core/rcu 14/28] torture: Extract kvm-test-1-run-qemu.sh from kvm-test-1-run.sh

2021-03-03 Thread paulmck
From: "Paul E. McKenney" 

Currently, kvm-test-1-run.sh both builds and runs an rcutorture kernel,
which is inconvenient when it is necessary to re-run an old run or to
carry out a run on a remote system.  This commit therefore extracts the
portion of kvm-test-1-run.sh that invoke qemu to actually run rcutorture
and places it in kvm-test-1-run-qemu.sh.

Signed-off-by: Paul E. McKenney 
---
 .../rcutorture/bin/kvm-test-1-run-qemu.sh  | 170 +
 .../selftests/rcutorture/bin/kvm-test-1-run.sh | 127 +--
 2 files changed, 171 insertions(+), 126 deletions(-)
 create mode 100755 
tools/testing/selftests/rcutorture/bin/kvm-test-1-run-qemu.sh

diff --git a/tools/testing/selftests/rcutorture/bin/kvm-test-1-run-qemu.sh 
b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run-qemu.sh
new file mode 100755
index 000..6b0d71b
--- /dev/null
+++ b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run-qemu.sh
@@ -0,0 +1,170 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Carry out a kvm-based run for the specified qemu-cmd file, which might
+# have been generated by --build-only kvm.sh run.
+#
+# Usage: kvm-test-1-run-qemu.sh qemu-cmd-dir
+#
+# qemu-cmd-dir provides the directory containing qemu-cmd file.
+#  This is assumed to be of the form prefix/ds/scenario, where
+#  "ds" is the top-level date-stamped directory and "scenario"
+#  is the scenario name.  Any required adjustments to this file
+#  must have been made by the caller.  The shell-command comments
+#  at the end of the qemu-cmd file are not optional.
+#
+# Copyright (C) 2021 Facebook, Inc.
+#
+# Authors: Paul E. McKenney 
+
+T=${TMPDIR-/tmp}/kvm-test-1-run-qemu.sh.$$
+trap 'rm -rf $T' 0
+mkdir $T
+
+resdir="$1"
+if ! test -d "$resdir"
+then
+   echo $0: Nonexistent directory: $resdir
+   exit 1
+fi
+if ! test -f "$resdir/qemu-cmd"
+then
+   echo $0: Nonexistent qemu-cmd file: $resdir/qemu-cmd
+   exit 1
+fi
+
+# Obtain settings from the qemu-cmd file.
+grep '^#' $resdir/qemu-cmd | sed -e 's/^# //' > $T/qemu-cmd-settings
+. $T/qemu-cmd-settings
+
+# Decorate qemu-cmd with redirection, backgrounding, and PID capture
+sed -e 's/$/ 2>\&1 \&/' < $resdir/qemu-cmd > $T/qemu-cmd
+echo 'echo $! > $resdir/qemu_pid' >> $T/qemu-cmd
+
+# In case qemu refuses to run...
+echo "NOTE: $QEMU either did not run or was interactive" > $resdir/console.log
+
+# Attempt to run qemu
+kstarttime=`gawk 'BEGIN { print systime() }' < /dev/null`
+( . $T/qemu-cmd; wait `cat  $resdir/qemu_pid`; echo $? > $resdir/qemu-retval ) 
&
+commandcompleted=0
+if test -z "$TORTURE_KCONFIG_GDB_ARG"
+then
+   sleep 10 # Give qemu's pid a chance to reach the file
+   if test -s "$resdir/qemu_pid"
+   then
+   qemu_pid=`cat "$resdir/qemu_pid"`
+   echo Monitoring qemu job at pid $qemu_pid
+   else
+   qemu_pid=""
+   echo Monitoring qemu job at yet-as-unknown pid
+   fi
+fi
+if test -n "$TORTURE_KCONFIG_GDB_ARG"
+then
+   base_resdir=`echo $resdir | sed -e 's/\.[0-9]\+$//'`
+   if ! test -f $base_resdir/vmlinux
+   then
+   base_resdir=/path/to
+   fi
+   echo Waiting for you to attach a debug session, for example: > /dev/tty
+   echo "gdb $base_resdir/vmlinux" > /dev/tty
+   echo 'After symbols load and the "(gdb)" prompt appears:' > /dev/tty
+   echo "target remote :1234" > /dev/tty
+   echo "continue" > /dev/tty
+   kstarttime=`gawk 'BEGIN { print systime() }' < /dev/null`
+fi
+while :
+do
+   if test -z "$qemu_pid" -a -s "$resdir/qemu_pid"
+   then
+   qemu_pid=`cat "$resdir/qemu_pid"`
+   fi
+   kruntime=`gawk 'BEGIN { print systime() - '"$kstarttime"' }' < 
/dev/null`
+   if test -z "$qemu_pid" || kill -0 "$qemu_pid" > /dev/null 2>&1
+   then
+   if test -n "$TORTURE_KCONFIG_GDB_ARG"
+   then
+   :
+   elif test $kruntime -ge $seconds || test -f "$resdir/../STOP.1"
+   then
+   break;
+   fi
+   sleep 1
+   else
+   commandcompleted=1
+   if test $kruntime -lt $seconds
+   then
+   echo Completed in $kruntime vs. $seconds >> 
$resdir/Warnings 2>&1
+   grep "^(qemu) qemu:" $resdir/kvm-test-1-run.sh.out >> 
$resdir/Warnings 2>&1
+   killpid="`sed -n "s/^(qemu) qemu: terminating on signal 
[0-9]* from pid \([0-9]*\).*$/\1/p" $resdir/Warnings`"
+   if test -n "$killpid"
+   then
+   echo "ps -fp $killpid" >> $resdir/Warnings 2>&1
+   ps -fp $killpid >> $resdir/Warnings 2>&1
+   fi
+   else
+   echo ' ---' `date`: "Kernel done"
+   fi
+   break
+   fi
+done
+if test -z 

[PATCH tip/core/rcu 10/28] torture: Eliminate jitter_pids file

2021-03-03 Thread paulmck
From: "Paul E. McKenney" 

Now that there is a reliable way to convince the jitter.sh scripts to
stop, the jitter_pids file is not needed, nor is the code that kills all
the PIDs contained in this file.  This commit therefore eliminates this
file and the code using it.

Signed-off-by: Paul E. McKenney 
---
 tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh | 14 --
 tools/testing/selftests/rcutorture/bin/kvm.sh|  5 +
 2 files changed, 1 insertion(+), 18 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh 
b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh
index fed6f10..eb5346b 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh
@@ -270,20 +270,6 @@ do
echo "ps -fp $killpid" >> $resdir/Warnings 2>&1
ps -fp $killpid >> $resdir/Warnings 2>&1
fi
-   # Reduce probability of PID reuse by allowing a 
one-minute buffer
-   if test $((kruntime + 60)) -lt $seconds && test -s 
"$resdir/../jitter_pids"
-   then
-   awk < "$resdir/../jitter_pids" '
-   NF > 0 {
-   pidlist = pidlist " " $1;
-   n++;
-   }
-   END {
-   if (n > 0) {
-   print "kill " pidlist;
-   }
-   }' | sh
-   fi
else
echo ' ---' `date`: "Kernel done"
fi
diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh 
b/tools/testing/selftests/rcutorture/bin/kvm.sh
index 48da4cd..de93802 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -502,12 +502,9 @@ function dump(first, pastlast, batchnum)
print "if test -n \"$needqemurun\""
print "then"
print "\techo  Starting kernels. `date` | tee -a " rd "log";
-   print "\techo > " rd "jitter_pids"
print "\ttouch " rd "jittering"
-   for (j = 0; j < njitter; j++) {
+   for (j = 0; j < njitter; j++)
print "\tjitter.sh " j " " dur " " rd "jittering " ja[2] " " 
ja[3] "&"
-   print "\techo $! >> " rd "jitter_pids"
-   }
print "\twhile ls $runfiles > /dev/null 2>&1"
print "\tdo"
print "\t\t:"
-- 
2.9.5



[PATCH tip/core/rcu 08/28] torture: Use file-based protocol to mark batch's runs complete

2021-03-03 Thread paulmck
From: "Paul E. McKenney" 

Currently, the script generated by kvm.sh does a "wait" to wait on both
the current batch's guest OSes and any jitter.sh scripts.  This works,
but makes it hard to abstract the jittering so that common code can be
used for both local and distributed runs.  This commit therefore uses
"build.run" files in scenario directories, and these files are removed
after the corresponding scenario's guest OS has completed.

Note that --build-only runs do not create build.run files because they
also do not create guest OSes and do not run any jitter.sh scripts.

Signed-off-by: Paul E. McKenney 
---
 tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh |  3 +++
 tools/testing/selftests/rcutorture/bin/kvm.sh| 13 +++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh 
b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh
index 91578d3..fed6f10 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh
@@ -345,4 +345,7 @@ then
echo Unknown PID, cannot kill qemu command
 fi
 
+# Tell the script that this run is done.
+rm -f $resdir/build.run
+
 parse-console.sh $resdir/console.log $title
diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh 
b/tools/testing/selftests/rcutorture/bin/kvm.sh
index 7944510..1f5f872 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -469,9 +469,15 @@ function dump(first, pastlast, batchnum)
print "echo ", cfr[jn], cpusr[jn] ovf ": Build complete. `date` 
| tee -a " rd "log";
jn++;
}
+   print "runfiles="
for (j = 1; j < jn; j++) {
builddir=rd cfr[j] "/build";
-   print "rm -f " builddir ".ready"
+   if (TORTURE_BUILDONLY)
+   print "rm -f " builddir ".ready"
+   else
+   print "mv " builddir ".ready " builddir ".run"
+   print "runfiles=\"$runfiles " builddir ".run\""
+   fi
print "if test -f \"" rd cfr[j] "/builtkernel\""
print "then"
print "\techo ", cfr[j], cpusr[j] ovf ": Kernel present. 
`date` | tee -a " rd "log";
@@ -501,7 +507,10 @@ function dump(first, pastlast, batchnum)
print "\tjitter.sh " j " " dur " " ja[2] " " ja[3] "&"
print "\techo $! >> " rd "jitter_pids"
}
-   print "\twait"
+   print "\twhile ls $runfiles > /dev/null 2>&1"
+   print "\tdo"
+   print "\t\t:"
+   print "\tdone"
print "\techo  All kernel runs complete. `date` | tee -a " rd "log";
print "else"
print "\twait"
-- 
2.9.5



[PATCH tip/core/rcu 13/28] torture: Record TORTURE_KCONFIG_GDB_ARG in qemu-cmd

2021-03-03 Thread paulmck
From: "Paul E. McKenney" 

When re-running old rcutorture builds, if the original run involved
gdb, the re-run also needs to do so.  This commit therefore records the
TORTURE_KCONFIG_GDB_ARG environment variable into the qemu-cmd file so
that the re-run can access it.

Signed-off-by: Paul E. McKenney 
---
 tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh 
b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh
index eb5346b..5d9ac90 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh
@@ -201,6 +201,7 @@ echo kernel here: `head -n 1 $testid_txt | sed -e 's/^Build 
directory: //'`  >>
 echo $QEMU $qemu_args -m $TORTURE_QEMU_MEM -kernel $KERNEL -append 
\"$qemu_append $boot_args\" $TORTURE_QEMU_GDB_ARG > $resdir/qemu-cmd
 echo "# TORTURE_SHUTDOWN_GRACE=$TORTURE_SHUTDOWN_GRACE" >> $resdir/qemu-cmd
 echo "# seconds=$seconds" >> $resdir/qemu-cmd
+echo "# TORTURE_KCONFIG_GDB_ARG=\"$TORTURE_KCONFIG_GDB_ARG\"" >> 
$resdir/qemu-cmd
 
 if test -n "$TORTURE_BUILDONLY"
 then
-- 
2.9.5



[PATCH tip/core/rcu 12/28] torture: Abstract jitter.sh start/stop into scripts

2021-03-03 Thread paulmck
From: "Paul E. McKenney" 

This commit creates jitterstart.sh and jitterstop.sh scripts that handle
the starting and stopping of the jitter.sh scripts.  These must be sourced
using the bash "." command to allow the generated script to wait on the
backgrounded jitter.sh scripts.

Signed-off-by: Paul E. McKenney 
---
 .../selftests/rcutorture/bin/jitterstart.sh| 37 ++
 .../testing/selftests/rcutorture/bin/jitterstop.sh | 23 ++
 tools/testing/selftests/rcutorture/bin/kvm.sh  |  7 ++--
 3 files changed, 62 insertions(+), 5 deletions(-)
 create mode 100644 tools/testing/selftests/rcutorture/bin/jitterstart.sh
 create mode 100644 tools/testing/selftests/rcutorture/bin/jitterstop.sh

diff --git a/tools/testing/selftests/rcutorture/bin/jitterstart.sh 
b/tools/testing/selftests/rcutorture/bin/jitterstart.sh
new file mode 100644
index 000..9fe3e83
--- /dev/null
+++ b/tools/testing/selftests/rcutorture/bin/jitterstart.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Start up the specified number of jitter.sh scripts in the background.
+#
+# Usage: . jitterstart.sh n jittering-dir duration [ sleepmax [ spinmax ] ]
+#
+# n: Number of jitter.sh scripts to start up.
+# jittering-dir: Directory in which to put "jittering" file.
+# duration: Time to run in seconds.
+# sleepmax: Maximum microseconds to sleep, defaults to one second.
+# spinmax: Maximum microseconds to spin, defaults to one millisecond.
+#
+# Copyright (C) 2021 Facebook, Inc.
+#
+# Authors: Paul E. McKenney 
+
+jitter_n=$1
+if test -z "$jitter_n"
+then
+   echo jitterstart.sh: Missing count of jitter.sh scripts to start.
+   exit 33
+fi
+jittering_dir=$2
+if test -z "$jittering_dir"
+then
+   echo jitterstart.sh: Missing directory in which to place jittering file.
+   exit 34
+fi
+shift
+shift
+
+touch ${jittering_dir}jittering
+for ((jitter_i = 1; jitter_i <= $jitter_n; jitter_i++))
+do
+   jitter.sh $jitter_i "${jittering_dir}jittering" "$@" &
+done
diff --git a/tools/testing/selftests/rcutorture/bin/jitterstop.sh 
b/tools/testing/selftests/rcutorture/bin/jitterstop.sh
new file mode 100644
index 000..b70d1f4
--- /dev/null
+++ b/tools/testing/selftests/rcutorture/bin/jitterstop.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Remove the "jittering" file, signaling the jitter.sh scripts to stop,
+# then wait for them to terminate.
+#
+# Usage: . jitterstop.sh jittering-dir
+#
+# jittering-dir: Directory containing "jittering" file.
+#
+# Copyright (C) 2021 Facebook, Inc.
+#
+# Authors: Paul E. McKenney 
+
+jittering_dir=$1
+if test -z "$jittering_dir"
+then
+   echo jitterstop.sh: Missing directory in which to place jittering file.
+   exit 34
+fi
+
+rm -f ${jittering_dir}jittering
+wait
diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh 
b/tools/testing/selftests/rcutorture/bin/kvm.sh
index a2ee3f2..d6973e4 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -502,15 +502,12 @@ function dump(first, pastlast, batchnum)
print "if test -n \"$needqemurun\""
print "then"
print "\techo  Starting kernels. `date` | tee -a " rd "log";
-   print "\ttouch " rd "jittering"
-   for (j = 0; j < njitter; j++)
-   print "\tjitter.sh " j " " rd "jittering " dur " " ja[2] " " 
ja[3] "&"
+   print "\t. jitterstart.sh " njitter " " rd " " dur " " ja[2] " " ja[3]
print "\twhile ls $runfiles > /dev/null 2>&1"
print "\tdo"
print "\t\t:"
print "\tdone"
-   print "\trm -f " rd "jittering"
-   print "\twait"
+   print "\t. jitterstop.sh " rd
print "\techo  All kernel runs complete. `date` | tee -a " rd "log";
print "else"
print "\twait"
-- 
2.9.5



[PATCH tip/core/rcu 09/28] torture: Use "jittering" file to control jitter.sh execution

2021-03-03 Thread paulmck
From: "Paul E. McKenney" 

Currently, jitter.sh execution is controlled by a time limit and by the
"kill" command.  The former allowed jitter.sh to run uselessly past
the end of a set of runs that panicked during boot, and the latter is
vulnerable to PID reuse.  This commit therefore introduces a "jittering"
file in the date-stamp directory within "res" that must be present for
the jitter.sh scripts to continue executing.  The time limit is still
in place in order to avoid disturbing runs featuring large trace dumps,
but the removal of the "jittering" file handles the panic-during-boot
scenario without relying on PIDs.

Signed-off-by: Paul E. McKenney 
---
 tools/testing/selftests/rcutorture/bin/jitter.sh | 10 ++
 tools/testing/selftests/rcutorture/bin/kvm.sh|  5 -
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/rcutorture/bin/jitter.sh 
b/tools/testing/selftests/rcutorture/bin/jitter.sh
index 188b864..ed0ea86 100755
--- a/tools/testing/selftests/rcutorture/bin/jitter.sh
+++ b/tools/testing/selftests/rcutorture/bin/jitter.sh
@@ -5,10 +5,11 @@
 # of this script is to inflict random OS jitter on a concurrently running
 # test.
 #
-# Usage: jitter.sh me duration [ sleepmax [ spinmax ] ]
+# Usage: jitter.sh me duration jittering-path [ sleepmax [ spinmax ] ]
 #
 # me: Random-number-generator seed salt.
 # duration: Time to run in seconds.
+# jittering-path: Path to file whose removal will stop this script.
 # sleepmax: Maximum microseconds to sleep, defaults to one second.
 # spinmax: Maximum microseconds to spin, defaults to one millisecond.
 #
@@ -18,8 +19,9 @@
 
 me=$(($1 * 1000))
 duration=$2
-sleepmax=${3-100}
-spinmax=${4-1000}
+jittering=$3
+sleepmax=${4-100}
+spinmax=${5-1000}
 
 n=1
 
@@ -47,7 +49,7 @@ do
fi
 
# Check for stop request.
-   if test -f "$TORTURE_STOPFILE"
+   if ! test -f "$jittering"
then
exit 1;
fi
diff --git a/tools/testing/selftests/rcutorture/bin/kvm.sh 
b/tools/testing/selftests/rcutorture/bin/kvm.sh
index 1f5f872..48da4cd 100755
--- a/tools/testing/selftests/rcutorture/bin/kvm.sh
+++ b/tools/testing/selftests/rcutorture/bin/kvm.sh
@@ -503,14 +503,17 @@ function dump(first, pastlast, batchnum)
print "then"
print "\techo  Starting kernels. `date` | tee -a " rd "log";
print "\techo > " rd "jitter_pids"
+   print "\ttouch " rd "jittering"
for (j = 0; j < njitter; j++) {
-   print "\tjitter.sh " j " " dur " " ja[2] " " ja[3] "&"
+   print "\tjitter.sh " j " " dur " " rd "jittering " ja[2] " " 
ja[3] "&"
print "\techo $! >> " rd "jitter_pids"
}
print "\twhile ls $runfiles > /dev/null 2>&1"
print "\tdo"
print "\t\t:"
print "\tdone"
+   print "\trm -f " rd "jittering"
+   print "\twait"
print "\techo  All kernel runs complete. `date` | tee -a " rd "log";
print "else"
print "\twait"
-- 
2.9.5



[PATCH kernel/time 5/5] clocksource: Do pairwise clock-desynchronization checking

2021-03-03 Thread paulmck
From: "Paul E. McKenney" 

Although smp_call_function() has the advantage of simplicity, using
it to check for cross-CPU clock desynchronization means that any CPU
being slow reduces the sensitivity of the checking across all CPUs.
And it is not uncommon for smp_call_function() latencies to be in the
hundreds of microseconds.

This commit therefore switches to smp_call_function_single(), so that
delays from a given CPU affect only those measurements involving that
particular CPU.

Cc: John Stultz 
Cc: Thomas Gleixner 
Cc: Stephen Boyd 
Cc: Jonathan Corbet 
Cc: Mark Rutland 
Cc: Marc Zyngier 
Cc: Andi Kleen 
Reported-by: Chris Mason 
Signed-off-by: Paul E. McKenney 
---
 kernel/time/clocksource.c | 41 +
 1 file changed, 25 insertions(+), 16 deletions(-)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index df48416..4161c84 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -214,7 +214,7 @@ static void clocksource_watchdog_inject_delay(void)
 }
 
 static struct clocksource *clocksource_verify_work_cs;
-static DEFINE_PER_CPU(u64, csnow_mid);
+static u64 csnow_mid;
 static cpumask_t cpus_ahead;
 static cpumask_t cpus_behind;
 
@@ -228,7 +228,7 @@ static void clocksource_verify_one_cpu(void *csin)
sign = ((smp_processor_id() >> inject_delay_shift_percpu) & 
0x1) * 2 - 1;
delta = sign * NSEC_PER_SEC;
}
-   __this_cpu_write(csnow_mid, cs->read(cs) + delta);
+   csnow_mid = cs->read(cs) + delta;
 }
 
 static void clocksource_verify_percpu_wq(struct work_struct *unused)
@@ -236,9 +236,12 @@ static void clocksource_verify_percpu_wq(struct 
work_struct *unused)
int cpu;
struct clocksource *cs;
int64_t cs_nsec;
+   int64_t cs_nsec_max;
+   int64_t cs_nsec_min;
u64 csnow_begin;
u64 csnow_end;
-   u64 delta;
+   s64 delta;
+   bool firsttime = 1;
 
cs = smp_load_acquire(_verify_work_cs); // pairs with 
release
if (WARN_ON_ONCE(!cs))
@@ -247,19 +250,28 @@ static void clocksource_verify_percpu_wq(struct 
work_struct *unused)
cs->name, smp_processor_id());
cpumask_clear(_ahead);
cpumask_clear(_behind);
-   csnow_begin = cs->read(cs);
-   smp_call_function(clocksource_verify_one_cpu, cs, 1);
-   csnow_end = cs->read(cs);
+   preempt_disable();
for_each_online_cpu(cpu) {
if (cpu == smp_processor_id())
continue;
-   delta = (per_cpu(csnow_mid, cpu) - csnow_begin) & cs->mask;
-   if ((s64)delta < 0)
+   csnow_begin = cs->read(cs);
+   smp_call_function_single(cpu, clocksource_verify_one_cpu, cs, 
1);
+   csnow_end = cs->read(cs);
+   delta = (s64)((csnow_mid - csnow_begin) & cs->mask);
+   if (delta < 0)
cpumask_set_cpu(cpu, _behind);
-   delta = (csnow_end - per_cpu(csnow_mid, cpu)) & cs->mask;
-   if ((s64)delta < 0)
+   delta = (csnow_end - csnow_mid) & cs->mask;
+   if (delta < 0)
cpumask_set_cpu(cpu, _ahead);
+   delta = clocksource_delta(csnow_end, csnow_begin, cs->mask);
+   cs_nsec = clocksource_cyc2ns(delta, cs->mult, cs->shift);
+   if (firsttime || cs_nsec > cs_nsec_max)
+   cs_nsec_max = cs_nsec;
+   if (firsttime || cs_nsec < cs_nsec_min)
+   cs_nsec_min = cs_nsec;
+   firsttime = 0;
}
+   preempt_enable();
if (!cpumask_empty(_ahead))
pr_warn("CPUs %*pbl ahead of CPU %d for clocksource 
%s.\n",
cpumask_pr_args(_ahead),
@@ -268,12 +280,9 @@ static void clocksource_verify_percpu_wq(struct 
work_struct *unused)
pr_warn("CPUs %*pbl behind CPU %d for clocksource 
%s.\n",
cpumask_pr_args(_behind),
smp_processor_id(), cs->name);
-   if (!cpumask_empty(_ahead) || !cpumask_empty(_behind)) {
-   delta = clocksource_delta(csnow_end, csnow_begin, cs->mask);
-   cs_nsec = clocksource_cyc2ns(delta, cs->mult, cs->shift);
-   pr_warn("CPU %d duration %lldns for clocksource %s.\n",
-   smp_processor_id(), cs_nsec, cs->name);
-   }
+   if (!firsttime && (!cpumask_empty(_ahead) || 
!cpumask_empty(_behind)))
+   pr_warn("CPU %d check durations %lldns - %lldns for 
clocksource %s.\n",
+   smp_processor_id(), cs_nsec_min, cs_nsec_max, cs->name);
smp_store_release(_verify_work_cs, NULL); // pairs with 
acquire.
 }
 
-- 
2.9.5



Re: [PATCH -next] ASoC: rt1316: Fix return value check in rt1316_sdw_probe()

2021-03-03 Thread Mark Brown
On Wed, 3 Mar 2021 06:40:41 +, Wei Yongjun wrote:
> In case of error, the function devm_regmap_init_sdw() returns ERR_PTR()
> and never returns NULL. The NULL test in the return value check should
> be replaced with IS_ERR().

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: rt1316: Fix return value check in rt1316_sdw_probe()
  commit: f87aec4585c3cf0853ba20637bb8c6bdd2689c46

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


[PATCH kernel/time 2/5] clocksource: Retry clock read if long delays detected

2021-03-03 Thread paulmck
From: "Paul E. McKenney" 

When the clocksource watchdog marks a clock as unstable, this might
be due to that clock being unstable or it might be due to delays that
happen to occur between the reads of the two clocks.  Yes, interrupts are
disabled across those two reads, but there are no shortage of things that
can delay interrupts-disabled regions of code ranging from SMI handlers
to vCPU preemption.  It would be good to have some indication as to why
the clock was marked unstable.

This commit therefore re-reads the watchdog clock on either side of
the read from the clock under test.  If the watchdog clock shows an
excessive time delta between its pair of reads, the reads are retried.
The maximum number of retries is specified by a new kernel boot
parameter clocksource.max_read_retries, which defaults to three, that
is, up to four reads, one initial and up to three retries.  If retries
were required, a message is printed on the console.  If the number of
retries is exceeded, the clock under test will be marked unstable.
However, the probability of this happening due to various sorts of
delays is quite small.  In addition, the reason (clock-read delays)
for the unstable marking will be apparent.

Cc: John Stultz 
Cc: Thomas Gleixner 
Cc: Stephen Boyd 
Cc: Jonathan Corbet 
Cc: Mark Rutland 
Cc: Marc Zyngier 
Cc: Andi Kleen 
Reported-by: Chris Mason 
[ paulmck: Per-clocksource retries per Neeraj Upadhyay feedback. ]
[ paulmck: Don't reset injectfail per Neeraj Upadhyay feedback. ]
Signed-off-by: Paul E. McKenney 
---
 kernel/time/clocksource.c | 23 +++
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 4be4391..3f734c6 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -124,6 +124,7 @@ static void __clocksource_change_rating(struct clocksource 
*cs, int rating);
  */
 #define WATCHDOG_INTERVAL (HZ >> 1)
 #define WATCHDOG_THRESHOLD (NSEC_PER_SEC >> 4)
+#define WATCHDOG_MAX_SKEW (NSEC_PER_SEC >> 6)
 
 static void clocksource_watchdog_work(struct work_struct *work)
 {
@@ -213,9 +214,10 @@ static void clocksource_watchdog_inject_delay(void)
 static void clocksource_watchdog(struct timer_list *unused)
 {
struct clocksource *cs;
-   u64 csnow, wdnow, cslast, wdlast, delta;
-   int64_t wd_nsec, cs_nsec;
+   u64 csnow, wdnow, wdagain, cslast, wdlast, delta;
+   int64_t wd_nsec, wdagain_nsec, wderr_nsec = 0, cs_nsec;
int next_cpu, reset_pending;
+   int nretries;
 
spin_lock(_lock);
if (!watchdog_running)
@@ -224,6 +226,7 @@ static void clocksource_watchdog(struct timer_list *unused)
reset_pending = atomic_read(_reset_pending);
 
list_for_each_entry(cs, _list, wd_list) {
+   nretries = 0;
 
/* Clocksource already marked unstable? */
if (cs->flags & CLOCK_SOURCE_UNSTABLE) {
@@ -232,11 +235,23 @@ static void clocksource_watchdog(struct timer_list 
*unused)
continue;
}
 
+retry:
local_irq_disable();
-   csnow = cs->read(cs);
-   clocksource_watchdog_inject_delay();
wdnow = watchdog->read(watchdog);
+   clocksource_watchdog_inject_delay();
+   csnow = cs->read(cs);
+   wdagain = watchdog->read(watchdog);
local_irq_enable();
+   delta = clocksource_delta(wdagain, wdnow, watchdog->mask);
+   wdagain_nsec = clocksource_cyc2ns(delta, watchdog->mult, 
watchdog->shift);
+   if (wdagain_nsec < 0 || wdagain_nsec > WATCHDOG_MAX_SKEW) {
+   wderr_nsec = wdagain_nsec;
+   if (nretries++ < max_read_retries)
+   goto retry;
+   }
+   if (nretries)
+   pr_warn("timekeeping watchdog on CPU%d: %s read-back 
delay of %lldns, attempt %d\n",
+   smp_processor_id(), watchdog->name, wderr_nsec, 
nretries);
 
/* Clocksource initialized ? */
if (!(cs->flags & CLOCK_SOURCE_WATCHDOG) ||
-- 
2.9.5



Re: [PATCH][next] ASoC: fsl: fsl_easrc: Fix uninitialized variable st2_mem_alloc

2021-03-03 Thread Mark Brown
On Wed, 3 Mar 2021 09:18:35 +, Colin King wrote:
> A previous cleanup commit removed the ininitialization of st2_mem_alloc.
> Fix this by restoring the original behaviour by initializing it to zero.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: fsl: fsl_easrc: Fix uninitialized variable st2_mem_alloc
  commit: 84e4eb57ed620adc0371579a5662c4924a72a306

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


Re: [kbuild-all] Re: COPYING CREDITS Documentation Kbuild Kconfig LICENSES MAINTAINERS Makefile README arch block certs crypto drivers fs include init ipc kernel lib mm net samples scripts security so

2021-03-03 Thread Rong Chen




On 3/4/21 4:07 AM, Arnd Bergmann wrote:

On Wed, Mar 3, 2021 at 8:44 PM kernel test robot  wrote:

Hi Arnd,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   f69d02e37a85645aa90d18cacfff36dba370f797
commit: a579fcfa8e49cc77ad59211bb18bc5004133e6a0 c6x: remove architecture
date:   6 weeks ago
config: c6x-randconfig-r026-20210303 (attached as .config)
compiler: c6x-elf-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
 wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
 chmod +x ~/bin/make.cross
 # 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a579fcfa8e49cc77ad59211bb18bc5004133e6a0
 git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
 git fetch --no-tags linus master
 git checkout a579fcfa8e49cc77ad59211bb18bc5004133e6a0
 # save the attached .config to linux build tree
 COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=c6x

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All errors (new ones prefixed by >>):

Makefile:681: arch/c6x/Makefile: No such file or directory

Yes, arch/c6x is gone and unlikely to return. Please fix the 0day scripts
to no longer build it on v5.12-rc1 or higher.


Hi Arnd,

Thanks for the warning, we have removed the related tests.

Best Regards,
Rong Chen


 Arnd
___
kbuild-all mailing list -- kbuild-...@lists.01.org
To unsubscribe send an email to kbuild-all-le...@lists.01.org




Re: (subset) [PATCH v2 0/7] Add I2S-MCC support for Microchip's SAMA7G5

2021-03-03 Thread Mark Brown
On Mon, 1 Mar 2021 19:08:58 +0200, Codrin Ciubotariu wrote:
> SAMA7G5 includes an updated version of I2S-MCC, found previously on
> SAM9X60. This controller includes 8 data pins, 4 for playback and 4 for
> capture. For I2S and LEFT_J formats, these pins can be used to
> send/receive up to 8 audio channels. For DSP_A, with TDM, any pins pair
> (DIN/DOUT) from these 4 can be selected to send/receive data. This
> version also includes 2 FIFOs (send and receive).
> This patch set starts by moving the driver's bindings to yaml and
> continues with adding a new compatible for the SAMA7G5 variant, followed
> by the changes needed for I2S/LEFT_J support, TDM pin pair selection and
> FIFO support, exclusively for SAMA7G5.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/7] dt-bindings: mchp,i2s-mcc: Add SAMA7G5 to binding
  commit: 4423a2724e3d1d55adfb1d515a9fa0759e95451e
[2/7] ASoC: mchp-i2s-mcc: Add compatible for SAMA7G5
  commit: 02d212ce7c72509139c46f631fdf20e4c2fb
[3/7] ASoC: mchp-i2s-mcc: Add multi-channel support for I2S and LEFT_J formats
  commit: 89dcd5cc4bee9f87ef597374a8d7dc0c51436fb2
[4/7] dt-bindings: mchp, i2s-mcc: Add property to specify pin pair for TDM
  commit: d43f821b8a0162de9e9d392a8f1907c5638f558a
[5/7] ASoC: mchp-i2s-mcc: Add support to select TDM pins
  commit: 1d6257bbe6e9fcaf639f313ccd4cebe1f5e46865
[6/7] ASoC: mchp-i2s-mcc: Add FIFOs support
  commit: cb43e3692731401d4303c378f530c43bd283716e

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


[PATCH kernel/time 3/5] clocksource: Check per-CPU clock synchronization when marked unstable

2021-03-03 Thread paulmck
From: "Paul E. McKenney" 

Some sorts of per-CPU clock sources have a history of going out of
synchronization with each other.  However, this problem has purportedy
been solved in the past ten years.  Except that it is all too possible
that the problem has instead simply been made less likely, which might
mean that some of the occasional "Marking clocksource 'tsc' as unstable"
messages might be due to desynchronization.  How would anyone know?

This commit therefore adds CPU-to-CPU synchronization checking
for newly unstable clocksource that are marked with the new
CLOCK_SOURCE_VERIFY_PERCPU flag.  Lists of desynchronized CPUs are
printed, with the caveat that if it is the reporting CPU that is itself
desynchronized, it will appear that all the other clocks are wrong.
Just like in real life.

Cc: John Stultz 
Cc: Thomas Gleixner 
Cc: Stephen Boyd 
Cc: Jonathan Corbet 
Cc: Mark Rutland 
Cc: Marc Zyngier 
Cc: Andi Kleen 
Reported-by: Chris Mason 
[ paulmck: Add "static" to clocksource_verify_one_cpu() per kernel test robot 
feedback. ]
Signed-off-by: Paul E. McKenney 
---
 arch/x86/kernel/kvmclock.c  |  2 +-
 arch/x86/kernel/tsc.c   |  3 +-
 include/linux/clocksource.h |  2 +-
 kernel/time/clocksource.c   | 73 +
 4 files changed, 77 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c
index aa59374..337bb2c 100644
--- a/arch/x86/kernel/kvmclock.c
+++ b/arch/x86/kernel/kvmclock.c
@@ -169,7 +169,7 @@ struct clocksource kvm_clock = {
.read   = kvm_clock_get_cycles,
.rating = 400,
.mask   = CLOCKSOURCE_MASK(64),
-   .flags  = CLOCK_SOURCE_IS_CONTINUOUS,
+   .flags  = CLOCK_SOURCE_IS_CONTINUOUS | CLOCK_SOURCE_VERIFY_PERCPU,
.enable = kvm_cs_enable,
 };
 EXPORT_SYMBOL_GPL(kvm_clock);
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index f70dffc..5628917 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -1151,7 +1151,8 @@ static struct clocksource clocksource_tsc = {
.mask   = CLOCKSOURCE_MASK(64),
.flags  = CLOCK_SOURCE_IS_CONTINUOUS |
  CLOCK_SOURCE_VALID_FOR_HRES |
- CLOCK_SOURCE_MUST_VERIFY,
+ CLOCK_SOURCE_MUST_VERIFY |
+ CLOCK_SOURCE_VERIFY_PERCPU,
.vdso_clock_mode= VDSO_CLOCKMODE_TSC,
.enable = tsc_cs_enable,
.resume = tsc_resume,
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 86d143d..83a3ebf 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -131,7 +131,7 @@ struct clocksource {
 #define CLOCK_SOURCE_UNSTABLE  0x40
 #define CLOCK_SOURCE_SUSPEND_NONSTOP   0x80
 #define CLOCK_SOURCE_RESELECT  0x100
-
+#define CLOCK_SOURCE_VERIFY_PERCPU 0x200
 /* simplify initialization of mask field */
 #define CLOCKSOURCE_MASK(bits) GENMASK_ULL((bits) - 1, 0)
 
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 3f734c6..663bc53 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -211,6 +211,78 @@ static void clocksource_watchdog_inject_delay(void)
WARN_ON_ONCE(injectfail < 0);
 }
 
+static struct clocksource *clocksource_verify_work_cs;
+static DEFINE_PER_CPU(u64, csnow_mid);
+static cpumask_t cpus_ahead;
+static cpumask_t cpus_behind;
+
+static void clocksource_verify_one_cpu(void *csin)
+{
+   struct clocksource *cs = (struct clocksource *)csin;
+
+   __this_cpu_write(csnow_mid, cs->read(cs));
+}
+
+static void clocksource_verify_percpu_wq(struct work_struct *unused)
+{
+   int cpu;
+   struct clocksource *cs;
+   int64_t cs_nsec;
+   u64 csnow_begin;
+   u64 csnow_end;
+   u64 delta;
+
+   cs = smp_load_acquire(_verify_work_cs); // pairs with 
release
+   if (WARN_ON_ONCE(!cs))
+   return;
+   pr_warn("Checking clocksource %s synchronization from CPU %d.\n",
+   cs->name, smp_processor_id());
+   cpumask_clear(_ahead);
+   cpumask_clear(_behind);
+   csnow_begin = cs->read(cs);
+   smp_call_function(clocksource_verify_one_cpu, cs, 1);
+   csnow_end = cs->read(cs);
+   for_each_online_cpu(cpu) {
+   if (cpu == smp_processor_id())
+   continue;
+   delta = (per_cpu(csnow_mid, cpu) - csnow_begin) & cs->mask;
+   if ((s64)delta < 0)
+   cpumask_set_cpu(cpu, _behind);
+   delta = (csnow_end - per_cpu(csnow_mid, cpu)) & cs->mask;
+   if ((s64)delta < 0)
+   cpumask_set_cpu(cpu, _ahead);
+   }
+   if (!cpumask_empty(_ahead))
+   pr_warn("CPUs %*pbl ahead of CPU %d for clocksource 
%s.\n",
+   cpumask_pr_args(_ahead),
+   

Re: [PATCH] SoC: codecs: fix platform_no_drv_owner.cocci warnings

2021-03-03 Thread Mark Brown
On Wed, 3 Mar 2021 17:08:01 +0800, Yang Li wrote:
> ./sound/soc/codecs/lpass-rx-macro.c:3588:3-8: No need to set .owner here.
> The core will do it.
> 
> Remove .owner field if calls are used which set it automatically

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] SoC: codecs: fix platform_no_drv_owner.cocci warnings
  commit: 0ce5d3ac4ffe5c3b2d3ead09692e0bd7ff7487ca

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


Re: [PATCH v2] ASoC: codec: Omit superfluous error message in jz4760_codec_probe()

2021-03-03 Thread Mark Brown
On Tue, 2 Mar 2021 21:56:30 +0800, Tang Bin wrote:
> The function devm_platform_ioremap_resource has already contained
> error message, so remove the redundant dev_err here.

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: codec: Omit superfluous error message in jz4760_codec_probe()
  commit: 046c4e329066c50ff3ffd174ab95a0ac638807b4

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


Re: [PATCH net] Revert "r8152: adjust the settings about MAC clock speed down for RTL8153"

2021-03-03 Thread patchwork-bot+netdevbpf
Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Wed, 3 Mar 2021 16:39:47 +0800 you wrote:
> This reverts commit 134f98bcf1b898fb9d6f2b91bc85dd2e5478b4b8.
> 
> The r8153_mac_clk_spd() is used for RTL8153A only, because the register
> table of RTL8153B is different from RTL8153A. However, this function would
> be called when RTL8153B calls r8153_first_init() and r8153_enter_oob().
> That causes RTL8153B becomes unstable when suspending and resuming. The
> worst case may let the device stop working.
> 
> [...]

Here is the summary with links:
  - [net] Revert "r8152: adjust the settings about MAC clock speed down for 
RTL8153"
https://git.kernel.org/netdev/net/c/4b5dc1a94d4f

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




Re: [PATCH net v2] net: l2tp: reduce log level of messages in receive path, add counter instead

2021-03-03 Thread patchwork-bot+netdevbpf
Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Wed,  3 Mar 2021 16:50:49 +0100 you wrote:
> Commit 5ee759cda51b ("l2tp: use standard API for warning log messages")
> changed a number of warnings about invalid packets in the receive path
> so that they are always shown, instead of only when a special L2TP debug
> flag is set. Even with rate limiting these warnings can easily cause
> significant log spam - potentially triggered by a malicious party
> sending invalid packets on purpose.
> 
> [...]

Here is the summary with links:
  - [net,v2] net: l2tp: reduce log level of messages in receive path, add 
counter instead
https://git.kernel.org/netdev/net/c/3e59e8856758

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




RE: [PATCH] KVM: arm64: Fix unaligned addr case in mmu walking

2021-03-03 Thread Justin He
Hi Marc

> -Original Message-
> From: Will Deacon 
> Sent: Thursday, March 4, 2021 5:13 AM
> To: Marc Zyngier 
> Cc: Justin He ; kvm...@lists.cs.columbia.edu; James
> Morse ; Julien Thierry ;
> Suzuki Poulose ; Catalin Marinas
> ; Gavin Shan ; Yanan Wang
> ; Quentin Perret ; linux-arm-
> ker...@lists.infradead.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] KVM: arm64: Fix unaligned addr case in mmu walking
> 
> On Wed, Mar 03, 2021 at 07:07:37PM +, Marc Zyngier wrote:
> > From e0524b41a71e0f17d6dc8f197e421e677d584e72 Mon Sep 17 00:00:00 2001
> > From: Jia He 
> > Date: Wed, 3 Mar 2021 10:42:25 +0800
> > Subject: [PATCH] KVM: arm64: Fix range alignment when walking page tables
> >
> > When walking the page tables at a given level, and if the start
> > address for the range isn't aligned for that level, we propagate
> > the misalignment on each iteration at that level.
> >
> > This results in the walker ignoring a number of entries (depending
> > on the original misalignment) on each subsequent iteration.
> >
> > Properly aligning the address at the before the next iteration
> 
> "at the before the next" ???
> 
> > addresses the issue.
> >
> > Cc: sta...@vger.kernel.org
> > Reported-by: Howard Zhang 
> > Signed-off-by: Jia He 
> > Fixes: b1e57de62cfb ("KVM: arm64: Add stand-alone page-table walker
> infrastructure")
> > [maz: rewrite commit message]
> > Signed-off-by: Marc Zyngier 
> > Link: https://lore.kernel.org/r/20210303024225.2591-1-justin...@arm.com
> > ---
> >  arch/arm64/kvm/hyp/pgtable.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c
> > index 4d177ce1d536..124cd2f93020 100644
> > --- a/arch/arm64/kvm/hyp/pgtable.c
> > +++ b/arch/arm64/kvm/hyp/pgtable.c
> > @@ -223,7 +223,7 @@ static inline int __kvm_pgtable_visit(struct
> kvm_pgtable_walk_data *data,
> > goto out;
> >
> > if (!table) {
> > -   data->addr += kvm_granule_size(level);
> > +   data->addr = ALIGN(data->addr, kvm_granule_size(level));

What if previous data->addr is already aligned with kvm_granule_size(level)?
Hence a deadloop? Am I missing anything else?

--
Cheers,
Justin (Jia He)

> > goto out;
> > }
> 
> If Jia is happy with it, please feel free to add:
> 
> Acked-by: Will Deacon 
> 
> Will


Re: Broken kretprobe stack traces

2021-03-03 Thread Daniel Xu
On Wed, Mar 03, 2021 at 03:37:40PM -0500, Steven Rostedt wrote:
> On Wed, 03 Mar 2021 12:13:08 -0800
> "Daniel Xu"  wrote:
> 
> > On Wed, Mar 3, 2021, at 11:58 AM, Daniel Xu wrote:
> > > On Wed, Mar 03, 2021 at 09:26:04AM -0500, Steven Rostedt wrote:  
> > > > On Wed, 3 Mar 2021 13:48:28 +0900
> > > > Masami Hiramatsu  wrote:
> > > >   
> > > > >   
> > > > > > 
> > > > > > I think (can't prove) this used to work:
> > > > 
> > > > Would be good to find out if it did.  
> > > 
> > > I'm installing some older kernels now to check. Will report back.  
> > 
> > Yep, works in 4.11. So there was a regression somewhere.
> 
> Care to bisect? ;-)

Took a while (I'll probably be typing "test_regression.sh" in my sleep
tonight) but I've bisected it down to f95b23a112f1 ("Merge branch
'x86/urgent' into x86/asm, to pick up dependent fixes").

I think I saw the default option for stack unwinder change from frame
pointers -> ORC so that may be the root cause. Not sure, though. Need to
look more closely at the commits in the merge commit.

<...>

Daniel


Re: [PATCH v3 5/9] KVM: vmx/pmu: Add MSR_ARCH_LBR_DEPTH emulation for Arch LBR

2021-03-03 Thread Xu, Like

Hi Sean,

Thanks for your detailed review on the patch set.

On 2021/3/4 0:58, Sean Christopherson wrote:

On Wed, Mar 03, 2021, Like Xu wrote:

@@ -348,10 +352,26 @@ static bool intel_pmu_handle_lbr_msrs_access(struct 
kvm_vcpu *vcpu,
return true;
  }
  
+/*

+ * Check if the requested depth values is supported
+ * based on the bits [0:7] of the guest cpuid.1c.eax.
+ */
+static bool arch_lbr_depth_is_valid(struct kvm_vcpu *vcpu, u64 depth)
+{
+   struct kvm_cpuid_entry2 *best;
+
+   best = kvm_find_cpuid_entry(vcpu, 0x1c, 0);
+   if (best && depth && !(depth % 8))

This is still wrong, it fails to weed out depth > 64.


How come ? The testcases depth = {65, 127, 128} get #GP as expected.



Not that this is a hot path, but it's probably worth double checking that the
compiler generates simple code for "depth % 8", e.g. it can be "depth & 7)".


Emm, the "%" operation is quite normal over kernel code.

if (best && depth && !(depth % 8))
   10659:   48 85 c0    test   rax,rax
   1065c:   74 c7   je 10625 
   1065e:   4d 85 e4    test   r12,r12
   10661:   74 c2   je 10625 
   10663:   41 f6 c4 07 test   r12b,0x7
   10667:   75 bc   jne    10625 

It looks like the compiler does the right thing.
Do you see the room for optimization ?




+   return (best->eax & 0xff) & (1ULL << (depth / 8 - 1));
+
+   return false;
+}
+




[PATCH v1 1/3] i40e: use minimal tx and rx pairs for kdump

2021-03-03 Thread Coiby Xu
Set the number of the MSI-X vectors to 1. When MSI-X is enabled,
it's not allowed to use more TC queue pairs than MSI-X vectors
(pf->num_lan_msix) exist. Thus the number of tx and rx pairs
(vsi->num_queue_pairs) will be equal to the number of MSI-X vectors,
i.e., 1.

Signed-off-by: Coiby Xu 
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c 
b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 353deae139f9..77bf8c392750 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -6,6 +6,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* Local includes */
 #include "i40e.h"
@@ -15485,6 +15486,14 @@ static int i40e_probe(struct pci_dev *pdev, const 
struct pci_device_id *ent)
if (err)
goto err_switch_setup;
 
+   /* Reduce tx and rx pairs for kdump
+* When MSI-X is enabled, it's not allowed to use more TC queue
+* pairs than MSI-X vectors (pf->num_lan_msix) exist. Thus
+* vsi->num_queue_pairs will be equal to pf->num_lan_msix, i.e., 1.
+*/
+   if (is_kdump_kernel())
+   pf->num_lan_msix = 1;
+
pf->udp_tunnel_nic.set_port = i40e_udp_tunnel_set_port;
pf->udp_tunnel_nic.unset_port = i40e_udp_tunnel_unset_port;
pf->udp_tunnel_nic.flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP;
-- 
2.30.1



[PATCH v1 3/3] i40e: use minimal admin queue for kdump

2021-03-03 Thread Coiby Xu
The minimum size of admin send/receive queue is 1 and 2 respectively.
The admin send queue can't be set to 1 because in that case, the
firmware would fail to init.

Signed-off-by: Coiby Xu 
---
 drivers/net/ethernet/intel/i40e/i40e.h  | 2 ++
 drivers/net/ethernet/intel/i40e/i40e_main.c | 9 +++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e.h 
b/drivers/net/ethernet/intel/i40e/i40e.h
index cd53981fa5e0..09217944baa4 100644
--- a/drivers/net/ethernet/intel/i40e/i40e.h
+++ b/drivers/net/ethernet/intel/i40e/i40e.h
@@ -66,6 +66,8 @@
 #define I40E_FDIR_RING_COUNT   32
 #define I40E_MAX_AQ_BUF_SIZE   4096
 #define I40E_AQ_LEN256
+#define I40E_MIN_ARQ_LEN   1
+#define I40E_MIN_ASQ_LEN   2
 #define I40E_AQ_WORK_LIMIT 66 /* max number of VFs + a little */
 #define I40E_MAX_USER_PRIORITY 8
 #define I40E_DEFAULT_TRAFFIC_CLASS BIT(0)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c 
b/drivers/net/ethernet/intel/i40e/i40e_main.c
index d6868c7aee05..5d67fb12e576 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -15327,8 +15327,13 @@ static int i40e_probe(struct pci_dev *pdev, const 
struct pci_device_id *ent)
 
i40e_check_recovery_mode(pf);
 
-   hw->aq.num_arq_entries = I40E_AQ_LEN;
-   hw->aq.num_asq_entries = I40E_AQ_LEN;
+   if (is_kdump_kernel()) {
+   hw->aq.num_arq_entries = I40E_MIN_ARQ_LEN;
+   hw->aq.num_asq_entries = I40E_MIN_ASQ_LEN;
+   } else {
+   hw->aq.num_arq_entries = I40E_AQ_LEN;
+   hw->aq.num_asq_entries = I40E_AQ_LEN;
+   }
hw->aq.arq_buf_size = I40E_MAX_AQ_BUF_SIZE;
hw->aq.asq_buf_size = I40E_MAX_AQ_BUF_SIZE;
pf->adminq_work_limit = I40E_AQ_WORK_LIMIT;
-- 
2.30.1



Re: [PATCH v3 6/9] KVM: vmx/pmu: Add MSR_ARCH_LBR_CTL emulation for Arch LBR

2021-03-03 Thread Xu, Like

On 2021/3/4 1:19, Sean Christopherson wrote:

On Wed, Mar 03, 2021, Like Xu wrote:

diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c
index 25d620685ae7..d14a14eb712d 100644
--- a/arch/x86/kvm/vmx/pmu_intel.c
+++ b/arch/x86/kvm/vmx/pmu_intel.c
@@ -19,6 +19,7 @@
  #include "pmu.h"
  
  #define MSR_PMC_FULL_WIDTH_BIT  (MSR_IA32_PMC0 - MSR_IA32_PERFCTR0)

+#define KVM_ARCH_LBR_CTL_MASK  0x7f000f

It would nice to build this up with the individual bits instead of tossing in a
magic number.


I will move the mask ARCH_LBR_CTL_MASK from lbr.c to msr-index.h and thus,
#define KVM_ARCH_LBR_CTL_MASK  (ARCH_LBR_CTL_MASK | ARCH_LBR_CTL_LBREN)

I assume the move operation would be a separate patch for host side.




  static struct kvm_event_hw_type_mapping intel_arch_events[] = {
/* Index must match CPUID 0x0A.EBX bit vector */
@@ -221,6 +222,7 @@ static bool intel_is_valid_msr(struct kvm_vcpu *vcpu, u32 
msr)
ret = pmu->version > 1;
break;
case MSR_ARCH_LBR_DEPTH:
+   case MSR_ARCH_LBR_CTL:
ret = guest_cpuid_has(vcpu, X86_FEATURE_ARCH_LBR);
break;
default:
@@ -390,6 +392,9 @@ static int intel_pmu_get_msr(struct kvm_vcpu *vcpu, struct 
msr_data *msr_info)
case MSR_ARCH_LBR_DEPTH:
msr_info->data = lbr_desc->records.nr;
return 0;
+   case MSR_ARCH_LBR_CTL:
+   msr_info->data = vmcs_read64(GUEST_IA32_LBR_CTL);
+   return 0;
default:
if ((pmc = get_gp_pmc(pmu, msr, MSR_IA32_PERFCTR0)) ||
(pmc = get_gp_pmc(pmu, msr, MSR_IA32_PMC0))) {
@@ -457,6 +462,15 @@ static int intel_pmu_set_msr(struct kvm_vcpu *vcpu, struct 
msr_data *msr_info)
lbr_desc->records.nr = data;
lbr_desc->arch_lbr_reset = true;
return 0;
+   case MSR_ARCH_LBR_CTL:
+   if (!(data & ~KVM_ARCH_LBR_CTL_MASK)) {

Maybe invert this to reduce indentation?

if (data & ...)
break; (or "return 1;")


Fine to me.





+   vmcs_write64(GUEST_IA32_LBR_CTL, data);
+   if (intel_pmu_lbr_is_enabled(vcpu) && !lbr_desc->event 
&&
+   (data & ARCH_LBR_CTL_LBREN))

Alignment.


I'll fix it.




+   intel_pmu_create_guest_lbr_event(vcpu);
+   return 0;
+   }
+   break;
default:
if ((pmc = get_gp_pmc(pmu, msr, MSR_IA32_PERFCTR0)) ||
(pmc = get_gp_pmc(pmu, msr, MSR_IA32_PMC0))) {
@@ -635,12 +649,15 @@ static void intel_pmu_reset(struct kvm_vcpu *vcpu)
   */
  static void intel_pmu_legacy_freezing_lbrs_on_pmi(struct kvm_vcpu *vcpu)
  {
-   u64 data = vmcs_read64(GUEST_IA32_DEBUGCTL);
+   u32 lbr_ctl_field = GUEST_IA32_DEBUGCTL;
  
-	if (data & DEBUGCTLMSR_FREEZE_LBRS_ON_PMI) {

-   data &= ~DEBUGCTLMSR_LBR;
-   vmcs_write64(GUEST_IA32_DEBUGCTL, data);
-   }
+   if (!(vmcs_read64(GUEST_IA32_DEBUGCTL) & 
DEBUGCTLMSR_FREEZE_LBRS_ON_PMI))
+   return;
+
+   if (guest_cpuid_has(vcpu, X86_FEATURE_ARCH_LBR))
+   lbr_ctl_field = GUEST_IA32_LBR_CTL;
+
+   vmcs_write64(lbr_ctl_field, vmcs_read64(lbr_ctl_field) & ~BIT(0));

Use ARCH_LBR_CTL_LBREN?


I'm trying to unify the usage of EN bit for both Arch LBR and legacy LBR:

#define ARCH_LBR_CTL_LBREN        BIT(0)
#define DEBUGCTLMSR_LBR            (1UL <<  0)

Any suggestion ?




  }
  
  static void intel_pmu_deliver_pmi(struct kvm_vcpu *vcpu)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 6d7e760fdfa0..a0660b9934c6 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -2036,6 +2036,13 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct 
msr_data *msr_info)
VM_EXIT_SAVE_DEBUG_CONTROLS)
get_vmcs12(vcpu)->guest_ia32_debugctl = data;
  
+		/*

+* For Arch LBR, IA32_DEBUGCTL[bit 0] has no meaning.
+* It can be written to 0 or 1, but reads will always return 0.
+*/
+   if (guest_cpuid_has(vcpu, X86_FEATURE_ARCH_LBR))
+   data &= ~DEBUGCTLMSR_LBR;
+
vmcs_write64(GUEST_IA32_DEBUGCTL, data);
if (intel_pmu_lbr_is_enabled(vcpu) && !to_vmx(vcpu)->lbr_desc.event 
&&
(data & DEBUGCTLMSR_LBR))
@@ -4463,6 +4470,8 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu, bool 
init_event)
vmcs_writel(GUEST_SYSENTER_ESP, 0);
vmcs_writel(GUEST_SYSENTER_EIP, 0);
vmcs_write64(GUEST_IA32_DEBUGCTL, 0);
+   if (cpu_has_vmx_arch_lbr())
+   vmcs_write64(GUEST_IA32_LBR_CTL, 0);

Not that any guest is likely to care, but is the MSR cleared on INIT?  The 

Re: [PATCH] PATCH Documentation translations:translate sound/hd-audio/controls to chinese

2021-03-03 Thread Alex Shi



在 2021/3/2 下午5:13, huangjianghui 写道:
>> we usually include patch into email instead of attach it as attachment.
>> You can try use 'git send-email' to post your patches.
>>
>> Thanks
>> Alex
>>
>>
> I am sorry to do those, my patch is shown below:

Hi Jianghui,

I cann't apply your patch:

$ g am ../Re_\ \[PATCH\]\ PATCH\ Documentation\ translations_translate\ 
sound_hd-audio_controls\ to\ chinese.eml
Applying: PATCH Documentation translations:translate sound/hd-audio/controls to 
chinese
error: patch failed: Documentation/translations/zh_CN/index.rst:20
error: Documentation/translations/zh_CN/index.rst: patch does not apply
Patch failed at 0001 PATCH Documentation translations:translate 
sound/hd-audio/controls to chinese
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".


You'd better try to use 'git am' apply your email patch from your email client,
before send it to linux-doc.

There are some process doc of how community working:
https://landlock.io/linux-doc/landlock-v27/translations/zh_CN/process/

Thanks
Alex


[PATCH v1 2/3] i40e: use minimal rx and tx ring buffers for kdump

2021-03-03 Thread Coiby Xu
Use the minimum of the number of descriptors thus we will allocate the
minimal ring buffers for kdump.

Signed-off-by: Coiby Xu 
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c 
b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 77bf8c392750..d6868c7aee05 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -11029,6 +11029,11 @@ static int i40e_set_num_rings_in_vsi(struct i40e_vsi 
*vsi)
return -ENODATA;
}
 
+   if (is_kdump_kernel()) {
+   vsi->num_tx_desc = I40E_MIN_NUM_DESCRIPTORS;
+   vsi->num_rx_desc = I40E_MIN_NUM_DESCRIPTORS;
+   }
+
return 0;
 }
 
-- 
2.30.1



Re: [PATCH/v4] bpf: add bpf_skb_adjust_room flag BPF_F_ADJ_ROOM_ENCAP_L2_ETH

2021-03-03 Thread Xuesen Huang



> 2021年3月4日 上午2:53,Willem de Bruijn  写道:
> 
> On Wed, Mar 3, 2021 at 7:33 AM Xuesen Huang  wrote:
>> 
>> From: Xuesen Huang 
>> 
>> bpf_skb_adjust_room sets the inner_protocol as skb->protocol for packets
>> encapsulation. But that is not appropriate when pushing Ethernet header.
>> 
>> Add an option to further specify encap L2 type and set the inner_protocol
>> as ETH_P_TEB.
>> 
>> Update test_tc_tunnel to verify adding vxlan encapsulation works with
>> this flag.
>> 
>> Suggested-by: Willem de Bruijn 
>> Signed-off-by: Xuesen Huang 
>> Signed-off-by: Zhiyong Cheng 
>> Signed-off-by: Li Wang 
> 
> Thanks for adding the test. Perhaps that is better in a separate patch?
> 
> Overall looks great to me.
> 
> The patch has not (yet?) arrived on patchwork.
> 
Thanks Willem, I will separate it into two patch.

I will send patch/v5 with only that new flag addition, lol.

>> enum {
>> diff --git a/tools/testing/selftests/bpf/progs/test_tc_tunnel.c 
>> b/tools/testing/selftests/bpf/progs/test_tc_tunnel.c
>> index 37bce7a..6e144db 100644
>> --- a/tools/testing/selftests/bpf/progs/test_tc_tunnel.c
>> +++ b/tools/testing/selftests/bpf/progs/test_tc_tunnel.c
>> @@ -20,6 +20,14 @@
>> #include 
>> #include 
>> 
>> +#define encap_ipv4(...) __encap_ipv4(__VA_ARGS__, 0)
>> +
>> +#define encap_ipv4_with_ext_proto(...) __encap_ipv4(__VA_ARGS__)
>> +
>> +#define encap_ipv6(...) __encap_ipv6(__VA_ARGS__, 0)
>> +
>> +#define encap_ipv6_with_ext_proto(...) __encap_ipv6(__VA_ARGS__)
>> +
> 
> Instead of untyped macros, I'd define encap_ipv4 as a function that
> calls __encap_ipv4.
> 
> And no need for encap_ipv4_with_ext_proto equivalent to __encap_ipv4.
> 
I defined these macros to try to keep the existing  invocation for encap_ipv4/6
as the same, if we define this as a function all invocation should be modified?

>> static const int cfg_port = 8000;
>> 
>> static const int cfg_udp_src = 2;
>> @@ -27,11 +35,24 @@
>> #defineUDP_PORT
>> #defineMPLS_OVER_UDP_PORT  6635
>> #defineETH_OVER_UDP_PORT   
>> +#defineVXLAN_UDP_PORT  8472
>> +
>> +#defineEXTPROTO_VXLAN  0x1
>> +
>> +#defineVXLAN_N_VID (1u << 24)
>> +#defineVXLAN_VNI_MASK  bpf_htonl((VXLAN_N_VID - 1) << 8)
>> +#defineVXLAN_FLAGS 0x8
>> +#defineVXLAN_VNI   1
>> 
>> /* MPLS label 1000 with S bit (last label) set and ttl of 255. */
>> static const __u32 mpls_label = __bpf_constant_htonl(1000 << 12 |
>> MPLS_LS_S_MASK | 0xff);
>> 
>> +struct vxlanhdr {
>> +   __be32 vx_flags;
>> +   __be32 vx_vni;
>> +} __attribute__((packed));
>> +
>> struct gre_hdr {
>>__be16 flags;
>>__be16 protocol;
>> @@ -45,13 +66,13 @@ struct gre_hdr {
>> struct v4hdr {
>>struct iphdr ip;
>>union l4hdr l4hdr;
>> -   __u8 pad[16];   /* enough space for L2 header */
>> +   __u8 pad[24];   /* space for L2 header / vxlan 
>> header ... */
> 
> could we use something like sizeof(..) instead of a constant?
> 
Thanks, I will try to fix this.

>> @@ -171,14 +197,26 @@ static __always_inline int encap_ipv4(struct __sk_buff 
>> *skb, __u8 encap_proto,
>>}
>> 
>>/* add L2 encap (if specified) */
>> +   l2_hdr = (__u8 *)_outer + olen;
>>switch (l2_proto) {
>>case ETH_P_MPLS_UC:
>> -   *((__u32 *)((__u8 *)_outer + olen)) = mpls_label;
>> +   *(__u32 *)l2_hdr = mpls_label;
>>break;
>>case ETH_P_TEB:
>> -   if (bpf_skb_load_bytes(skb, 0, (__u8 *)_outer + olen,
>> -  ETH_HLEN))
> 
> This is non-standard indentation? Here and elsewhere.
I thinks it’s a previous issue.

> 
>> @@ -249,7 +288,11 @@ static __always_inline int encap_ipv6(struct __sk_buff 
>> *skb, __u8 encap_proto,
>>break;
>>case ETH_P_TEB:
>>l2_len = ETH_HLEN;
>> -   udp_dst = ETH_OVER_UDP_PORT;
>> +   if (ext_proto & EXTPROTO_VXLAN) {
>> +   udp_dst = VXLAN_UDP_PORT;
>> +   l2_len += sizeof(struct vxlanhdr);
>> +   } else
>> +   udp_dst = ETH_OVER_UDP_PORT;
>>break;
>>}
>>flags |= BPF_F_ADJ_ROOM_ENCAP_L2(l2_len);
>> @@ -267,7 +310,7 @@ static __always_inline int encap_ipv6(struct __sk_buff 
>> *skb, __u8 encap_proto,
>>h_outer.l4hdr.udp.source = __bpf_constant_htons(cfg_udp_src);
>>h_outer.l4hdr.udp.dest = bpf_htons(udp_dst);
>>tot_len = bpf_ntohs(iph_inner.payload_len) + 
>> sizeof(iph_inner) +
>> - sizeof(h_outer.l4hdr.udp);
>> + sizeof(h_outer.l4hdr.udp) + l2_len;
> 
> Was this a bug previously?
> 
Yes, a tiny bug.

>>h_outer.l4hdr.udp.check = 0;
>>h_outer.l4hdr.udp.len = 

Re: [PATCH] MIPS: Add comment about CONFIG_MIPS32_O32 in loongson3_defconfig when build with Clang

2021-03-03 Thread Tiezhu Yang

On 03/04/2021 10:02 AM, Nathan Chancellor wrote:

On Thu, Mar 04, 2021 at 09:15:44AM +0800, Tiezhu Yang wrote:

When build kernel with Clang [1]:

$ make CC=clang loongson3_defconfig
$ make CC=clang


[snip]


I think this might be a better solution. I know that I personally never
read defconfig files if a build fails.

If CONFIG_MIPS32_O32 is broken with clang and the MIPS backend
maintainer has said that it will not be supported due to lack of
resources, then the config should not even be selectable in my opinion.

Cheers,
Nathan

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index d89efba3d8a4..ed35318a759d 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -3315,6 +3315,8 @@ config SYSVIPC_COMPAT
  config MIPS32_O32
bool "Kernel support for o32 binaries"
depends on 64BIT
+   # https://bugs.llvm.org/show_bug.cgi?id=38063
+   depends on $(success,$(CC) $(CLANG_FLAGS) -march=mips64 -o32 -c -x c 
/dev/null -o /dev/null)
select ARCH_WANT_OLD_COMPAT_IPC
select COMPAT
select MIPS32_COMPAT


Hi Nathan,

Thank you very much for your reply and suggestion, maybe the following
change is simple, clear and better? If yes, I will send v2 later.

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 3a38d27..f6ba59f 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -3318,6 +3318,8 @@ config SYSVIPC_COMPAT
 config MIPS32_O32
bool "Kernel support for o32 binaries"
depends on 64BIT
+   # https://bugs.llvm.org/show_bug.cgi?id=38063
+   depends on !CC_IS_CLANG
select ARCH_WANT_OLD_COMPAT_IPC
select COMPAT
select MIPS32_COMPAT

Thanks,
Tiezhu



[PATCH v2] amba: Remove deferred device addition

2021-03-03 Thread Saravana Kannan
The uevents generated for an amba device need PID and CID information
that's available only when the amba device is powered on, clocked and
out of reset. So, if those resources aren't available, the information
can't be read to generate the uevents. To workaround this requirement,
if the resources weren't available, the device addition was deferred and
retried periodically.

However, this deferred addition retry isn't based on resources becoming
available. Instead, it's retried every 5 seconds and causes arbitrary
probe delays for amba devices and their consumers.

Also, maintaining a separate deferred-probe like mechanism is
maintenance headache.

With this commit, instead of deferring the device addition, we simply
defer the generation of uevents for the device and probing of the device
(because drivers needs PID and CID to match) until the PID and CID
information can be read. This allows us to delete all the amba specific
deferring code and also avoid the arbitrary probing delays.

Cc: Rob Herring 
Cc: Ulf Hansson 
Cc: John Stultz 
Cc: Saravana Kannan 
Cc: Linus Walleij 
Cc: Sudeep Holla 
Cc: Nicolas Saenz Julienne 
Cc: Geert Uytterhoeven 
Cc: Russell King 
Signed-off-by: Saravana Kannan 
---
 drivers/amba/bus.c | 293 ++---
 1 file changed, 115 insertions(+), 178 deletions(-)

diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index 939ca220bf78..fac4110b2f58 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -149,11 +149,101 @@ static struct attribute *amba_dev_attrs[] = {
 };
 ATTRIBUTE_GROUPS(amba_dev);
 
+static int amba_read_periphid(struct amba_device *dev)
+{
+   u32 size;
+   void __iomem *tmp;
+   u32 pid, cid;
+   struct reset_control *rstc;
+   int i, ret;
+
+   /*
+* Dynamically calculate the size of the resource
+* and use this for iomap
+*/
+   size = resource_size(>res);
+   tmp = ioremap(dev->res.start, size);
+   if (!tmp)
+   return -ENOMEM;
+
+   ret = dev_pm_domain_attach(>dev, true);
+   if (ret)
+   goto err_pm;
+
+   ret = amba_get_enable_pclk(dev);
+   if (ret)
+   goto err_clk;
+
+   /*
+* Find reset control(s) of the amba bus and de-assert them.
+*/
+   rstc = of_reset_control_array_get_optional_shared(dev->dev.of_node);
+   if (IS_ERR(rstc)) {
+   ret = PTR_ERR(rstc);
+   if (ret != -EPROBE_DEFER)
+   dev_err(>dev, "can't get reset: %d\n",
+   ret);
+   goto err_reset;
+   }
+   reset_control_deassert(rstc);
+   reset_control_put(rstc);
+
+   /*
+* Read pid and cid based on size of resource
+* they are located at end of region
+*/
+   for (pid = 0, i = 0; i < 4; i++)
+   pid |= (readl(tmp + size - 0x20 + 4 * i) & 255) <<
+   (i * 8);
+   for (cid = 0, i = 0; i < 4; i++)
+   cid |= (readl(tmp + size - 0x10 + 4 * i) & 255) <<
+   (i * 8);
+
+   if (cid == CORESIGHT_CID) {
+   /* set the base to the start of the last 4k block */
+   void __iomem *csbase = tmp + size - 4096;
+
+   dev->uci.devarch =
+   readl(csbase + UCI_REG_DEVARCH_OFFSET);
+   dev->uci.devtype =
+   readl(csbase + UCI_REG_DEVTYPE_OFFSET) & 0xff;
+   }
+
+   amba_put_disable_pclk(dev);
+
+   if (cid == AMBA_CID || cid == CORESIGHT_CID) {
+   dev->periphid = pid;
+   dev->cid = cid;
+   }
+
+   if (!dev->periphid)
+   ret = -ENODEV;
+
+   return ret;
+
+err_reset:
+   amba_put_disable_pclk(dev);
+err_clk:
+   dev_pm_domain_detach(>dev, true);
+err_pm:
+   iounmap(tmp);
+   return ret;
+}
+
 static int amba_match(struct device *dev, struct device_driver *drv)
 {
struct amba_device *pcdev = to_amba_device(dev);
struct amba_driver *pcdrv = to_amba_driver(drv);
 
+   if (!pcdev->periphid) {
+   int ret = amba_read_periphid(pcdev);
+
+   if (ret)
+   return ret;
+   dev_set_uevent_suppress(dev, false);
+   kobject_uevent(>kobj, KOBJ_ADD);
+   }
+
/* When driver_override is set, only bind to the matching driver */
if (pcdev->driver_override)
return !strcmp(pcdev->driver_override, drv->name);
@@ -373,98 +463,43 @@ static void amba_device_release(struct device *dev)
kfree(d);
 }
 
-static int amba_device_try_add(struct amba_device *dev, struct resource 
*parent)
+/**
+ * amba_device_add - add a previously allocated AMBA device structure
+ * @dev: AMBA device allocated by amba_device_alloc
+ * @parent: resource parent for this devices resources
+ *
+ * Claim the resource, and read the device cell ID if not already
+ * 

Re: [PATCH] mm,hwpoison: return -EBUSY when page already poisoned

2021-03-03 Thread Aili Yao
On Thu, 4 Mar 2021 10:16:53 +0800
Aili Yao  wrote:

> On Wed, 3 Mar 2021 15:41:35 +
> "Luck, Tony"  wrote:
> 
> > > For error address with sigbus, i think this is not an issue resulted by 
> > > the patch i post, before my patch, the issue is already there.
> > > I don't find a realizable way to get the correct address for same reason 
> > > --- we don't know whether the page mapping is there or not when
> > > we got to kill_me_maybe(), in some case, we may get it, but there are a 
> > > lot of parallel issue need to consider, and if failed we have to fallback
> > > to the error brach again, remaining current code may be an easy option;   
> > >  
> > 
> > My RFC patch from yesterday removes the uncertainty about whether the page 
> > is there or not. After it walks the page
> > tables we know that the poison page isn't mapped (note that patch is RFC 
> > for a reason ... I'm 90% sure that it should
> > do a bit more that just clear the PRESENT bit).
> > 
> > So perhaps memory_failure() has queued a SIGBUS for this task, if so, we 
> > take it when we return from kill_me_maybe()

And when this happen, the process will receive an SIGBUS with AO level, is it 
proper as not an AR?

> > If not, we will return to user mode and re-execute the failing instruction 
> > ... but because the page is unmapped we will take a #PF  
> 
> Got this, I have some error thoughts here.
> 
> 
> > The x86 page fault handler will see that the page for this physical address 
> > is marked HWPOISON, and it will send the SIGBUS
> > (just like it does if the page had been removed by an earlier UCNA/SRAO 
> > error).  
> 
> if your methods works, should it be like this?
> 
> 1582 pteval = 
> swp_entry_to_pte(make_hwpoison_entry(subpage));
> 1583 if (PageHuge(page)) {
> 1584 hugetlb_count_sub(compound_nr(page), mm);
> 1585 set_huge_swap_pte_at(mm, address,
> 1586  pvmw.pte, pteval,
> 1587  
> vma_mmu_pagesize(vma));
> 1588 } else {
> 1589 dec_mm_counter(mm, mm_counter(page));
> 1590 set_pte_at(mm, address, pvmw.pte, 
> pteval);
> 1591 }
> 
> the page fault check if it's a poison page using is_hwpoison_entry(),
> 

And if it works, does we need some locking mechanism before we call 
walk_page_range();
if we lock, does we need to process the blocking interrupted error as other 
places will do?

-- 
Thanks!
Aili Yao


[PATCH v4 05/13] phy: cadence: cadence-sierra: Move all clk_get_*() to a separate function

2021-03-03 Thread Kishon Vijay Abraham I
No functional change. Group all devm_clk_get_optional() to a
separate function.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/phy/cadence/phy-cadence-sierra.c | 57 +++-
 1 file changed, 35 insertions(+), 22 deletions(-)

diff --git a/drivers/phy/cadence/phy-cadence-sierra.c 
b/drivers/phy/cadence/phy-cadence-sierra.c
index f7ba0ed416bc..7bf1b4c7774a 100644
--- a/drivers/phy/cadence/phy-cadence-sierra.c
+++ b/drivers/phy/cadence/phy-cadence-sierra.c
@@ -477,6 +477,38 @@ static int cdns_regmap_init_blocks(struct cdns_sierra_phy 
*sp,
return 0;
 }
 
+static int cdns_sierra_phy_get_clocks(struct cdns_sierra_phy *sp,
+ struct device *dev)
+{
+   struct clk *clk;
+   int ret;
+
+   clk = devm_clk_get_optional(dev, "phy_clk");
+   if (IS_ERR(clk)) {
+   dev_err(dev, "failed to get clock phy_clk\n");
+   return PTR_ERR(clk);
+   }
+   sp->clk = clk;
+
+   clk = devm_clk_get_optional(dev, "cmn_refclk_dig_div");
+   if (IS_ERR(clk)) {
+   dev_err(dev, "cmn_refclk_dig_div clock not found\n");
+   ret = PTR_ERR(clk);
+   return ret;
+   }
+   sp->cmn_refclk_dig_div = clk;
+
+   clk = devm_clk_get_optional(dev, "cmn_refclk1_dig_div");
+   if (IS_ERR(clk)) {
+   dev_err(dev, "cmn_refclk1_dig_div clock not found\n");
+   ret = PTR_ERR(clk);
+   return ret;
+   }
+   sp->cmn_refclk1_dig_div = clk;
+
+   return 0;
+}
+
 static int cdns_sierra_phy_probe(struct platform_device *pdev)
 {
struct cdns_sierra_phy *sp;
@@ -487,7 +519,6 @@ static int cdns_sierra_phy_probe(struct platform_device 
*pdev)
unsigned int id_value;
int i, ret, node = 0;
void __iomem *base;
-   struct clk *clk;
struct device_node *dn = dev->of_node, *child;
 
if (of_get_child_count(dn) == 0)
@@ -524,11 +555,9 @@ static int cdns_sierra_phy_probe(struct platform_device 
*pdev)
 
platform_set_drvdata(pdev, sp);
 
-   sp->clk = devm_clk_get_optional(dev, "phy_clk");
-   if (IS_ERR(sp->clk)) {
-   dev_err(dev, "failed to get clock phy_clk\n");
-   return PTR_ERR(sp->clk);
-   }
+   ret = cdns_sierra_phy_get_clocks(sp, dev);
+   if (ret)
+   return ret;
 
sp->phy_rst = devm_reset_control_get(dev, "sierra_reset");
if (IS_ERR(sp->phy_rst)) {
@@ -542,22 +571,6 @@ static int cdns_sierra_phy_probe(struct platform_device 
*pdev)
return PTR_ERR(sp->apb_rst);
}
 
-   clk = devm_clk_get_optional(dev, "cmn_refclk_dig_div");
-   if (IS_ERR(clk)) {
-   dev_err(dev, "cmn_refclk_dig_div clock not found\n");
-   ret = PTR_ERR(clk);
-   return ret;
-   }
-   sp->cmn_refclk_dig_div = clk;
-
-   clk = devm_clk_get_optional(dev, "cmn_refclk1_dig_div");
-   if (IS_ERR(clk)) {
-   dev_err(dev, "cmn_refclk1_dig_div clock not found\n");
-   ret = PTR_ERR(clk);
-   return ret;
-   }
-   sp->cmn_refclk1_dig_div = clk;
-
ret = clk_prepare_enable(sp->clk);
if (ret)
return ret;
-- 
2.17.1



[PATCH v4 10/13] phy: cadence: cadence-sierra: Add missing clk_disable_unprepare() in .remove callback

2021-03-03 Thread Kishon Vijay Abraham I
commit 44d30d622821 ("phy: cadence: Add driver for Sierra PHY") enabled
the clock in probe and failed to disable in remove callback. Add missing
clk_disable_unprepare() in cdns_sierra_phy_remove().

Fixes: 44d30d622821 ("phy: cadence: Add driver for Sierra PHY")
Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/phy/cadence/phy-cadence-sierra.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/phy/cadence/phy-cadence-sierra.c 
b/drivers/phy/cadence/phy-cadence-sierra.c
index a45278c30948..ac32b7b0289f 100644
--- a/drivers/phy/cadence/phy-cadence-sierra.c
+++ b/drivers/phy/cadence/phy-cadence-sierra.c
@@ -689,6 +689,9 @@ static int cdns_sierra_phy_remove(struct platform_device 
*pdev)
reset_control_assert(phy->phys[i].lnk_rst);
reset_control_put(phy->phys[i].lnk_rst);
}
+
+   clk_disable_unprepare(phy->input_clks[PHY_CLK]);
+
return 0;
 }
 
-- 
2.17.1



[PATCH v4 13/13] phy: cadence: phy-cadence-sierra: Enable pll_cmnlc and pll_cmnlc1 clocks

2021-03-03 Thread Kishon Vijay Abraham I
Get pll_cmnlc and pll_cmnlc1 optional clocks and enable them.
This will enable REFRCV/1 in case the pll_cmnlc/1 takes input
from REFRCV/1 respectively.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/phy/cadence/phy-cadence-sierra.c | 40 ++--
 1 file changed, 37 insertions(+), 3 deletions(-)

diff --git a/drivers/phy/cadence/phy-cadence-sierra.c 
b/drivers/phy/cadence/phy-cadence-sierra.c
index be2c91be4205..68d81f953f4f 100644
--- a/drivers/phy/cadence/phy-cadence-sierra.c
+++ b/drivers/phy/cadence/phy-cadence-sierra.c
@@ -768,6 +768,40 @@ static int cdns_sierra_phy_get_clocks(struct 
cdns_sierra_phy *sp,
return 0;
 }
 
+static int cdns_sierra_phy_enable_clocks(struct cdns_sierra_phy *sp)
+{
+   int ret;
+
+   ret = clk_prepare_enable(sp->input_clks[PLL0_REFCLK]);
+   if (ret)
+   return ret;
+
+   ret = clk_prepare_enable(sp->output_clks[CDNS_SIERRA_PLL_CMNLC]);
+   if (ret)
+   goto err_pll_cmnlc;
+
+   ret = clk_prepare_enable(sp->output_clks[CDNS_SIERRA_PLL_CMNLC1]);
+   if (ret)
+   goto err_pll_cmnlc1;
+
+   return 0;
+
+err_pll_cmnlc:
+   clk_disable_unprepare(sp->input_clks[PHY_CLK]);
+
+err_pll_cmnlc1:
+   clk_disable_unprepare(sp->output_clks[CDNS_SIERRA_PLL_CMNLC]);
+
+   return 0;
+}
+
+static void cdns_sierra_phy_disable_clocks(struct cdns_sierra_phy *sp)
+{
+   clk_disable_unprepare(sp->output_clks[CDNS_SIERRA_PLL_CMNLC1]);
+   clk_disable_unprepare(sp->output_clks[CDNS_SIERRA_PLL_CMNLC]);
+   clk_disable_unprepare(sp->input_clks[PHY_CLK]);
+}
+
 static int cdns_sierra_phy_get_resets(struct cdns_sierra_phy *sp,
  struct device *dev)
 {
@@ -848,7 +882,7 @@ static int cdns_sierra_phy_probe(struct platform_device 
*pdev)
if (ret)
goto unregister_clk;
 
-   ret = clk_prepare_enable(sp->input_clks[PHY_CLK]);
+   ret = cdns_sierra_phy_enable_clocks(sp);
if (ret)
goto unregister_clk;
 
@@ -925,7 +959,7 @@ static int cdns_sierra_phy_probe(struct platform_device 
*pdev)
reset_control_put(sp->phys[i].lnk_rst);
of_node_put(child);
 clk_disable:
-   clk_disable_unprepare(sp->input_clks[PHY_CLK]);
+   cdns_sierra_phy_disable_clocks(sp);
reset_control_assert(sp->apb_rst);
 unregister_clk:
cdns_sierra_clk_register(sp);
@@ -941,6 +975,7 @@ static int cdns_sierra_phy_remove(struct platform_device 
*pdev)
reset_control_assert(phy->apb_rst);
pm_runtime_disable(>dev);
 
+   cdns_sierra_phy_disable_clocks(phy);
/*
 * The device level resets will be put automatically.
 * Need to put the subnode resets here though.
@@ -950,7 +985,6 @@ static int cdns_sierra_phy_remove(struct platform_device 
*pdev)
reset_control_put(phy->phys[i].lnk_rst);
}
 
-   clk_disable_unprepare(phy->input_clks[PHY_CLK]);
cdns_sierra_clk_unregister(phy);
 
return 0;
-- 
2.17.1



[PATCH v4 00/13] PHY: Add support in Sierra to use external clock

2021-03-03 Thread Kishon Vijay Abraham I
Patch series adds support in Sierra driver to use external clock.

v1 of the patch series can be found @ [1]
v2 of the patch series can be found @ [2]
v3 of the patch series can be found @ [3]

Changes from v3:
1) Instead of adding separate subnodes for each clock, just add
#clock-cells in Sierra SERDES nodes and model the clocks. This is
in alignment with Rob's comment for a different series [4]
2) Removed device tree changes from the series.

Changes from v2:
1) Add depends on COMMON_CLK in Sierra
2) Add modelling PLL_CMNLC and PLL_CMNLC1 as clocks into a separate
patch
3) Disable clocks in Sierra driver remove

Changes from v1:
1) Remove the part that prevents configuration if the SERDES is already
   configured and focus only on using external clock and the associated
   cleanups
2) Change patch ordering
3) Use exclusive reset control APIs
4) Fix error handling code
5) Include DT patches in this series (I can send this separately to DT
MAINTAINER once the driver patches are merged)

[1] -> http://lore.kernel.org/r/20201103035556.21260-1-kis...@ti.com
[2] -> http://lore.kernel.org/r/20201222070520.28132-1-kis...@ti.com
[3] -> http://lore.kernel.org/r/20201224111627.32590-1-kis...@ti.com
[4] -> http://lore.kernel.org/r/20210108025943.ga1790...@robh.at.kernel.org

Kishon Vijay Abraham I (13):
  phy: cadence: Sierra: Fix PHY power_on sequence
  phy: ti: j721e-wiz: Invoke wiz_init() before
of_platform_device_create()
  phy: cadence: cadence-sierra: Create PHY only for "phy" or "link"
sub-nodes
  phy: ti: j721e-wiz: Get PHY properties only for "phy" or "link"
subnode
  phy: cadence: cadence-sierra: Move all clk_get_*() to a separate
function
  phy: cadence: cadence-sierra: Move all reset_control_get*() to a
separate function
  phy: cadence: cadence-sierra: Explicitly request exclusive reset
control
  phy: cadence-torrent: Use a common header file for Cadence SERDES
  phy: cadence: cadence-sierra: Add array of input clocks in "struct
cdns_sierra_phy"
  phy: cadence: cadence-sierra: Add missing clk_disable_unprepare() in
.remove callback
  dt-bindings: phy: phy-cadence-sierra: Add binding to model Sierra as
clock provider
  phy: cadence: phy-cadence-sierra: Model PLL_CMNLC and PLL_CMNLC1 as
clocks (mux clocks)
  phy: cadence: phy-cadence-sierra: Enable pll_cmnlc and pll_cmnlc1
clocks

 .../bindings/phy/phy-cadence-sierra.yaml  |  17 +-
 drivers/phy/cadence/Kconfig   |   1 +
 drivers/phy/cadence/phy-cadence-sierra.c  | 419 --
 drivers/phy/cadence/phy-cadence-torrent.c |   2 +-
 drivers/phy/ti/phy-j721e-wiz.c|  21 +-
 include/dt-bindings/phy/phy-cadence-torrent.h |  15 -
 include/dt-bindings/phy/phy-cadence.h |  20 +
 7 files changed, 428 insertions(+), 67 deletions(-)
 delete mode 100644 include/dt-bindings/phy/phy-cadence-torrent.h
 create mode 100644 include/dt-bindings/phy/phy-cadence.h

-- 
2.17.1



[PATCH v4 06/13] phy: cadence: cadence-sierra: Move all reset_control_get*() to a separate function

2021-03-03 Thread Kishon Vijay Abraham I
No functional change. Group devm_reset_control_get() and
devm_reset_control_get_optional() to a separate function.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/phy/cadence/phy-cadence-sierra.c | 36 
 1 file changed, 25 insertions(+), 11 deletions(-)

diff --git a/drivers/phy/cadence/phy-cadence-sierra.c 
b/drivers/phy/cadence/phy-cadence-sierra.c
index 7bf1b4c7774a..935f165404e4 100644
--- a/drivers/phy/cadence/phy-cadence-sierra.c
+++ b/drivers/phy/cadence/phy-cadence-sierra.c
@@ -509,6 +509,28 @@ static int cdns_sierra_phy_get_clocks(struct 
cdns_sierra_phy *sp,
return 0;
 }
 
+static int cdns_sierra_phy_get_resets(struct cdns_sierra_phy *sp,
+ struct device *dev)
+{
+   struct reset_control *rst;
+
+   rst = devm_reset_control_get(dev, "sierra_reset");
+   if (IS_ERR(rst)) {
+   dev_err(dev, "failed to get reset\n");
+   return PTR_ERR(rst);
+   }
+   sp->phy_rst = rst;
+
+   rst = devm_reset_control_get_optional(dev, "sierra_apb");
+   if (IS_ERR(rst)) {
+   dev_err(dev, "failed to get apb reset\n");
+   return PTR_ERR(rst);
+   }
+   sp->apb_rst = rst;
+
+   return 0;
+}
+
 static int cdns_sierra_phy_probe(struct platform_device *pdev)
 {
struct cdns_sierra_phy *sp;
@@ -559,17 +581,9 @@ static int cdns_sierra_phy_probe(struct platform_device 
*pdev)
if (ret)
return ret;
 
-   sp->phy_rst = devm_reset_control_get(dev, "sierra_reset");
-   if (IS_ERR(sp->phy_rst)) {
-   dev_err(dev, "failed to get reset\n");
-   return PTR_ERR(sp->phy_rst);
-   }
-
-   sp->apb_rst = devm_reset_control_get_optional(dev, "sierra_apb");
-   if (IS_ERR(sp->apb_rst)) {
-   dev_err(dev, "failed to get apb reset\n");
-   return PTR_ERR(sp->apb_rst);
-   }
+   ret = cdns_sierra_phy_get_resets(sp, dev);
+   if (ret)
+   return ret;
 
ret = clk_prepare_enable(sp->clk);
if (ret)
-- 
2.17.1



[PATCH v4 02/13] phy: ti: j721e-wiz: Invoke wiz_init() before of_platform_device_create()

2021-03-03 Thread Kishon Vijay Abraham I
Invoke wiz_init() before configuring anything else in Sierra/Torrent
(invoked as part of of_platform_device_create()). wiz_init() resets the
SERDES device and any configuration done in the probe() of
Sierra/Torrent will be lost. In order to prevent SERDES configuration
from getting reset, invoke wiz_init() immediately before invoking
of_platform_device_create().

Fixes: 091876cc355d ("phy: ti: j721e-wiz: Add support for WIZ module present in 
TI J721E SoC")
Signed-off-by: Kishon Vijay Abraham I 
Cc:  # v5.10
---
 drivers/phy/ti/phy-j721e-wiz.c | 17 +++--
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c
index 995c7dbec77b..1bb73822f44a 100644
--- a/drivers/phy/ti/phy-j721e-wiz.c
+++ b/drivers/phy/ti/phy-j721e-wiz.c
@@ -1262,27 +1262,24 @@ static int wiz_probe(struct platform_device *pdev)
goto err_get_sync;
}
 
+   ret = wiz_init(wiz);
+   if (ret) {
+   dev_err(dev, "WIZ initialization failed\n");
+   goto err_wiz_init;
+   }
+
serdes_pdev = of_platform_device_create(child_node, NULL, dev);
if (!serdes_pdev) {
dev_WARN(dev, "Unable to create SERDES platform device\n");
ret = -ENOMEM;
-   goto err_pdev_create;
-   }
-   wiz->serdes_pdev = serdes_pdev;
-
-   ret = wiz_init(wiz);
-   if (ret) {
-   dev_err(dev, "WIZ initialization failed\n");
goto err_wiz_init;
}
+   wiz->serdes_pdev = serdes_pdev;
 
of_node_put(child_node);
return 0;
 
 err_wiz_init:
-   of_platform_device_destroy(_pdev->dev, NULL);
-
-err_pdev_create:
wiz_clock_cleanup(wiz, node);
 
 err_get_sync:
-- 
2.17.1



[PATCH v4 03/13] phy: cadence: cadence-sierra: Create PHY only for "phy" or "link" sub-nodes

2021-03-03 Thread Kishon Vijay Abraham I
Cadence Sierra PHY driver registers PHY using devm_phy_create()
for all sub-nodes of Sierra device tree node. However Sierra device
tree node can have sub-nodes for the various clocks in addtion to the
PHY. Use devm_phy_create() only for nodes with name "phy" (or "link"
for old device tree) which represent the actual PHY.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/phy/cadence/phy-cadence-sierra.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/phy/cadence/phy-cadence-sierra.c 
b/drivers/phy/cadence/phy-cadence-sierra.c
index 19f32ae877b9..f7ba0ed416bc 100644
--- a/drivers/phy/cadence/phy-cadence-sierra.c
+++ b/drivers/phy/cadence/phy-cadence-sierra.c
@@ -577,6 +577,10 @@ static int cdns_sierra_phy_probe(struct platform_device 
*pdev)
for_each_available_child_of_node(dn, child) {
struct phy *gphy;
 
+   if (!(of_node_name_eq(child, "phy") ||
+ of_node_name_eq(child, "link")))
+   continue;
+
sp->phys[node].lnk_rst =
of_reset_control_array_get_exclusive(child);
 
-- 
2.17.1



[PATCH v4 08/13] phy: cadence-torrent: Use a common header file for Cadence SERDES

2021-03-03 Thread Kishon Vijay Abraham I
No functional change. In order to have a single header file for all
Cadence SERDES move phy-cadence-torrent.h to phy-cadence.h. This is
in preparation for adding Cadence Sierra SERDES specific macros.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/phy/cadence/phy-cadence-torrent.c| 2 +-
 .../phy/{phy-cadence-torrent.h => phy-cadence.h} | 9 +
 2 files changed, 6 insertions(+), 5 deletions(-)
 rename include/dt-bindings/phy/{phy-cadence-torrent.h => phy-cadence.h} (51%)

diff --git a/drivers/phy/cadence/phy-cadence-torrent.c 
b/drivers/phy/cadence/phy-cadence-torrent.c
index b371795e66a2..56083fd0c69f 100644
--- a/drivers/phy/cadence/phy-cadence-torrent.c
+++ b/drivers/phy/cadence/phy-cadence-torrent.c
@@ -7,7 +7,7 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
diff --git a/include/dt-bindings/phy/phy-cadence-torrent.h 
b/include/dt-bindings/phy/phy-cadence.h
similarity index 51%
rename from include/dt-bindings/phy/phy-cadence-torrent.h
rename to include/dt-bindings/phy/phy-cadence.h
index 3c92c6192493..4a5ea52a856f 100644
--- a/include/dt-bindings/phy/phy-cadence-torrent.h
+++ b/include/dt-bindings/phy/phy-cadence.h
@@ -1,15 +1,16 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 /*
- * This header provides constants for Cadence Torrent SERDES.
+ * This header provides constants for Cadence SERDES.
  */
 
-#ifndef _DT_BINDINGS_TORRENT_SERDES_H
-#define _DT_BINDINGS_TORRENT_SERDES_H
+#ifndef _DT_BINDINGS_CADENCE_SERDES_H
+#define _DT_BINDINGS_CADENCE_SERDES_H
 
+/* Torrent */
 #define TORRENT_SERDES_NO_SSC  0
 #define TORRENT_SERDES_EXTERNAL_SSC1
 #define TORRENT_SERDES_INTERNAL_SSC2
 
 #define CDNS_TORRENT_REFCLK_DRIVER  0
 
-#endif /* _DT_BINDINGS_TORRENT_SERDES_H */
+#endif /* _DT_BINDINGS_CADENCE_SERDES_H */
-- 
2.17.1



[PATCH v4 04/13] phy: ti: j721e-wiz: Get PHY properties only for "phy" or "link" subnode

2021-03-03 Thread Kishon Vijay Abraham I
"serdes" node (child node of WIZ) can have sub-nodes for representing links
or it can have sub-nodes for representing the various clocks within the
serdes. Instead of trying to read "reg" from every child node used for
assigning "lane_phy_type", read only if the child node's name is "phy"
or "link" subnode.
Ideally all PHY dt nodes should have node name as "phy", however
existing devicetree used "link" as subnode. So in order to maintain old
DT compatibility get PHY properties for "phy" or "link" subnode.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/phy/ti/phy-j721e-wiz.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/phy/ti/phy-j721e-wiz.c b/drivers/phy/ti/phy-j721e-wiz.c
index 1bb73822f44a..659597645201 100644
--- a/drivers/phy/ti/phy-j721e-wiz.c
+++ b/drivers/phy/ti/phy-j721e-wiz.c
@@ -1102,6 +1102,10 @@ static int wiz_get_lane_phy_types(struct device *dev, 
struct wiz *wiz)
u32 reg, num_lanes = 1, phy_type = PHY_NONE;
int ret, i;
 
+   if (!(of_node_name_eq(subnode, "phy") ||
+ of_node_name_eq(subnode, "link")))
+   continue;
+
ret = of_property_read_u32(subnode, "reg", );
if (ret) {
dev_err(dev,
-- 
2.17.1



[PATCH] arch:powerpc:kernel: remove duplicate include in traps.c

2021-03-03 Thread menglong8 . dong
From: Zhang Yunkai 

'asm/tm.h' included in 'traps.c' is duplicated.
It is also included in the 62th line.

Signed-off-by: Zhang Yunkai 
---
 arch/powerpc/kernel/traps.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 1583fd1c6010..dcdb93588828 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -53,7 +53,6 @@
 #ifdef CONFIG_PPC64
 #include 
 #include 
-#include 
 #endif
 #include 
 #include 
-- 
2.25.1



Re: [External] Re: [PATCH v17 1/9] mm: memory_hotplug: factor out bootmem core functions to bootmem_info.c

2021-03-03 Thread Muchun Song
On Thu, Mar 4, 2021 at 12:26 PM Balbir Singh  wrote:
>
> On Wed, Mar 03, 2021 at 01:45:00PM +1100, Singh, Balbir wrote:
> > On 26/2/21 12:21 am, Muchun Song wrote:
> > > Move bootmem info registration common API to individual bootmem_info.c.
> > > And we will use {get,put}_page_bootmem() to initialize the page for the
> > > vmemmap pages or free the vmemmap pages to buddy in the later patch.
> > > So move them out of CONFIG_MEMORY_HOTPLUG_SPARSE. This is just code
> > > movement without any functional change.
> > >
> > > Signed-off-by: Muchun Song 
> > > Acked-by: Mike Kravetz 
> > > Reviewed-by: Oscar Salvador 
> > > Reviewed-by: David Hildenbrand 
> > > Reviewed-by: Miaohe Lin 
> > ...
> >
> > > diff --git a/mm/bootmem_info.c b/mm/bootmem_info.c
> > > new file mode 100644
> > > index ..fcab5a3f8cc0
> > > --- /dev/null
> > > +++ b/mm/bootmem_info.c
> > > @@ -0,0 +1,124 @@
> > > +// SPDX-License-Identifier: GPL-2.0
> > > +/*
> > > + *  linux/mm/bootmem_info.c
> > > + *
> > > + *  Copyright (C)
> >
> > Looks like incomplete
> >
> Not that my comment was, I should have said
>
> The copyright looks very incomplete

Yes. Just copied from mm/memory_hotplug.c.
I can improve it in the next version. Thanks.

>
> Balbir Singh.


[PATCH] net: sctp: trivial: fix typo in comment

2021-03-03 Thread Drew Fustini
Fix typo of 'overflow' for comment in sctp_tsnmap_check().

Reported-by: Gustavo A. R. Silva 
Signed-off-by: Drew Fustini 
---
 net/sctp/tsnmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sctp/tsnmap.c b/net/sctp/tsnmap.c
index a9c6af5795d8..5ba456727f63 100644
--- a/net/sctp/tsnmap.c
+++ b/net/sctp/tsnmap.c
@@ -75,7 +75,7 @@ int sctp_tsnmap_check(const struct sctp_tsnmap *map, __u32 
tsn)
return 1;
 
/* Verify that we can hold this TSN and that it will not
-* overlfow our map
+* overflow our map
 */
if (!TSN_lt(tsn, map->base_tsn + SCTP_TSN_MAP_SIZE))
return -1;
-- 
2.27.0



Re: [PATCH v3] KVM: nVMX: Sync L2 guest CET states between L1/L2

2021-03-03 Thread Yang Weijiang
On Wed, Mar 03, 2021 at 01:24:07PM +0100, Paolo Bonzini wrote:
> On 03/03/21 07:04, Yang Weijiang wrote:
> > These fields are rarely updated by L1 QEMU/KVM, sync them when L1 is trying 
> > to
> > read/write them and after they're changed. If CET guest entry-load bit is 
> > not
> > set by L1 guest, migrate them to L2 manaully.
> > 
> > Suggested-by: Sean Christopherson 
> > Signed-off-by: Yang Weijiang 
> 
> Hi Weijiang, can you post the complete series again?  Thanks!

Sure, sent v3 version to include all the patches. Thanks!

> 
> Paolo
> 
> > ---
> >   arch/x86/kvm/cpuid.c  |  1 -
> >   arch/x86/kvm/vmx/nested.c | 30 ++
> >   arch/x86/kvm/vmx/vmx.h|  3 +++
> >   3 files changed, 33 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
> > index d191de769093..8692f53b8cd0 100644
> > --- a/arch/x86/kvm/cpuid.c
> > +++ b/arch/x86/kvm/cpuid.c
> > @@ -143,7 +143,6 @@ void kvm_update_cpuid_runtime(struct kvm_vcpu *vcpu)
> > }
> > vcpu->arch.guest_supported_xss =
> > (((u64)best->edx << 32) | best->ecx) & supported_xss;
> > -
> > } else {
> > vcpu->arch.guest_supported_xss = 0;
> > }
> > diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> > index 9728efd529a1..24cace55e1f9 100644
> > --- a/arch/x86/kvm/vmx/nested.c
> > +++ b/arch/x86/kvm/vmx/nested.c
> > @@ -2516,6 +2516,13 @@ static void prepare_vmcs02_rare(struct vcpu_vmx 
> > *vmx, struct vmcs12 *vmcs12)
> > vmcs_write32(VM_ENTRY_MSR_LOAD_COUNT, vmx->msr_autoload.guest.nr);
> > set_cr4_guest_host_mask(vmx);
> > +
> > +   if (kvm_cet_supported() && vmx->nested.nested_run_pending &&
> > +   (vmcs12->vm_entry_controls & VM_ENTRY_LOAD_CET_STATE)) {
> > +   vmcs_writel(GUEST_SSP, vmcs12->guest_ssp);
> > +   vmcs_writel(GUEST_S_CET, vmcs12->guest_s_cet);
> > +   vmcs_writel(GUEST_INTR_SSP_TABLE, vmcs12->guest_ssp_tbl);
> > +   }
> >   }
> >   /*
> > @@ -2556,6 +2563,15 @@ static int prepare_vmcs02(struct kvm_vcpu *vcpu, 
> > struct vmcs12 *vmcs12,
> > if (kvm_mpx_supported() && (!vmx->nested.nested_run_pending ||
> > !(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_BNDCFGS)))
> > vmcs_write64(GUEST_BNDCFGS, vmx->nested.vmcs01_guest_bndcfgs);
> > +
> > +   if (kvm_cet_supported() && (!vmx->nested.nested_run_pending ||
> > +   !(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_CET_STATE))) {
> > +   vmcs_writel(GUEST_SSP, vmx->nested.vmcs01_guest_ssp);
> > +   vmcs_writel(GUEST_S_CET, vmx->nested.vmcs01_guest_s_cet);
> > +   vmcs_writel(GUEST_INTR_SSP_TABLE,
> > +   vmx->nested.vmcs01_guest_ssp_tbl);
> > +   }
> > +
> > vmx_set_rflags(vcpu, vmcs12->guest_rflags);
> > /* EXCEPTION_BITMAP and CR0_GUEST_HOST_MASK should basically be the
> > @@ -3375,6 +3391,12 @@ enum nvmx_vmentry_status 
> > nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu,
> > if (kvm_mpx_supported() &&
> > !(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_BNDCFGS))
> > vmx->nested.vmcs01_guest_bndcfgs = vmcs_read64(GUEST_BNDCFGS);
> > +   if (kvm_cet_supported() &&
> > +   !(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_CET_STATE)) {
> > +   vmx->nested.vmcs01_guest_ssp = vmcs_readl(GUEST_SSP);
> > +   vmx->nested.vmcs01_guest_s_cet = vmcs_readl(GUEST_S_CET);
> > +   vmx->nested.vmcs01_guest_ssp_tbl = 
> > vmcs_readl(GUEST_INTR_SSP_TABLE);
> > +   }
> > /*
> >  * Overwrite vmcs01.GUEST_CR3 with L1's CR3 if EPT is disabled *and*
> > @@ -4001,6 +4023,9 @@ static bool is_vmcs12_ext_field(unsigned long field)
> > case GUEST_IDTR_BASE:
> > case GUEST_PENDING_DBG_EXCEPTIONS:
> > case GUEST_BNDCFGS:
> > +   case GUEST_SSP:
> > +   case GUEST_INTR_SSP_TABLE:
> > +   case GUEST_S_CET:
> > return true;
> > default:
> > break;
> > @@ -4052,6 +4077,11 @@ static void sync_vmcs02_to_vmcs12_rare(struct 
> > kvm_vcpu *vcpu,
> > vmcs_readl(GUEST_PENDING_DBG_EXCEPTIONS);
> > if (kvm_mpx_supported())
> > vmcs12->guest_bndcfgs = vmcs_read64(GUEST_BNDCFGS);
> > +   if (kvm_cet_supported()) {
> > +   vmcs12->guest_ssp = vmcs_readl(GUEST_SSP);
> > +   vmcs12->guest_s_cet = vmcs_readl(GUEST_S_CET);
> > +   vmcs12->guest_ssp_tbl = vmcs_readl(GUEST_INTR_SSP_TABLE);
> > +   }
> > vmx->nested.need_sync_vmcs02_to_vmcs12_rare = false;
> >   }
> > diff --git a/arch/x86/kvm/vmx/vmx.h b/arch/x86/kvm/vmx/vmx.h
> > index 9d3a557949ac..36dc4fdb0909 100644
> > --- a/arch/x86/kvm/vmx/vmx.h
> > +++ b/arch/x86/kvm/vmx/vmx.h
> > @@ -155,6 +155,9 @@ struct nested_vmx {
> > /* to migrate it to L2 if VM_ENTRY_LOAD_DEBUG_CONTROLS is off */
> > u64 vmcs01_debugctl;
> > u64 vmcs01_guest_bndcfgs;
> > +   u64 vmcs01_guest_ssp;
> > +   u64 vmcs01_guest_s_cet;
> > +   u64 vmcs01_guest_ssp_tbl;
> > /* to migrate it to 

RE: [RFC PATCH 2/5] char: rpmb: provide a user space interface

2021-03-03 Thread Winkler, Tomas

> 
> The user space API is achieved via a number of synchronous IOCTLs.
> 
>   * RPMB_IOC_VER_CMD - simple versioning API
>   * RPMB_IOC_CAP_CMD - query of underlying capabilities
>   * RPMB_IOC_PKEY_CMD - one time programming of access key
>   * RPMB_IOC_COUNTER_CMD - query the write counter
>   * RPMB_IOC_WBLOCKS_CMD - write blocks to device
>   * RPMB_IOC_RBLOCKS_CMD - read blocks from device
> 
> The keys used for programming and writing blocks to the device are
> key_serial_t handles as provided by the keyctl() interface.
> 
> [AJB: here there are two key differences between this and the original
> proposal. The first is the dropping of the sequence of preformated frames in
> favour of explicit actions. The second is the introduction of key_serial_t and
> the keyring API for referencing the key to use]

Putting it gently I'm not sure this is good idea, from the security point of 
view.
The key has to be possession of the one that signs the frames as they are, it 
doesn't mean it is linux kernel keyring, it can be other party on different 
system.
With this approach you will make the other usecases not applicable. It is less 
then trivial to move key securely from one system to another.
We all wished it can be abstracted more but the frames has to come already 
signed, and the key material is inside the frame. 
Thanks
Tomas


> 
> Signed-off-by: Alex Bennée 
> Cc: Ulf Hansson 
> Cc: Linus  Walleij 
> Cc: Arnd Bergmann 
> Cc: Ilias Apalodimas 
> Cc: Tomas Winkler 
> Cc: Alexander Usyskin 
> Cc: Avri Altman 
> ---
>  .../userspace-api/ioctl/ioctl-number.rst  |   1 +
>  MAINTAINERS   |   1 +
>  drivers/char/rpmb/Kconfig |   7 +
>  drivers/char/rpmb/Makefile|   1 +
>  drivers/char/rpmb/cdev.c  | 246 ++
>  drivers/char/rpmb/core.c  |  10 +-
>  drivers/char/rpmb/rpmb-cdev.h |  17 ++
>  include/linux/rpmb.h  |  10 +
>  include/uapi/linux/rpmb.h |  68 +
>  9 files changed, 357 insertions(+), 4 deletions(-)  create mode 100644
> drivers/char/rpmb/cdev.c  create mode 100644 drivers/char/rpmb/rpmb-
> cdev.h  create mode 100644 include/uapi/linux/rpmb.h
> 
> diff --git a/Documentation/userspace-api/ioctl/ioctl-number.rst
> b/Documentation/userspace-api/ioctl/ioctl-number.rst
> index a4c75a28c839..0ff2d4d81bb0 100644
> --- a/Documentation/userspace-api/ioctl/ioctl-number.rst
> +++ b/Documentation/userspace-api/ioctl/ioctl-number.rst
> @@ -344,6 +344,7 @@ Code  Seq#Include File
> Comments
>  0xB5  00-0F  uapi/linux/rpmsg.h  
>  remotep...@vger.kernel.org>
>  0xB6  alllinux/fpga-dfl.h
>  0xB7  alluapi/linux/remoteproc_cdev.h
>  remotep...@vger.kernel.org>
> +0xB8  80-8F  uapi/linux/rpmb.h   
>  m...@vger.kernel.org>
>  0xC0  00-0F  linux/usb/iowarrior.h
>  0xCA  00-0F  uapi/misc/cxl.h
>  0xCA  10-2F  uapi/misc/ocxl.h
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 076f3983526c..c60b41b6e6bd 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -15374,6 +15374,7 @@ M:?
>  L:   linux-kernel@vger.kernel.org
>  S:   Supported
>  F:   drivers/char/rpmb/*
> +F:   include/uapi/linux/rpmb.h
>  F:   include/linux/rpmb.h
> 
>  RTL2830 MEDIA DRIVER
> diff --git a/drivers/char/rpmb/Kconfig b/drivers/char/rpmb/Kconfig index
> 431c2823cf70..9068664a399a 100644
> --- a/drivers/char/rpmb/Kconfig
> +++ b/drivers/char/rpmb/Kconfig
> @@ -9,3 +9,10 @@ config RPMB
> access RPMB partition.
> 
> If unsure, select N.
> +
> +config RPMB_INTF_DEV
> + bool "RPMB character device interface /dev/rpmbN"
> + depends on RPMB && KEYS
> + help
> +   Say yes here if you want to access RPMB from user space
> +   via character device interface /dev/rpmb%d
> diff --git a/drivers/char/rpmb/Makefile b/drivers/char/rpmb/Makefile index
> 24d4752a9a53..f54b3f30514b 100644
> --- a/drivers/char/rpmb/Makefile
> +++ b/drivers/char/rpmb/Makefile
> @@ -3,5 +3,6 @@
> 
>  obj-$(CONFIG_RPMB) += rpmb.o
>  rpmb-objs += core.o
> +rpmb-$(CONFIG_RPMB_INTF_DEV) += cdev.o
> 
>  ccflags-y += -D__CHECK_ENDIAN__
> diff --git a/drivers/char/rpmb/cdev.c b/drivers/char/rpmb/cdev.c new file
> mode 100644 index ..55f66720fd03
> --- /dev/null
> +++ b/drivers/char/rpmb/cdev.c
> @@ -0,0 +1,246 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright(c) 2015 - 2019 Intel Corporation.
> + */
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +
> +#include "rpmb-cdev.h"
> +
> +static dev_t rpmb_devt;
> +#define RPMB_MAX_DEVS  MINORMASK
> +
> +#define RPMB_DEV_OPEN0  /** single open bit (position) */
> +
> +/**
> + * rpmb_open - the open function
> + *
> + * @inode: pointer to inode structure
> 

Re: [V2][PATCH] vt: keyboard, fix uninitialized variables warning

2021-03-03 Thread Greg KH
On Thu, Mar 04, 2021 at 11:10:48AM +0800, Li Wang wrote:
> drivers/tty/vt/keyboard.c: In function 'vt_do_kdgkb_ioctl':
> drivers/tty/vt/keyboard.c: warning: 'ret' may be used uninitialized in this 
> function [-Wmaybe-uninitialized]
>   return ret;
>  ^~~
> drivers/tty/vt/keyboard.c: warning: 'kbs' may be used uninitialized in this 
> function [-Wmaybe-uninitialized]
>   kfree(kbs);
>   ^~

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- You did not specify a description of why the patch is needed, or
  possibly, any description at all, in the email body.  Please read the
  section entitled "The canonical patch format" in the kernel file,
  Documentation/SubmittingPatches for what is needed in order to
  properly describe the change.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot


Re: [V2][PATCH] vt: keyboard, fix uninitialized variables warning

2021-03-03 Thread Jiri Slaby

On 04. 03. 21, 4:10, Li Wang wrote:

drivers/tty/vt/keyboard.c: In function 'vt_do_kdgkb_ioctl':
drivers/tty/vt/keyboard.c: warning: 'ret' may be used uninitialized in this 
function [-Wmaybe-uninitialized]
   return ret;
  ^~~
drivers/tty/vt/keyboard.c: warning: 'kbs' may be used uninitialized in this 
function [-Wmaybe-uninitialized]
   kfree(kbs);
   ^~

Signed-off-by: Li Wang 
---
  drivers/tty/vt/keyboard.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c
index 7763862..62f1ecb 100644
--- a/drivers/tty/vt/keyboard.c
+++ b/drivers/tty/vt/keyboard.c
@@ -2090,6 +2090,8 @@ int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user 
*user_kdgkb, int perm)
  
  		ret = 0;

break;
+   default:
+   return -EINVAL;


I am not biased whether to add it or not, but I would return 
-ENOIOCTLCMD if we do.



}
  
  	kfree(kbs);





--
js
suse labs


[PATCH mips/linux.git] firmware: bcm47xx_nvram: refactor finding & reading NVRAM

2021-03-03 Thread Rafał Miłecki
From: Rafał Miłecki 

1. Use meaningful variable names (e.g. "flash_start", "res_size" instead
   of e.g. "iobase", "end")
2. Always operate on "offset" instead of mix of start, end, size, etc.
3. Add helper checking for NVRAM to avoid duplicating code
4. Use "found" variable instead of goto
5. Use simpler checking of offsets and sizes (2 nested loops with
   trivial check instead of extra function)

This change has been tested on BCM4706. Updated code checks the same
offsets as before. Driver still finds & copies NVRAM content.

Signed-off-by: Rafał Miłecki 
---
 drivers/firmware/broadcom/bcm47xx_nvram.c | 111 --
 1 file changed, 63 insertions(+), 48 deletions(-)

diff --git a/drivers/firmware/broadcom/bcm47xx_nvram.c 
b/drivers/firmware/broadcom/bcm47xx_nvram.c
index 835ece9c00f1..7cfe857b3e98 100644
--- a/drivers/firmware/broadcom/bcm47xx_nvram.c
+++ b/drivers/firmware/broadcom/bcm47xx_nvram.c
@@ -34,26 +34,47 @@ static char nvram_buf[NVRAM_SPACE];
 static size_t nvram_len;
 static const u32 nvram_sizes[] = {0x6000, 0x8000, 0xF000, 0x1};
 
-static u32 find_nvram_size(void __iomem *end)
+/**
+ * bcm47xx_nvram_validate - check for a valid NVRAM at specified memory
+ */
+static bool bcm47xx_nvram_is_valid(void __iomem *nvram)
 {
-   struct nvram_header __iomem *header;
-   int i;
+   return ((struct nvram_header *)nvram)->magic == NVRAM_MAGIC;
+}
 
-   for (i = 0; i < ARRAY_SIZE(nvram_sizes); i++) {
-   header = (struct nvram_header *)(end - nvram_sizes[i]);
-   if (header->magic == NVRAM_MAGIC)
-   return nvram_sizes[i];
+/**
+ * bcm47xx_nvram_copy - copy NVRAM to internal buffer
+ */
+static void bcm47xx_nvram_copy(void __iomem *nvram_start, size_t res_size)
+{
+   struct nvram_header __iomem *header = nvram_start;
+   size_t copy_size;
+
+   copy_size = header->len;
+   if (copy_size > res_size) {
+   pr_err("The nvram size according to the header seems to be 
bigger than the partition on flash\n");
+   copy_size = res_size;
+   }
+   if (copy_size >= NVRAM_SPACE) {
+   pr_err("nvram on flash (%zu bytes) is bigger than the reserved 
space in memory, will just copy the first %i bytes\n",
+  copy_size, NVRAM_SPACE - 1);
+   copy_size = NVRAM_SPACE - 1;
}
 
-   return 0;
+   __ioread32_copy(nvram_buf, nvram_start, DIV_ROUND_UP(copy_size, 4));
+   nvram_buf[NVRAM_SPACE - 1] = '\0';
+   nvram_len = copy_size;
 }
 
-/* Probe for NVRAM header */
-static int nvram_find_and_copy(void __iomem *iobase, u32 lim)
+/**
+ * bcm47xx_nvram_find_and_copy - find NVRAM on flash mapping & copy it
+ */
+static int bcm47xx_nvram_find_and_copy(void __iomem *flash_start, size_t 
res_size)
 {
-   struct nvram_header __iomem *header;
-   u32 off;
-   u32 size;
+   size_t flash_size;
+   size_t offset;
+   bool found;
+   int i;
 
if (nvram_len) {
pr_warn("nvram already initialized\n");
@@ -61,49 +82,43 @@ static int nvram_find_and_copy(void __iomem *iobase, u32 
lim)
}
 
/* TODO: when nvram is on nand flash check for bad blocks first. */
-   off = FLASH_MIN;
-   while (off <= lim) {
-   /* Windowed flash access */
-   size = find_nvram_size(iobase + off);
-   if (size) {
-   header = (struct nvram_header *)(iobase + off - size);
-   goto found;
+
+   found = false;
+
+   /* Try every possible flash size and check for NVRAM at its end */
+   for (flash_size = FLASH_MIN; flash_size <= res_size; flash_size <<= 1) {
+   for (i = 0; i < ARRAY_SIZE(nvram_sizes); i++) {
+   offset = flash_size - nvram_sizes[i];
+   if (bcm47xx_nvram_is_valid(flash_start + offset)) {
+   found = true;
+   break;
+   }
}
-   off <<= 1;
+
+   if (found)
+   break;
}
 
/* Try embedded NVRAM at 4 KB and 1 KB as last resorts */
-   header = (struct nvram_header *)(iobase + 4096);
-   if (header->magic == NVRAM_MAGIC) {
-   size = NVRAM_SPACE;
-   goto found;
-   }
 
-   header = (struct nvram_header *)(iobase + 1024);
-   if (header->magic == NVRAM_MAGIC) {
-   size = NVRAM_SPACE;
-   goto found;
+   if (!found) {
+   offset = 4096;
+   if (bcm47xx_nvram_is_valid(flash_start + offset))
+   found = true;
}
 
-   pr_err("no nvram found\n");
-   return -ENXIO;
-
-found:
-   __ioread32_copy(nvram_buf, header, sizeof(*header) / 4);
-   nvram_len = ((struct nvram_header *)(nvram_buf))->len;
-   if (nvram_len > size) {
-   pr_err("The nvram size according 

Re: [PATCH 5/7] printk: Make %pS and friends print module build ID

2021-03-03 Thread Steven Rostedt
On Wed, 03 Mar 2021 16:38:28 -0800
Stephen Boyd  wrote:

> I'm starting to feel like nobody read the commit text, or I messed up
> somehow and the commit text was confusing? :(
> 

I read it, I'm just unfamiliar with it. I don't use pstore, and I'm not
sure what "crashdump" is. Do you mean the kexec/kdump? in which case
you can retrieve data within the kernel quite easily.

I haven't used debuginfod (never heard of it before actually).

> │ This is especially helpful for crash debugging with pstore or crashdump 
>   
>   
> │ kernels. If we have the build ID for the module in the stacktrace we can
>   
>   
> │ request the debug symbols for the module from a remote debuginfod server
>   
>   
> │ or parse stacktraces at a later time with decode_stacktrace.sh by   
>   
>   
> │ downloading the correct symbols based on the build ID. This cuts down on
>   
>   
> │ the amount of time and effort needed to find the correct kernel modules 
>   
>   
> │ for a stacktrace by encoding that information into it.  

Are you saying it's common to have modules from different builds?

> 
> In some distro (read: non-kernel dev) workflows the vmlinux isn't
> shipped on the device and crash handling is done offline or much later.
> Using the build ID[1] is a common way to identify the binary that's
> running on the device. In conjunction with a debuginfod[2] server you
> can download the symbols for a crash automatically if you have the build
> ID information.
> 
> I can add a patch that updates decode_stacktrace.sh to show how it can
> download the correct vmlinux/modules if it isn't provided on the
> commandline.

Are you just trying to match modules with the builds that they were
created with?

> 
> If the debug symbols are on some public server then in theory we could
> have some robot sitting on the mailing list that looks for stacktraces
> and automatically replies with information about the line number/file
> and even provides the code snippet for the code that's crashing from
> that binary, because it's all stored in the full debuginfo builds.

Again, I have no idea how buildids are created or what they are used
for. This is the first time I've even heard about them. I'm all for
helping other people out to make their workflow easier, if it doesn't
make a mess for everyone else.

-- Steve



Re: [PATCH] perf record: Fix continue profiling after draining the buffer

2021-03-03 Thread Yang Jihong




On 2021/3/4 0:43, Arnaldo Carvalho de Melo wrote:

Em Mon, Feb 22, 2021 at 09:31:51AM +0800, Yang Jihong escreveu:

Hello,

On 2021/2/19 1:09, Arnaldo Carvalho de Melo wrote:

Em Thu, Feb 18, 2021 at 10:20:53AM -0300, Arnaldo Carvalho de Melo escreveu:

Em Fri, Feb 05, 2021 at 11:46:12AM +0100, Jiri Olsa escreveu:

On Fri, Feb 05, 2021 at 07:35:22PM +0900, Namhyung Kim wrote:

Hello,

On Fri, Feb 5, 2021 at 3:50 PM Yang Jihong  wrote:


commit da231338ec9c098707c8a1e4d8a50e2400e2fe17 uses eventfd to solve rare race
where the setting and checking of 'done' which add done_fd to pollfd.
When draining buffer, revents of done_fd is 0 and evlist__filter_pollfd
function returns a non-zero value.
As a result, perf record does not stop profiling.

The following simple scenarios can trigger this condition:

sleep 10 &
perf record -p $!

After the sleep process exits, perf record should stop profiling and exit.
However, perf record keeps running.

If pollfd revents contains only POLLERR or POLLHUP,
perf record indicates that buffer is draining and need to stop profiling.
Use fdarray_flag__nonfilterable to set done eventfd to nonfilterable objects,
so that evlist__filter_pollfd does not filter and check done eventfd.

Fixes: da231338ec9c (perf record: Use an eventfd to wakeup when done)
Signed-off-by: Yang Jihong 
---
   tools/perf/builtin-record.c | 2 +-
   tools/perf/util/evlist.c| 8 
   tools/perf/util/evlist.h| 4 
   3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index fd3911650612..51e593e896ea 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -1663,7 +1663,7 @@ static int __cmd_record(struct record *rec, int argc, 
const char **argv)
  status = -1;
  goto out_delete_session;
  }
-   err = evlist__add_pollfd(rec->evlist, done_fd);
+   err = evlist__add_wakeup_eventfd(rec->evlist, done_fd);
  if (err < 0) {
  pr_err("Failed to add wakeup eventfd to poll list\n");
  status = err;
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 05363a7247c4..fea4c1e8010d 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -572,6 +572,14 @@ int evlist__filter_pollfd(struct evlist *evlist, short 
revents_and_mask)
  return perf_evlist__filter_pollfd(>core, revents_and_mask);
   }

+#ifdef HAVE_EVENTFD_SUPPORT
+int evlist__add_wakeup_eventfd(struct evlist *evlist, int fd)
+{
+   return perf_evlist__add_pollfd(>core, fd, NULL, POLLIN,
+  fdarray_flag__nonfilterable);
+}
+#endif


Does it build when HAVE_EVENTFD_SUPPORT is not defined?


yea, I was wondering the same.. but it's called only from
code within HAVE_EVENTFD_SUPPORT ifdef


Yes, this can't work on systems without eventfd, it will simply not
build, and why do we have to make the definition of this function
conditional on HAVE_EVENTFD_SUPPORT?

I'm missing something :-\

Yeah, this whole call to evlist__add_pollfd is already surrounded by
#ifdef HAVE_EVENTFD_SUPPORT:

1656 if (zstd_init(>zstd_data, rec->opts.comp_level) < 0) {
1657 pr_err("Compression initialization failed.\n");
1658 return -1;
1659 }
1660 #ifdef HAVE_EVENTFD_SUPPORT
1661 done_fd = eventfd(0, EFD_NONBLOCK);
1662 if (done_fd < 0) {
1663 pr_err("Failed to create wakeup eventfd, error: %m\n");
1664 status = -1;
1665 goto out_delete_session;
1666 }
1667 err = evlist__add_pollfd(rec->evlist, done_fd);
1668 if (err < 0) {
1669 pr_err("Failed to add wakeup eventfd to poll list\n");
1670 status = err;
1671 goto out_delete_session;
1672 }
1673 #endif // HAVE_EVENTFD_SUPPORT
1674
1675 session->header.env.comp_type  = PERF_COMP_ZSTD;
1676 session->header.env.comp_level = rec->opts.comp_level;

Jiri, does your Acked-by stands? Namhyung?


Thanks tested and applied, together with Jiri's Tested-by,

- Arnaldo
.


Is this patch okay? Is there anything that needs to be modified?


It was merged:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/tools/perf/builtin-record.c?id=e16c2ce7c5ed5de881066c1fd10ba5c09af69559

- Arnaldo
.
Thanks.

Yang


[PATCH] MIPS: drm/radeon: A gray screen appears when going into hibernation(S4)

2021-03-03 Thread wangjingyu
Radeon Card:
  Caicos[Radeon HD 6450/7450/8450 /R5 230 OEM]

there is no gray screen when echo 4>/sys/module/drm/parameters/debug,
so the WREG32 function after DRM_DEBUG_KMS may have wrong when going
into hibernation.the delay of msleep(50) just can fix gray screen.

Signed-off-by: wangjingyu 
Signed-off-by: zhuyong 
---
 drivers/gpu/drm/radeon/radeon_display.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_display.c 
b/drivers/gpu/drm/radeon/radeon_display.c
index 652af7a134bd..1be50f949bb4 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -226,6 +226,8 @@ void radeon_crtc_load_lut(struct drm_crtc *crtc)
if (!crtc->enabled)
return;
 
+   sleep(50);
+
if (ASIC_IS_DCE5(rdev))
dce5_crtc_load_lut(crtc);
else if (ASIC_IS_DCE4(rdev))
-- 
2.11.0





Re: XDP socket rings, and LKMM litmus tests

2021-03-03 Thread Boqun Feng
On Wed, Mar 03, 2021 at 03:22:46PM -0500, Alan Stern wrote:
> On Wed, Mar 03, 2021 at 09:40:22AM -0800, Paul E. McKenney wrote:
> > On Wed, Mar 03, 2021 at 12:12:21PM -0500, Alan Stern wrote:
> 
> > > Local variables absolutely should be treated just like CPU registers, if 
> > > possible.  In fact, the compiler has the option of keeping local 
> > > variables stored in registers.
> > > 
> > > (Of course, things may get complicated if anyone writes a litmus test 
> > > that uses a pointer to a local variable,  Especially if the pointer 
> > > could hold the address of a local variable in one execution and a 
> > > shared variable in another!  Or if the pointer is itself a shared 
> > > variable and is dereferenced in another thread!)
> > 
> > Good point!  I did miss this complication.  ;-)
> 
> I suspect it wouldn't be so bad if herd7 disallowed taking addresses of 
> local variables.
> 
> > As you say, when its address is taken, the "local" variable needs to be
> > treated as is it were shared.  There are exceptions where the pointed-to
> > local is still used only by its process.  Are any of these exceptions
> > problematic?
> 
> Easiest just to rule out the whole can of worms.
> 
> > > But even if local variables are treated as non-shared storage locations, 
> > > we should still handle this correctly.  Part of the problem seems to lie 
> > > in the definition of the to-r dependency relation; the relevant portion 
> > > is:
> > > 
> > >   (dep ; [Marked] ; rfi)
> > > 
> > > Here dep is the control dependency from the READ_ONCE to the 
> > > local-variable store, and the rfi refers to the following load of the 
> > > local variable.  The problem is that the store to the local variable 
> > > doesn't go in the Marked class, because it is notated as a plain C 
> > > assignment.  (And likewise for the following load.)
> > > 
> > > Should we change the model to make loads from and stores to local 
> > > variables always count as Marked?
> > 
> > As long as the initial (possibly unmarked) load would be properly
> > complained about.
> 
> Sorry, I don't understand what you mean.
> 
> >  And I cannot immediately think of a situation where
> > this approach would break that would not result in a data race being
> > flagged.  Or is this yet another failure of my imagination?
> 
> By definition, an access to a local variable cannot participate in a 
> data race because all such accesses are confined to a single thread.
> 
> However, there are other aspects to consider, in particular, the 
> ordering relations on local-variable accesses.  But if, as Luc says, 
> local variables are treated just like registers then perhaps the issue 
> doesn't arise.
> 
> > > What should have happened if the local variable were instead a shared 
> > > variable which the other thread didn't access at all?  It seems like a 
> > > weak point of the memory model that it treats these two things 
> > > differently.
> > 
> > But is this really any different than the situation where a global
> > variable is only accessed by a single thread?
> 
> Indeed; it is the _same_ situation.  Which leads to some interesting 
> questions, such as: What does READ_ONCE(r) mean when r is a local 
> variable?  Should it be allowed at all?  In what way is it different 
> from a plain read of r?
> 
> One difference is that the LKMM doesn't allow dependencies to originate 
> from a plain load.  Of course, when you're dealing with a local 
> variable, what matters is not the load from that variable but rather the 
> earlier loads which determined the value that had been stored there.  
> Which brings us back to the case of the
> 
>   dep ; rfi
> 
> dependency relation, where the accesses in the middle are plain and 
> non-racy.  Should the LKMM be changed to allow this?
> 

For this particular question, do we need to consider code as the follow?

r1 = READ_ONCE(x);  // f
if (r == 1) {
local_v =  // g
do_something_a();
}
else {
local_v = 
do_something_b();
}

r2 = READ_ONCE(*local_v); // e

, do we have the guarantee that the first READ_ONCE() happens before the
second one? Can compiler optimize the code as:

r2 = READ_ONCE(y);
r1 = READ_ONCE(x);

if (r == 1) {
do_something_a();
}
else {
do_something_b();
}

? Although we have:

f ->dep g ->rfi ->addr e

Regards,
Boqun

> There are other differences to consider.  For example:
> 
>   r = READ_ONCE(x);
>   smp_wmb();
>   WRITE_ONCE(y, 1);
> 
> If the write to r were treated as a marked store, the smp_wmb would 
> order it (and consequently the READ_ONCE) before the WRITE_ONCE.  
> However we don't want to do this when r is a local variable.  Indeed, a 
> plain store wouldn't be ordered this way because the compiler might 
> optimize the store away entirely, leaving the smp_wmb nothing to act on.
> 
> 

[PATCH 0/3] Don't use RCU for x_tables synchronization

2021-03-03 Thread Mark Tomlinson
The patches to change to using RCU synchronization in x_tables cause
updating tables to be slowed down by an order of magnitude. This has
been tried before, see https://lore.kernel.org/patchwork/patch/151796/
and ultimately was rejected. As mentioned in the patch description, a
different method can be used to ensure ordering of reads/writes. This
can simply be done by changing from smp_wmb() to smp_mb().

Mark Tomlinson (3):
  Revert "netfilter: x_tables: Update remaining dereference to RCU"
  Revert "netfilter: x_tables: Switch synchronization to RCU"
  netfilter: x_tables: Use correct memory barriers.

 include/linux/netfilter/x_tables.h |  7 ++---
 net/ipv4/netfilter/arp_tables.c| 16 +-
 net/ipv4/netfilter/ip_tables.c | 16 +-
 net/ipv6/netfilter/ip6_tables.c| 16 +-
 net/netfilter/x_tables.c   | 49 +-
 5 files changed, 60 insertions(+), 44 deletions(-)

-- 
2.30.1



[PATCH 1/3] Revert "netfilter: x_tables: Update remaining dereference to RCU"

2021-03-03 Thread Mark Tomlinson
This reverts commit 443d6e86f821a165fae3fc3fc13086d27ac140b1.

This (and the following) patch basically re-implemented the RCU
mechanisms of patch 784544739a25. That patch was replaced because of the
performance problems that it created when replacing tables. Now, we have
the same issue: the call to synchronize_rcu() makes replacing tables
slower by as much as an order of magnitude.

See https://lore.kernel.org/patchwork/patch/151796/ for why using RCU is
not a good idea.

Revert these patches and fix the issue in a different way.

Signed-off-by: Mark Tomlinson 
---
 net/ipv4/netfilter/arp_tables.c | 2 +-
 net/ipv4/netfilter/ip_tables.c  | 2 +-
 net/ipv6/netfilter/ip6_tables.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
index c576a63d09db..563b62b76a5f 100644
--- a/net/ipv4/netfilter/arp_tables.c
+++ b/net/ipv4/netfilter/arp_tables.c
@@ -1379,7 +1379,7 @@ static int compat_get_entries(struct net *net,
xt_compat_lock(NFPROTO_ARP);
t = xt_find_table_lock(net, NFPROTO_ARP, get.name);
if (!IS_ERR(t)) {
-   const struct xt_table_info *private = 
xt_table_get_private_protected(t);
+   const struct xt_table_info *private = t->private;
struct xt_table_info info;
 
ret = compat_table_info(private, );
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index e8f6f9d86237..6e2851f8d3a3 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -1589,7 +1589,7 @@ compat_get_entries(struct net *net, struct 
compat_ipt_get_entries __user *uptr,
xt_compat_lock(AF_INET);
t = xt_find_table_lock(net, AF_INET, get.name);
if (!IS_ERR(t)) {
-   const struct xt_table_info *private = 
xt_table_get_private_protected(t);
+   const struct xt_table_info *private = t->private;
struct xt_table_info info;
ret = compat_table_info(private, );
if (!ret && get.size == info.size)
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index 0d453fa9e327..c4f532f4d311 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -1598,7 +1598,7 @@ compat_get_entries(struct net *net, struct 
compat_ip6t_get_entries __user *uptr,
xt_compat_lock(AF_INET6);
t = xt_find_table_lock(net, AF_INET6, get.name);
if (!IS_ERR(t)) {
-   const struct xt_table_info *private = 
xt_table_get_private_protected(t);
+   const struct xt_table_info *private = t->private;
struct xt_table_info info;
ret = compat_table_info(private, );
if (!ret && get.size == info.size)
-- 
2.30.1



[PATCH] arch/parisc/kernel: remove duplicate include in ptrace

2021-03-03 Thread menglong8 . dong
From: Zhang Yunkai 

'linux/compat.h' included in 'arch/parisc/kernel/ptrace.c' is duplicated.
It is also included in the 24th line.

Signed-off-by: Zhang Yunkai 
---
 arch/parisc/kernel/ptrace.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c
index 2127974982df..918faa95740c 100644
--- a/arch/parisc/kernel/ptrace.c
+++ b/arch/parisc/kernel/ptrace.c
@@ -567,7 +567,6 @@ static const struct user_regset_view 
user_parisc_native_view = {
 };
 
 #ifdef CONFIG_64BIT
-#include 
 
 static int gpr32_get(struct task_struct *target,
 const struct user_regset *regset,
-- 
2.25.1



Re: [PATCH v2 3/4] mm: /proc/sys/vm/stat_refresh skip checking known negative stats

2021-03-03 Thread Roman Gushchin
On Mon, Mar 01, 2021 at 10:03:26PM -0800, Hugh Dickins wrote:
> vmstat_refresh() can occasionally catch nr_zone_write_pending and
> nr_writeback when they are transiently negative.  The reason is partly
> that the interrupt which decrements them in test_clear_page_writeback()
> can come in before __test_set_page_writeback() got to increment them;
> but transient negatives are still seen even when that is prevented, and
> I am not yet certain why (but see Roman's note below).  Those stats are
> not buggy, they have never been seen to drift away from 0 permanently:
> so just avoid the annoyance of showing a warning on them.
> 
> Similarly avoid showing a warning on nr_free_cma: CMA users have seen
> that one reported negative from /proc/sys/vm/stat_refresh too, but it
> does drift away permanently: I believe that's because its incrementation
> and decrementation are decided by page migratetype, but the migratetype
> of a pageblock is not guaranteed to be constant.
> 
> Roman Gushchin points out:
> For performance reasons, vmstat counters are incremented and decremented
> using per-cpu batches.  vmstat_refresh() flushes the per-cpu batches on
> all CPUs, to get values as accurate as possible; but this method is not
> atomic, so the resulting value is not always precise.  As a consequence,
> for those counters whose actual value is close to 0, a small negative
> value may occasionally be reported.  If the value is small and the state
> is transient, it is not an indication of an error.
> 
> Link: https://lore.kernel.org/linux-mm/20200714173747.3315771-1-g...@fb.com/
> Reported-by: Roman Gushchin 
> Signed-off-by: Hugh Dickins 
> ---

Oh, sorry, it looks like I missed to ack it. Thank you for updating
the commit log!

Acked-by: Roman Gushchin 


Re: [PATCH] Documentation/admin-guide: kernel-parameters: correct the architectures for numa_balancing

2021-03-03 Thread Palmer Dabbelt

On Tue, 02 Mar 2021 00:41:59 PST (-0800), song.bao@hisilicon.com wrote:

X86 isn't the only architecture supporting NUMA_BALANCING. ARM64, PPC,
S390 and RISCV also support it:

arch$ git grep NUMA_BALANCING
arm64/Kconfig:  select ARCH_SUPPORTS_NUMA_BALANCING
arm64/configs/defconfig:CONFIG_NUMA_BALANCING=y
arm64/include/asm/pgtable.h:#ifdef CONFIG_NUMA_BALANCING
powerpc/configs/powernv_defconfig:CONFIG_NUMA_BALANCING=y
powerpc/configs/ppc64_defconfig:CONFIG_NUMA_BALANCING=y
powerpc/configs/pseries_defconfig:CONFIG_NUMA_BALANCING=y
powerpc/include/asm/book3s/64/pgtable.h:#ifdef CONFIG_NUMA_BALANCING
powerpc/include/asm/book3s/64/pgtable.h:#ifdef CONFIG_NUMA_BALANCING
powerpc/include/asm/book3s/64/pgtable.h:#endif /* CONFIG_NUMA_BALANCING */
powerpc/include/asm/book3s/64/pgtable.h:#ifdef CONFIG_NUMA_BALANCING
powerpc/include/asm/book3s/64/pgtable.h:#endif /* CONFIG_NUMA_BALANCING */
powerpc/include/asm/nohash/pgtable.h:#ifdef CONFIG_NUMA_BALANCING
powerpc/include/asm/nohash/pgtable.h:#endif /* CONFIG_NUMA_BALANCING */
powerpc/platforms/Kconfig.cputype:  select ARCH_SUPPORTS_NUMA_BALANCING
riscv/Kconfig:  select ARCH_SUPPORTS_NUMA_BALANCING
riscv/include/asm/pgtable.h:#ifdef CONFIG_NUMA_BALANCING
s390/Kconfig:   select ARCH_SUPPORTS_NUMA_BALANCING
s390/configs/debug_defconfig:CONFIG_NUMA_BALANCING=y
s390/configs/defconfig:CONFIG_NUMA_BALANCING=y
s390/include/asm/pgtable.h:#ifdef CONFIG_NUMA_BALANCING
x86/Kconfig:select ARCH_SUPPORTS_NUMA_BALANCING if X86_64
x86/include/asm/pgtable.h:#ifdef CONFIG_NUMA_BALANCING
x86/include/asm/pgtable.h:#endif /* CONFIG_NUMA_BALANCING */

On the other hand, setup_numabalancing() is implemented in mm/mempolicy.c
which doesn't depend on architectures.

Cc: Mel Gorman 
Cc: Paul Walmsley 
Cc: Palmer Dabbelt 
Cc: Albert Ou 
Cc: "Paul E. McKenney" 
Cc: Randy Dunlap 
Cc: Andrew Morton 
Cc: Thomas Gleixner 
Cc: Mauro Carvalho Chehab 
Cc: Viresh Kumar 
Cc: Mike Kravetz 
Cc: Peter Zijlstra 
Signed-off-by: Barry Song 
---
 Documentation/admin-guide/kernel-parameters.rst | 1 +
 Documentation/admin-guide/kernel-parameters.txt | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/admin-guide/kernel-parameters.rst 
b/Documentation/admin-guide/kernel-parameters.rst
index 1132796a8d96..24302cad174a 100644
--- a/Documentation/admin-guide/kernel-parameters.rst
+++ b/Documentation/admin-guide/kernel-parameters.rst
@@ -140,6 +140,7 @@ parameter is applicable::
PPT Parallel port support is enabled.
PS2 Appropriate PS/2 support is enabled.
RAM RAM disk support is enabled.
+   RISCV   RISCV architecture is enabled.
RDT Intel Resource Director Technology.
S390S390 architecture is enabled.
SCSIAppropriate SCSI support is enabled.
diff --git a/Documentation/admin-guide/kernel-parameters.txt 
b/Documentation/admin-guide/kernel-parameters.txt
index 04545725f187..371a02ae1e21 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -3472,7 +3472,8 @@

nr_uarts=   [SERIAL] maximum number of UARTs to be registered.

-   numa_balancing= [KNL,X86] Enable or disable automatic NUMA balancing.
+   numa_balancing= [KNL,ARM64,PPC,RISCV,S390,X86] Enable or disable 
automatic
+   NUMA balancing.
Allowed values are enable and disable

numa_zonelist_order= [KNL, BOOT] Select zonelist order for NUMA.


Reviewed-by: Palmer Dabbelt 
Acked-by: Palmer Dabbelt 


Re: [PATCH V2 0/4] scsi: ufs-debugfs: Add UFS Exception Event reporting

2021-03-03 Thread Martin K. Petersen
On Tue, 9 Feb 2021 08:24:33 +0200, Adrian Hunter wrote:

> Here are V2 patches to add a tracepoint for UFS Exception Events and to
> allow users to enable specific exception events without affecting the
> driver's use of exception events.
> 
> 
> Changes in V2:
> 
> [...]

Applied to 5.13/scsi-queue, thanks!

[1/4] scsi: ufs: Add exception event tracepoint
  https://git.kernel.org/mkp/scsi/c/26b01633fac8
[2/4] scsi: ufs: Add exception event definitions
  https://git.kernel.org/mkp/scsi/c/8fd31fc2b84f
[3/4] scsi: ufs-debugfs: Add user-defined exception_event_mask
  https://git.kernel.org/mkp/scsi/c/e1c8b528dd23
[4/4] scsi: ufs-debugfs: Add user-defined exception event rate limiting
  https://git.kernel.org/mkp/scsi/c/c3f04083d653

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH] scsi: ufs: Fix incorrect ufshcd_state after ufshcd_reset_and_restore()

2021-03-03 Thread Martin K. Petersen
On Mon, 1 Mar 2021 21:19:40 +0200, Adrian Hunter wrote:

> If ufshcd_probe_hba() fails it sets ufshcd_state to UFSHCD_STATE_ERROR,
> however, if it is called again, as it is within a loop in
> ufshcd_reset_and_restore(), and succeeds, then it will not set the state
> back to UFSHCD_STATE_OPERATIONAL unless the state was
> UFSHCD_STATE_RESET.
> 
> That can result in the state being UFSHCD_STATE_ERROR even though
> ufshcd_reset_and_restore() is successful and returns zero.
> 
> [...]

Applied to 5.12/scsi-fixes, thanks!

[1/1] scsi: ufs: Fix incorrect ufshcd_state after ufshcd_reset_and_restore()
  https://git.kernel.org/mkp/scsi/c/02c2fc6acc43

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH] scsi: ufs: convert sysfs sprintf/snprintf family to sysfs_emit

2021-03-03 Thread Martin K. Petersen
On Tue, 2 Mar 2021 14:08:18 +0800, Jiapeng Chong wrote:

> Fix the following coccicheck warning:
> 
> ./drivers/scsi/ufs/ufshcd.c:1538:8-16: WARNING: use scnprintf or
> sprintf.

Applied to 5.12/scsi-fixes, thanks!

[1/1] scsi: ufs: convert sysfs sprintf/snprintf family to sysfs_emit
  https://git.kernel.org/mkp/scsi/c/7393d296d6f2

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH v5 0/5] ibmvfc: hard reset fixes

2021-03-03 Thread Martin K. Petersen
On Tue, 2 Mar 2021 17:05:38 -0600, Tyrel Datwyler wrote:

> This series contains a minor simplification of ibmvfc_init_sub_crqs() followed
> by a couple fixes for sub-CRQ handling which effect hard reset of the
> client/host adapter CRQ pair.
> 
> changes in v5:
> Patches 2-5: Corrected upstream commit ids for Fixes: tags
> 
> [...]

Applied to 5.12/scsi-fixes, thanks!

[1/5] ibmvfc: simplify handling of sub-CRQ initialization
  https://git.kernel.org/mkp/scsi/c/2e415356fd6f
[2/5] ibmvfc: fix invalid sub-CRQ handles after hard reset
  https://git.kernel.org/mkp/scsi/c/2de4c19179b1
[3/5] ibmvfc: treat H_CLOSED as success during sub-CRQ registration
  https://git.kernel.org/mkp/scsi/c/98cf9a92b8d6
[4/5] ibmvfc: store return code of H_FREE_SUB_CRQ during cleanup
  https://git.kernel.org/mkp/scsi/c/5bc26ea9498a
[5/5] ibmvfc: reinitialize sub-CRQs and perform channel enquiry after LPM
  https://git.kernel.org/mkp/scsi/c/f4c5e949056d

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH] scsi: vmw_pvscsi: Update maintainer

2021-03-03 Thread Martin K. Petersen
On Fri, 26 Feb 2021 15:43:48 -0800, Vishal Bhakta wrote:

> The entries in the source files are removed as well.

Applied to 5.12/scsi-fixes, thanks!

[1/1] scsi: vmw_pvscsi: Update maintainer
  https://git.kernel.org/mkp/scsi/c/1dbafd931d90

-- 
Martin K. Petersen  Oracle Linux Engineering


Re: [PATCH v3 3/8] mm/rmap: Split try_to_munlock from try_to_unmap

2021-03-03 Thread Alistair Popple
On Tuesday, 2 March 2021 3:10:49 AM AEDT Jason Gunthorpe wrote:
> > +   while (page_vma_mapped_walk()) {
> > +   /*
> > +* If the page is mlock()d, we cannot swap it out.
> > +* If it's recently referenced (perhaps page_referenced
> > +* skipped over this mm) then we should reactivate it.
> > +*/
> > +   if (vma->vm_flags & VM_LOCKED) {
> 
> And since we write the data without holding the PTLs this looks
> pointless, unless there is some other VM_LOCKED manipulation
> 

Thanks. I couldn't find any other manipulation of VM_LOCKED whilst holding the 
PTL so I'll remove this redundant check.

 - Alistair





Re: [PATCH] certs: Fix wrong kconfig option used for x509_revocation_list

2021-03-03 Thread Jarkko Sakkinen
On Tue, Mar 02, 2021 at 10:44:18PM -0500, Eric Snowberg wrote:
> This fixes a build issue when x509_revocation_list is not defined.

"Fix a"

Let's stick to the imperative form in commit messages.

> 
> $ make ARCH=x86_64 O=build64 all
> 
>  EXTRACT_CERTS   ../
> At main.c:154:
> - SSL error:0909006C:PEM routines:get_name:no start line: 
> crypto/pem/pem_lib.c:745
> extract-cert: ../: Is a directory
> make[2]: [../certs/Makefile:119: certs/x509_revocation_list] Error 1 (ignored)
> 
> When the new CONFIG_SYSTEM_REVOCATION_LIST was added [1], it was not carried
> into the code for preloading the revocation certificates [2].  Change from
> using the original CONFIG_SYSTEM_BLACKLIST_KEYRING  to the new
> CONFIG_SYSTEM_REVOCATION_LIST.
> 
> [1] 
> https://lore.kernel.org/keyrings/eda280f9-f72d-4181-93c7-cdbe95976...@oracle.com/T/#m562c1b27bf402190e7bb573ad20eff5b6310d08f
> [2] 
> https://lore.kernel.org/keyrings/eda280f9-f72d-4181-93c7-cdbe95976...@oracle.com/T/#m07e258bf019ccbac23820fad5192ceffa74fc6ab
> 
> Reported-by: Randy Dunlap 
> Signed-off-by: Eric Snowberg 
> ---
>  certs/Makefile| 7 +--
>  certs/blacklist.c | 4 
>  2 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/certs/Makefile b/certs/Makefile
> index e3f4926fd21e..3bc43c88a6d2 100644
> --- a/certs/Makefile
> +++ b/certs/Makefile
> @@ -4,7 +4,10 @@
>  #
>  
>  obj-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += system_keyring.o 
> system_certificates.o common.o
> -obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist.o 
> revocation_certificates.o common.o
> +obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist.o common.o
> +ifeq ($(CONFIG_SYSTEM_REVOCATION_LIST),y)
> +obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += revocation_certificates.o
> +endif
>  ifneq ($(CONFIG_SYSTEM_BLACKLIST_HASH_LIST),"")
>  obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist_hashes.o
>  else
> @@ -105,7 +108,7 @@ $(obj)/signing_key.x509: scripts/extract-cert $(X509_DEP) 
> FORCE
>   $(call 
> if_changed,extract_certs,$(MODULE_SIG_KEY_SRCPREFIX)$(CONFIG_MODULE_SIG_KEY))
>  endif # CONFIG_MODULE_SIG
>  
> -ifeq ($(CONFIG_SYSTEM_BLACKLIST_KEYRING),y)
> +ifeq ($(CONFIG_SYSTEM_REVOCATION_LIST),y)
>  
>  $(eval $(call config_filename,SYSTEM_REVOCATION_KEYS))
>  
> diff --git a/certs/blacklist.c b/certs/blacklist.c
> index 723b19c96256..c9a435b15af4 100644
> --- a/certs/blacklist.c
> +++ b/certs/blacklist.c
> @@ -21,8 +21,10 @@
>  
>  static struct key *blacklist_keyring;
>  
> +#ifdef CONFIG_SYSTEM_REVOCATION_LIST
>  extern __initconst const u8 revocation_certificate_list[];
>  extern __initconst const unsigned long revocation_certificate_list_size;
> +#endif
>  
>  /*
>   * The description must be a type prefix, a colon and then an even number of
> @@ -225,6 +227,7 @@ static int __init blacklist_init(void)
>   */
>  device_initcall(blacklist_init);
>  
> +#ifdef CONFIG_SYSTEM_REVOCATION_LIST
>  /*
>   * Load the compiled-in list of revocation X.509 certificates.
>   */
> @@ -237,3 +240,4 @@ static __init int load_revocation_certificate_list(void)
>blacklist_keyring);
>  }
>  late_initcall(load_revocation_certificate_list);
> +#endif
> -- 
> 2.18.4
> 
> 

Code change looks good.

/Jarkko


Re: [PATCH 02/20] crypto: Manual replacement of the deprecated strlcpy() with return values

2021-03-03 Thread Herbert Xu
On Mon, Feb 22, 2021 at 04:12:13PM +0100, Romain Perier wrote:
>
> diff --git a/crypto/lrw.c b/crypto/lrw.c
> index bcf09fbc750a..4d35f4439012 100644
> --- a/crypto/lrw.c
> +++ b/crypto/lrw.c
> @@ -357,10 +357,10 @@ static int lrw_create(struct crypto_template *tmpl, 
> struct rtattr **tb)
>* cipher name.
>*/
>   if (!strncmp(cipher_name, "ecb(", 4)) {
> - unsigned len;
> + ssize_t len;
>  
> - len = strlcpy(ecb_name, cipher_name + 4, sizeof(ecb_name));
> - if (len < 2 || len >= sizeof(ecb_name))
> + len = strscpy(ecb_name, cipher_name + 4, sizeof(ecb_name));
> + if (len == -E2BIG || len < 2)

len == -E2BIG is superfluous as len < 2 will catch it anyway.

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


kernel/sched/fair.c:8894:20: warning: stack frame size of 1072 bytes in function 'update_sd_lb_stats'

2021-03-03 Thread kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   f69d02e37a85645aa90d18cacfff36dba370f797
commit: 8b3165e54566e8bb8f4b7d4e5f12ced78ce462bb MIPS: Enable GCOV
date:   3 months ago
config: mips-randconfig-r036-20210304 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 
eec7f8f7b1226be422a76542cb403d02538f453a)
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8b3165e54566e8bb8f4b7d4e5f12ced78ce462bb
git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 8b3165e54566e8bb8f4b7d4e5f12ced78ce462bb
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

   kernel/sched/fair.c:5368:6: warning: no previous prototype for function 
'init_cfs_bandwidth' [-Wmissing-prototypes]
   void init_cfs_bandwidth(struct cfs_bandwidth *cfs_b) {}
^
   kernel/sched/fair.c:5368:1: note: declare 'static' if the function is not 
intended to be used outside of this translation unit
   void init_cfs_bandwidth(struct cfs_bandwidth *cfs_b) {}
   ^
   static 
   kernel/sched/fair.c:11129:6: warning: no previous prototype for function 
'free_fair_sched_group' [-Wmissing-prototypes]
   void free_fair_sched_group(struct task_group *tg) { }
^
   kernel/sched/fair.c:11129:1: note: declare 'static' if the function is not 
intended to be used outside of this translation unit
   void free_fair_sched_group(struct task_group *tg) { }
   ^
   static 
   kernel/sched/fair.c:11131:5: warning: no previous prototype for function 
'alloc_fair_sched_group' [-Wmissing-prototypes]
   int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent)
   ^
   kernel/sched/fair.c:11131:1: note: declare 'static' if the function is not 
intended to be used outside of this translation unit
   int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent)
   ^
   static 
   kernel/sched/fair.c:11136:6: warning: no previous prototype for function 
'online_fair_sched_group' [-Wmissing-prototypes]
   void online_fair_sched_group(struct task_group *tg) { }
^
   kernel/sched/fair.c:11136:1: note: declare 'static' if the function is not 
intended to be used outside of this translation unit
   void online_fair_sched_group(struct task_group *tg) { }
   ^
   static 
   kernel/sched/fair.c:11138:6: warning: no previous prototype for function 
'unregister_fair_sched_group' [-Wmissing-prototypes]
   void unregister_fair_sched_group(struct task_group *tg) { }
^
   kernel/sched/fair.c:11138:1: note: declare 'static' if the function is not 
intended to be used outside of this translation unit
   void unregister_fair_sched_group(struct task_group *tg) { }
   ^
   static 
   kernel/sched/fair.c:486:20: warning: unused function 'list_del_leaf_cfs_rq' 
[-Wunused-function]
   static inline void list_del_leaf_cfs_rq(struct cfs_rq *cfs_rq)
  ^
   kernel/sched/fair.c:5349:20: warning: unused function 'sync_throttle' 
[-Wunused-function]
   static inline void sync_throttle(struct task_group *tg, int cpu) {}
  ^
   kernel/sched/fair.c:5374:37: warning: unused function 'tg_cfs_bandwidth' 
[-Wunused-function]
   static inline struct cfs_bandwidth *tg_cfs_bandwidth(struct task_group *tg)
   ^
   kernel/sched/fair.c:5378:20: warning: unused function 
'destroy_cfs_bandwidth' [-Wunused-function]
   static inline void destroy_cfs_bandwidth(struct cfs_bandwidth *cfs_b) {}
  ^
   kernel/sched/fair.c:8190:19: warning: unused function 'check_misfit_status' 
[-Wunused-function]
   static inline int check_misfit_status(struct rq *rq, struct sched_domain *sd)
 ^
>> kernel/sched/fair.c:8894:20: warning: stack frame size of 1072 bytes in 
>> function 'update_sd_lb_stats' [-Wframe-larger-than=]
   static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats 
*sds)
  ^
   kernel/sched/fair.c:5932:19: warning: stack frame size of 1048 bytes in 
function 'find_idlest_cpu' [-Wframe-larger-than=]
   static inline int find_idlest_cpu(struct sched_domain *sd, struct 
task_struct *p,
 ^
   12 warnings generated.


vim +/update_sd_lb_stats +8894 kernel/sched/fair.c

57abff067a0848 kernel/sched/fair.c Vincent Guittot   2019-10-18  8887  
1e3c88bdeb1260 kernel/sched_fair.c 

Re: [PATCH] x86/vdso: Use proper modifier for len's printf in extract

2021-03-03 Thread Jiri Slaby

On 03. 03. 21, 19:36, Borislav Petkov wrote:

On Wed, Mar 03, 2021 at 07:43:57AM +0100, Jiri Slaby wrote:

Commit 8382c668ce4f ("x86/vdso: Add support for exception fixup in vDSO
functions") added a printf of len which is size_t. Compilers now
complain on 32b:
In file included from arch/x86/entry/vdso/vdso2c.c:162:
arch/x86/entry/vdso/vdso2c.h: In function 'extract64':
arch/x86/entry/vdso/vdso2c.h:38:52: warning: format '%lu' expects argument of 
type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'}



I know it is obvious but how do you trigger this?

A 32-bit allmodconfig with both debian's gcc-10 and leap15's gcc-7 don't
trigger that warning. Which might answer your question why I haven't
caught it yet. :-)


It was caught by suse's build bot while merging the stable branch. But 
it can be also seen in OBS in Kernel:stable:


https://build.opensuse.org/public/build/Kernel:stable/standard/i586/kernel-pae/_log
https://build.opensuse.org/public/build/Kernel:stable/standard/i586/kernel-vanilla/_log

It's built with gcc 10 from tumbleweed and it's a standard config from 
kerncvs:

https://github.com/openSUSE/kernel-source/blob/stable/config/i386/pae

thanks,
--
js
suse labs


Re: [PATCH] MIPS: Add comment about CONFIG_MIPS32_O32 in loongson3_defconfig when build with Clang

2021-03-03 Thread Nathan Chancellor
On Thu, Mar 04, 2021 at 11:48:09AM +0800, Tiezhu Yang wrote:
> On 03/04/2021 10:02 AM, Nathan Chancellor wrote:
> > On Thu, Mar 04, 2021 at 09:15:44AM +0800, Tiezhu Yang wrote:
> > > When build kernel with Clang [1]:
> > > 
> > > $ make CC=clang loongson3_defconfig
> > > $ make CC=clang
> 
> [snip]
> 
> > I think this might be a better solution. I know that I personally never
> > read defconfig files if a build fails.
> > 
> > If CONFIG_MIPS32_O32 is broken with clang and the MIPS backend
> > maintainer has said that it will not be supported due to lack of
> > resources, then the config should not even be selectable in my opinion.
> > 
> > Cheers,
> > Nathan
> > 
> > diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> > index d89efba3d8a4..ed35318a759d 100644
> > --- a/arch/mips/Kconfig
> > +++ b/arch/mips/Kconfig
> > @@ -3315,6 +3315,8 @@ config SYSVIPC_COMPAT
> >   config MIPS32_O32
> > bool "Kernel support for o32 binaries"
> > depends on 64BIT
> > +   # https://bugs.llvm.org/show_bug.cgi?id=38063
> > +   depends on $(success,$(CC) $(CLANG_FLAGS) -march=mips64 -o32 -c -x c 
> > /dev/null -o /dev/null)
> > select ARCH_WANT_OLD_COMPAT_IPC
> > select COMPAT
> > select MIPS32_COMPAT
> 
> Hi Nathan,
> 
> Thank you very much for your reply and suggestion, maybe the following
> change is simple, clear and better? If yes, I will send v2 later.

Hi Tiezhu,

I think that the change is simpler but better is subjective. I tend to
prefer tests like mine so that it is not dependent on someone going "oh
hey, this LLVM bug has been fixed so we can turn this config on!".
Instead, the config will just turn on automatically as soon as that bug
is fixed.

However, in this particular case, it does not seem like that will happen
unless someone steps but there have been times where an independent
party will implement some change that benefits them and nobody notices
for a while. Plus, I periodically grep the tree for CC_IS_CLANG to see
if there are any configuration options that can be re-enabled..

Regardless, if Thomas is happy with the below change, so am I, as it
will allow us to test more 64-bit MIPS configurations. I can add an ack
or review at that point in time.

Cheers,
Nathan

> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index 3a38d27..f6ba59f 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -3318,6 +3318,8 @@ config SYSVIPC_COMPAT
>  config MIPS32_O32
> bool "Kernel support for o32 binaries"
> depends on 64BIT
> +   # https://bugs.llvm.org/show_bug.cgi?id=38063
> +   depends on !CC_IS_CLANG
> select ARCH_WANT_OLD_COMPAT_IPC
> select COMPAT
> select MIPS32_COMPAT
> 
> Thanks,
> Tiezhu
> 


[PATCH v3 1/3] KVM: nVMX: Sync L2 guest CET states between L1/L2

2021-03-03 Thread Yang Weijiang
These fields are rarely updated by L1 QEMU/KVM, sync them when L1 is trying to
read/write them and after they're changed. If CET guest entry-load bit is not
set by L1 guest, migrate them to L2 manaully.

Suggested-by: Sean Christopherson 
Signed-off-by: Yang Weijiang 
---
 arch/x86/kvm/cpuid.c  |  1 -
 arch/x86/kvm/vmx/nested.c | 30 ++
 arch/x86/kvm/vmx/vmx.h|  3 +++
 3 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index d191de769093..8692f53b8cd0 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -143,7 +143,6 @@ void kvm_update_cpuid_runtime(struct kvm_vcpu *vcpu)
}
vcpu->arch.guest_supported_xss =
(((u64)best->edx << 32) | best->ecx) & supported_xss;
-
} else {
vcpu->arch.guest_supported_xss = 0;
}
diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index 9728efd529a1..24cace55e1f9 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -2516,6 +2516,13 @@ static void prepare_vmcs02_rare(struct vcpu_vmx *vmx, 
struct vmcs12 *vmcs12)
vmcs_write32(VM_ENTRY_MSR_LOAD_COUNT, vmx->msr_autoload.guest.nr);
 
set_cr4_guest_host_mask(vmx);
+
+   if (kvm_cet_supported() && vmx->nested.nested_run_pending &&
+   (vmcs12->vm_entry_controls & VM_ENTRY_LOAD_CET_STATE)) {
+   vmcs_writel(GUEST_SSP, vmcs12->guest_ssp);
+   vmcs_writel(GUEST_S_CET, vmcs12->guest_s_cet);
+   vmcs_writel(GUEST_INTR_SSP_TABLE, vmcs12->guest_ssp_tbl);
+   }
 }
 
 /*
@@ -2556,6 +2563,15 @@ static int prepare_vmcs02(struct kvm_vcpu *vcpu, struct 
vmcs12 *vmcs12,
if (kvm_mpx_supported() && (!vmx->nested.nested_run_pending ||
!(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_BNDCFGS)))
vmcs_write64(GUEST_BNDCFGS, vmx->nested.vmcs01_guest_bndcfgs);
+
+   if (kvm_cet_supported() && (!vmx->nested.nested_run_pending ||
+   !(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_CET_STATE))) {
+   vmcs_writel(GUEST_SSP, vmx->nested.vmcs01_guest_ssp);
+   vmcs_writel(GUEST_S_CET, vmx->nested.vmcs01_guest_s_cet);
+   vmcs_writel(GUEST_INTR_SSP_TABLE,
+   vmx->nested.vmcs01_guest_ssp_tbl);
+   }
+
vmx_set_rflags(vcpu, vmcs12->guest_rflags);
 
/* EXCEPTION_BITMAP and CR0_GUEST_HOST_MASK should basically be the
@@ -3375,6 +3391,12 @@ enum nvmx_vmentry_status 
nested_vmx_enter_non_root_mode(struct kvm_vcpu *vcpu,
if (kvm_mpx_supported() &&
!(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_BNDCFGS))
vmx->nested.vmcs01_guest_bndcfgs = vmcs_read64(GUEST_BNDCFGS);
+   if (kvm_cet_supported() &&
+   !(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_CET_STATE)) {
+   vmx->nested.vmcs01_guest_ssp = vmcs_readl(GUEST_SSP);
+   vmx->nested.vmcs01_guest_s_cet = vmcs_readl(GUEST_S_CET);
+   vmx->nested.vmcs01_guest_ssp_tbl = 
vmcs_readl(GUEST_INTR_SSP_TABLE);
+   }
 
/*
 * Overwrite vmcs01.GUEST_CR3 with L1's CR3 if EPT is disabled *and*
@@ -4001,6 +4023,9 @@ static bool is_vmcs12_ext_field(unsigned long field)
case GUEST_IDTR_BASE:
case GUEST_PENDING_DBG_EXCEPTIONS:
case GUEST_BNDCFGS:
+   case GUEST_SSP:
+   case GUEST_INTR_SSP_TABLE:
+   case GUEST_S_CET:
return true;
default:
break;
@@ -4052,6 +4077,11 @@ static void sync_vmcs02_to_vmcs12_rare(struct kvm_vcpu 
*vcpu,
vmcs_readl(GUEST_PENDING_DBG_EXCEPTIONS);
if (kvm_mpx_supported())
vmcs12->guest_bndcfgs = vmcs_read64(GUEST_BNDCFGS);
+   if (kvm_cet_supported()) {
+   vmcs12->guest_ssp = vmcs_readl(GUEST_SSP);
+   vmcs12->guest_s_cet = vmcs_readl(GUEST_S_CET);
+   vmcs12->guest_ssp_tbl = vmcs_readl(GUEST_INTR_SSP_TABLE);
+   }
 
vmx->nested.need_sync_vmcs02_to_vmcs12_rare = false;
 }
diff --git a/arch/x86/kvm/vmx/vmx.h b/arch/x86/kvm/vmx/vmx.h
index 9d3a557949ac..36dc4fdb0909 100644
--- a/arch/x86/kvm/vmx/vmx.h
+++ b/arch/x86/kvm/vmx/vmx.h
@@ -155,6 +155,9 @@ struct nested_vmx {
/* to migrate it to L2 if VM_ENTRY_LOAD_DEBUG_CONTROLS is off */
u64 vmcs01_debugctl;
u64 vmcs01_guest_bndcfgs;
+   u64 vmcs01_guest_ssp;
+   u64 vmcs01_guest_s_cet;
+   u64 vmcs01_guest_ssp_tbl;
 
/* to migrate it to L1 if L2 writes to L1's CR8 directly */
int l1_tpr_threshold;
-- 
2.26.2



[PATCH v3 0/3] CET fix patches for nested guest

2021-03-03 Thread Yang Weijiang
This patch series is to fix a few issues found during nested guest
testing on Linux, also including a patch to explictly disable CET
support in nested guest over Hyper-V(s).

Yang Weijiang (3):
  KVM: nVMX: Sync L2 guest CET states between L1/L2
  KVM: nVMX: Set X86_CR4_CET in cr4_fixed1_bits if CET IBT is enabled
  KVM: nVMX: Add CET entry/exit load bits to evmcs unsupported list

 arch/x86/kvm/cpuid.c  |  1 -
 arch/x86/kvm/vmx/evmcs.c  |  4 ++--
 arch/x86/kvm/vmx/evmcs.h  |  6 --
 arch/x86/kvm/vmx/nested.c | 30 ++
 arch/x86/kvm/vmx/vmx.c|  1 +
 arch/x86/kvm/vmx/vmx.h|  3 +++
 6 files changed, 40 insertions(+), 5 deletions(-)

-- 
2.26.2



[PATCH v3 2/3] KVM: nVMX: Set X86_CR4_CET in cr4_fixed1_bits if CET IBT is enabled

2021-03-03 Thread Yang Weijiang
CET SHSTK and IBT are independently controlled by kernel, set X86_CR4_CET
bit in cr4_fixed1_bits if either of them is enabled so that nested guest
can enjoy the feature.

Reviewed-by: Sean Christopherson 
Signed-off-by: Yang Weijiang 
---
 arch/x86/kvm/vmx/vmx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index e78650bf8ae8..bd89b5a24c38 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -7267,6 +7267,7 @@ static void nested_vmx_cr_fixed1_bits_update(struct 
kvm_vcpu *vcpu)
cr4_fixed1_update(X86_CR4_UMIP,   ecx, feature_bit(UMIP));
cr4_fixed1_update(X86_CR4_LA57,   ecx, feature_bit(LA57));
cr4_fixed1_update(X86_CR4_CET,ecx, feature_bit(SHSTK));
+   cr4_fixed1_update(X86_CR4_CET,edx, feature_bit(IBT));
 
 #undef cr4_fixed1_update
 }
-- 
2.26.2



[PATCH v3 3/3] KVM: nVMX: Add CET entry/exit load bits to evmcs unsupported list

2021-03-03 Thread Yang Weijiang
Nested guest doesn't support CET when KVM is running as an intermediate
layer between two Hyper-Vs for now, so mask out related CET entry/exit
load bits. Relevant enabling patches will be posted as a separate patch
series.

Suggested-by: Paolo Bonzini 
Suggested-by: Vitaly Kuznetsov 
Signed-off-by: Yang Weijiang 
---
 arch/x86/kvm/vmx/evmcs.c | 4 ++--
 arch/x86/kvm/vmx/evmcs.h | 6 --
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kvm/vmx/evmcs.c b/arch/x86/kvm/vmx/evmcs.c
index 41f24661af04..9f81db51fd8b 100644
--- a/arch/x86/kvm/vmx/evmcs.c
+++ b/arch/x86/kvm/vmx/evmcs.c
@@ -351,11 +351,11 @@ void nested_evmcs_filter_control_msr(u32 msr_index, u64 
*pdata)
switch (msr_index) {
case MSR_IA32_VMX_EXIT_CTLS:
case MSR_IA32_VMX_TRUE_EXIT_CTLS:
-   ctl_high &= ~VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL;
+   ctl_high &= ~EVMCS1_UNSUPPORTED_VMEXIT_CTRL;
break;
case MSR_IA32_VMX_ENTRY_CTLS:
case MSR_IA32_VMX_TRUE_ENTRY_CTLS:
-   ctl_high &= ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL;
+   ctl_high &= ~EVMCS1_UNSUPPORTED_VMENTRY_CTRL;
break;
case MSR_IA32_VMX_PROCBASED_CTLS2:
ctl_high &= ~SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES;
diff --git a/arch/x86/kvm/vmx/evmcs.h b/arch/x86/kvm/vmx/evmcs.h
index bd41d9462355..25588694eb04 100644
--- a/arch/x86/kvm/vmx/evmcs.h
+++ b/arch/x86/kvm/vmx/evmcs.h
@@ -59,8 +59,10 @@ DECLARE_STATIC_KEY_FALSE(enable_evmcs);
 SECONDARY_EXEC_SHADOW_VMCS |   \
 SECONDARY_EXEC_TSC_SCALING |   \
 SECONDARY_EXEC_PAUSE_LOOP_EXITING)
-#define EVMCS1_UNSUPPORTED_VMEXIT_CTRL (VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL)
-#define EVMCS1_UNSUPPORTED_VMENTRY_CTRL (VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL)
+#define EVMCS1_UNSUPPORTED_VMEXIT_CTRL (VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL | \
+   VM_EXIT_LOAD_CET_STATE)
+#define EVMCS1_UNSUPPORTED_VMENTRY_CTRL (VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL | 
\
+VM_ENTRY_LOAD_CET_STATE)
 #define EVMCS1_UNSUPPORTED_VMFUNC (VMX_VMFUNC_EPTP_SWITCHING)
 
 #if IS_ENABLED(CONFIG_HYPERV)
-- 
2.26.2



Re: [PATCH v6] i2c: virtio: add a virtio i2c frontend driver

2021-03-03 Thread Viresh Kumar
On 04-03-21, 09:59, Jie Deng wrote:
> Add an I2C bus driver for virtio para-virtualization.
> 
> The controller can be emulated by the backend driver in
> any device model software by following the virtio protocol.
> 
> The device specification can be found on
> https://lists.oasis-open.org/archives/virtio-comment/202101/msg8.html.
> 
> By following the specification, people may implement different
> backend drivers to emulate different controllers according to
> their needs.
> 
> Co-developed-by: Conghui Chen 
> Signed-off-by: Conghui Chen 
> Signed-off-by: Jie Deng 
> ---

Please always supply version history, it makes it difficult to review otherwise.

>  drivers/i2c/busses/Kconfig  |  11 ++
>  drivers/i2c/busses/Makefile |   3 +
>  drivers/i2c/busses/i2c-virtio.c | 289 
> 
>  include/uapi/linux/virtio_i2c.h |  42 ++
>  include/uapi/linux/virtio_ids.h |   1 +
>  5 files changed, 346 insertions(+)
>  create mode 100644 drivers/i2c/busses/i2c-virtio.c
>  create mode 100644 include/uapi/linux/virtio_i2c.h
> 
> diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
> index 05ebf75..0860395 100644
> --- a/drivers/i2c/busses/Kconfig
> +++ b/drivers/i2c/busses/Kconfig
> @@ -21,6 +21,17 @@ config I2C_ALI1535
> This driver can also be built as a module.  If so, the module
> will be called i2c-ali1535.
>  
> +config I2C_VIRTIO
> + tristate "Virtio I2C Adapter"
> + depends on VIRTIO

depends on I2C as well ?

> + help
> +   If you say yes to this option, support will be included for the virtio
> +   I2C adapter driver. The hardware can be emulated by any device model
> +   software according to the virtio protocol.
> +
> +   This driver can also be built as a module. If so, the module
> +   will be called i2c-virtio.
> +
>  config I2C_ALI1563
>   tristate "ALI 1563"
>   depends on PCI
> diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
> index 615f35e..b88da08 100644
> --- a/drivers/i2c/busses/Makefile
> +++ b/drivers/i2c/busses/Makefile
> @@ -6,6 +6,9 @@
>  # ACPI drivers
>  obj-$(CONFIG_I2C_SCMI)   += i2c-scmi.o
>  
> +# VIRTIO I2C host controller driver
> +obj-$(CONFIG_I2C_VIRTIO) += i2c-virtio.o
> +

Not that it is important but I would have added it towards the end instead of at
the top of the file..

>  # PC SMBus host controller drivers
>  obj-$(CONFIG_I2C_ALI1535)+= i2c-ali1535.o
>  obj-$(CONFIG_I2C_ALI1563)+= i2c-ali1563.o
> diff --git a/drivers/i2c/busses/i2c-virtio.c b/drivers/i2c/busses/i2c-virtio.c
> new file mode 100644
> index 000..98c0fcc
> --- /dev/null
> +++ b/drivers/i2c/busses/i2c-virtio.c
> @@ -0,0 +1,289 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Virtio I2C Bus Driver
> + *
> + * The Virtio I2C Specification:
> + * 
> https://raw.githubusercontent.com/oasis-tcs/virtio-spec/master/virtio-i2c.tex
> + *
> + * Copyright (c) 2021 Intel Corporation. All rights reserved.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 

> +#include 
> +#include 

I don't think above two are required here..

> +#include 
> +#include 

> +#include 

same here.

> +#include 

same here.

> +

And this blank line as well, since all are standard linux headers.

> +#include 
> +#include 
> +
> +/**
> + * struct virtio_i2c - virtio I2C data
> + * @vdev: virtio device for this controller
> + * @completion: completion of virtio I2C message
> + * @adap: I2C adapter for this controller
> + * @i2c_lock: lock for virtqueue processing
> + * @vq: the virtio virtqueue for communication
> + */
> +struct virtio_i2c {
> + struct virtio_device *vdev;
> + struct completion completion;
> + struct i2c_adapter adap;
> + struct mutex i2c_lock;

i2c_ is redundant here. "lock" sounds good enough.

> + struct virtqueue *vq;
> +};
> +
> +/**
> + * struct virtio_i2c_req - the virtio I2C request structure
> + * @out_hdr: the OUT header of the virtio I2C message
> + * @buf: the buffer into which data is read, or from which it's written
> + * @in_hdr: the IN header of the virtio I2C message
> + */
> +struct virtio_i2c_req {
> + struct virtio_i2c_out_hdr out_hdr;
> + u8 *buf;
> + struct virtio_i2c_in_hdr in_hdr;
> +};
> +
> +static void virtio_i2c_msg_done(struct virtqueue *vq)
> +{
> + struct virtio_i2c *vi = vq->vdev->priv;
> +
> + complete(>completion);
> +}
> +
> +static int virtio_i2c_send_reqs(struct virtqueue *vq,
> + struct virtio_i2c_req *reqs,
> + struct i2c_msg *msgs, int nr)
> +{
> + struct scatterlist *sgs[3], out_hdr, msg_buf, in_hdr;
> + int i, outcnt, incnt, err = 0;
> + u8 *buf;
> +
> + for (i = 0; i < nr; i++) {
> + if (!msgs[i].len)
> + break;
> +
> + /* Only 7-bit mode supported for this moment. For the address 
> format,
> +  * Please check the Virtio I2C 

Re: [PATCH 3/3] PCI: Convert rtw88 power cycle quirk to shutdown quirk

2021-03-03 Thread Kai-Heng Feng
On Sat, Feb 27, 2021 at 2:17 AM Bjorn Helgaas  wrote:
>
> On Fri, Feb 26, 2021 at 02:31:31PM +0100, Heiner Kallweit wrote:
> > On 26.02.2021 13:18, Kai-Heng Feng wrote:
> > > On Fri, Feb 26, 2021 at 8:10 PM Heiner Kallweit  
> > > wrote:
> > >>
> > >> On 26.02.2021 08:12, Kalle Valo wrote:
> > >>> Kai-Heng Feng  writes:
> > >>>
> >  Now we have a generic D3 shutdown quirk, so convert the original
> >  approach to a PCI quirk.
> > 
> >  Signed-off-by: Kai-Heng Feng 
> >  ---
> >   drivers/net/wireless/realtek/rtw88/pci.c | 2 --
> >   drivers/pci/quirks.c | 6 ++
> >   2 files changed, 6 insertions(+), 2 deletions(-)
> > >>>
> > >>> It would have been nice to CC linux-wireless also on patches 1-2. I only
> > >>> saw patch 3 and had to search the rest of patches from lkml.
> > >>>
> > >>> I assume this goes via the PCI tree so:
> > >>>
> > >>> Acked-by: Kalle Valo 
> > >>
> > >> To me it looks odd to (mis-)use the quirk mechanism to set a device
> > >> to D3cold on shutdown. As I see it the quirk mechanism is used to work
> > >> around certain device misbehavior. And setting a device to a D3
> > >> state on shutdown is a normal activity, and the shutdown() callback
> > >> seems to be a good place for it.
> > >> I miss an explanation what the actual benefit of the change is.
> > >
> > > To make putting device to D3 more generic, as there are more than one
> > > device need the quirk.
> > >
> > > Here's the discussion:
> > > https://lore.kernel.org/linux-usb/00de6927-3fa6-a9a3-2d65-2b4d4e8f0...@linux.intel.com/
> > >
> >
> > Thanks for the link. For the AMD USB use case I don't have a strong opinion,
> > what's considered the better option may be a question of personal taste.
> > For rtw88 however I'd still consider it over-engineering to replace a simple
> > call to pci_set_power_state() with a PCI quirk.
> > I may be biased here because I find it sometimes bothering if I want to
> > look up how a device is handled and in addition to checking the respective
> > driver I also have to grep through quirks.c whether there's any special
> > handling.
>
> I haven't looked at these patches carefully, but in general, I agree
> that quirks should be used to work around hardware defects in the
> device.  If the device behaves correctly per spec, we should use a
> different mechanism so the code remains generic and all devices get
> the benefit.
>
> If we do add quirks, the commit log should explain what the device
> defect is.

So maybe it's reasonable to put all PCI devices to D3 at shutdown?

Kai-Heng

>
> Bjorn


Re: [PATCH v26 4/4] scsi: ufs: Add HPB 2.0 support

2021-03-03 Thread Can Guo


-   if (!ufshpb_is_support_chunk(transfer_len))
-   return;
+   if (!ufshpb_is_support_chunk(hpb, transfer_len) &&
+	(ufshpb_is_legacy(hba) && (transfer_len != 
HPB_LEGACY_CHUNK_HIGH)))

+   return 0;



This is looks awkward, can we put the checks in 
ufshpb_is_support_chunk()?


Thanks,

Can Guo.


Re: [PATCH v6] i2c: virtio: add a virtio i2c frontend driver

2021-03-03 Thread kernel test robot
Hi Jie,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on wsa/i2c/for-next]
[also build test ERROR on vhost/linux-next linux/master linus/master v5.12-rc1 
next-20210303]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:
https://github.com/0day-ci/linux/commits/Jie-Deng/i2c-virtio-add-a-virtio-i2c-frontend-driver/20210304-100543
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git 
i2c/for-next
config: x86_64-randconfig-a014-20210304 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 
eec7f8f7b1226be422a76542cb403d02538f453a)
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# 
https://github.com/0day-ci/linux/commit/bb645653b6d7750a026229726f8d9d0371457ac6
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review 
Jie-Deng/i2c-virtio-add-a-virtio-i2c-frontend-driver/20210304-100543
git checkout bb645653b6d7750a026229726f8d9d0371457ac6
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All errors (new ones prefixed by >>):

   In file included from :1:
>> ./usr/include/linux/virtio_i2c.h:35:2: error: unknown type name 'u8'
   u8 status;
   ^
   1 error generated.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


.config.gz
Description: application/gzip


[PATCH] perf report: Fix -F for branch & mem modes

2021-03-03 Thread Ravi Bangoria
perf report fails to add valid additional fields with -F when
used with branch or mem modes. Fix it.

Before patch:

  $ ./perf record -b
  $ ./perf report -b -F +srcline_from --stdio
  Error:
  Invalid --fields key: `srcline_from'

After patch:

  $ ./perf report -b -F +srcline_from --stdio
  # Samples: 8K of event 'cycles'
  # Event count (approx.): 8784
  ...

Reported-by: Athira Rajeev 
Fixes: aa6b3c99236b ("perf report: Make -F more strict like -s")
Signed-off-by: Ravi Bangoria 
---
 tools/perf/util/sort.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 0d5ad42812b9..552b590485bf 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -3140,7 +3140,7 @@ int output_field_add(struct perf_hpp_list *list, char 
*tok)
if (strncasecmp(tok, sd->name, strlen(tok)))
continue;
 
-   if (sort__mode != SORT_MODE__MEMORY)
+   if (sort__mode != SORT_MODE__BRANCH)
return -EINVAL;
 
return __sort_dimension__add_output(list, sd);
@@ -3152,7 +3152,7 @@ int output_field_add(struct perf_hpp_list *list, char 
*tok)
if (strncasecmp(tok, sd->name, strlen(tok)))
continue;
 
-   if (sort__mode != SORT_MODE__BRANCH)
+   if (sort__mode != SORT_MODE__MEMORY)
return -EINVAL;
 
return __sort_dimension__add_output(list, sd);
-- 
2.29.2



Re: [PATCH] crypto: testmgr - delete some redundant code

2021-03-03 Thread Herbert Xu
On Tue, Feb 23, 2021 at 11:42:04AM +0800, Kai Ye wrote:
> Delete sg_data function, because sg_data function definition same as
> sg_virt(), so need to delete it and use sg_virt() replace to sg_data().
> 
> Signed-off-by: Kai Ye 
> ---
>  crypto/testmgr.c | 11 +++
>  1 file changed, 3 insertions(+), 8 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


[PATCH v1] mm, hwpoison: do not lock page again when me_huge_page() successfully recovers

2021-03-03 Thread Naoya Horiguchi
From: Naoya Horiguchi 

Currently me_huge_page() temporary unlocks page to perform some actions
then locks it again later. My testcase (which calls hard-offline on some
tail page in a hugetlb, then accesses the address of the hugetlb range)
showed that page allocation code detects the page lock on buddy page and
printed out "BUG: Bad page state" message.  PG_hwpoison does not prevent
it because PG_hwpoison flag is set on any subpage of the hugetlb page
but the 2nd page lock is on the head page.

This patch suggests to drop the 2nd page lock to fix the issue.

Fixes: commit 78bb920344b8 ("mm: hwpoison: dissolve in-use hugepage in 
unrecoverable memory error")
Cc: sta...@vger.kernel.org
Signed-off-by: Naoya Horiguchi 
---
 mm/memory-failure.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git v5.11/mm/memory-failure.c v5.11_patched/mm/memory-failure.c
index e9481632fcd1..d8aba15295c5 100644
--- v5.11/mm/memory-failure.c
+++ v5.11_patched/mm/memory-failure.c
@@ -830,7 +830,6 @@ static int me_huge_page(struct page *p, unsigned long pfn)
page_ref_inc(p);
res = MF_RECOVERED;
}
-   lock_page(hpage);
}
 
return res;
@@ -1286,7 +1285,8 @@ static int memory_failure_hugetlb(unsigned long pfn, int 
flags)
 
res = identify_page_state(pfn, p, page_flags);
 out:
-   unlock_page(head);
+   if (PageLocked(head))
+   unlock_page(head);
return res;
 }
 
-- 
2.25.1



Re: [PATCH v2] crypto/nx: add missing call to of_node_put()

2021-03-03 Thread Herbert Xu
On Fri, Feb 26, 2021 at 09:23:06AM +0800, Yang Li wrote:
> In one of the error paths of the for_each_child_of_node() loop,
> add missing call to of_node_put().
> 
> Fix the following coccicheck warning:
> ./drivers/crypto/nx/nx-common-powernv.c:927:1-23: WARNING: Function
> "for_each_child_of_node" should have of_node_put() before return around
> line 936.
> 
> Reported-by: Abaci Robot 
> Signed-off-by: Yang Li 
> ---
> 
> Changes in v2:
> -add braces for if
> 
>  drivers/crypto/nx/nx-common-powernv.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


Re: [PATCH] mm,hwpoison: return -EBUSY when page already poisoned

2021-03-03 Thread Aili Yao
On Thu, 4 Mar 2021 12:19:41 +0800
Aili Yao  wrote:

> On Thu, 4 Mar 2021 10:16:53 +0800
> Aili Yao  wrote:
> 
> > On Wed, 3 Mar 2021 15:41:35 +
> > "Luck, Tony"  wrote:
> >   
> > > > For error address with sigbus, i think this is not an issue resulted by 
> > > > the patch i post, before my patch, the issue is already there.
> > > > I don't find a realizable way to get the correct address for same 
> > > > reason --- we don't know whether the page mapping is there or not when
> > > > we got to kill_me_maybe(), in some case, we may get it, but there are a 
> > > > lot of parallel issue need to consider, and if failed we have to 
> > > > fallback
> > > > to the error brach again, remaining current code may be an easy option; 
> > > >  
> > > 
> > > My RFC patch from yesterday removes the uncertainty about whether the 
> > > page is there or not. After it walks the page
> > > tables we know that the poison page isn't mapped (note that patch is RFC 
> > > for a reason ... I'm 90% sure that it should
> > > do a bit more that just clear the PRESENT bit).
> > > 
> > > So perhaps memory_failure() has queued a SIGBUS for this task, if so, we 
> > > take it when we return from kill_me_maybe()  
> 
> And when this happen, the process will receive an SIGBUS with AO level, is it 
> proper as not an AR?
> 
> > > If not, we will return to user mode and re-execute the failing 
> > > instruction ... but because the page is unmapped we will take a #PF
> > 
> > Got this, I have some error thoughts here.
> > 
> >   
> > > The x86 page fault handler will see that the page for this physical 
> > > address is marked HWPOISON, and it will send the SIGBUS
> > > (just like it does if the page had been removed by an earlier UCNA/SRAO 
> > > error).
> > 
> > if your methods works, should it be like this?
> > 
> > 1582 pteval = 
> > swp_entry_to_pte(make_hwpoison_entry(subpage));
> > 1583 if (PageHuge(page)) {
> > 1584 hugetlb_count_sub(compound_nr(page), 
> > mm);
> > 1585 set_huge_swap_pte_at(mm, address,
> > 1586  pvmw.pte, pteval,
> > 1587  
> > vma_mmu_pagesize(vma));
> > 1588 } else {
> > 1589 dec_mm_counter(mm, mm_counter(page));
> > 1590 set_pte_at(mm, address, pvmw.pte, 
> > pteval);
> > 1591 }
> > 
> > the page fault check if it's a poison page using is_hwpoison_entry(),
> >   
> 
> And if it works, does we need some locking mechanism before we call 
> walk_page_range();
> if we lock, does we need to process the blocking interrupted error as other 
> places will do?
> 

And another thing:
Do we need a call to flush_tlb_page(vma, address) to make the pte changes into 
effect?

-- 
Thanks!
Aili Yao


Re: [PATCH] perf report: Fix -F for branch & mem modes

2021-03-03 Thread Athira Rajeev



> On 04-Mar-2021, at 11:59 AM, Ravi Bangoria  
> wrote:
> 
> perf report fails to add valid additional fields with -F when
> used with branch or mem modes. Fix it.
> 
> Before patch:
> 
>  $ ./perf record -b
>  $ ./perf report -b -F +srcline_from --stdio
>  Error:
>  Invalid --fields key: `srcline_from'
> 
> After patch:
> 
>  $ ./perf report -b -F +srcline_from --stdio
>  # Samples: 8K of event 'cycles'
>  # Event count (approx.): 8784
>  ...
> 
> Reported-by: Athira Rajeev 
> Fixes: aa6b3c99236b ("perf report: Make -F more strict like -s")
> Signed-off-by: Ravi Bangoria 

Thanks for the fix Ravi.

Reviewed-and-tested-by: Athira Rajeev 

> ---
> tools/perf/util/sort.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
> index 0d5ad42812b9..552b590485bf 100644
> --- a/tools/perf/util/sort.c
> +++ b/tools/perf/util/sort.c
> @@ -3140,7 +3140,7 @@ int output_field_add(struct perf_hpp_list *list, char 
> *tok)
>   if (strncasecmp(tok, sd->name, strlen(tok)))
>   continue;
> 
> - if (sort__mode != SORT_MODE__MEMORY)
> + if (sort__mode != SORT_MODE__BRANCH)
>   return -EINVAL;
> 
>   return __sort_dimension__add_output(list, sd);
> @@ -3152,7 +3152,7 @@ int output_field_add(struct perf_hpp_list *list, char 
> *tok)
>   if (strncasecmp(tok, sd->name, strlen(tok)))
>   continue;
> 
> - if (sort__mode != SORT_MODE__BRANCH)
> + if (sort__mode != SORT_MODE__MEMORY)
>   return -EINVAL;
> 
>   return __sort_dimension__add_output(list, sd);
> -- 
> 2.29.2
> 



Re: [PATCH v2] MIPS: Make MIPS32_O32 depends on !CC_IS_CLANG

2021-03-03 Thread Nathan Chancellor
On Thu, Mar 04, 2021 at 02:19:38PM +0800, Tiezhu Yang wrote:
> When build kernel with Clang [1]:

Sorry I did not catch this in the first revision but I think this would
sound better as:

When building with Clang [1]:

I think the kernel part is obvious :) couple more comments about the
commit message inline.

> 
> $ make CC=clang loongson3_defconfig
> $ make CC=clang
> 
> there exists the following error:
> 
>   Checking missing-syscalls for O32
>   CALLscripts/checksyscalls.sh
> error: ABI 'o32' is not supported on CPU 'mips64r2'
> make[1]: *** [Kbuild:48: missing-syscalls] Error 1
> make: *** [arch/mips/Makefile:419: archprepare] Error 2
> 
> This is a known bug [2] with Clang, as Simon Atanasyan said,
> "There is no plan on support O32 for MIPS64 due to lack of
> resources".
> 
> It is not a good idea to remove CONFIG_MIPS32_O32=y directly
> in defconfig due to GCC works well, as Nathan said, the config

in defconfig because GCC works, as...

> should not even be selectable when build kernel with Clang, so

 building with Clang

> just make MIPS32_O32 depends on !CC_IS_CLANG.
> 
> [1] https://www.kernel.org/doc/html/latest/kbuild/llvm.html
> [2] https://bugs.llvm.org/show_bug.cgi?id=38063
> 
> Signed-off-by: Tiezhu Yang 

I don't know if Nick will have any comments but for me:

Acked-by: Nathan Chancellor 

I have added this patch and the LLVM bug to our issue tracker:

https://github.com/ClangBuiltLinux/linux/issues/884

> ---
>  arch/mips/Kconfig | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index 3a38d27..f6ba59f 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -3318,6 +3318,8 @@ config SYSVIPC_COMPAT
>  config MIPS32_O32
>   bool "Kernel support for o32 binaries"
>   depends on 64BIT
> + # https://bugs.llvm.org/show_bug.cgi?id=38063
> + depends on !CC_IS_CLANG
>   select ARCH_WANT_OLD_COMPAT_IPC
>   select COMPAT
>   select MIPS32_COMPAT
> -- 
> 2.1.0
> 


Re: [PATCH v3 1/2] dt-bindings: iommu: add bindings for sprd iommu

2021-03-03 Thread Chunyan Zhang
Hi Robin,

On Tue, 16 Feb 2021 at 23:10, Robin Murphy  wrote:
>
> >>>
> >>> On Wed, Feb 03, 2021 at 05:07:26PM +0800, Chunyan Zhang wrote:
>  From: Chunyan Zhang 
> 
>  This iommu module can be used by Unisoc's multimedia devices, such as
>  display, Image codec(jpeg) and a few signal processors, including
>  VSP(video), GSP(graphic), ISP(image), and CPP(camera pixel processor), 
>  etc.
> 
>  Signed-off-by: Chunyan Zhang 
>  ---
>    .../devicetree/bindings/iommu/sprd,iommu.yaml | 72 +++
>    1 file changed, 72 insertions(+)
>    create mode 100644 
>  Documentation/devicetree/bindings/iommu/sprd,iommu.yaml
> 
>  diff --git a/Documentation/devicetree/bindings/iommu/sprd,iommu.yaml 
>  b/Documentation/devicetree/bindings/iommu/sprd,iommu.yaml
>  new file mode 100644
>  index ..4fc99e81fa66
>  --- /dev/null
>  +++ b/Documentation/devicetree/bindings/iommu/sprd,iommu.yaml
>  @@ -0,0 +1,72 @@
>  +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>  +# Copyright 2020 Unisoc Inc.
>  +%YAML 1.2
>  +---
>  +$id: http://devicetree.org/schemas/iommu/sprd,iommu.yaml#
>  +$schema: http://devicetree.org/meta-schemas/core.yaml#
>  +
>  +title: Unisoc IOMMU and Multi-media MMU
>  +
>  +maintainers:
>  +  - Chunyan Zhang 
>  +
>  +properties:
>  +  compatible:
>  +enum:
>  +  - sprd,iommu-v1
>  +
>  +  "#iommu-cells":
>  +const: 0
>  +description:
>  +  Unisoc IOMMUs are all single-master IOMMU devices, therefore no
>  +  additional information needs to associate with its master device.
>  +  Please refer to the generic bindings document for more details,
>  +  Documentation/devicetree/bindings/iommu/iommu.txt
>  +
>  +  reg:
>  +maxItems: 1
>  +description:
>  +  Not required if 'sprd,iommu-regs' is defined.
>  +
>  +  clocks:
>  +description:
>  +  Reference to a gate clock phandle, since access to some of IOMMUs 
>  are
>  +  controlled by gate clock, but this is not required.
>  +
>  +  sprd,iommu-regs:
>  +$ref: /schemas/types.yaml#/definitions/phandle-array
>  +description:
>  +  Reference to a syscon phandle plus 1 cell, the syscon defines the
>  +  register range used by the iommu and the media device, the cell
>  +  defines the offset for iommu registers. Since iommu module shares
>  +  the same register range with the media device which uses it.
>  +
>  +required:
>  +  - compatible
>  +  - "#iommu-cells"
>
> OK, so apparently the hardware is not quite as trivial as my initial
> impression, and you should have interrupts as well.

I've checked with my colleagues for this issue. And like I explained
before, one sprd IOMMU serves one master device only, so interrupts
are handled by master devices rather than IOMMUs.

Chunyan


RE: [PATCH v2 0/2] Add DFX AXI Shutdown manager IP support for Xilinx

2021-03-03 Thread Nava kishore Manne
Ping!

> -Original Message-
> From: Nava kishore Manne 
> Sent: Thursday, February 11, 2021 10:42 AM
> To: m...@kernel.org; t...@redhat.com; robh...@kernel.org; Michal Simek
> ; linux-f...@vger.kernel.org;
> devicet...@vger.kernel.org; linux-arm-ker...@lists.infradead.org; linux-
> ker...@vger.kernel.org; chinnikishore...@gmail.com
> Cc: git ; Nava kishore Manne 
> Subject: [PATCH v2 0/2] Add DFX AXI Shutdown manager IP support for Xilinx
> 
> Nava kishore Manne (2):
>   dt-bindings: fpga: Add compatible value for Xilinx DFX AXI shutdown
> manager
>   fpga: Add support for Xilinx DFX AXI Shutdown manager
> 
>  .../bindings/fpga/xilinx-pr-decoupler.txt | 24 +++-
>  drivers/fpga/Kconfig  |  9 -
>  drivers/fpga/xilinx-pr-decoupler.c| 37 ---
>  3 files changed, 63 insertions(+), 7 deletions(-)
> 
> --
> 2.18.0



[PATCH 2/3] clocksource/drivers/timer-ti-dm: Remove extra of_node_put()

2021-03-03 Thread Tony Lindgren
We have of_translate_address() already do of_node_put() as needed.
I probably looked at __of_translate_address() earlier by accident
that of_translate_address() uses.

Fixes: 52762fbd1c47 ("clocksource/drivers/timer-ti-dm: Add clockevent and 
clocksource support")
Signed-off-by: Tony Lindgren 
---
 drivers/clocksource/timer-ti-dm-systimer.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/clocksource/timer-ti-dm-systimer.c 
b/drivers/clocksource/timer-ti-dm-systimer.c
--- a/drivers/clocksource/timer-ti-dm-systimer.c
+++ b/drivers/clocksource/timer-ti-dm-systimer.c
@@ -265,7 +265,6 @@ static void __init dmtimer_systimer_assign_alwon(void)
pa == 0x48318000)
continue;
 
-   of_node_put(np);
break;
}
}
@@ -300,7 +299,6 @@ static u32 __init 
dmtimer_systimer_find_first_available(void)
continue;
}
 
-   of_node_put(np);
break;
}
}
-- 
2.30.1


[PATCH 0/3] Fixes for timer-ti-dm systimer posted mode

2021-03-03 Thread Tony Lindgren
Hi all,

Here are few timer-ti-dm fixes. The first fix corrects the status bit
check order for posted mode. The other two are minor fixes noticed while
reviewing and testing the code.

Regards,

Tony


Tony Lindgren (3):
  clocksource/drivers/timer-ti-dm: Fix posted mode status check order
  clocksource/drivers/timer-ti-dm: Remove extra of_node_put()
  clocksource/drivers/timer-ti-dm: Add missing set_state_oneshot_stopped

 drivers/clocksource/timer-ti-dm-systimer.c | 15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

-- 
2.30.1


Re: [PATCH 3/5] CMDLINE: powerpc: convert to generic builtin command line

2021-03-03 Thread Christophe Leroy




Le 04/03/2021 à 05:48, Daniel Walker a écrit :

This updates the powerpc code to use the CONFIG_GENERIC_CMDLINE
option.


Should be split in two patches. The change of strcpy to strlcpy should go in a 
first patch.



Cc: xe-linux-exter...@cisco.com
Signed-off-by: Ruslan Ruslichenko 
Signed-off-by: Ruslan Bilovol 
Signed-off-by: Daniel Walker 
---
  arch/powerpc/Kconfig| 37 +
  arch/powerpc/kernel/prom.c  |  1 +
  arch/powerpc/kernel/prom_init.c | 31 +++
  3 files changed, 20 insertions(+), 49 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 107bb4319e0e..276b06d5c961 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -167,6 +167,7 @@ config PPC
select EDAC_SUPPORT
select GENERIC_ATOMIC64 if PPC32
select GENERIC_CLOCKEVENTS_BROADCASTif SMP
+   select GENERIC_CMDLINE
select GENERIC_CMOS_UPDATE
select GENERIC_CPU_AUTOPROBE
select GENERIC_CPU_VULNERABILITIES  if PPC_BARRIER_NOSPEC
@@ -906,42 +907,6 @@ config PPC_DENORMALISATION
  Add support for handling denormalisation of single precision
  values.  Useful for bare metal only.  If unsure say Y here.
  
-config CMDLINE

-   string "Initial kernel command string"
-   default ""
-   help
- On some platforms, there is currently no way for the boot loader to
- pass arguments to the kernel. For these platforms, you can supply
- some command-line options at build time by entering them here.  In
- most cases you will need to specify the root device here.
-
-choice
-   prompt "Kernel command line type" if CMDLINE != ""
-   default CMDLINE_FROM_BOOTLOADER
-
-config CMDLINE_FROM_BOOTLOADER
-   bool "Use bootloader kernel arguments if available"
-   help
- Uses the command-line options passed by the boot loader. If
- the boot loader doesn't provide any, the default kernel command
- string provided in CMDLINE will be used.
-
-config CMDLINE_EXTEND
-   bool "Extend bootloader kernel arguments"
-   help
- The command-line arguments provided by the boot loader will be
- appended to the default kernel command string.
-
-config CMDLINE_FORCE
-   bool "Always use the default kernel command string"
-   help
- Always use the default kernel command string, even if the boot
- loader passes other arguments to the kernel.
- This is useful if you cannot or don't want to change the
- command-line options your boot loader passes to the kernel.
-
-endchoice
-
  config EXTRA_TARGETS
string "Additional default image types"
help
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index ae3c41730367..96d0a01be1b4 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -27,6 +27,7 @@
  #include 
  #include 
  #include 
+#include 
  #include 
  #include 
  #include 
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index e9d4eb6144e1..d752be688b62 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -27,6 +27,7 @@
  #include 
  #include 
  #include 
+#include 
  #include 
  #include 
  #include 
@@ -242,15 +243,6 @@ static int __init prom_strcmp(const char *cs, const char 
*ct)
return 0;
  }
  
-static char __init *prom_strcpy(char *dest, const char *src)

-{
-   char *tmp = dest;
-
-   while ((*dest++ = *src++) != '\0')
-   /* nothing */;
-   return tmp;
-}
-
  static int __init prom_strncmp(const char *cs, const char *ct, size_t count)
  {
unsigned char c1, c2;
@@ -276,6 +268,19 @@ static size_t __init prom_strlen(const char *s)
return sc - s;
  }
  
+static size_t __init prom_strlcpy(char *dest, const char *src, size_t size)

+{
+   size_t ret = prom_strlen(src);
+
+   if (size) {
+   size_t len = (ret >= size) ? size - 1 : ret;
+   memcpy(dest, src, len);
+   dest[len] = '\0';
+   }
+   return ret;
+}
+
+
  static int __init prom_memcmp(const void *cs, const void *ct, size_t count)
  {
const unsigned char *su1, *su2;
@@ -778,9 +783,9 @@ static void __init early_cmdline_parse(void)
if (!IS_ENABLED(CONFIG_CMDLINE_FORCE) && (long)prom.chosen > 0)


You have removed CONFIG_CMDLINE_FORCE and the generic cmdline doesn't provide 
it.


l = prom_getprop(prom.chosen, "bootargs", p, 
COMMAND_LINE_SIZE-1);
  
-	if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) || l <= 0 || p[0] == '\0')

-   prom_strlcat(prom_cmd_line, " " CONFIG_CMDLINE,
-sizeof(prom_cmd_line));
+   if (l <= 0 || p[0] == '\0') /* dbl check */


So it means cmdline_add_builtin_custom() is only called when bootloader does 
not provide bootargs ?


+   cmdline_add_builtin_custom(prom_cmd_line, 

Re: [RFC PATCH 3/4] KVM: arm64: Install the block entry before unmapping the page mappings

2021-03-03 Thread wangyanan (Y)



On 2021/3/4 15:07, wangyanan (Y) wrote:

Hi Alex,

On 2021/3/4 1:27, Alexandru Elisei wrote:

Hi Yanan,

On 3/3/21 11:04 AM, wangyanan (Y) wrote:

Hi Alex,

On 2021/3/3 1:13, Alexandru Elisei wrote:

Hello,

On 2/8/21 11:22 AM, Yanan Wang wrote:
When KVM needs to coalesce the normal page mappings into a block 
mapping,
we currently invalidate the old table entry first followed by 
invalidation
of TLB, then unmap the page mappings, and install the block entry 
at last.


It will cost a long time to unmap the numerous page mappings, 
which means
there will be a long period when the table entry can be found 
invalid.
If other vCPUs access any guest page within the block range and 
find the
table entry invalid, they will all exit from guest with a 
translation fault
which is not necessary. And KVM will make efforts to handle these 
faults,

especially when performing CMOs by block range.

So let's quickly install the block entry at first to ensure 
uninterrupted
memory access of the other vCPUs, and then unmap the page mappings 
after
installation. This will reduce most of the time when the table 
entry is

invalid, and avoid most of the unnecessary translation faults.
I'm not convinced I've fully understood what is going on yet, but 
it seems to me

that the idea is sound. Some questions and comments below.
What I am trying to do in this patch is to adjust the order of 
rebuilding block

mappings from page mappings.
Take the rebuilding of 1G block mappings as an example.
Before this patch, the order is like:
1) invalidate the table entry of the 1st level(PUD)
2) flush TLB by VMID
3) unmap the old PMD/PTE tables
4) install the new block entry to the 1st level(PUD)

So entry in the 1st level can be found invalid by other vcpus in 1), 
2), and 3),

and it's a long time in 3) to unmap
the numerous old PMD/PTE tables, which means the total time of the 
entry being

invalid is long enough to
affect the performance.

After this patch, the order is like:
1) invalidate the table ebtry of the 1st level(PUD)
2) flush TLB by VMID
3) install the new block entry to the 1st level(PUD)
4) unmap the old PMD/PTE tables

The change ensures that period of entry in the 1st level(PUD) being 
invalid is

only in 1) and 2),
so if other vcpus access memory within 1G, there will be less chance 
to find the

entry invalid
and as a result trigger an unnecessary translation fault.
Thank you for the explanation, that was my understand of it also, and 
I believe
your idea is correct. I was more concerned that I got some of the 
details wrong,

and you have kindly corrected me below.


Signed-off-by: Yanan Wang 
---
   arch/arm64/kvm/hyp/pgtable.c | 26 --
   1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/arch/arm64/kvm/hyp/pgtable.c 
b/arch/arm64/kvm/hyp/pgtable.c

index 78a560446f80..308c36b9cd21 100644
--- a/arch/arm64/kvm/hyp/pgtable.c
+++ b/arch/arm64/kvm/hyp/pgtable.c
@@ -434,6 +434,7 @@ struct stage2_map_data {
   kvm_pte_t    attr;
     kvm_pte_t    *anchor;
+    kvm_pte_t    *follow;
     struct kvm_s2_mmu    *mmu;
   struct kvm_mmu_memory_cache    *memcache;
@@ -553,15 +554,14 @@ static int stage2_map_walk_table_pre(u64 
addr, u64 end,

u32 level,
   if (!kvm_block_mapping_supported(addr, end, data->phys, 
level))

   return 0;
   -    kvm_set_invalid_pte(ptep);
-
   /*
- * Invalidate the whole stage-2, as we may have numerous leaf
- * entries below us which would otherwise need invalidating
- * individually.
+ * If we need to coalesce existing table entries into a block 
here,
+ * then install the block entry first and the sub-level page 
mappings

+ * will be unmapped later.
    */
-    kvm_call_hyp(__kvm_tlb_flush_vmid, data->mmu);
   data->anchor = ptep;
+    data->follow = kvm_pte_follow(*ptep);
+    stage2_coalesce_tables_into_block(addr, level, ptep, data);
Here's how stage2_coalesce_tables_into_block() is implemented from 
the previous
patch (it might be worth merging it with this patch, I found it 
impossible to
judge if the function is correct without seeing how it is used and 
what is

replacing):

Ok, will do this if v2 is going to be post.

static void stage2_coalesce_tables_into_block(u64 addr, u32 level,
                    kvm_pte_t *ptep,
                    struct stage2_map_data *data)
{
  u64 granule = kvm_granule_size(level), phys = data->phys;
  kvm_pte_t new = kvm_init_valid_leaf_pte(phys, data->attr, 
level);


  kvm_set_invalid_pte(ptep);

  /*
   * Invalidate the whole stage-2, as we may have numerous leaf 
entries
   * below us which would otherwise need invalidating 
individually.

   */
  kvm_call_hyp(__kvm_tlb_flush_vmid, data->mmu);
  smp_store_release(ptep, new);
  data->phys += granule;
}

This works because __kvm_pgtable_visit() saves the *ptep value 
before calling the
pre callback, and it visits the next 

[PATCH 3/3] clocksource/drivers/timer-ti-dm: Add missing set_state_oneshot_stopped

2021-03-03 Thread Tony Lindgren
To avoid spurious timer interrupts when KTIME_MAX is used, we need to
configure set_state_oneshot_stopped(). Although implementing this is
optional, it still affects things like power management for the extra
timer interrupt.

For more information, please see commit 8fff52fd5093 ("clockevents:
Introduce CLOCK_EVT_STATE_ONESHOT_STOPPED state") and commit cf8c5009ee37
("clockevents/drivers/arm_arch_timer: Implement
->set_state_oneshot_stopped()").

Fixes: 52762fbd1c47 ("clocksource/drivers/timer-ti-dm: Add clockevent and 
clocksource support")
Signed-off-by: Tony Lindgren 
---
 drivers/clocksource/timer-ti-dm-systimer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clocksource/timer-ti-dm-systimer.c 
b/drivers/clocksource/timer-ti-dm-systimer.c
--- a/drivers/clocksource/timer-ti-dm-systimer.c
+++ b/drivers/clocksource/timer-ti-dm-systimer.c
@@ -552,6 +552,7 @@ static int __init dmtimer_clockevent_init(struct 
device_node *np)
dev->set_state_shutdown = dmtimer_clockevent_shutdown;
dev->set_state_periodic = dmtimer_set_periodic;
dev->set_state_oneshot = dmtimer_clockevent_shutdown;
+   dev->set_state_oneshot_stopped = dmtimer_clockevent_shutdown;
dev->tick_resume = dmtimer_clockevent_shutdown;
dev->cpumask = cpu_possible_mask;
 
-- 
2.30.1


[PATCH 1/3] clocksource/drivers/timer-ti-dm: Fix posted mode status check order

2021-03-03 Thread Tony Lindgren
When the timer is configured in posted mode, we need to check the write-
posted status register (TWPS) before writing to the register.

We now check TWPS after the write starting with commit 52762fbd1c47
("clocksource/drivers/timer-ti-dm: Add clockevent and clocksource
support").

For example, in the TRM for am571x the following is documented in chapter
"22.2.4.13.1.1 Write Posting Synchronization Mode":

"For each register, a status bit is provided in the timer write-posted
 status (TWPS) register. In this mode, it is mandatory that software check
 this status bit before any write access. If a write is attempted to a
 register with a previous access pending, the previous access is discarded
 without notice."

The regression happened when I updated the code to use standard read/write
accessors for the driver instead of using __omap_dm_timer_load_start().
We have__omap_dm_timer_load_start() check the TWPS status correctly using
__omap_dm_timer_write().

Fixes: 52762fbd1c47 ("clocksource/drivers/timer-ti-dm: Add clockevent and 
clocksource support")
Signed-off-by: Tony Lindgren 
---
 drivers/clocksource/timer-ti-dm-systimer.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/clocksource/timer-ti-dm-systimer.c 
b/drivers/clocksource/timer-ti-dm-systimer.c
--- a/drivers/clocksource/timer-ti-dm-systimer.c
+++ b/drivers/clocksource/timer-ti-dm-systimer.c
@@ -449,13 +449,13 @@ static int dmtimer_set_next_event(unsigned long cycles,
struct dmtimer_systimer *t = >t;
void __iomem *pend = t->base + t->pend;
 
-   writel_relaxed(0x - cycles, t->base + t->counter);
while (readl_relaxed(pend) & WP_TCRR)
cpu_relax();
+   writel_relaxed(0x - cycles, t->base + t->counter);
 
-   writel_relaxed(OMAP_TIMER_CTRL_ST, t->base + t->ctrl);
while (readl_relaxed(pend) & WP_TCLR)
cpu_relax();
+   writel_relaxed(OMAP_TIMER_CTRL_ST, t->base + t->ctrl);
 
return 0;
 }
@@ -490,18 +490,18 @@ static int dmtimer_set_periodic(struct clock_event_device 
*evt)
dmtimer_clockevent_shutdown(evt);
 
/* Looks like we need to first set the load value separately */
-   writel_relaxed(clkevt->period, t->base + t->load);
while (readl_relaxed(pend) & WP_TLDR)
cpu_relax();
+   writel_relaxed(clkevt->period, t->base + t->load);
 
-   writel_relaxed(clkevt->period, t->base + t->counter);
while (readl_relaxed(pend) & WP_TCRR)
cpu_relax();
+   writel_relaxed(clkevt->period, t->base + t->counter);
 
-   writel_relaxed(OMAP_TIMER_CTRL_AR | OMAP_TIMER_CTRL_ST,
-  t->base + t->ctrl);
while (readl_relaxed(pend) & WP_TCLR)
cpu_relax();
+   writel_relaxed(OMAP_TIMER_CTRL_AR | OMAP_TIMER_CTRL_ST,
+  t->base + t->ctrl);
 
return 0;
 }
-- 
2.30.1


cpuidle-qcom-spm.c:undefined reference to `cpu_resume_arm'

2021-03-03 Thread kernel test robot
Hi Stephan,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   f69d02e37a85645aa90d18cacfff36dba370f797
commit: a871be6b8eee13a35a3e8e56c62770ef17ee9220 cpuidle: Convert Qualcomm SPM 
driver to a generic CPUidle driver
date:   9 months ago
config: arm-randconfig-r015-20210304 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a871be6b8eee13a35a3e8e56c62770ef17ee9220
git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout a871be6b8eee13a35a3e8e56c62770ef17ee9220
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All errors (new ones prefixed by >>):

   arm-linux-gnueabi-ld: drivers/cpuidle/cpuidle-qcom-spm.o: in function 
`spm_dev_probe':
>> cpuidle-qcom-spm.c:(.text+0x36c): undefined reference to `cpu_resume_arm'
   arm-linux-gnueabi-ld: drivers/firmware/qcom_scm-smc.o: in function 
`__scm_smc_do_quirk':
>> qcom_scm-smc.c:(.text+0x3c): undefined reference to `__arm_smccc_smc'
   arm-linux-gnueabi-ld: drivers/firmware/qcom_scm-legacy.o: in function 
`scm_legacy_call':
>> qcom_scm-legacy.c:(.text+0x136): undefined reference to `__arm_smccc_smc'
   arm-linux-gnueabi-ld: drivers/firmware/qcom_scm-legacy.o: in function 
`scm_legacy_call_atomic':
   qcom_scm-legacy.c:(.text+0x356): undefined reference to `__arm_smccc_smc'

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


.config.gz
Description: application/gzip


Re: [PATCH v2] net: 9p: advance iov on empty read

2021-03-03 Thread patchwork-bot+netdevbpf
Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Tue, 2 Mar 2021 17:19:32 +0800 you wrote:
> I met below warning when cating a small size(about 80bytes) txt file
> on 9pfs(msize=2097152 is passed to 9p mount option), the reason is we
> miss iov_iter_advance() if the read count is 0 for zerocopy case, so
> we didn't truncate the pipe, then iov_iter_pipe() thinks the pipe is
> full. Fix it by removing the exception for 0 to ensure to call
> iov_iter_advance() even on empty read for zerocopy case.
> 
> [...]

Here is the summary with links:
  - [v2] net: 9p: advance iov on empty read
https://git.kernel.org/netdev/net/c/d65614a01d24

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




linux-next: build failure after merge of the pinctrl tree

2021-03-03 Thread Stephen Rothwell
Hi all,

After merging the pinctrl tree, today's linux-next build (x86_64
allmodconfig ) failed like this:


Presumably caused by commit

  c9e84d46cc03 ("pinctrl: rockchip: make driver be tristate module")

I have used the pinctrl tree from next-20210303 for today.

-- 
Cheers,
Stephen Rothwell


pgpWesbc9OWtw.pgp
Description: OpenPGP digital signature


<    5   6   7   8   9   10   11   12   13   14   >