Re: [PATCH v4 4/7] KVM: PPC: clean up redundant 'kvm_run' parameters

2020-05-25 Thread Paul Mackerras
On Mon, Apr 27, 2020 at 12:35:11PM +0800, Tianjia Zhang wrote:
> In the current kvm version, 'kvm_run' has been included in the 'kvm_vcpu'
> structure. For historical reasons, many kvm-related function parameters
> retain the 'kvm_run' and 'kvm_vcpu' parameters at the same time. This
> patch does a unified cleanup of these remaining redundant parameters.
> 
> Signed-off-by: Tianjia Zhang 

This looks OK, though possibly a little larger than it needs to be
because of variable name changes (kvm_run -> run) that aren't strictly
necessary.

Reviewed-by: Paul Mackerras 


Re: [PATCH v4 3/7] KVM: PPC: Remove redundant kvm_run from vcpu_arch

2020-05-25 Thread Paul Mackerras
On Mon, Apr 27, 2020 at 12:35:10PM +0800, Tianjia Zhang wrote:
> The 'kvm_run' field already exists in the 'vcpu' structure, which
> is the same structure as the 'kvm_run' in the 'vcpu_arch' and
> should be deleted.
> 
> Signed-off-by: Tianjia Zhang 

This looks fine.

I assume each architecture sub-maintainer is taking the relevant
patches from this series via their tree - is that right?

Reviewed-by: Paul Mackerras 


Re: [PATCH] net/ethernet/freescale: rework quiesce/activate for ucc_geth

2020-05-25 Thread Valentin Longchamp

Le 23.05.2020 à 00:50, David Miller a écrit :

From: Valentin Longchamp 
Date: Wed, 20 May 2020 17:53:50 +0200


ugeth_quiesce/activate are used to halt the controller when there is a
link change that requires to reconfigure the mac.

The previous implementation called netif_device_detach(). This however
causes the initial activation of the netdevice to fail precisely because
it's detached. For details, see [1].

A possible workaround was the revert of commit
net: linkwatch: add check for netdevice being present to linkwatch_do_dev
However, the check introduced in the above commit is correct and shall be
kept.

The netif_device_detach() is thus replaced with
netif_tx_stop_all_queues() that prevents any tranmission. This allows to
perform mac config change required by the link change, without detaching
the corresponding netdevice and thus not preventing its initial
activation.

[1] https://lists.openwall.net/netdev/2020/01/08/201

Signed-off-by: Valentin Longchamp 
Acked-by: Matteo Ghidoni 


Applied, thanks.



Thanks David.

May I suggest that this get backported to stable until (including) the 
4.19 stable release ?


As the above mentioned commit, merged for 4.19,
124eee3f6955 net: linkwatch: add check for netdevice being present to 
linkwatch_do_dev
does indeed break the ucc_geth driver, this patch can be considered as a 
bugfix that should be taken into account for stable.


Re: [PATCH] powerpc: Add ppc_inst_as_u64()

2020-05-25 Thread Jordan Niethe
On Mon, May 25, 2020 at 3:49 PM Michael Ellerman  wrote:
>
> The code patching code wants to get the value of a struct ppc_inst as
Might need to change the wording here as it also gets used in
arch_prepare_optimized_kprobe()
> a u64 when the instruction is prefixed, so we can pass the u64 down to
> __put_user_asm() and write it with a single store.
>
> This is a bit awkward because the value differs based on the CPU
> endianness, so add a helper to do the conversion.
>
> Signed-off-by: Michael Ellerman 
> ---
>  arch/powerpc/include/asm/inst.h  | 9 +
>  arch/powerpc/kernel/optprobes.c  | 3 +--
>  arch/powerpc/lib/code-patching.c | 8 +---
>  3 files changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/inst.h b/arch/powerpc/include/asm/inst.h
> index d82e0c99cfa1..d61e07fb2937 100644
> --- a/arch/powerpc/include/asm/inst.h
> +++ b/arch/powerpc/include/asm/inst.h
> @@ -100,6 +100,15 @@ static inline int ppc_inst_len(struct ppc_inst x)
> return ppc_inst_prefixed(x) ? 8 : 4;
>  }
>
> +static inline u64 ppc_inst_as_u64(struct ppc_inst x)
> +{
> +#ifdef CONFIG_CPU_LITTLE_ENDIAN
> +   return (u64)ppc_inst_suffix(x) << 32 | ppc_inst_val(x);
> +#else
> +   return (u64)ppc_inst_val(x) << 32 | ppc_inst_suffix(x);
> +#endif
> +}
> +
>  int probe_user_read_inst(struct ppc_inst *inst,
>  struct ppc_inst __user *nip);
>
> diff --git a/arch/powerpc/kernel/optprobes.c b/arch/powerpc/kernel/optprobes.c
> index 3ac105e7faae..69bfe96884e2 100644
> --- a/arch/powerpc/kernel/optprobes.c
> +++ b/arch/powerpc/kernel/optprobes.c
> @@ -283,8 +283,7 @@ int arch_prepare_optimized_kprobe(struct optimized_kprobe 
> *op, struct kprobe *p)
>  * 3. load instruction to be emulated into relevant register, and
>  */
> temp = ppc_inst_read((struct ppc_inst *)p->ainsn.insn);
> -   patch_imm64_load_insns(ppc_inst_val(temp) | 
> ((u64)ppc_inst_suffix(temp) << 32),
> -  4, buff + TMPL_INSN_IDX);
> +   patch_imm64_load_insns(ppc_inst_as_u64(temp), 4, buff + 
> TMPL_INSN_IDX);
>
> /*
>  * 4. branch back from trampoline
> diff --git a/arch/powerpc/lib/code-patching.c 
> b/arch/powerpc/lib/code-patching.c
> index 64cf621e5b00..5ecf0d635a8d 100644
> --- a/arch/powerpc/lib/code-patching.c
> +++ b/arch/powerpc/lib/code-patching.c
> @@ -27,13 +27,7 @@ static int __patch_instruction(struct ppc_inst *exec_addr, 
> struct ppc_inst instr
> if (!ppc_inst_prefixed(instr)) {
> __put_user_asm(ppc_inst_val(instr), patch_addr, err, "stw");
> } else {
> -#ifdef CONFIG_CPU_LITTLE_ENDIAN
> -   __put_user_asm((u64)ppc_inst_suffix(instr) << 32 |
> -  ppc_inst_val(instr), patch_addr, err, "std");
> -#else
> -   __put_user_asm((u64)ppc_inst_val(instr) << 32 |
> -  ppc_inst_suffix(instr), patch_addr, err, 
> "std");
> -#endif
> +   __put_user_asm(ppc_inst_as_u64(instr), patch_addr, err, 
> "std");
> }
>
> if (err)
> --
> 2.25.1
>
I booted a BE and LE kernel - test_prefixed_patching() worked on both.
Also on BE and LE kernels I put optprobes on prefixed and non prefixed
instructions.
The correct value was passed via r4 to emulate_step().

Tested-by: Jordan Niethe 


[PATCH] ASoC: fsl_asrc_dma: Fix dma_chan leak when config DMA channel failed

2020-05-25 Thread Xiyu Yang
fsl_asrc_dma_hw_params() invokes dma_request_channel() or
fsl_asrc_get_dma_channel(), which returns a reference of the specified
dma_chan object to "pair->dma_chan[dir]" with increased refcnt.

The reference counting issue happens in one exception handling path of
fsl_asrc_dma_hw_params(). When config DMA channel failed for Back-End,
the function forgets to decrease the refcnt increased by
dma_request_channel() or fsl_asrc_get_dma_channel(), causing a refcnt
leak.

Fix this issue by calling dma_release_channel() when config DMA channel
failed.

Signed-off-by: Xiyu Yang 
Signed-off-by: Xin Tan 
---
 sound/soc/fsl/fsl_asrc_dma.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/fsl/fsl_asrc_dma.c b/sound/soc/fsl/fsl_asrc_dma.c
index e7178817d7a7..1ee10eafe3e6 100644
--- a/sound/soc/fsl/fsl_asrc_dma.c
+++ b/sound/soc/fsl/fsl_asrc_dma.c
@@ -252,6 +252,7 @@ static int fsl_asrc_dma_hw_params(struct snd_soc_component 
*component,
ret = dmaengine_slave_config(pair->dma_chan[dir], _be);
if (ret) {
dev_err(dev, "failed to config DMA channel for Back-End\n");
+   dma_release_channel(pair->dma_chan[dir]);
return ret;
}
 
-- 
2.7.4



Re: [PATCH] ASoC: fsl: imx-audmix: Fix unused assignment to variable 'ret'

2020-05-25 Thread Mark Brown
On Wed, 13 May 2020 19:14:08 +0800, Tang Bin wrote:
> Omit unused initialized value, because 'ret' will be assigined
> by the function snd_soc_component_read().

Applied to

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

Thanks!

[1/1] ASoC: fsl: imx-audmix: Fix unused assignment to variable 'ret'
  commit: 085c02d355ac585184ef4f00eb333cd86f6add80

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] ASoC: fsl_asrc: Fix -Wmissing-prototypes warning

2020-05-25 Thread Mark Brown
On Mon, 25 May 2020 17:03:32 +0800, Shengjiu Wang wrote:
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
> 
> sound/soc/fsl/fsl_asrc.c:557:18: warning: no previous prototype for function 
> 'fsl_asrc_get_dma_channel' [-Wmissing-prototypes]
> struct dma_chan *fsl_asrc_get_dma_channel(struct fsl_asrc_pair *pair, bool 
> dir)
>  ^
> sound/soc/fsl/fsl_asrc.c:557:1: note: declare 'static' if the function is not 
> intended to be used outside of this translation unit
> struct dma_chan *fsl_asrc_get_dma_channel(struct fsl_asrc_pair *pair, bool 
> dir)
> ^
> static

Applied to

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

Thanks!

[1/1] ASoC: fsl_asrc: Fix -Wmissing-prototypes warning
  commit: cff1f8b4f8e119a9dbd9872d7a04fedef8d0c1a2

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] ASoC: fsl_asrc: Merge suspend/resume function to runtime_suspend/resume

2020-05-25 Thread Mark Brown
On Fri, 22 May 2020 17:57:24 +0800, Shengjiu Wang wrote:
> With dedicated power domain for asrc, power can be disabled after
> probe and pm runtime suspend, then the value of all registers need to
> be restored in pm runtime resume. So we can merge suspend/resume function
> to runtime_suspend/resume function and enable regcache only in end of
> probe.

Applied to

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

Thanks!

[1/1] ASoC: fsl_asrc: Merge suspend/resume function to runtime_suspend/resume
  commit: 393dc21d0f25e8fcde8baca78b8a38afe61db2a7

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: Endless soft-lockups for compiling workload since next-20200519

2020-05-25 Thread Peter Zijlstra
On Mon, May 25, 2020 at 04:05:49PM +0200, Frederic Weisbecker wrote:
> On Mon, May 25, 2020 at 03:21:05PM +0200, Peter Zijlstra wrote:
> > @@ -2320,7 +2304,7 @@ static void ttwu_queue_remote(struct task_struct *p, 
> > int cpu, int wake_flags)
> >  
> > if (llist_add(>wake_entry, >wake_list)) {
> > if (!set_nr_if_polling(rq->idle))
> > -   smp_call_function_single_async(cpu, >wake_csd);
> > +   smp_call_function_single_async(cpu, >wake_csd);
> > else
> > trace_sched_wake_idle_without_ipi(cpu);
> 
> Ok that's of course very unlikely but could it be possible to have the
> following:
> 
> CPU 0 CPU 1 CPU 2
> -   
> 
> //Wake up A
> ttwu_queue(TASK A, CPU 1) idle_loop {
>   ttwu_queue_pending {
>   
>   raw_spin_unlock_irqrestore(rq)
>   # VMEXIT (with IPI still pending)
> 
> //task A migrates here
> 
> wait_event()
> 
> //sleep
> 
> //Wake up A
> ttwu_queue(TASK A, CPU 2) {
> //IPI on CPU 2 ignored
> // due to csd->flags == CSD_LOCK
> 

Right you are.

Bah!

More thinking


Re: Endless soft-lockups for compiling workload since next-20200519

2020-05-25 Thread Peter Zijlstra
On Mon, May 25, 2020 at 03:21:05PM +0200, Peter Zijlstra wrote:
> - flags = atomic_fetch_andnot(NOHZ_KICK_MASK, nohz_flags(this_cpu));
> - if (!(flags & NOHZ_KICK_MASK))
> + if (idle != CPU_IDLE)
>   return false;
>  
>   _nohz_idle_balance(this_rq, flags, idle);

Bah, I think I broke something there. Lemme go mend.


Re: Endless soft-lockups for compiling workload since next-20200519

2020-05-25 Thread Frederic Weisbecker
On Mon, May 25, 2020 at 03:21:05PM +0200, Peter Zijlstra wrote:
> @@ -2320,7 +2304,7 @@ static void ttwu_queue_remote(struct task_struct *p, 
> int cpu, int wake_flags)
>  
>   if (llist_add(>wake_entry, >wake_list)) {
>   if (!set_nr_if_polling(rq->idle))
> - smp_call_function_single_async(cpu, >wake_csd);
> + smp_call_function_single_async(cpu, >wake_csd);
>   else
>   trace_sched_wake_idle_without_ipi(cpu);

Ok that's of course very unlikely but could it be possible to have the
following:

CPU 0 CPU 1 CPU 2
-   

//Wake up A
ttwu_queue(TASK A, CPU 1) idle_loop {
  ttwu_queue_pending {
  
  raw_spin_unlock_irqrestore(rq)
  # VMEXIT (with IPI still pending)
//task 
A migrates here

wait_event()
//sleep

//Wake up A
ttwu_queue(TASK A, CPU 2) {
//IPI on CPU 2 ignored
// due to csd->flags == CSD_LOCK



Re: Endless soft-lockups for compiling workload since next-20200519

2020-05-25 Thread Peter Zijlstra
On Thu, May 21, 2020 at 02:41:14PM +0200, Frederic Weisbecker wrote:
> On Thu, May 21, 2020 at 01:00:27PM +0200, Peter Zijlstra wrote:

> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index 01f94cf52783..b6d8a7b991f0 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -10033,7 +10033,7 @@ static void kick_ilb(unsigned int flags)
> >  * is idle. And the softirq performing nohz idle load balance
> >  * will be run before returning from the IPI.
> >  */
> > -   smp_call_function_single_async(ilb_cpu, _rq(ilb_cpu)->nohz_csd);
> > +   smp_call_function_single_async(ilb_cpu, _rq()->nohz_csd);
> 
> My fear here is that if a previous call from the the same CPU but to another
> target is still pending, the new one will be spuriously ignored.
> 

Urgh, indeed!

> But I believe we can still keep the remote csd if nohz_flags() are
> strictly only set before the IPI and strictly only cleared from it.
> 
> And I still don't understand why trigger_load_balance() raise the
> softirq without setting the current CPU as ilb. run_rebalance_domains()
> thus ignores it most of the time in the end or it spuriously clear the
> nohz_flags set by an IPI sender. Or there is something I misunderstood
> there.

That is because it is simple and didn't matter before. Whoever got there
first go to run the ilb whenever the flag was set.

But now we have this race due to having to serialize access to the csd.

We want the IPI to clear the flag, but then the softirq no longer knows
it was supposed to do ILB.

How's this then?

---
 include/linux/sched.h |  4 
 kernel/sched/core.c   | 41 +
 kernel/sched/fair.c   | 15 +++
 kernel/sched/sched.h  |  2 +-
 4 files changed, 25 insertions(+), 37 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index f38d62c4632c..136ee400b568 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -696,6 +696,10 @@ struct task_struct {
struct uclamp_seuclamp[UCLAMP_CNT];
 #endif
 
+#ifdef CONFIG_SMP
+   call_single_data_t  wake_csd;
+#endif
+
 #ifdef CONFIG_PREEMPT_NOTIFIERS
/* List of struct preempt_notifier: */
struct hlist_head   preempt_notifiers;
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 5b286469e26e..90484b988b65 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -637,41 +637,25 @@ void wake_up_nohz_cpu(int cpu)
wake_up_idle_cpu(cpu);
 }
 
-static inline bool got_nohz_idle_kick(void)
+static void nohz_csd_func(void *info)
 {
-   int cpu = smp_processor_id();
-
-   if (!(atomic_read(nohz_flags(cpu)) & NOHZ_KICK_MASK))
-   return false;
-
-   if (idle_cpu(cpu) && !need_resched())
-   return true;
+   struct rq *rq = info;
+   int cpu = cpu_of(rq);
 
+   WARN_ON(!(atomic_read(nohz_flags(cpu)) & NOHZ_KICK_MASK));
/*
-* We can't run Idle Load Balance on this CPU for this time so we
-* cancel it and clear NOHZ_BALANCE_KICK
+* Release the rq::nohz_csd.
 */
+   smp_mb__before_atomic();
atomic_andnot(NOHZ_KICK_MASK, nohz_flags(cpu));
-   return false;
-}
-
-static void nohz_csd_func(void *info)
-{
-   struct rq *rq = info;
 
-   if (got_nohz_idle_kick()) {
-   rq->idle_balance = 1;
+   rq->idle_balance = idle_cpu(cpu);
+   if (rq->idle_balance && !need_resched()) {
+   rq->nohz_idle_balance = 1;
raise_softirq_irqoff(SCHED_SOFTIRQ);
}
 }
 
-#else /* CONFIG_NO_HZ_COMMON */
-
-static inline bool got_nohz_idle_kick(void)
-{
-   return false;
-}
-
 #endif /* CONFIG_NO_HZ_COMMON */
 
 #ifdef CONFIG_NO_HZ_FULL
@@ -2320,7 +2304,7 @@ static void ttwu_queue_remote(struct task_struct *p, int 
cpu, int wake_flags)
 
if (llist_add(>wake_entry, >wake_list)) {
if (!set_nr_if_polling(rq->idle))
-   smp_call_function_single_async(cpu, >wake_csd);
+   smp_call_function_single_async(cpu, >wake_csd);
else
trace_sched_wake_idle_without_ipi(cpu);
}
@@ -2921,6 +2905,9 @@ int sched_fork(unsigned long clone_flags, struct 
task_struct *p)
 #endif
 #if defined(CONFIG_SMP)
p->on_cpu = 0;
+   p->wake_csd = (struct __call_single_data) {
+   .func = wake_csd_func,
+   };
 #endif
init_task_preempt_count(p);
 #ifdef CONFIG_SMP
@@ -6723,8 +6710,6 @@ void __init sched_init(void)
rq->avg_idle = 2*sysctl_sched_migration_cost;
rq->max_idle_balance_cost = sysctl_sched_migration_cost;
 
-   rq_csd_init(rq, >wake_csd, wake_csd_func);
-
INIT_LIST_HEAD(>cfs_tasks);
 
rq_attach_root(rq, _root_domain);
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 01f94cf52783..93525549a023 100644
--- a/kernel/sched/fair.c

Re: [RESEND PATCH v7 4/5] ndctl/papr_scm, uapi: Add support for PAPR nvdimm specific methods

2020-05-25 Thread Vaibhav Jain
Hi Ira, Mpe and Aneesh,

Vaibhav Jain  writes:

> Michael Ellerman  writes:
>
>> Ira Weiny  writes:
>>> On Wed, May 20, 2020 at 12:30:57AM +0530, Vaibhav Jain wrote:
 Introduce support for Papr nvDimm Specific Methods (PDSM) in papr_scm
 modules and add the command family to the white list of NVDIMM command
 sets. Also advertise support for ND_CMD_CALL for the dimm
 command mask and implement necessary scaffolding in the module to
 handle ND_CMD_CALL ioctl and PDSM requests that we receive.
>> ...
 + *
 + * Payload Version:
 + *
 + * A 'payload_version' field is present in PDSM header that indicates a 
 specific
 + * version of the structure present in PDSM Payload for a given PDSM 
 command.
 + * This provides backward compatibility in case the PDSM Payload structure
 + * evolves and different structures are supported by 'papr_scm' and 
 'libndctl'.
 + *
 + * When sending a PDSM Payload to 'papr_scm', 'libndctl' should send the 
 version
 + * of the payload struct it supports via 'payload_version' field. The 
 'papr_scm'
 + * module when servicing the PDSM envelope checks the 'payload_version' 
 and then
 + * uses 'payload struct version' == MIN('payload_version field',
 + * 'max payload-struct-version supported by papr_scm') to service the 
 PDSM.
 + * After servicing the PDSM, 'papr_scm' put the negotiated version of 
 payload
 + * struct in returned 'payload_version' field.
>>>
>>> FWIW many people believe using a size rather than version is more 
>>> sustainable.
>>> It is expected that new payload structures are larger (more features) than 
>>> the
>>> previous payload structure.
>>>
>>> I can't find references at the moment through.
>>
>> I think clone_args is a good modern example:
>>
>>   
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/sched.h#n88
>>
>> cheers
>
> Thank Ira and Mpe for pointing this out. I looked into how clone3 sycall
> handles clone_args and few differences came out:
>
> * Unlike clone_args that are always transferred in one direction from
>   user-space to kernel, payload contents of pdsms are transferred in both
>   directions. Having a single version number makes it easier for
>   user-space and kernel to determine what data will be exchanged.
>
> * For PDSMs, the version number is negotiated between libndctl and
>   kernel. For example in case kernel only supports an older version of
>   a structure, its free to send a lower version number back to
>   libndctl. Such negotiations doesnt happen with clone3 syscall.

If you are ok with the explaination above please let me know. I will
quickly spin off a v8 addressing your review comments.

Thanks,
-- 
Cheers
~ Vaibhav


Re: [PATCH v4 07/45] powerpc/ptdump: Limit size of flags text to 1/2 chars on PPC32

2020-05-25 Thread Christophe Leroy




Le 25/05/2020 à 07:15, Michael Ellerman a écrit :

Christophe Leroy  writes:

In order to have all flags fit on a 80 chars wide screen,
reduce the flags to 1 char (2 where ambiguous).


I don't love this, the output is less readable. Is fitting on an 80 char
screen a real issue for you? I just make my terminal window bigger.


I don't have strong opinion about that, and the terminal can be made bigger.
I just don't like how messy it is, some flags are so big that they hide 
other ones and getting it more ordered and more compact helped me during 
all the verifications I did with this series, but we can leave it as is 
if you prefer.


Would you like a v5 without patches 7 and 8 ? Or I can just resend the 
patches that will be impacted, that is 9 and 38 ?


Without the changes I get:

---[ Start of kernel VM ]---
0xc000-0xc0ff  0x16M   huge  shared  rX 
present  accessed
0xc100-0xc7ff  0x0100   112M   huge  shared  rw 
present   dirty  accessed

---[ vmalloc() Area ]---
0xc900-0xc9003fff  0x050e400016K shared  rw 
present   dirty  accessed
0xc9008000-0xc900bfff  0x050ec00016K shared  rw 
present   dirty  accessed
0xc901-0xc9013fff  0xd00016K shared  rw 
present  guarded  dirty  accessed  no cache
0xc9018000-0xc901bfff  0x050f16K shared  rw 
present   dirty  accessed


---[ Fixmap start ]---
0xf7f0-0xf7f7  0xff00   512K   huge  shared  rw 
present  guarded  dirty  accessed  no cache

---[ Fixmap end ]---
---[ kasan shadow mem start ]---
0xf800-0xf8ff  0x070016M   huge  shared  rw 
present   dirty  accessed
0xf900-0xf91f [0x01288000]   16K shared  r 
present  accessed
0xf920-0xf9203fff  0x050e16K shared  rw 
present   dirty  accessed



With the change I get.

---[ Start of kernel VM ]---
0xc000-0xc0ff  0x16M   h  r   x  psh 
   a
0xc100-0xc7ff  0x0100   112M   h  rw psh 
d  a

---[ vmalloc() Area ]---
0xc900-0xc9003fff  0x050e400016K  rw psh 
d  a
0xc9008000-0xc900bfff  0x050ec00016K  rw psh 
d  a
0xc901-0xc9013fff  0xd00016K  rw p  i  g  sh 
d  a
0xc9018000-0xc901bfff  0x050f16K  rw psh 
d  a


---[ Fixmap start ]---
0xf7f0-0xf7f7  0xff00   512K   h  rw p  i  g  sh 
d  a

---[ Fixmap end ]---
---[ kasan shadow mem start ]---
0xf800-0xf8ff  0x070016M   h  rw psh 
d  a
0xf900-0xf91f [0x01288000]   16K  r  psh 
   a
0xf920-0xf9203fff  0x050e16K  rw psh 
d  a



Christophe



cheers



No cache is 'i'
User is 'ur' (Supervisor would be sr)
Shared (for 8xx) becomes 'sh' (it was 'user' when not shared but
that was ambiguous because that's not entirely right)

Signed-off-by: Christophe Leroy 
---
  arch/powerpc/mm/ptdump/8xx.c| 33 ---
  arch/powerpc/mm/ptdump/shared.c | 35 +
  2 files changed, 35 insertions(+), 33 deletions(-)


[PATCH v10 5/5] powerpc/pseries: Update hv-24x7 information after migration

2020-05-25 Thread Kajol Jain
Function 'read_sys_info_pseries()' is added to get system parameter
values like number of sockets and chips per socket.
and it gets these details via rtas_call with token
"PROCESSOR_MODULE_INFO".

Incase lpar migrate from one system to another, system
parameter details like chips per sockets or number of sockets might
change. So, it needs to be re-initialized otherwise, these values
corresponds to previous system values.
This patch adds a call to 'read_sys_info_pseries()' from
'post-mobility_fixup()' to re-init the physsockets and physchips values

Signed-off-by: Kajol Jain 
---
 arch/powerpc/platforms/pseries/mobility.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/powerpc/platforms/pseries/mobility.c 
b/arch/powerpc/platforms/pseries/mobility.c
index b571285f6c14..10d982997736 100644
--- a/arch/powerpc/platforms/pseries/mobility.c
+++ b/arch/powerpc/platforms/pseries/mobility.c
@@ -371,6 +371,9 @@ void post_mobility_fixup(void)
/* Possibly switch to a new RFI flush type */
pseries_setup_rfi_flush();
 
+   /* Reinitialise system information for hv-24x7 */
+   read_24x7_sys_info();
+
return;
 }
 
-- 
2.18.2



[PATCH v10 4/5] Documentation/ABI: Add ABI documentation for chips and sockets

2020-05-25 Thread Kajol Jain
Add documentation for the following sysfs files:
/sys/devices/hv_24x7/interface/chipspersocket,
/sys/devices/hv_24x7/interface/sockets,
/sys/devices/hv_24x7/interface/coresperchip

Signed-off-by: Kajol Jain 
---
 .../sysfs-bus-event_source-devices-hv_24x7| 21 +++
 1 file changed, 21 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-bus-event_source-devices-hv_24x7 
b/Documentation/ABI/testing/sysfs-bus-event_source-devices-hv_24x7
index ec27c6c9e737..e8698afcd952 100644
--- a/Documentation/ABI/testing/sysfs-bus-event_source-devices-hv_24x7
+++ b/Documentation/ABI/testing/sysfs-bus-event_source-devices-hv_24x7
@@ -22,6 +22,27 @@ Description:
Exposes the "version" field of the 24x7 catalog. This is also
extractable from the provided binary "catalog" sysfs entry.
 
+What:  /sys/devices/hv_24x7/interface/sockets
+Date:  May 2020
+Contact:   Linux on PowerPC Developer List 
+Description:   read only
+   This sysfs interface exposes the number of sockets present in 
the
+   system.
+
+What:  /sys/devices/hv_24x7/interface/chipspersocket
+Date:  May 2020
+Contact:   Linux on PowerPC Developer List 
+Description:   read only
+   This sysfs interface exposes the number of chips per socket
+   present in the system.
+
+What:  /sys/devices/hv_24x7/interface/coresperchip
+Date:  May 2020
+Contact:   Linux on PowerPC Developer List 
+Description:   read only
+   This sysfs interface exposes the number of cores per chip
+   present in the system.
+
 What:  /sys/bus/event_source/devices/hv_24x7/event_descs/
 Date:  February 2014
 Contact:   Linux on PowerPC Developer List 
-- 
2.18.2



[PATCH v10 3/5] powerpc/hv-24x7: Add sysfs files inside hv-24x7 device to show processor details

2020-05-25 Thread Kajol Jain
To expose the system dependent parameter like total number of
sockets and numbers of chips per socket, patch adds two sysfs files.
"sockets" and "chips" are added to /sys/devices/hv_24x7/interface/
of the "hv_24x7" pmu.

Signed-off-by: Kajol Jain 
---
 arch/powerpc/perf/hv-24x7.c | 24 
 1 file changed, 24 insertions(+)

diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c
index 5cd954af5445..995dd170ca4b 100644
--- a/arch/powerpc/perf/hv-24x7.c
+++ b/arch/powerpc/perf/hv-24x7.c
@@ -448,6 +448,24 @@ static ssize_t device_show_string(struct device *dev,
return sprintf(buf, "%s\n", (char *)d->var);
 }
 
+static ssize_t sockets_show(struct device *dev,
+   struct device_attribute *attr, char *buf)
+{
+   return sprintf(buf, "%d\n", phys_sockets);
+}
+
+static ssize_t chipspersocket_show(struct device *dev,
+  struct device_attribute *attr, char *buf)
+{
+   return sprintf(buf, "%d\n", phys_chipspersocket);
+}
+
+static ssize_t coresperchip_show(struct device *dev,
+struct device_attribute *attr, char *buf)
+{
+   return sprintf(buf, "%d\n", phys_coresperchip);
+}
+
 static struct attribute *device_str_attr_create_(char *name, char *str)
 {
struct dev_ext_attribute *attr = kzalloc(sizeof(*attr), GFP_KERNEL);
@@ -1094,6 +1112,9 @@ PAGE_0_ATTR(catalog_len, "%lld\n",
(unsigned long long)be32_to_cpu(page_0->length) * 4096);
 static BIN_ATTR_RO(catalog, 0/* real length varies */);
 static DEVICE_ATTR_RO(domains);
+static DEVICE_ATTR_RO(sockets);
+static DEVICE_ATTR_RO(chipspersocket);
+static DEVICE_ATTR_RO(coresperchip);
 
 static struct bin_attribute *if_bin_attrs[] = {
_attr_catalog,
@@ -1104,6 +1125,9 @@ static struct attribute *if_attrs[] = {
_attr_catalog_len.attr,
_attr_catalog_version.attr,
_attr_domains.attr,
+   _attr_sockets.attr,
+   _attr_chipspersocket.attr,
+   _attr_coresperchip.attr,
NULL,
 };
 
-- 
2.18.2



[PATCH v10 2/5] powerpc/hv-24x7: Add rtas call in hv-24x7 driver to get processor details

2020-05-25 Thread Kajol Jain
For hv_24x7 socket/chip level events, specific chip-id to which
the data requested should be added as part of pmu events.
But number of chips/socket in the system details are not exposed.

Patch implements read_24x7_sys_info() to get system
parameter values like number of sockets, cores per chip and
chips per socket. Rtas_call with token "PROCESSOR_MODULE_INFO"
is used to get these values.

Sub-sequent patch exports these values via sysfs.

Patch also make these parameters default to 1

Signed-off-by: Kajol Jain 
---
 arch/powerpc/include/asm/rtas.h |  6 
 arch/powerpc/perf/hv-24x7.c | 64 +
 2 files changed, 70 insertions(+)

diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h
index 3c1887351c71..7ef81b3e33f6 100644
--- a/arch/powerpc/include/asm/rtas.h
+++ b/arch/powerpc/include/asm/rtas.h
@@ -483,5 +483,11 @@ static inline void rtas_initialize(void) { };
 
 extern int call_rtas(const char *, int, int, unsigned long *, ...);
 
+#ifdef CONFIG_HV_PERF_CTRS
+void read_24x7_sys_info(void);
+#else
+static inline void read_24x7_sys_info(void) { }
+#endif
+
 #endif /* __KERNEL__ */
 #endif /* _POWERPC_RTAS_H */
diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c
index 48e8f4b17b91..5cd954af5445 100644
--- a/arch/powerpc/perf/hv-24x7.c
+++ b/arch/powerpc/perf/hv-24x7.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 
+#include 
 #include "hv-24x7.h"
 #include "hv-24x7-catalog.h"
 #include "hv-common.h"
@@ -57,6 +58,67 @@ static bool is_physical_domain(unsigned domain)
}
 }
 
+/*
+ * The Processor Module Information system parameter allows transferring
+ * of certain processor module information from the platform to the OS.
+ * Refer PAPR+ document to get parameter token value as '43'.
+ */
+
+#define PROCESSOR_MODULE_INFO   43
+
+static u32 phys_sockets;   /* Physical sockets */
+static u32 phys_chipspersocket;/* Physical chips per socket*/
+static u32 phys_coresperchip; /* Physical cores per chip */
+
+/*
+ * read_24x7_sys_info()
+ * Retrieve the number of sockets and chips per socket and cores per
+ * chip details through the get-system-parameter rtas call.
+ */
+void read_24x7_sys_info(void)
+{
+   int call_status, len, ntypes;
+
+   spin_lock(_data_buf_lock);
+
+   /*
+* Making system parameter: chips and sockets and cores per chip
+* default to 1.
+*/
+   phys_sockets = 1;
+   phys_chipspersocket = 1;
+   phys_coresperchip = 1;
+
+   call_status = rtas_call(rtas_token("ibm,get-system-parameter"), 3, 1,
+   NULL,
+   PROCESSOR_MODULE_INFO,
+   __pa(rtas_data_buf),
+   RTAS_DATA_BUF_SIZE);
+
+   rtas_data_buf[RTAS_DATA_BUF_SIZE - 1] = '\0';
+
+   if (call_status != 0) {
+   pr_err("Error calling get-system-parameter %d\n",
+  call_status);
+   } else {
+   len = be16_to_cpup((__be16 *)_data_buf[0]);
+   if (len < 8)
+   goto out;
+
+   ntypes = be16_to_cpup((__be16 *)_data_buf[2]);
+
+   if (!ntypes)
+   goto out;
+
+   phys_sockets = be16_to_cpup((__be16 *)_data_buf[4]);
+   phys_chipspersocket = be16_to_cpup((__be16 *)_data_buf[6]);
+   phys_coresperchip = be16_to_cpup((__be16 *)_data_buf[8]);
+   }
+
+out:
+   spin_unlock(_data_buf_lock);
+}
+
 /* Domains for which more than one result element are returned for each event. 
*/
 static bool domain_needs_aggregation(unsigned int domain)
 {
@@ -1605,6 +1667,8 @@ static int hv_24x7_init(void)
if (r)
return r;
 
+   read_24x7_sys_info();
+
return 0;
 }
 
-- 
2.18.2



[PATCH v10 1/5] powerpc/perf/hv-24x7: Fix inconsistent output values incase multiple hv-24x7 events run

2020-05-25 Thread Kajol Jain
Commit 2b206ee6b0df ("powerpc/perf/hv-24x7: Display change in counter
values")' added to print _change_ in the counter value rather then raw
value for 24x7 counters. Incase of transactions, the event count
is set to 0 at the beginning of the transaction. It also sets
the event's prev_count to the raw value at the time of initialization.
Because of setting event count to 0, we are seeing some weird behaviour,
whenever we run multiple 24x7 events at a time.

For example:

command#: ./perf stat -e "{hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/,
   hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/}"
   -C 0 -I 1000 sleep 100

 1.000121704120 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/
 1.000121704  5 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/
 2.000357733  8 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/
 2.000357733 10 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/
 3.000495215 18,446,744,073,709,551,616 
hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/
 3.000495215 18,446,744,073,709,551,616 
hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/
 4.000641884 56 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/
 4.000641884 18,446,744,073,709,551,616 
hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/
 5.000791887 18,446,744,073,709,551,616 
hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/

Getting these large values in case we do -I.

As we are setting event_count to 0, for interval case, overall event_count is 
not
coming in incremental order. As we may can get new delta lesser then previous 
count.
Because of which when we print intervals, we are getting negative value which 
create
these large values.

This patch removes part where we set event_count to 0 in function
'h_24x7_event_read'. There won't be much impact as we do set 
event->hw.prev_count
to the raw value at the time of initialization to print change value.

With this patch
In power9 platform

command#: ./perf stat -e "{hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/,
   hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/}"
   -C 0 -I 1000 sleep 100

 1.000117685 93 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/
 1.000117685  1 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/
 2.000349331 98 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/
 2.000349331  2 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/
 3.000495900131 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/
 3.000495900  4 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/
 4.000645920204 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/
 4.000645920 61 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=1/
 4.284169997 22 hv_24x7/PM_MCS01_128B_RD_DISP_PORT01,chip=0/

Signed-off-by: Kajol Jain 
Suggested-by: Sukadev Bhattiprolu 
Tested-by: Madhavan Srinivasan 
---
 arch/powerpc/perf/hv-24x7.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c
index 573e0b309c0c..48e8f4b17b91 100644
--- a/arch/powerpc/perf/hv-24x7.c
+++ b/arch/powerpc/perf/hv-24x7.c
@@ -1400,16 +1400,6 @@ static void h_24x7_event_read(struct perf_event *event)
h24x7hw = _cpu_var(hv_24x7_hw);
h24x7hw->events[i] = event;
put_cpu_var(h24x7hw);
-   /*
-* Clear the event count so we can compute the _change_
-* in the 24x7 raw counter value at the end of the txn.
-*
-* Note that we could alternatively read the 24x7 value
-* now and save its value in event->hw.prev_count. But
-* that would require issuing a hcall, which would then
-* defeat the purpose of using the txn interface.
-*/
-   local64_set(>count, 0);
}
 
put_cpu_var(hv_24x7_reqb);
-- 
2.18.2



[PATCH v10 0/5] powerpc/hv-24x7: Expose chip/sockets info to add json file metric support for the hv_24x7 socket/chip level events

2020-05-25 Thread Kajol Jain
Patchset fixes the inconsistent results we are getting when
we run multiple 24x7 events.

"hv_24x7" pmu interface events needs system dependent parameter
like socket/chip/core. For example, hv_24x7 chip level events needs
specific chip-id to which the data is requested should be added as part
of pmu events.

So to enable JSON file support to "hv_24x7" interface, patchset expose
total number of sockets and chips per-socket details in sysfs
files (sockets, chips) under "/sys/devices/hv_24x7/interface/".

To get number of sockets, chips per sockets and cores per chip
patchset adds a rtas call with token "PROCESSOR_MODULE_INFO" to get these
details. Patchset also handles partition migration case to re-init these
system depended parameters by adding proper calls in
post_mobility_fixup()(mobility.c).

Changelog:
v9 -> v10
- Change function name from 'read_sys_info_pseries()' to
  'read_24x7_sys_info()'.
- Remove rtas_local_data_buf use, as we can directly use
  rtas_data_buf itself as we just need to do few loads and it
  also remove overload of memcpy in the lock
  Suggested by: Michael Ellerman.
- Move part of updating 24x7 system info variables inside
  'rtas_data_buf_lock' and make sure we release spinlock in each case.
- Added Tested-by: Madhavan Srinivasan tag for patch 1

v8 -> v9
- As we not need 8k data buffer we also not require new lock and
  buffer size. So, removed that part.
- Since we are using rtas_data_buf itself for rtas call, Switch to
  kmalloc for data buffer so that we can free that memory.
- Made more changes as suggested by Nathan Lynch.

v7 -> v8
- Add support for exposing cores per details as well.
  Suggested by: Madhavan Srinivasan.
- Remove config check for 'CONFIG_PPC_RTAS' in previous
  implementation and address other comments by Michael Ellerman.

v6 -> v7
- Split patchset into two patch series, one with kernel changes
  and another with perf tool side changes. This pachset contain
  all kernel side changes.

Kajol Jain (5):
  powerpc/perf/hv-24x7: Fix inconsistent output values incase multiple
hv-24x7 events run
  powerpc/hv-24x7: Add rtas call in hv-24x7 driver to get processor
details
  powerpc/hv-24x7: Add sysfs files inside hv-24x7 device to show
processor details
  Documentation/ABI: Add ABI documentation for chips and sockets
  powerpc/pseries: Update hv-24x7 information after migration

 .../sysfs-bus-event_source-devices-hv_24x7| 21 
 arch/powerpc/include/asm/rtas.h   |  6 ++
 arch/powerpc/perf/hv-24x7.c   | 98 +--
 arch/powerpc/platforms/pseries/mobility.c |  3 +
 4 files changed, 118 insertions(+), 10 deletions(-)

-- 
2.18.2



Re: [PATCH v2 0/2] powerpc: Remove support for ppc405/440 Xilinx platforms

2020-05-25 Thread Michal Simek
Hi Michael,

On 01. 04. 20 13:30, Michal Simek wrote:
> On 01. 04. 20 12:38, Takashi Iwai wrote:
>> On Wed, 01 Apr 2020 12:35:16 +0200,
>> Michael Ellerman wrote:
>>>
>>> Michal Simek  writes:
 On 01. 04. 20 4:07, Michael Ellerman wrote:
> Michal Simek  writes:
>> Hi,
>>
>> recently we wanted to update xilinx intc driver and we found that 
>> function
>> which we wanted to remove is still wired by ancient Xilinx PowerPC
>> platforms. Here is the thread about it.
>> https://lore.kernel.org/linux-next/48d3232d-0f1d-42ea-3109-f44bbabfa...@xilinx.com/
>>
>> I have been talking about it internally and there is no interest in these
>> platforms and it is also orphan for quite a long time. None is really
>> running/testing these platforms regularly that's why I think it makes 
>> sense
>> to remove them also with drivers which are specific to this platform.
>>
>> U-Boot support was removed in 2017 without anybody complain about it
>> https://github.com/Xilinx/u-boot-xlnx/commit/98f705c9cefdfdba62c069821bbba10273a0a8ed
>>
>> Based on current ppc/next.
>>
>> If anyone has any objection about it, please let me know.
>
> Thanks for taking the time to find all this code and remove it.
>
> I'm not going to take this series for v5.7, it was posted too close to
> the merge window, and doing so wouldn't give people much time to object,
> especially given people are distracted at the moment.
>
> I'm happy to take it for v5.8, assuming there's no major objections.

 Sure. Just to let you know Christophe Leroy included this patch in his
 series about ppc405 removal. It should be the same.

 If you don't want to take that alsa patch I can send it separately and
 this patch can be taken from his series. I don't really mind but please
 let me know what way you prefer.
>>>
>>> It's better to keep it all together, so I'm happy take the alsa patch as
>>> well, it's already been acked.
>>
>> Sure, please go ahead.
> 
> 
> g8.

Can you please take this series? I know that there is v5 from Christophe
which has this 1/2 as 1/13. But I need this alsa patch too and I would
like to close this because it is around for almost 2 months and none
raised a concern about removing just these Xilinx platforms.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs




signature.asc
Description: OpenPGP digital signature


[PATCH] ASoC: fsl_asrc: Fix -Wmissing-prototypes warning

2020-05-25 Thread Shengjiu Wang
From: shengjiu wang 

COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

sound/soc/fsl/fsl_asrc.c:557:18: warning: no previous prototype for function 
'fsl_asrc_get_dma_channel' [-Wmissing-prototypes]
struct dma_chan *fsl_asrc_get_dma_channel(struct fsl_asrc_pair *pair, bool dir)
 ^
sound/soc/fsl/fsl_asrc.c:557:1: note: declare 'static' if the function is not 
intended to be used outside of this translation unit
struct dma_chan *fsl_asrc_get_dma_channel(struct fsl_asrc_pair *pair, bool dir)
^
static

Fixes: be7bd03f0201 ("ASoC: fsl_asrc: Move common definition to 
fsl_asrc_common")
Reported-by: kbuild test robot 
Signed-off-by: shengjiu wang 
---
 sound/soc/fsl/fsl_asrc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c
index 7e2d598ffb81..d79d2c7f8d36 100644
--- a/sound/soc/fsl/fsl_asrc.c
+++ b/sound/soc/fsl/fsl_asrc.c
@@ -554,7 +554,8 @@ static void fsl_asrc_stop_pair(struct fsl_asrc_pair *pair)
 /**
  * Get DMA channel according to the pair and direction.
  */
-struct dma_chan *fsl_asrc_get_dma_channel(struct fsl_asrc_pair *pair, bool dir)
+static struct dma_chan *fsl_asrc_get_dma_channel(struct fsl_asrc_pair *pair,
+bool dir)
 {
struct fsl_asrc *asrc = pair->asrc;
enum asrc_pair_index index = pair->index;
@@ -564,7 +565,6 @@ struct dma_chan *fsl_asrc_get_dma_channel(struct 
fsl_asrc_pair *pair, bool dir)
 
return dma_request_slave_channel(>pdev->dev, name);
 }
-EXPORT_SYMBOL_GPL(fsl_asrc_get_dma_channel);
 
 static int fsl_asrc_dai_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
-- 
2.21.0



[linux-next PATCH] mm/gup.c: Convert to use get_user_{page|pages}_fast_only()

2020-05-25 Thread Souptick Joarder
API __get_user_pages_fast() renamed to get_user_pages_fast_only()
to align with pin_user_pages_fast_only().

As part of this we will get rid of write parameter.
Instead caller will pass FOLL_WRITE to get_user_pages_fast_only().
This will not change any existing functionality of the API.

All the callers are changed to pass FOLL_WRITE.

Also introduce get_user_page_fast_only(), and use it in a few
places that hard-code nr_pages to 1.

Updated the documentation of the API.

Signed-off-by: Souptick Joarder 
Reviewed-by: John Hubbard 
Cc: Matthew Wilcox 
Cc: John Hubbard 
---
 arch/powerpc/kvm/book3s_64_mmu_hv.c|  2 +-
 arch/powerpc/kvm/book3s_64_mmu_radix.c |  2 +-
 arch/powerpc/perf/callchain_64.c   |  4 +---
 include/linux/mm.h | 10 --
 kernel/events/core.c   |  4 ++--
 mm/gup.c   | 29 -
 virt/kvm/kvm_main.c|  8 +++-
 7 files changed, 32 insertions(+), 27 deletions(-)

diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c 
b/arch/powerpc/kvm/book3s_64_mmu_hv.c
index 18aed97..ddfc4c9 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
@@ -581,7 +581,7 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct 
kvm_vcpu *vcpu,
 * We always ask for write permission since the common case
 * is that the page is writable.
 */
-   if (__get_user_pages_fast(hva, 1, 1, ) == 1) {
+   if (get_user_page_fast_only(hva, FOLL_WRITE, )) {
write_ok = true;
} else {
/* Call KVM generic code to do the slow-path check */
diff --git a/arch/powerpc/kvm/book3s_64_mmu_radix.c 
b/arch/powerpc/kvm/book3s_64_mmu_radix.c
index 3248f78..5d4c087 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_radix.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_radix.c
@@ -795,7 +795,7 @@ int kvmppc_book3s_instantiate_page(struct kvm_vcpu *vcpu,
 * is that the page is writable.
 */
hva = gfn_to_hva_memslot(memslot, gfn);
-   if (!kvm_ro && __get_user_pages_fast(hva, 1, 1, ) == 1) {
+   if (!kvm_ro && get_user_page_fast_only(hva, FOLL_WRITE, )) {
upgrade_write = true;
} else {
unsigned long pfn;
diff --git a/arch/powerpc/perf/callchain_64.c b/arch/powerpc/perf/callchain_64.c
index 1bff896d..814d1c2 100644
--- a/arch/powerpc/perf/callchain_64.c
+++ b/arch/powerpc/perf/callchain_64.c
@@ -29,11 +29,9 @@ int read_user_stack_slow(void __user *ptr, void *buf, int nb)
unsigned long addr = (unsigned long) ptr;
unsigned long offset;
struct page *page;
-   int nrpages;
void *kaddr;
 
-   nrpages = __get_user_pages_fast(addr, 1, 1, );
-   if (nrpages == 1) {
+   if (get_user_page_fast_only(addr, FOLL_WRITE, )) {
kaddr = page_address(page);
 
/* align address to page boundary */
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 93d93bd..c1718df 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1817,10 +1817,16 @@ extern int mprotect_fixup(struct vm_area_struct *vma,
 /*
  * doesn't attempt to fault and will return short.
  */
-int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
- struct page **pages);
+int get_user_pages_fast_only(unsigned long start, int nr_pages,
+unsigned int gup_flags, struct page **pages);
 int pin_user_pages_fast_only(unsigned long start, int nr_pages,
 unsigned int gup_flags, struct page **pages);
+
+static inline bool get_user_page_fast_only(unsigned long addr,
+   unsigned int gup_flags, struct page **pagep)
+{
+   return get_user_pages_fast_only(addr, 1, gup_flags, pagep) == 1;
+}
 /*
  * per-process(per-mm_struct) statistics.
  */
diff --git a/kernel/events/core.c b/kernel/events/core.c
index c94eb27..856d98c 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -6934,12 +6934,12 @@ static u64 perf_virt_to_phys(u64 virt)
 * Walking the pages tables for user address.
 * Interrupts are disabled, so it prevents any tear down
 * of the page tables.
-* Try IRQ-safe __get_user_pages_fast first.
+* Try IRQ-safe get_user_page_fast_only first.
 * If failed, leave phys_addr as 0.
 */
if (current->mm != NULL) {
pagefault_disable();
-   if (__get_user_pages_fast(virt, 1, 0, ) == 1)
+   if (get_user_page_fast_only(virt, 0, ))
phys_addr = page_to_phys(p) + virt % PAGE_SIZE;
pagefault_enable();
}
diff --git a/mm/gup.c b/mm/gup.c
index 80f51a36..f4b05f3 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -2278,7 +2278,7 @@ static int gup_pte_range(pmd_t pmd, unsigned long addr, 

Re: [PATCH] ASoC: fsl_asrc: Merge suspend/resume function to runtime_suspend/resume

2020-05-25 Thread Nicolin Chen
On Mon, May 25, 2020 at 02:11:18PM +0800, Shengjiu Wang wrote:
> > > @@ -1135,6 +1137,24 @@ static int fsl_asrc_runtime_resume(struct device 
> > > *dev)
> > >   goto disable_asrck_clk;
> > >   }
> > >
> > > + /* Stop all pairs provisionally */
> > > + regmap_read(asrc->regmap, REG_ASRCTR, );
> > > + regmap_update_bits(asrc->regmap, REG_ASRCTR,
> > > +ASRCTR_ASRCEi_ALL_MASK, 0);
> > > +
> > > + /* Restore all registers */
> > > + regcache_cache_only(asrc->regmap, false);
> > > + regcache_mark_dirty(asrc->regmap);
> >
> >
> > I see you doing regcache_mark_dirty() in the resume() now,
> > being different from previously doing in suspend()?

> Which is for probe -> runtime_resume case.
> After probe, the power may be disabled, so move mark_dirtry
> to runtime_resume, then regcache can re-write all the registers.

I see. Just noticed that you add a regcache_cache_only
in probe(). Acked already. Thanks.


Re: [PATCH] ASoC: fsl_asrc: Merge suspend/resume function to runtime_suspend/resume

2020-05-25 Thread Nicolin Chen
On Fri, May 22, 2020 at 05:57:24PM +0800, Shengjiu Wang wrote:
> With dedicated power domain for asrc, power can be disabled after
> probe and pm runtime suspend, then the value of all registers need to
> be restored in pm runtime resume. So we can merge suspend/resume function
> to runtime_suspend/resume function and enable regcache only in end of
> probe.
> 
> Signed-off-by: Shengjiu Wang 

Acked-by: Nicolin Chen 


Re: [PATCH] kbuild: reuse vmlinux.o in vmlinux_link

2020-05-25 Thread Masahiro Yamada
Hi Sam,

Thanks for the comments.

On Sun, May 24, 2020 at 1:54 AM Sam Ravnborg  wrote:
>
> Hi Masahiro.
>
> On Sun, May 24, 2020 at 12:12:35AM +0900, Masahiro Yamada wrote:
> > Hi Nicholas,
> > (+CC: Sam Ravnborg)
> >
> >
> > On Sat, May 23, 2020 at 7:06 PM Nicholas Piggin  wrote:
> > >
> > > Excerpts from Masahiro Yamada's message of May 23, 2020 3:44 am:
> > > > + Michael, and PPC ML.
> > > >
> > > > They may know something about the reason of failure.
> > >
> > > Because the linker can't put branch stubs within object code sections,
> > > so when you incrementally link them too large, the linker can't resolve
> > > branches into other object files.
> >
> >
> > Ah, you are right.
> >
> > So, this is a problem not only for PPC
> > but also for ARM (both 32 and 64 bit), etc.
> >
> > ARM needs to insert a veneer to jump far.
> >
> > Prior to thin archive, we could not compile
> > ARCH=arm allyesconfig because
> > drivers/built-in.o was too large.
> >
> > This patch gets us back to the too large
> > incremental object situation.
> >
> > With my quick compile-testing,
> > ARCH=arm allyesconfig
> > and ARCH=arm64 allyesconfig are broken.
> >
> >
> > > This is why we added incremental linking in the first place. I suppose
> > > it could be made conditional for platforms that can use this
> > > optimization.
> > >
> > > What'd be really nice is if we could somehow build and link kallsyms
> > > without relinking everything twice, and if we could do section mismatch
> > > analysis without making that vmlinux.o as well. I had a few ideas but
> > > not enough time to do much work on it.
> >
> >
> > Right, kallsyms links 3 times. (not twice)
> >
> >
> > Hmm, I think Sami's main motivation is Clang LTO.
> >
> > LTO is very time-consuming.
> > So, the android common kernel implements Clang LTO
> > in the pre modpost stage:
> >
> >
> > 1) LTO against vmlinux.o
> >
> > 2) modpost against vmlinux.o
> >
> > 3) Link vmlinux.o + kallsyms into vmlinux
> >(this requires linking 3 times)
>
> We have kallsyms we had to link three times because the linking
> increased the object a little in size so symbols did not match.
> The last time was added more or less only to check that we did
> have stable symbol addresses.


Usually vmlinux_link is invoked 3 times if CONFIG_KALLSYMS=y.

(kallsyms_step 1, kallsyms_step 2, and final vmlinux_link)

If the elf size does not match after kallsyms_step 2,
kallsyms_step 3 is invoked.

So, 4 times including the extra check pass.

If CONFIG_DEBUG_INFO_BTF=y, vmlinux_link is invoked
one more time.

So, linked 5 times at most.



>
> All this predates LTO stuff which we only introduced later.
>
> The reason for doing modpost on vmlinux.o was that we had cases
> where everything in drivers/ was fine but there was section mismatch
> references from arch/* to drivers/*
> This is back when there were much more drivers in arch/ than what we
> have today.
> And back then we also had much more to check ad we had cPU hotplug
> that could really cause section mismatches - this is no longer the case
> which is a good thing.
>
>
>
> ...
> >
> > The following two commits.
> > I did not fully understand the background, though.
> >
> > I CC'ed Sam in case he may add some comments.
> >
> > commit 85bd2fddd68e757da8e1af98f857f61a3c9ce647
> > Author: Sam Ravnborg 
> > Date:   Mon Feb 26 15:33:52 2007 +0100
> >
> > kbuild: fix section mismatch check for vmlinux
> >
> > vmlinux does not contain relocation entries which is
> > used by the section mismatch checks.
> > Reported by: Atsushi Nemoto 
> >
> > Use the individual objects as inputs to overcome
> > this limitation.
> > In modpost check the .o files and skip non-ELF files.
> >
> > Signed-off-by: Sam Ravnborg 
>
>
> So we checked vmlinx - but vmlinx did have too much stripped away.
> so in reality nothing was checked.
> To allow the warnings to be as precise as possible move the checks
> out to the indovidual .o files.
> Sometimes the names was mangled a little so if warnigns was only
> reported on vmlinx level in could be difficult to track down the
> offender.
> This would then also do the check on .o files that had all the
> relocation symbols rtequired.
>
> >
> > commit 741f98fe298a73c9d47ed53703c1279a29718581
> > Author: Sam Ravnborg 
> > Date:   Tue Jul 17 10:54:06 2007 +0200
> >
> > kbuild: do section mismatch check on full vmlinux
> >
> > Previously we did do the check on the .o files used to link
> > vmlinux but that failed to find questionable references across
> > the .o files.
> > Create a dedicated vmlinux.o file used only for section mismatch checks
> > that uses the defualt linker script so section does not get renamed.
> >
> > The vmlinux.o may later be used as part of the the final link of vmlinux
> > but for now it is used fo section mismatch only.
> > For a defconfig build this is instant but for an allyesconfig this
> > add two minutes to a full build (that anyways 

Re: [PATCH] ASoC: fsl_asrc: Merge suspend/resume function to runtime_suspend/resume

2020-05-25 Thread Shengjiu Wang
On Mon, May 25, 2020 at 1:12 PM Nicolin Chen  wrote:
>
> On Fri, May 22, 2020 at 05:57:24PM +0800, Shengjiu Wang wrote:
> > With dedicated power domain for asrc, power can be disabled after
> > probe and pm runtime suspend, then the value of all registers need to
> > be restored in pm runtime resume. So we can merge suspend/resume function
> > to runtime_suspend/resume function and enable regcache only in end of
> > probe.
> >
> > Signed-off-by: Shengjiu Wang 
> > ---
> >  sound/soc/fsl/fsl_asrc.c | 70 
> >  1 file changed, 27 insertions(+), 43 deletions(-)
> >
> > diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c
> > index 432936039de4..3ebbe15ac378 100644
> > --- a/sound/soc/fsl/fsl_asrc.c
> > +++ b/sound/soc/fsl/fsl_asrc.c
> > @@ -1100,6 +1100,7 @@ static int fsl_asrc_probe(struct platform_device 
> > *pdev)
> >   platform_set_drvdata(pdev, asrc);
> >   pm_runtime_enable(>dev);
> >   spin_lock_init(>lock);
> > + regcache_cache_only(asrc->regmap, true);
> >
> >   ret = devm_snd_soc_register_component(>dev, _asrc_component,
> > _asrc_dai, 1);
> > @@ -1117,6 +1118,7 @@ static int fsl_asrc_runtime_resume(struct device *dev)
> >   struct fsl_asrc *asrc = dev_get_drvdata(dev);
> >   struct fsl_asrc_priv *asrc_priv = asrc->private;
> >   int i, ret;
> > + u32 asrctr;
> >
> >   ret = clk_prepare_enable(asrc->mem_clk);
> >   if (ret)
> > @@ -1135,6 +1137,24 @@ static int fsl_asrc_runtime_resume(struct device 
> > *dev)
> >   goto disable_asrck_clk;
> >   }
> >
> > + /* Stop all pairs provisionally */
> > + regmap_read(asrc->regmap, REG_ASRCTR, );
> > + regmap_update_bits(asrc->regmap, REG_ASRCTR,
> > +ASRCTR_ASRCEi_ALL_MASK, 0);
> > +
> > + /* Restore all registers */
> > + regcache_cache_only(asrc->regmap, false);
> > + regcache_mark_dirty(asrc->regmap);
>
>
> I see you doing regcache_mark_dirty() in the resume() now,
> being different from previously doing in suspend()?
>
> Thanks
> Nic

Which is for probe -> runtime_resume case.
After probe, the power may be disabled, so move mark_dirtry
to runtime_resume, then regcache can re-write all the registers.

best regards
wang shengjiu

>
>
> > + regcache_sync(asrc->regmap);
> > +
> > + regmap_update_bits(asrc->regmap, REG_ASRCFG,
> > +ASRCFG_NDPRi_ALL_MASK | ASRCFG_POSTMODi_ALL_MASK |
> > +ASRCFG_PREMODi_ALL_MASK, asrc_priv->regcache_cfg);
> > +
> > + /* Restart enabled pairs */
> > + regmap_update_bits(asrc->regmap, REG_ASRCTR,
> > +ASRCTR_ASRCEi_ALL_MASK, asrctr);
> > +
> >   return 0;
> >
> >  disable_asrck_clk:
> > @@ -1155,6 +1175,11 @@ static int fsl_asrc_runtime_suspend(struct device 
> > *dev)
> >   struct fsl_asrc_priv *asrc_priv = asrc->private;
> >   int i;
> >
> > + regmap_read(asrc->regmap, REG_ASRCFG,
> > + _priv->regcache_cfg);
> > +
> > + regcache_cache_only(asrc->regmap, true);
> > +
> >   for (i = 0; i < ASRC_CLK_MAX_NUM; i++)
> >   clk_disable_unprepare(asrc_priv->asrck_clk[i]);
> >   if (!IS_ERR(asrc->spba_clk))
> > @@ -1166,51 +1191,10 @@ static int fsl_asrc_runtime_suspend(struct device 
> > *dev)
> >  }
> >  #endif /* CONFIG_PM */
> >
> > -#ifdef CONFIG_PM_SLEEP
> > -static int fsl_asrc_suspend(struct device *dev)
> > -{
> > - struct fsl_asrc *asrc = dev_get_drvdata(dev);
> > - struct fsl_asrc_priv *asrc_priv = asrc->private;
> > -
> > - regmap_read(asrc->regmap, REG_ASRCFG,
> > - _priv->regcache_cfg);
> > -
> > - regcache_cache_only(asrc->regmap, true);
> > - regcache_mark_dirty(asrc->regmap);
> > -
> > - return 0;
> > -}
> > -
> > -static int fsl_asrc_resume(struct device *dev)
> > -{
> > - struct fsl_asrc *asrc = dev_get_drvdata(dev);
> > - struct fsl_asrc_priv *asrc_priv = asrc->private;
> > - u32 asrctr;
> > -
> > - /* Stop all pairs provisionally */
> > - regmap_read(asrc->regmap, REG_ASRCTR, );
> > - regmap_update_bits(asrc->regmap, REG_ASRCTR,
> > -ASRCTR_ASRCEi_ALL_MASK, 0);
> > -
> > - /* Restore all registers */
> > - regcache_cache_only(asrc->regmap, false);
> > - regcache_sync(asrc->regmap);
> > -
> > - regmap_update_bits(asrc->regmap, REG_ASRCFG,
> > -ASRCFG_NDPRi_ALL_MASK | ASRCFG_POSTMODi_ALL_MASK |
> > -ASRCFG_PREMODi_ALL_MASK, asrc_priv->regcache_cfg);
> > -
> > - /* Restart enabled pairs */
> > - regmap_update_bits(asrc->regmap, REG_ASRCTR,
> > -ASRCTR_ASRCEi_ALL_MASK, asrctr);
> > -
> > - return 0;
> > -}
> > -#endif /* CONFIG_PM_SLEEP */
> > -
> >  static const struct dev_pm_ops fsl_asrc_pm = {
> >   SET_RUNTIME_PM_OPS(fsl_asrc_runtime_suspend, fsl_asrc_runtime_resume, 
> > NULL)

Re: [linux-next RFC v2] mm/gup.c: Convert to use get_user_{page|pages}_fast_only()

2020-05-25 Thread Souptick Joarder
On Mon, May 25, 2020 at 6:36 AM John Hubbard  wrote:
>
> On 2020-05-23 21:27, Souptick Joarder wrote:
> > API __get_user_pages_fast() renamed to get_user_pages_fast_only()
> > to align with pin_user_pages_fast_only().
> >
> > As part of this we will get rid of write parameter. Instead caller
> > will pass FOLL_WRITE to get_user_pages_fast_only(). This will not
> > change any existing functionality of the API.
> >
> > All the callers are changed to pass FOLL_WRITE.
>
> This looks good. A few nits below, but with those fixed, feel free to
> add:
>
>  Reviewed-by: John Hubbard 
>
> >
> > There are few places where 1 is passed to 2nd parameter of
> > __get_user_pages_fast() and return value is checked for 1
> > like [1]. Those are replaced with new inline
> > get_user_page_fast_only().
> >
> > [1] if (__get_user_pages_fast(hva, 1, 1, ) == 1)
> >
>
> We try to avoid talking *too* much about the previous version of
> the code. Just enough. So, instead of the above two paragraphs,
> I'd compress it down to:
>
> Also: introduce get_user_page_fast_only(), and use it in a few
> places that hard-code nr_pages to 1.
>
> ...
> > diff --git a/include/linux/mm.h b/include/linux/mm.h
> > index 93d93bd..8d4597f 100644
> > --- a/include/linux/mm.h
> > +++ b/include/linux/mm.h
> > @@ -1817,10 +1817,16 @@ extern int mprotect_fixup(struct vm_area_struct 
> > *vma,
> >   /*
> >* doesn't attempt to fault and will return short.
> >*/
> > -int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
> > -   struct page **pages);
> > +int get_user_pages_fast_only(unsigned long start, int nr_pages,
> > + unsigned int gup_flags, struct page **pages);
>
> Silly nit:
>
> Can you please leave the original indentation in place? I don't normally
> comment about this, but I like the original indentation better, and it matches
> the pin_user_pages_fast() below, too.
>
> ...
> > @@ -2786,8 +2792,8 @@ static int internal_get_user_pages_fast(unsigned long 
> > start, int nr_pages,
> >* If the architecture does not support this function, simply return with 
> > no
> >* pages pinned.
> >*/
> > -int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
> > -   struct page **pages)
> > +int get_user_pages_fast_only(unsigned long start, int nr_pages,
> > + unsigned int gup_flags, struct page **pages)
>
>
> Same thing here: you've changed the original indentation, which was 
> (arguably, but
> to my mind anyway) more readable, and for no reason. It still would have fit 
> within
> 80 cols.
>
> I'm sure it's a perfect 50/50 mix of people who prefer either indentation 
> style, and
> so for brand new code, I'll remain silent, as long as it is consistent with 
> either
> itself and/or the surrounding code. But changing it back and forth is a bit
> aggravating, and best avoided. :)

Ok, along with these changes I will remove the *RFC* tag and repost it.