Re: Coccinelle: Checking of_node_put() calls with SmPL
On Thu, 11 Jul 2019, wen.yan...@zte.com.cn wrote: > > > we developed a coccinelle script to detect such problems. > > > > Would you find the implementation of the function “dt_init_idle_driver” > > suspicious according to discussed source code search patterns? > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/cpuidle/dt_idle_states.c?id=e9a83bd2322035ed9d7dcf35753d3f984d76c6a5#n208 > > https://elixir.bootlin.com/linux/v5.2/source/drivers/cpuidle/dt_idle_states.c#L208 > > > > > > > This script is still being improved. > > > > Will corresponding software development challenges become more interesting? > > Hello Markus, > This is the simplified code pattern for it: > > 172 for (i = 0; ; i++) { > 173 state_node = of_parse_phandle(...); ---> Obtain here > ... > 177 match_id = of_match_node(matches, state_node); > 178 if (!match_id) { > 179 err = -ENODEV; > 180 break; ---> Jump out of > the loop without releasing it > 181 } > 182 > 183 if (!of_device_is_available(state_node)) { > 184 of_node_put(state_node); > 185 continue;---> Release the > object references within a loop > 186 } > ... > 208 of_node_put(state_node); --> Release the object > references within a loop > 209 } > 210 > 211 of_node_put(state_node); -->There may be double free > here. > > This code pattern is very interesting and the coccinelle software should also > recognize this pattern. In my experience, when you start looking at these of_node_put things, all sorts of strange things appear... julia
Re: [PATCH v2 5/7] x86/mm, tracing: Fix CR2 corruption
On Wed, Jul 10, 2019 at 04:27:09PM -0400, Steven Rostedt wrote: > > [ added stable folks ] > > On Sun, 7 Jul 2019 11:17:09 -0700 > Linus Torvalds wrote: > > > On Sun, Jul 7, 2019 at 8:11 AM Andy Lutomirski wrote: > > > > > > FWIW, I'm leaning toward suggesting that we apply the trivial tracing > > > fix and backport *that*. Then, in -tip, we could revert it and apply > > > this patch instead. > > > > You don't have to have the same fix in stable as in -tip. > > > > It's fine to send something to stable that says "Fixed differently by > > commit XYZ upstream". The main thing is to make sure that stable > > doesn't have fixes that then get lost upstream (which we used to have > > long long ago). > > > > But isn't it easier for them to just pull the quick fix in, if it is in > your tree? That is, it shouldn't be too hard to make the "quick fix" > that gets backported on your tree (and probably better testing), and > then add the proper fix on top of it. The stable folks will then just > use the commit sha to know what to take, and feel more confident about > taking it. It all depends on what the "quick fix" is. The reason I want to take the exact same patch that is in Linus's tree is that 95% of the time that we do a "one off" patch for stable only, it's wrong. We _ALWAYS_ get it wrong somehow, it's crazy how bad we are at this. I don't know why this is, but we have the stats to prove it. Because of this, I now require the "one off" stable only fixes to get a bunch of people reviewing it and write up a bunch of explaination as to why this is the way it is and why we can't just take whatever is in mainline. thanks, greg k-h
Re: [PATCH AUTOSEL 5.1 08/39] arm64: dts: ls1028a: Fix CPU idle fail.
On Thu, Jul 11, 2019 at 05:04:24AM +, Ran Wang wrote: > Hi Sasha, > > Thanks for helping port this patch to stable. > May I know if I can submit other bug fixes which has been accepted by > upstream to stable by myself? > If yes, where I can find related process for reference? Sure!, please read: https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
Re: [PATCH 2/2] cputime: remove duplicate code in account_process_tick
在 2019/7/10 下午10:15, Peter Zijlstra 写道: > On Tue, Jul 09, 2019 at 02:01:00PM +0800, Alex Shi wrote: >> In funcation account_process_tick, func actually do same things with >> irqtime_account_process_tick, whenever if IRQ_TIME_ACCOUNTING set or >> if sched_clock_irqtime enabled. >> >> So it's better to reuse one function for both. > > But it's not the exact same.. and you didn't say, not did you say why > that is fine. > Thanks for reply! The irqtime_account_process_tick path was introduced for precise ns irq time account(abb74cefa9c682fb sched: Export ns irqtimes through /proc/stat) while account_process_tick still use jiffes. but now both pathes are using ns cputime. And there is not strong reason to keep 2 very very similar path coexists. That's the reason I believe unite the collection is better. Thanks Alex
[PATCH 1/1] dt-bindings: interrupt-controller: al-fic: remove redundant binding
Remove dt binding description for standard binding. Signed-off-by: Talel Shenhar --- .../bindings/interrupt-controller/amazon,al-fic.txt | 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Documentation/devicetree/bindings/interrupt-controller/amazon,al-fic.txt b/Documentation/devicetree/bindings/interrupt-controller/amazon,al-fic.txt index 4e82fd5..c676b03 100644 --- a/Documentation/devicetree/bindings/interrupt-controller/amazon,al-fic.txt +++ b/Documentation/devicetree/bindings/interrupt-controller/amazon,al-fic.txt @@ -5,21 +5,19 @@ Required properties: - compatible: should be "amazon,al-fic" - reg: physical base address and size of the registers - interrupt-controller: identifies the node as an interrupt controller -- #interrupt-cells: must be 2. - First cell defines the index of the interrupt within the controller. - Second cell is used to specify the trigger type and must be one of the - following: -- bits[3:0] trigger type and level flags - 1 = low-to-high edge triggered - 4 = active high level-sensitive -- interrupt-parent: specifies the parent interrupt controller. +- #interrupt-cells : must be 2. Specifies the number of cells needed to encode + an interrupt source. Supported trigger types are low-to-high edge + triggered and active high level-sensitive. - interrupts: describes which input line in the interrupt parent, this fic's output is connected to. This field property depends on the parent's binding +Please refer to interrupts.txt in this directory for details of the common +Interrupt Controllers bindings used by client devices. + Example: -amazon_fic: interrupt-controller@0xfd8a8500 { +amazon_fic: interrupt-controller@fd8a8500 { compatible = "amazon,al-fic"; interrupt-controller; #interrupt-cells = <2>; -- 2.7.4
[tip:x86/urgent] x86/stacktrace: Prevent infinite loop in arch_stack_walk_user()
Commit-ID: cbf5b73d162b22e044fe0b7d51dcaa33be065253 Gitweb: https://git.kernel.org/tip/cbf5b73d162b22e044fe0b7d51dcaa33be065253 Author: Eiichi Tsukata AuthorDate: Thu, 11 Jul 2019 11:35:01 +0900 Committer: Thomas Gleixner CommitDate: Thu, 11 Jul 2019 08:22:03 +0200 x86/stacktrace: Prevent infinite loop in arch_stack_walk_user() arch_stack_walk_user() checks `if (fp == frame.next_fp)` to prevent a infinite loop by self reference but it's not enogh for circular reference. Once a lack of return address is found, there is no point to continue the loop, so break out. Fixes: 02b67518e2b1 ("tracing: add support for userspace stacktraces in tracing/iter_ctrl") Signed-off-by: Eiichi Tsukata Signed-off-by: Thomas Gleixner Acked-by: Linus Torvalds Link: https://lkml.kernel.org/r/20190711023501.963-1-de...@etsukata.com --- arch/x86/kernel/stacktrace.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/arch/x86/kernel/stacktrace.c b/arch/x86/kernel/stacktrace.c index 2abf27d7df6b..4f36d3241faf 100644 --- a/arch/x86/kernel/stacktrace.c +++ b/arch/x86/kernel/stacktrace.c @@ -129,11 +129,9 @@ void arch_stack_walk_user(stack_trace_consume_fn consume_entry, void *cookie, break; if ((unsigned long)fp < regs->sp) break; - if (frame.ret_addr) { - if (!consume_entry(cookie, frame.ret_addr, false)) - return; - } - if (fp == frame.next_fp) + if (!frame.ret_addr) + break; + if (!consume_entry(cookie, frame.ret_addr, false)) break; fp = frame.next_fp; }
Re: [PATCH 1/3] opp: core: add regulators enable and disable
On 08-07-19, 16:11, k.koniec...@partner.samsung.com wrote: > From: Kamil Konieczny > > Add enable regulators to dev_pm_opp_set_regulators() and disable > regulators to dev_pm_opp_put_regulators(). This prepares for > converting exynos-bus devfreq driver to use dev_pm_opp_set_rate(). > > Signed-off-by: Kamil Konieczny > --- > drivers/opp/core.c | 13 + > 1 file changed, 13 insertions(+) > > diff --git a/drivers/opp/core.c b/drivers/opp/core.c > index 0e7703fe733f..947cac452854 100644 > --- a/drivers/opp/core.c > +++ b/drivers/opp/core.c > @@ -1580,8 +1580,19 @@ struct opp_table *dev_pm_opp_set_regulators(struct > device *dev, > if (ret) > goto free_regulators; > > + for (i = 0; i < opp_table->regulator_count; i++) { > + ret = regulator_enable(opp_table->regulators[i]); > + if (ret < 0) > + goto disable; > + } What about doing this in the same loop of regulator_get_optional() ? > + > return opp_table; > > +disable: > + while (i != 0) > + regulator_disable(opp_table->regulators[--i]); > + > + i = opp_table->regulator_count; You also need to call _free_set_opp_data() here. > free_regulators: > while (i != 0) > regulator_put(opp_table->regulators[--i]); > @@ -1609,6 +1620,8 @@ void dev_pm_opp_put_regulators(struct opp_table > *opp_table) > > /* Make sure there are no concurrent readers while updating opp_table */ > WARN_ON(!list_empty(&opp_table->opp_list)); Preserve the blank line here. > + for (i = opp_table->regulator_count - 1; i >= 0; i--) > + regulator_disable(opp_table->regulators[i]); > > for (i = opp_table->regulator_count - 1; i >= 0; i--) > regulator_put(opp_table->regulators[i]); Only single loop should be sufficient for this. > -- > 2.22.0 -- viresh
Re: [BUG] lockdep splat with kernfs lockdep annotations and slab mutex from drm patch??
Quoting Steven Rostedt (2019-07-11 03:57:20) > On Fri, 14 Jun 2019 08:38:37 -0700 > Tejun Heo wrote: > > > Hello, > > > > On Fri, Jun 14, 2019 at 04:08:33PM +0100, Chris Wilson wrote: > > > #ifdef CONFIG_MEMCG > > > if (slab_state >= FULL && err >= 0 && is_root_cache(s)) { > > > struct kmem_cache *c; > > > > > > mutex_lock(&slab_mutex); > > > > > > so it happens to hit the error + FULL case with the additional slabcaches? > > > > > > Anyway, according to lockdep, it is dangerous to use the slab_mutex inside > > > slab_attr_store(). > > > > Didn't really look into the code but it looks like slab_mutex is held > > while trying to remove sysfs files. sysfs file removal flushes > > on-going accesses, so if a file operation then tries to grab a mutex > > which is held during removal, it leads to a deadlock. > > > > Looks like this never got fixed and now this bug is in 5.2. git blame gives commit 107dab5c92d5f9c3afe962036e47c207363255c7 Author: Glauber Costa Date: Tue Dec 18 14:23:05 2012 -0800 slub: slub-specific propagation changes for adding the mutex underneath sysfs read, and I think commit d50d82faa0c964e31f7a946ba8aba7c715ca7ab0 Author: Mikulas Patocka Date: Wed Jun 27 23:26:09 2018 -0700 slub: fix failure when we delete and create a slab cache added the sysfs removal underneath the slab_mutex. > Just got this: > > == > WARNING: possible circular locking dependency detected > 5.2.0-test #15 Not tainted > -- > slub_cpu_partia/899 is trying to acquire lock: > 0f6f2dd7 (slab_mutex){+.+.}, at: slab_attr_store+0x6d/0xe0 > > but task is already holding lock: > b23ffe3d (kn->count#160){}, at: kernfs_fop_write+0x125/0x230 > > which lock already depends on the new lock. > > > the existing dependency chain (in reverse order) is: > > -> #1 (kn->count#160){}: > __kernfs_remove+0x413/0x4a0 > kernfs_remove_by_name_ns+0x40/0x80 > sysfs_slab_add+0x1b5/0x2f0 > __kmem_cache_create+0x511/0x560 > create_cache+0xcd/0x1f0 > kmem_cache_create_usercopy+0x18a/0x240 > kmem_cache_create+0x12/0x20 > is_active_nid+0xdb/0x230 [snd_hda_codec_generic] > snd_hda_get_path_idx+0x55/0x80 [snd_hda_codec_generic] > get_nid_path+0xc/0x170 [snd_hda_codec_generic] > do_one_initcall+0xa2/0x394 > do_init_module+0xfd/0x370 > load_module+0x38c6/0x3bd0 > __do_sys_finit_module+0x11a/0x1b0 > do_syscall_64+0x68/0x250 > entry_SYSCALL_64_after_hwframe+0x49/0xbe > > -> #0 (slab_mutex){+.+.}: > lock_acquire+0xbd/0x1d0 > __mutex_lock+0xfc/0xb70 > slab_attr_store+0x6d/0xe0 > kernfs_fop_write+0x170/0x230 > vfs_write+0xe1/0x240 > ksys_write+0xba/0x150 > do_syscall_64+0x68/0x250 > entry_SYSCALL_64_after_hwframe+0x49/0xbe > > other info that might help us debug this: > > Possible unsafe locking scenario: > > CPU0CPU1 > >lock(kn->count#160); > lock(slab_mutex); > lock(kn->count#160); >lock(slab_mutex); > > *** DEADLOCK *** > > > > Attached is a config and the full dmesg. > > -- Steve >
Re: [PATCHv3 6/6] drivers/cpufreq: Add a CPUFreq driver for AMD processors (Fam17h and later)
On 10-07-19, 18:37, Natarajan, Janakarajan wrote: > diff --git a/drivers/cpufreq/amd-cpufreq.c b/drivers/cpufreq/amd-cpufreq.c > +#define pr_fmt(fmt) "AMD Cpufreq: " fmt > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include Please keep them in alphabetical order. > + > +#include > + > +#include > + > +struct amd_desc { > + int cpu_id; > + struct cppc_ctrls ctrls; > + struct kobject kobj; > +}; > + > +struct amd_desc **all_cpu_data; > + > +static unsigned int cppc_enable; > +module_param(cppc_enable, uint, 0644); > +MODULE_PARM_DESC(cppc_enable, > + "1 - enable AMD CpuFreq, create CPPC sysfs entries."); > + > +#define to_amd_desc(a) container_of(a, struct amd_desc, kobj) > + > +#define show_func(access_fn, struct_name, member_name) > \ > + static ssize_t show_##member_name(struct kobject *kobj, \ > + struct kobj_attribute *attr, \ > + char *buf)\ > + { \ > + struct amd_desc *desc = to_amd_desc(kobj); \ > + struct struct_name st_name = {0}; \ > + int ret;\ > + \ > + ret = access_fn(desc->cpu_id, &st_name);\ > + if (ret)\ > + return ret; \ > + \ > + return scnprintf(buf, PAGE_SIZE, "%llu\n", \ > + (u64)st_name.member_name); \ > + } \ > + > +#define store_func(struct_name, member_name, reg_idx) > \ > + static ssize_t store_##member_name(struct kobject *kobj,\ > +struct kobj_attribute *attr, \ > +const char *buf, size_t count)\ > + { \ > + struct amd_desc *desc = to_amd_desc(kobj); \ > + struct struct_name st_name = {0}; \ > + u32 val;\ > + int ret;\ > + \ > + ret = kstrtou32(buf, 0, &val); \ > + if (ret)\ > + return ret; \ > + \ > + st_name.member_name = val; \ > + \ > + ret = cppc_set_reg(desc->cpu_id, &st_name, reg_idx);\ > + if (ret)\ > + return ret; \ > + \ > + return count; \ > + } \ > + > +#define define_one_rw(struct_name, access_fn, member_name, reg_idx) \ > + show_func(access_fn, struct_name, member_name) \ > + store_func(struct_name, member_name, reg_idx) \ > + define_one_global_rw(member_name) > + > +define_one_rw(cppc_ctrls, cppc_get_ctrls, enable, ENABLE); > +define_one_rw(cppc_ctrls, cppc_get_ctrls, max_perf, MAX_PERF); > +define_one_rw(cppc_ctrls, cppc_get_ctrls, min_perf, MIN_PERF); > +define_one_rw(cppc_ctrls, cppc_get_ctrls, desired_perf, DESIRED_PERF); > +define_one_rw(cppc_ctrls, cppc_get_ctrls, auto_sel_enable, AUTO_SEL_ENABLE); > + > +static struct attribute *amd_cpufreq_attributes[] = { > + &enable.attr, > + &max_perf.attr, > + &min_perf.attr, > + &desired_perf.attr, > + &auto_sel_enable.attr, > + NULL > +}; > + > +static const struct attribute_group amd_cpufreq_attr_group = { > + .attrs = amd_cpufreq_attributes, > +}; > + > +static struct kobj_type amd_cpufreq_type = { > + .sysfs_ops = &kobj_sysfs_ops, > + .default_attrs = amd_cpufreq_attributes, > +}; > + > +static int amd_cpufreq_cpu_init(struct cpufreq_policy *policy) > +{ > + return 0; > +} > + > +static int amd_cpufreq_cpu_exit(struct cpufreq_policy *policy) > +{ > + return 0; > +} > + > +static int amd_cpufreq_cpu_verify(struct cpufreq_policy *policy) > +{ > + return 0; > +} > + > +static int a
Re: [PATCH V3 2/2] ASoC: fsl_esai: recover the channel swap after xrun
> > Hi Shengjiu, > > Mostly looks good to me, just some small comments. > > On Mon, Jul 08, 2019 at 02:38:52PM +0800, shengjiu.w...@nxp.com wrote: > > > +static void fsl_esai_hw_reset(unsigned long arg) { > > + struct fsl_esai *esai_priv = (struct fsl_esai *)arg; > > + u32 saisr, tfcr, rfcr; > > + bool tx = true, rx = false, enabled[2]; > > Could we swap the lines of u32 and bool? It'd look better. > > > + regmap_update_bits(esai_priv->regmap, REG_ESAI_TCR, > > +ESAI_xCR_xPR_MASK, ESAI_xCR_xPR); > > + regmap_update_bits(esai_priv->regmap, REG_ESAI_RCR, > > +ESAI_xCR_xPR_MASK, ESAI_xCR_xPR); > > Let's add a line of comments for these two: > /* Enforce ESAI personal resets for both TX and RX */ > > > + /* > > + * Restore registers by regcache_sync, and ignore > > + * return value > > + */ > > Could fit into single-line? > > > + regmap_update_bits(esai_priv->regmap, REG_ESAI_TCR, > > +ESAI_xCR_xPR_MASK, 0); > > + regmap_update_bits(esai_priv->regmap, REG_ESAI_RCR, > > +ESAI_xCR_xPR_MASK, 0); > > + > > + regmap_update_bits(esai_priv->regmap, REG_ESAI_PRRC, > > +ESAI_PRRC_PDC_MASK, ESAI_PRRC_PDC(ESAI_GPIO)); > > + regmap_update_bits(esai_priv->regmap, REG_ESAI_PCRC, > > +ESAI_PCRC_PC_MASK, ESAI_PCRC_PC(ESAI_GPIO)); > > Could remove the blank line and add a line of comments: > /* Remove ESAI personal resets by configuring PCRC and PRRC also */ > > Btw, I still feel this personal reset can be stuffed into one of the wrapper > functions. But let's keep this simple for now. > > > + regmap_read(esai_priv->regmap, REG_ESAI_SAISR, &saisr); > > Why do we read saisr here? All its bits would get cleared by the hardware > reset. If it's a must to clear again, we should add a line of comments to > emphasize it. This line can be removed. Best regards Wang Shengjiu
Re: [PATCH v2] module: add usage links when calling ref_module func
On 2019/7/10 0:10, Jessica Yu wrote: > +++ Zhiqiang Liu [03/07/19 10:09 +0800]: >> From: Zhiqiang Liu > >> V1->V2: >> - remove incorrect Fixes tag >> - fix error handling of sysfs_create_link as suggested by Jessica Yu >> >> Signed-off-by: Zhiqiang Liu >> Suggested-by: Jessica Yu >> Reviewed-by: Kang Zhou >> --- >> kernel/module.c | 18 ++ >> 1 file changed, 14 insertions(+), 4 deletions(-) >> >> diff --git a/kernel/module.c b/kernel/module.c >> index 80c7c09584cf..672abcec 100644 >> --- a/kernel/module.c >> +++ b/kernel/module.c >> @@ -837,25 +837,26 @@ static int already_uses(struct module *a, struct >> module *b) >> ?0?2*?0?2?0?2?0?2 'b' can walk the list to see who sourced them), and of 'a' >> ?0?2*?0?2?0?2?0?2 targets (so 'a' can see what modules it targets). >> ?0?2*/ >> /* Module a uses b: caller needs module_mutex() */ >> int ref_module(struct module *a, struct module *b) >> { >> +?0?2?0?2?0?2 struct module_use *use; >> ?0?2?0?2?0?2?0?2int err; >> >> ?0?2?0?2?0?2?0?2if (b == NULL || already_uses(a, b)) >> @@ -866,9 +867,18 @@ int ref_module(struct module *a, struct module *b) >> ?0?2?0?2?0?2?0?2if (err) >> ?0?2?0?2?0?2?0?2?0?2?0?2?0?2 return err; >> >> -?0?2?0?2?0?2 err = add_module_usage(a, b); >> +?0?2?0?2?0?2 use = add_module_usage(a, b); >> +?0?2?0?2?0?2 if (!use) { >> +?0?2?0?2?0?2?0?2?0?2?0?2?0?2 module_put(b); >> +?0?2?0?2?0?2?0?2?0?2?0?2?0?2 return -ENOMEM; >> +?0?2?0?2?0?2 } >> + >> +?0?2?0?2?0?2 err = sysfs_create_link(b->holders_dir, &a->mkobj.kobj, >> a->name); > > Sigh. This ultimately doesn't work because in load_module(), we use > ref_module() in resolve_symbol(), and mod->mkobj.kobj doesn't get > initialized until mod_sysfs_init(), which happens much later in > load_module(). So what happens is that the ref_module(mod, owner) call > in resolve_symbol() returns an error because sysfs_create_link() fails here. > We could *maybe* move sysfs initialization earlier in load_module() > but that is an entirely untested idea and I would need to think about > that more. Thank you for the reply. I have tested the patch through livepatch. Maybe I miss somethings. I will rewrite the patch and test it entirely before sending the v3 patch. Thanks again.
Re: [PATCH] net/mlx5e: Move priv variable into case statement in mlx5e_setup_tc
On Wed, Jul 10, 2019 at 11:02:00PM -0700, Saeed Mahameed wrote: > On Wed, Jul 10, 2019 at 12:05 PM Nathan Chancellor > wrote: > > > > There is an unused variable warning on arm64 defconfig when > > CONFIG_MLX5_ESWITCH is unset: > > > > drivers/net/ethernet/mellanox/mlx5/core/en_main.c:3467:21: warning: > > unused variable 'priv' [-Wunused-variable] > > struct mlx5e_priv *priv = netdev_priv(dev); > >^ > > 1 warning generated. > > > > Move it down into the case statement where it is used. > > > > Fixes: 4e95bc268b91 ("net: flow_offload: add flow_block_cb_setup_simple()") > > Link: https://github.com/ClangBuiltLinux/linux/issues/597 > > Signed-off-by: Nathan Chancellor > > --- > > drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 7 --- > > 1 file changed, 4 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c > > b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c > > index 6d0ae87c8ded..651eb714eb5b 100644 > > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c > > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c > > @@ -3464,15 +3464,16 @@ static LIST_HEAD(mlx5e_block_cb_list); > > static int mlx5e_setup_tc(struct net_device *dev, enum tc_setup_type type, > > void *type_data) > > { > > - struct mlx5e_priv *priv = netdev_priv(dev); > > - > > switch (type) { > > #ifdef CONFIG_MLX5_ESWITCH > > - case TC_SETUP_BLOCK: > > + case TC_SETUP_BLOCK: { > > + struct mlx5e_priv *priv = netdev_priv(dev); > > + > > return flow_block_cb_setup_simple(type_data, > > &mlx5e_block_cb_list, > > mlx5e_setup_tc_block_cb, > > priv, priv, true); > > + } > > Hi Nathan, > > We have another patch internally that fixes this, and it is already > queued up in my queue. > it works differently as we want to pass priv instead of netdev to > mlx5e_setup_tc_mqprio below, > which will also solve warning .. > > So i would like to submit that patch if it is ok with you ? Hi Saeed, Whatever works best for you, I just care that the warning gets fixed, not how it is done :) I wouldn't mind being put on CC so I can pick it up for my local tests. Thanks for the follow up! Nathan
Re: [PATCH] net/mlx5e: Move priv variable into case statement in mlx5e_setup_tc
On Wed, Jul 10, 2019 at 12:05 PM Nathan Chancellor wrote: > > There is an unused variable warning on arm64 defconfig when > CONFIG_MLX5_ESWITCH is unset: > > drivers/net/ethernet/mellanox/mlx5/core/en_main.c:3467:21: warning: > unused variable 'priv' [-Wunused-variable] > struct mlx5e_priv *priv = netdev_priv(dev); >^ > 1 warning generated. > > Move it down into the case statement where it is used. > > Fixes: 4e95bc268b91 ("net: flow_offload: add flow_block_cb_setup_simple()") > Link: https://github.com/ClangBuiltLinux/linux/issues/597 > Signed-off-by: Nathan Chancellor > --- > drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 7 --- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c > b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c > index 6d0ae87c8ded..651eb714eb5b 100644 > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c > @@ -3464,15 +3464,16 @@ static LIST_HEAD(mlx5e_block_cb_list); > static int mlx5e_setup_tc(struct net_device *dev, enum tc_setup_type type, > void *type_data) > { > - struct mlx5e_priv *priv = netdev_priv(dev); > - > switch (type) { > #ifdef CONFIG_MLX5_ESWITCH > - case TC_SETUP_BLOCK: > + case TC_SETUP_BLOCK: { > + struct mlx5e_priv *priv = netdev_priv(dev); > + > return flow_block_cb_setup_simple(type_data, > &mlx5e_block_cb_list, > mlx5e_setup_tc_block_cb, > priv, priv, true); > + } Hi Nathan, We have another patch internally that fixes this, and it is already queued up in my queue. it works differently as we want to pass priv instead of netdev to mlx5e_setup_tc_mqprio below, which will also solve warning .. So i would like to submit that patch if it is ok with you ? > #endif > case TC_SETUP_QDISC_MQPRIO: > return mlx5e_setup_tc_mqprio(dev, type_data); > -- > 2.22.0 >
Re: [PATCH v2] arm64: Kconfig.platforms: Enable GPIO_DAVINCI for ARCH_K3
On 29/06/19 2:07 AM, Nishanth Menon wrote: On 09:08-20190628, Keerthy wrote: [..] + select GPIO_SYSFS + select GPIO_DAVINCI Could you help explain the logic of doing this? commit message is basically the diff in English. To me, this does NOT make sense. I understand GPIO_DAVINCI is the driver compatible, but we cant do this for every single SoC driver that is NOT absolutely mandatory for basic functionality. In case of ARM64 could you help me find the right place to enable such SoC specific configs? Is'nt that what defconfig is supposed to be all about? arch/arm64/configs/defconfig Also keep in mind the impact to arm64/configs/defconfig -> every single SoC in the arm64 world will be now rebuild with GPIO_SYSFS.. why force that? This was the practice in arm32 soc specific configs like omap2plus_defconfig. GPIO_SYSFS was he only way to validate. Now i totally understand your concern about every single SoC rebuilding but now where do we need to enable the bare minimal GPIO_DAVINCI config? Well, SYSFS, I cannot agree testing as the rationale in Kconfig.platform. And, looking at [1], I see majority being mandatory components for the SoC bootup. However, most of the "optional" drivers go into arm64 as defconfig (preferably as a module?) and if you find a rationale for recommending DEBUG_GPIO, you could propose that to the community as well. Now, Thinking about this, I'd even challenge the current list of configs as being "select". I'd rather do an "imply"[2] - yes, you need this for the default dtb to boot, however a carefully carved dtb could boot with lesser driver set to get a smaller (and less functional) kernel. v1 i received feedback from Tero to enable in Kconfig.platforms. Hence i shifted to this approach. I noticed that you were posting a v2, for future reference, please use diffstat section to point to lore/patchworks link to point at v1 (I did notice you mentioned you had an update, thanks - link will help catch up on older discussions). This helps a later revision reviewer like me to get context. Tero, would you be able to help with a better rationale as to where the boundaries are to be in your mind, rather than risk every single peripheral driver getting into ARCH_K3? Tero, Could you point me to a better place for enabling? - Keerthy As of right now, I'd rather we do not explode the current list out of bounds. NAK unless we can find a better rationale. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/Kconfig.platforms [2] https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt
[PATCH v2 01/11] kbuild: do not create empty modules.order in the prepare stage
Currently, $(objtree)/modules.order is touched in two places. In the 'prepare0' rule, scripts/Makefile.build creates an empty modules.order while processing 'obj=.' In the 'modules' rule, the top-level Makefile overwrites it with the correct list of modules. While this might be a good side-effect that modules.order is made empty every time (probably this is not intended functionality), I personally do not like this behavior. Create modules.order only when it is sensible to do so. This avoids creating the following pointless files: scripts/basic/modules.order scripts/dtc/modules.order scripts/gcc-plugins/modules.order scripts/genksyms/modules.order scripts/mod/modules.order scripts/modules.order scripts/selinux/genheaders/modules.order scripts/selinux/mdp/modules.order scripts/selinux/modules.order Going forward, $(objtree)/modules.order lists the modules that was built in the last successful build. Signed-off-by: Masahiro Yamada --- Changes in v2: - inverted the logic "preparing" -> need-modorder Makefile | 4 ++-- scripts/Makefile.build | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 5c75ea7177f6..d8421d245f75 100644 --- a/Makefile +++ b/Makefile @@ -1076,7 +1076,7 @@ $(sort $(vmlinux-deps)): $(vmlinux-dirs) ; PHONY += $(vmlinux-dirs) $(vmlinux-dirs): prepare - $(Q)$(MAKE) $(build)=$@ need-builtin=1 + $(Q)$(MAKE) $(build)=$@ need-builtin=1 need-modorder=1 filechk_kernel.release = \ echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" @@ -1611,7 +1611,7 @@ $(objtree)/Module.symvers: module-dirs := $(addprefix _module_,$(KBUILD_EXTMOD)) PHONY += $(module-dirs) modules $(module-dirs): prepare $(objtree)/Module.symvers - $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@) + $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@) need-modorder=1 modules: $(module-dirs) @$(kecho) ' Building modules, stage 2.'; diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 776842b7e6a3..e9b3d88257dd 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -63,7 +63,7 @@ ifneq ($(strip $(real-obj-y) $(need-builtin)),) builtin-target := $(obj)/built-in.a endif -ifdef CONFIG_MODULES +ifeq ($(CONFIG_MODULES)$(need-modorder),y1) modorder-target := $(obj)/modules.order endif -- 2.17.1
[PATCH v2 05/11] kbuild: modinst: read modules.order instead of $(MODVERDIR)/*.mod
Towards the goal of removing MODVERDIR, read out modules.order to get the list of modules to be installed. This is simpler than parsing *.mod files in $(MODVERDIR). For external modules, $(KBUILD_EXTMOD)/modules.order should be read. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/Makefile.modinst | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst index 0dae402661f3..5a4579e76485 100644 --- a/scripts/Makefile.modinst +++ b/scripts/Makefile.modinst @@ -8,10 +8,7 @@ __modinst: include scripts/Kbuild.include -# - -__modules := $(sort $(shell grep -h '\.ko$$' /dev/null $(wildcard $(MODVERDIR)/*.mod))) -modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o))) +modules := $(sort $(shell cat $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)modules.order)) PHONY += $(modules) __modinst: $(modules) -- 2.17.1
[PATCH v2 09/11] kbuild: remove the first line of *.mod files
The current format of *.mod is like this: line 1: directory path to the .ko file line 2: a list of objects linked into this module line 3: unresolved symbols (only when CONFIG_TRIM_UNUSED_KSYMS=y) Now that *.mod and *.ko are created in the same directory, the line 1 provides no valuable information. It can be derived by replacing the extension .mod with .ko. Cut the first line. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/Makefile.build | 4 ++-- scripts/adjust_autoksyms.sh | 2 +- scripts/mod/sumversion.c| 9 ++--- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 9fb30633acd2..2709646b1a5d 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -279,7 +279,7 @@ $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE $(single-used-m): $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE $(call cmd,force_checksrc) $(call if_changed_rule,cc_o_c) - @{ echo $(@:.o=.ko); echo $@; \ + @{ echo $@; \ $(cmd_undef_syms); } > $(patsubst %.o,%.mod,$@) quiet_cmd_cc_lst_c = MKLST $@ @@ -461,7 +461,7 @@ cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(filter %.o,$^) $(cmd_secanalysis $(multi-used-m): FORCE $(call if_changed,link_multi-m) - @{ echo $(@:.o=.ko); echo $(filter %.o,$^); \ + @{ echo $(filter %.o,$^); \ $(cmd_undef_syms); } > $(patsubst %.o,%.mod,$@) $(call multi_depend, $(multi-used-m), .o, -objs -y -m) diff --git a/scripts/adjust_autoksyms.sh b/scripts/adjust_autoksyms.sh index 8b44bb80a451..89871cae3954 100755 --- a/scripts/adjust_autoksyms.sh +++ b/scripts/adjust_autoksyms.sh @@ -48,7 +48,7 @@ cat > "$new_ksyms_file" << EOT EOT sed 's/ko$/mod/' modules.order | -xargs -n1 sed -n -e '3{s/ /\n/g;/^$/!p;}' -- | +xargs -n1 sed -n -e '2{s/ /\n/g;/^$/!p;}' -- | sort -u | sed -e 's/\(.*\)/#define __KSYM_\1 1/' >> "$new_ksyms_file" diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c index 166f3fa247a9..63062024ce0e 100644 --- a/scripts/mod/sumversion.c +++ b/scripts/mod/sumversion.c @@ -398,7 +398,7 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen) char *sources, *end, *fname; char filelist[PATH_MAX + 1]; - /* objects for a module are listed in the second line of *.mod file. */ + /* objects for a module are listed in the first line of *.mod file. */ snprintf(filelist, sizeof(filelist), "%.*smod", (int)strlen(modname) - 1, modname); @@ -407,13 +407,8 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen) /* not a module or .mod file missing - ignore */ return; - sources = strchr(file, '\n'); - if (!sources) { - warn("malformed versions file for %s\n", modname); - goto release; - } + sources = file; - sources++; end = strchr(sources, '\n'); if (!end) { warn("bad ending versions file for %s\n", modname); -- 2.17.1
[PATCH v2 03/11] kbuild: remove duplication from modules.order in sub-directories
Currently, only the top-level modules.order drops duplicated entries. The modules.order files in sub-directories potentially contain duplication. To list out the paths of all modules, I want to use modules.order instead of parsing *.mod files in $(MODVERDIR). To achieve this, I want to rip off duplication from modules.order of external modules too. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/Makefile.build | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index f21d691c776a..98dede0b2ca8 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -423,13 +423,10 @@ endif # builtin-target # # Create commands to either record .ko file or cat modules.order from # a subdirectory -modorder-cmds =\ - $(foreach m, $(modorder), \ - $(if $(filter %/modules.order, $m), \ - cat $m;, echo $m;)) - $(modorder-target): $(subdir-ym) FORCE - $(Q)(cat /dev/null; $(modorder-cmds)) > $@ + $(Q){ $(foreach m, $(modorder), \ + $(if $(filter %/modules.order, $m), cat $m, echo $m);) :; } \ + | $(AWK) '!x[$$0]++' - > $@ # # Rule to compile a set of .o files into one .a file (with symbol table) -- 2.17.1
[PATCH v2 07/11] kbuild: modpost: read modules.order instead of $(MODVERDIR)/*.mod
Towards the goal of removing MODVERDIR, read out modules.order to get the list of modules to be processed. This is simpler than parsing *.mod files in $(MODVERDIR). For external modules, $(KBUILD_EXTMOD)/modules.order should be read. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/Makefile.modpost | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index fec6ec2ffa47..2ab1694a7df3 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -8,9 +8,10 @@ # b) A .o file which is the .o files above linked together # c) A .mod file in $(MODVERDIR)/, listing the name of the #the preliminary .o file, plus all .o files +# d) modules.order, which lists all the modules # Stage 2 is handled by this file and does the following -# 1) Find all modules from the files listed in $(MODVERDIR)/ +# 1) Find all modules listed in modules.order # 2) modpost is then used to # 3) create one .mod.c file pr. module # 4) create one Module.symvers file with CRC for all exported symbols @@ -60,10 +61,10 @@ include scripts/Makefile.lib kernelsymfile := $(objtree)/Module.symvers modulesymfile := $(firstword $(KBUILD_EXTMOD))/Module.symvers -# Step 1), find all modules listed in $(MODVERDIR)/ -MODLISTCMD := find $(MODVERDIR) -name '*.mod' | xargs -r grep -h '\.ko$$' | sort -u -__modules := $(shell $(MODLISTCMD)) -modules := $(patsubst %.o,%.ko, $(wildcard $(__modules:.ko=.o))) +modorder := $(if $(KBUILD_EXTMOD),$(KBUILD_EXTMOD)/)modules.order + +# Step 1), find all modules listed in modules.order +modules := $(sort $(shell cat $(modorder))) # Stop after building .o files if NOFINAL is set. Makes compile tests quicker _modpost: $(if $(KBUILD_MODPOST_NOFINAL), $(modules:.ko:.o),$(modules)) @@ -84,7 +85,7 @@ MODPOST_OPT=$(subst -i,-n,$(filter -i,$(MAKEFLAGS))) # We can go over command line length here, so be careful. quiet_cmd_modpost = MODPOST $(words $(filter-out vmlinux FORCE, $^)) modules - cmd_modpost = $(MODLISTCMD) | sed 's/\.ko$$/.o/' | $(modpost) $(MODPOST_OPT) -s -T - + cmd_modpost = sed 's/ko$$/o/' $(modorder) | $(modpost) $(MODPOST_OPT) -s -T - PHONY += __modpost __modpost: $(modules:.ko=.o) FORCE -- 2.17.1
[PATCH v2 06/11] kbuild: modsign: read modules.order instead of $(MODVERDIR)/*.mod
Towards the goal of removing MODVERDIR, read out modules.order to get the list of modules to be signed. This is simpler than parsing *.mod files in $(MODVERDIR). The modules_sign target is only supported for in-kernel modules. So, this commit does not take care of external modules. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/Makefile.modsign | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/Makefile.modsign b/scripts/Makefile.modsign index da56aa78d245..d7325cefe709 100644 --- a/scripts/Makefile.modsign +++ b/scripts/Makefile.modsign @@ -8,8 +8,7 @@ __modsign: include scripts/Kbuild.include -__modules := $(sort $(shell grep -h '\.ko$$' /dev/null $(wildcard $(MODVERDIR)/*.mod))) -modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o))) +modules := $(sort $(shell cat modules.order)) PHONY += $(modules) __modsign: $(modules) -- 2.17.1
[PATCH v2 02/11] kbuild: get rid of kernel/ prefix from in-tree modules.{order,builtin}
Removing the 'kernel/' prefix will make our life easier because we can simply do 'cat modules.order' to get all built modules with full paths. Currently, we parse the first line of '*.mod' files in $(MODVERDIR). Since we have duplicated functionality here, I plan to remove MODVERDIR entirely. In fact, modules.order is generated also for external modules in a broken format. It adds the 'kernel/' prefix to the absolute path of the module, like this: kernel//path/to/your/external/module/foo.ko This is fine for now since modules.order is not used for external modules. However, I want to sanitize the format everywhere towards the goal of removing MODVERDIR. We cannot change the format of installed module.{order,builtin}. So, 'make modules_install' will add the 'kernel/' prefix while copying them to $(MODLIB)/. Signed-off-by: Masahiro Yamada --- Changes in v2: None Makefile| 4 ++-- scripts/Makefile.build | 2 +- scripts/Makefile.modbuiltin | 2 +- scripts/modules-check.sh| 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index d8421d245f75..b5e21d676ee2 100644 --- a/Makefile +++ b/Makefile @@ -1333,8 +1333,8 @@ _modinst_: rm -f $(MODLIB)/build ; \ ln -s $(CURDIR) $(MODLIB)/build ; \ fi - @cp -f $(objtree)/modules.order $(MODLIB)/ - @cp -f $(objtree)/modules.builtin $(MODLIB)/ + @sed 's:^:kernel/:' modules.order > $(MODLIB)/modules.order + @sed 's:^:kernel/:' modules.builtin > $(MODLIB)/modules.builtin @cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/ $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modinst diff --git a/scripts/Makefile.build b/scripts/Makefile.build index e9b3d88257dd..f21d691c776a 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -426,7 +426,7 @@ endif # builtin-target modorder-cmds =\ $(foreach m, $(modorder), \ $(if $(filter %/modules.order, $m), \ - cat $m;, echo kernel/$m;)) + cat $m;, echo $m;)) $(modorder-target): $(subdir-ym) FORCE $(Q)(cat /dev/null; $(modorder-cmds)) > $@ diff --git a/scripts/Makefile.modbuiltin b/scripts/Makefile.modbuiltin index ea90a90b41a0..12ac300fe51b 100644 --- a/scripts/Makefile.modbuiltin +++ b/scripts/Makefile.modbuiltin @@ -40,7 +40,7 @@ __modbuiltin: $(modbuiltin-target) $(subdir-ym) @: $(modbuiltin-target): $(subdir-ym) FORCE - $(Q)(for m in $(modbuiltin-mods); do echo kernel/$$m; done; \ + $(Q)(for m in $(modbuiltin-mods); do echo $$m; done;\ cat /dev/null $(modbuiltin-subdirs)) > $@ PHONY += FORCE diff --git a/scripts/modules-check.sh b/scripts/modules-check.sh index 39e8cb36ba19..f51f446707b8 100755 --- a/scripts/modules-check.sh +++ b/scripts/modules-check.sh @@ -9,7 +9,7 @@ check_same_name_modules() for m in $(sed 's:.*/::' modules.order | sort | uniq -d) do echo "warning: same module names found:" >&2 - sed -n "/\/$m/s:^kernel/: :p" modules.order >&2 + sed -n "/\/$m/s:^: :p" modules.order >&2 done } -- 2.17.1
[PATCH v2 10/11] kbuild: remove 'prepare1' target
Now that there is no rule for 'prepare1', it can go away. Signed-off-by: Masahiro Yamada --- Changes in v2: None Makefile | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 4243b6daffcf..8de893e41149 100644 --- a/Makefile +++ b/Makefile @@ -1093,7 +1093,7 @@ scripts: scripts_basic scripts_dtc # archprepare is used in arch Makefiles and when processed asm symlink, # version.h and scripts_basic is processed / created. -PHONY += prepare archprepare prepare1 prepare3 +PHONY += prepare archprepare prepare3 # prepare3 is used to check if we are building in a separate output directory, # and if so do: @@ -1110,10 +1110,8 @@ ifneq ($(srctree),.) fi; endif -prepare1: prepare3 outputmakefile asm-generic $(version_h) $(autoksyms_h) \ - include/generated/utsrelease.h - -archprepare: archheaders archscripts prepare1 scripts +archprepare: archheaders archscripts scripts prepare3 outputmakefile \ + asm-generic $(version_h) $(autoksyms_h) include/generated/utsrelease.h prepare0: archprepare $(Q)$(MAKE) $(build)=scripts/mod -- 2.17.1
[PATCH v2 08/11] kbuild: create *.mod with full directory path and remove MODVERDIR
While descending directories, Kbuild produces objects for modules, but do not link final *.ko files; it is done in the modpost. To keep track of modules, Kbuild creates a *.mod file in $(MODVERDIR) for every module it is building. Some post-processing steps read the necessary information from *.mod files. This avoids descending into directories again. This mechanism was introduced in 2003 or so. Later, commit 551559e13af1 ("kbuild: implement modules.order") added modules.order. So, we can simply read it out to know all the modules with directory paths. This is easier than parsing the first line of *.mod files. $(MODVERDIR) has a flat directory structure, that is, *.mod files are named only with base names. This is based on the assumption that the module name is unique across the tree. This assumption is really fragile. Stephen Rothwell reported a race condition caused by a module name conflict: https://lkml.org/lkml/2019/5/13/991 In parallel building, two different threads could write to the same $(MODVERDIR)/*.mod simultaneously. Non-unique module names are the source of all kind of troubles, hence commit 3a48a91901c5 ("kbuild: check uniqueness of module names") introduced a new checker script. However, it is still fragile in the build system point of view because this race happens before scripts/modules-check.sh is invoked. If it happens again, the modpost will emit unclear error messages. To fix this issue completely, create *.mod in the same directory as *.ko so that two threads never attempt to write to the same file. $(MODVERDIR) is no longer needed. Since modules with directory paths are listed in modules.order, Kbuild is still able to find *.mod files without additional descending. Signed-off-by: Masahiro Yamada Acked-by: Nicolas Pitre --- Changes in v2: - Remove -r of xargs, which is a GNU extension - Add '--' for extra safety .gitignore | 1 + Documentation/dontdiff | 1 + Makefile| 20 +++- scripts/Makefile.build | 8 ++-- scripts/Makefile.modpost| 4 ++-- scripts/adjust_autoksyms.sh | 11 --- scripts/mod/sumversion.c| 16 +++- scripts/package/mkspec | 2 +- 8 files changed, 17 insertions(+), 46 deletions(-) diff --git a/.gitignore b/.gitignore index 7587ef56b92d..8f5422cba6e2 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ *.lz4 *.lzma *.lzo +*.mod *.mod.c *.o *.o.* diff --git a/Documentation/dontdiff b/Documentation/dontdiff index 5eba889ea84d..9f4392876099 100644 --- a/Documentation/dontdiff +++ b/Documentation/dontdiff @@ -30,6 +30,7 @@ *.lzo *.mo *.moc +*.mod *.mod.c *.o *.o.* diff --git a/Makefile b/Makefile index b5e21d676ee2..4243b6daffcf 100644 --- a/Makefile +++ b/Makefile @@ -488,11 +488,6 @@ export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL export KBUILD_ARFLAGS -# When compiling out-of-tree modules, put MODVERDIR in the module -# tree rather than in the kernel tree. The kernel tree might -# even be read-only. -export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions - # Files to ignore in find ... statements export RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o \ @@ -1033,7 +1028,7 @@ vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS) # Recurse until adjust_autoksyms.sh is satisfied PHONY += autoksyms_recursive -autoksyms_recursive: $(vmlinux-deps) +autoksyms_recursive: $(vmlinux-deps) modules.order ifdef CONFIG_TRIM_UNUSED_KSYMS $(Q)$(CONFIG_SHELL) $(srctree)/scripts/adjust_autoksyms.sh \ "$(MAKE) -f $(srctree)/Makefile vmlinux" @@ -1117,7 +1112,6 @@ endif prepare1: prepare3 outputmakefile asm-generic $(version_h) $(autoksyms_h) \ include/generated/utsrelease.h - $(cmd_crmodverdir) archprepare: archheaders archscripts prepare1 scripts @@ -1375,7 +1369,7 @@ endif # CONFIG_MODULES # make distclean Remove editor backup files, patch leftover files and the like # Directories & files removed with 'make clean' -CLEAN_DIRS += $(MODVERDIR) include/ksym +CLEAN_DIRS += include/ksym CLEAN_FILES += modules.builtin.modinfo # Directories & files removed with 'make mrproper' @@ -1636,7 +1630,6 @@ PHONY += $(clean-dirs) clean $(clean-dirs): $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) -clean: rm-dirs := $(MODVERDIR) clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers PHONY += help @@ -1650,8 +1643,6 @@ help: @echo '' PHONY += prepare -prepare: - $(cmd_crmodverdir) endif # KBUILD_EXTMOD clean: $(clean-dirs) @@ -1662,7 +1653,7 @@ clean: $(clean-dirs) -o -name '*.ko.*' \ -o -name '*.dtb' -o -name '*.dtb.S' -o -name '*.dt.yaml' \ -o -name '*.dwo' -o -name '*.lst' \ - -o -name '*.su' \ + -o -
[PATCH v2 00/11] kbuild: create *.mod with directory path and remove MODVERDIR
This series kills the long standing MODVERDIR. Since MODVERDIR has a flat structure, it cannot avoid a race condition when somebody introduces a module name conflict. Kbuild now reads modules.order to get the list of all modules. The post-processing/installation stages will be more robust and simpler. Masahiro Yamada (11): kbuild: do not create empty modules.order in the prepare stage kbuild: get rid of kernel/ prefix from in-tree modules.{order,builtin} kbuild: remove duplication from modules.order in sub-directories scsi: remove pointless $(MODVERDIR)/$(obj)/53c700.ver kbuild: modinst: read modules.order instead of $(MODVERDIR)/*.mod kbuild: modsign: read modules.order instead of $(MODVERDIR)/*.mod kbuild: modpost: read modules.order instead of $(MODVERDIR)/*.mod kbuild: create *.mod with full directory path and remove MODVERDIR kbuild: remove the first line of *.mod files kbuild: remove 'prepare1' target kbuild: split out *.mod out of {single,multi}-used-m rules .gitignore | 1 + Documentation/dontdiff | 1 + Makefile| 36 ++-- drivers/scsi/Makefile | 2 +- scripts/Makefile.build | 33 +++-- scripts/Makefile.modbuiltin | 2 +- scripts/Makefile.modinst| 5 + scripts/Makefile.modpost| 17 + scripts/Makefile.modsign| 3 +-- scripts/adjust_autoksyms.sh | 11 --- scripts/mod/sumversion.c| 23 --- scripts/modules-check.sh| 2 +- scripts/package/mkspec | 2 +- 13 files changed, 50 insertions(+), 88 deletions(-) -- 2.17.1
[PATCH v2 04/11] scsi: remove pointless $(MODVERDIR)/$(obj)/53c700.ver
Nothing depends on this, so it is dead code. Signed-off-by: Masahiro Yamada --- I will apply this to kbuild tree since it is trivial. Changes in v2: None drivers/scsi/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile index 8826111fdf4a..acdd57e647f8 100644 --- a/drivers/scsi/Makefile +++ b/drivers/scsi/Makefile @@ -183,7 +183,7 @@ zalon7xx-objs := zalon.o ncr53c8xx.o # Files generated that shall be removed upon make clean clean-files := 53c700_d.h 53c700_u.h scsi_devinfo_tbl.c -$(obj)/53c700.o $(MODVERDIR)/$(obj)/53c700.ver: $(obj)/53c700_d.h +$(obj)/53c700.o: $(obj)/53c700_d.h $(obj)/scsi_sysfs.o: $(obj)/scsi_devinfo_tbl.c -- 2.17.1
[PATCH v2 11/11] kbuild: split out *.mod out of {single,multi}-used-m rules
Currently, *.mod is created as a side-effect of obj-m. Split out *.mod as a dedicated build rule, which allows to unify the %.c -> %.o rule, and remove the single-used-m rule. This also makes the incremental build of allmodconfig faster because it saves $(NM) invocation when there is no change in the module. Signed-off-by: Masahiro Yamada --- Changes in v2: None scripts/Makefile.build | 22 +- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 2709646b1a5d..63fc266b4985 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -67,8 +67,10 @@ ifeq ($(CONFIG_MODULES)$(need-modorder),y1) modorder-target := $(obj)/modules.order endif +mod-targets := $(patsubst %.o, %.mod, $(obj-m)) + __build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ -$(if $(KBUILD_MODULES),$(obj-m) $(modorder-target)) \ +$(if $(KBUILD_MODULES),$(obj-m) $(mod-targets) $(modorder-target)) \ $(subdir-ym) $(always) @: @@ -266,7 +268,7 @@ endef # List module undefined symbols (or empty line if not enabled) ifdef CONFIG_TRIM_UNUSED_KSYMS -cmd_undef_syms = $(NM) $@ | sed -n 's/^ *U //p' | xargs echo +cmd_undef_syms = $(NM) $< | sed -n 's/^ *U //p' | xargs echo else cmd_undef_syms = echo endif @@ -276,11 +278,15 @@ $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE $(call cmd,force_checksrc) $(call if_changed_rule,cc_o_c) -$(single-used-m): $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE - $(call cmd,force_checksrc) - $(call if_changed_rule,cc_o_c) - @{ echo $@; \ - $(cmd_undef_syms); } > $(patsubst %.o,%.mod,$@) +cmd_mod = { \ + echo $(if $($*-objs)$($*-y)$($*-m), $(addprefix $(obj)/, $($*-objs) $($*-y) $($*-m)), $(@:.mod=.o)); \ + $(cmd_undef_syms); \ + } > $@ + +$(obj)/%.mod: $(obj)/%.o FORCE + $(call if_changed,mod) + +targets += $(mod-targets) quiet_cmd_cc_lst_c = MKLST $@ cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && \ @@ -461,8 +467,6 @@ cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(filter %.o,$^) $(cmd_secanalysis $(multi-used-m): FORCE $(call if_changed,link_multi-m) - @{ echo $(filter %.o,$^); \ - $(cmd_undef_syms); } > $(patsubst %.o,%.mod,$@) $(call multi_depend, $(multi-used-m), .o, -objs -y -m) targets += $(multi-used-m) -- 2.17.1
[PATCH v1] KVM: x86: expose AVX512_BF16 feature to guest
AVX512 BFLOAT16 instructions support 16-bit BFLOAT16 floating-point format (BF16) for deep learning optimization. Intel adds AVX512 BFLOAT16 feature in CooperLake, which is CPUID.7.1.EAX[5]. Detailed information of the CPUID bit can be found here, https://software.intel.com/sites/default/files/managed/c5/15/\ architecture-instruction-set-extensions-programming-reference.pdf. Signed-off-by: Jing Liu --- This patch depends on kernel patch https://lkml.org/lkml/2019/6/19/912 and Paolo's patch set https://lkml.org/lkml/2019/7/4/468. arch/x86/kvm/cpuid.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index 8fc6039..0c125dd 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -358,9 +358,13 @@ static inline void do_cpuid_7_mask(struct kvm_cpuid_entry2 *entry, int index) F(SPEC_CTRL_SSBD) | F(ARCH_CAPABILITIES) | F(INTEL_STIBP) | F(MD_CLEAR); + /* cpuid 7.1.eax */ + const u32 kvm_cpuid_7_1_eax_x86_features = + F(AVX512_BF16); + switch (index) { case 0: - entry->eax = 0; + entry->eax = min(entry->eax, 1); entry->ebx &= kvm_cpuid_7_0_ebx_x86_features; cpuid_mask(&entry->ebx, CPUID_7_0_EBX); /* TSC_ADJUST is emulated */ @@ -384,6 +388,12 @@ static inline void do_cpuid_7_mask(struct kvm_cpuid_entry2 *entry, int index) */ entry->edx |= F(ARCH_CAPABILITIES); break; + case 1: + entry->eax &= kvm_cpuid_7_1_eax_x86_features; + entry->ebx = 0; + entry->ecx = 0; + entry->edx = 0; + break; default: WARN_ON_ONCE(1); entry->eax = 0; -- 1.8.3.1
Re: linux-next: build failure after merge of the net-next tree
On Thu, Jul 11, 2019 at 01:16:03PM +1000, Stephen Rothwell wrote: > Hi all, > > On Thu, 11 Jul 2019 13:13:44 +1000 Stephen Rothwell > wrote: > > > > On Thu, 11 Jul 2019 02:26:27 + Jason Gunthorpe > > wrote: > > > > > > On Thu, Jul 11, 2019 at 11:50:54AM +1000, Stephen Rothwell wrote: > > > > > > > So today this failed to build after I merged the rdma tree (previously > > > > it didn;t until after the net-next tree was merged (I assume a > > > > dependency changed). It failed because in_dev_for_each_ifa_rcu (and > > > > in_dev_for_each_ifa_rtnl) is only defined in a commit in the net-next > > > > tree :-( > > > > > > ? I'm confused.. > > > > > > rdma.git builds fine stand alone (I hope!) > > > > I have "Fixup to build SIW issue" from Leon (which switches to using > > in_dev_for_each_ifa_rcu) included in the rmda tree merge commit because > > without that the rdma tree would not build for me. Are you saying that > > I don't need that at all, now? > > Actually , I get it now, "Fixup to build SIW issue" is really just a > fixup for the net-next and rdma trees merge ... OK, I will fix that up > tomorrow. Sorry for my confusion. Yes, it was for build only. > > -- > Cheers, > Stephen Rothwell
Re: [GIT PULL] clone3 for v5.3
On Wed, Jul 10, 2019 at 10:24:26PM -0700, Linus Torvalds wrote: > On Mon, Jul 8, 2019 at 8:05 AM Christian Brauner wrote: > > > > /* Syscall number 435 */ > > clone3() uses syscall number 435 and is coordinated with pidfd_open() which > > uses syscall number 434. I'm not aware of any other syscall targeted for > > 5.3 that has chosen the same number. > > You say that, and 434/435 would make sense, but that's not what the > code I see in the pull request actually does. > > It seems to use syscall 436. > > I think it's because openat2() is looking to use 435, but I'm a bit > nervous about the conflict between the code and your commentary.. Sorry, that was just me being dumb and forgetting that there was close_range() which had a chance of going through Al's tree. So I left a hole for it. I don't terribly mind if it's 435 or 436. People pointed out you might even renumber yourself if something makes more sense to you. Christian
Re: [PATCH v4 2/2] rtw88: pci: Use DMA sync instead of remapping in RX ISR
Jian-Hong Pan 於 2019年7月11日 週四 下午1:25寫道: > > Since each skb in RX ring is reused instead of new allocation, we can > treat the DMA in a more efficient way by DMA synchronization. > > Signed-off-by: Jian-Hong Pan > Cc: > --- Sorry, also forget to place the version difference here v2: - New patch by following [PATCH v3 1/2] rtw88: pci: Rearrange the memory usage for skb in RX ISR. v3: - Remove rtw_pci_sync_rx_desc_cpu and call dma_sync_single_for_cpu in rtw_pci_rx_isr directly. - Remove the return value of rtw_pci_sync_rx_desc_device. - Use DMA_FROM_DEVICE instead of PCI_DMA_FROMDEVICE. v4: - Same as v3. > drivers/net/wireless/realtek/rtw88/pci.c | 24 +--- > 1 file changed, 21 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/wireless/realtek/rtw88/pci.c > b/drivers/net/wireless/realtek/rtw88/pci.c > index c415f5e94fed..68fae52151dd 100644 > --- a/drivers/net/wireless/realtek/rtw88/pci.c > +++ b/drivers/net/wireless/realtek/rtw88/pci.c > @@ -206,6 +206,23 @@ static int rtw_pci_reset_rx_desc(struct rtw_dev *rtwdev, > struct sk_buff *skb, > return 0; > } > > +static void rtw_pci_sync_rx_desc_device(struct rtw_dev *rtwdev, dma_addr_t > dma, > + struct rtw_pci_rx_ring *rx_ring, > + u32 idx, u32 desc_sz) > +{ > + struct device *dev = rtwdev->dev; > + struct rtw_pci_rx_buffer_desc *buf_desc; > + int buf_sz = RTK_PCI_RX_BUF_SIZE; > + > + dma_sync_single_for_device(dev, dma, buf_sz, DMA_FROM_DEVICE); > + > + buf_desc = (struct rtw_pci_rx_buffer_desc *)(rx_ring->r.head + > +idx * desc_sz); > + memset(buf_desc, 0, sizeof(*buf_desc)); > + buf_desc->buf_size = cpu_to_le16(RTK_PCI_RX_BUF_SIZE); > + buf_desc->dma = cpu_to_le32(dma); > +} > + > static int rtw_pci_init_rx_ring(struct rtw_dev *rtwdev, > struct rtw_pci_rx_ring *rx_ring, > u8 desc_size, u32 len) > @@ -782,8 +799,8 @@ static void rtw_pci_rx_isr(struct rtw_dev *rtwdev, struct > rtw_pci *rtwpci, > rtw_pci_dma_check(rtwdev, ring, cur_rp); > skb = ring->buf[cur_rp]; > dma = *((dma_addr_t *)skb->cb); > - pci_unmap_single(rtwpci->pdev, dma, RTK_PCI_RX_BUF_SIZE, > -PCI_DMA_FROMDEVICE); > + dma_sync_single_for_cpu(rtwdev->dev, dma, RTK_PCI_RX_BUF_SIZE, > + DMA_FROM_DEVICE); > rx_desc = skb->data; > chip->ops->query_rx_desc(rtwdev, rx_desc, &pkt_stat, > &rx_status); > > @@ -818,7 +835,8 @@ static void rtw_pci_rx_isr(struct rtw_dev *rtwdev, struct > rtw_pci *rtwpci, > > next_rp: > /* new skb delivered to mac80211, re-enable original skb DMA > */ > - rtw_pci_reset_rx_desc(rtwdev, skb, ring, cur_rp, buf_desc_sz); > + rtw_pci_sync_rx_desc_device(rtwdev, dma, ring, cur_rp, > + buf_desc_sz); > > /* host read next element in ring */ > if (++cur_rp >= ring->r.len) > -- > 2.22.0 >
Re: [GIT PULL] pidfd updates for v5.3
The pull request you sent on Mon, 8 Jul 2019 15:54:23 +0200: > g...@gitolite.kernel.org:pub/scm/linux/kernel/git/brauner/linux > tags/pidfd-updates-v5.3 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/5450e8a316a64cddcbc15f90733ebc78aa736545 Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
Re: [git pull] m68k updates for 5.3 (take two)
The pull request you sent on Wed, 10 Jul 2019 14:11:20 +0200: > git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k.git > tags/m68k-for-v5.3-tag2 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/29cd581b59496c26334c910a8b848baa81a6becd Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
Re: [git pull] m68knommu changes for v5.3
The pull request you sent on Wed, 10 Jul 2019 15:22:09 +1000: > git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu.git for-next has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/398364a35daed7361e76c3666fb9a97792edce09 Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
Re: [PATCH v4 1/2] rtw88: pci: Rearrange the memory usage for skb in RX ISR
Jian-Hong Pan 於 2019年7月11日 週四 下午1:25寫道: > > Testing with RTL8822BE hardware, when available memory is low, we > frequently see a kernel panic and system freeze. > > First, rtw_pci_rx_isr encounters a memory allocation failure (trimmed): > > rx routine starvation > WARNING: CPU: 7 PID: 9871 at drivers/net/wireless/realtek/rtw88/pci.c:822 > rtw_pci_rx_isr.constprop.25+0x35a/0x370 [rtwpci] > [ 2356.580313] RIP: 0010:rtw_pci_rx_isr.constprop.25+0x35a/0x370 [rtwpci] > > Then we see a variety of different error conditions and kernel panics, > such as this one (trimmed): > > rtw_pci :02:00.0: pci bus timeout, check dma status > skbuff: skb_over_panic: text:091b6e66 len:415 put:415 > head:d2880c6f data:7a02b1ea tail:0x1df end:0xc0 dev: > [ cut here ] > kernel BUG at net/core/skbuff.c:105! > invalid opcode: [#1] SMP NOPTI > RIP: 0010:skb_panic+0x43/0x45 > > When skb allocation fails and the "rx routine starvation" is hit, the > function returns immediately without updating the RX ring. At this > point, the RX ring may continue referencing an old skb which was already > handed off to ieee80211_rx_irqsafe(). When it comes to be used again, > bad things happen. > > This patch allocates a new, data-sized skb first in RX ISR. After > copying the data in, we pass it to the upper layers. However, if skb > allocation fails, we effectively drop the frame. In both cases, the > original, full size ring skb is reused. > > In addition, to fixing the kernel crash, the RX routine should now > generally behave better under low memory conditions. > > Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=204053 > Signed-off-by: Jian-Hong Pan > Cc: > --- Sorry, I forget to place the version difference here. v2: - Allocate new data-sized skb and put data into it, then pass it to mac80211. Reuse the original skb in RX ring by DMA sync. - Modify the commit message. - Introduce following [PATCH v3 2/2] rtw88: pci: Use DMA sync instead of remapping in RX ISR. v3: - Same as v2. v4: - Fix comment: allocate a new skb for this frame, discard the frame if none available > drivers/net/wireless/realtek/rtw88/pci.c | 49 +++- > 1 file changed, 22 insertions(+), 27 deletions(-) > > diff --git a/drivers/net/wireless/realtek/rtw88/pci.c > b/drivers/net/wireless/realtek/rtw88/pci.c > index cfe05ba7280d..c415f5e94fed 100644 > --- a/drivers/net/wireless/realtek/rtw88/pci.c > +++ b/drivers/net/wireless/realtek/rtw88/pci.c > @@ -763,6 +763,7 @@ static void rtw_pci_rx_isr(struct rtw_dev *rtwdev, struct > rtw_pci *rtwpci, > u32 pkt_offset; > u32 pkt_desc_sz = chip->rx_pkt_desc_sz; > u32 buf_desc_sz = chip->rx_buf_desc_sz; > + u32 new_len; > u8 *rx_desc; > dma_addr_t dma; > > @@ -790,40 +791,34 @@ static void rtw_pci_rx_isr(struct rtw_dev *rtwdev, > struct rtw_pci *rtwpci, > pkt_offset = pkt_desc_sz + pkt_stat.drv_info_sz + > pkt_stat.shift; > > - if (pkt_stat.is_c2h) { > - /* keep rx_desc, halmac needs it */ > - skb_put(skb, pkt_stat.pkt_len + pkt_offset); > + /* allocate a new skb for this frame, > +* discard the frame if none available > +*/ > + new_len = pkt_stat.pkt_len + pkt_offset; > + new = dev_alloc_skb(new_len); > + if (WARN_ONCE(!new, "rx routine starvation\n")) > + goto next_rp; > + > + /* put the DMA data including rx_desc from phy to new skb */ > + skb_put_data(new, skb->data, new_len); > > - /* pass offset for further operation */ > - *((u32 *)skb->cb) = pkt_offset; > - skb_queue_tail(&rtwdev->c2h_queue, skb); > + if (pkt_stat.is_c2h) { > +/* pass rx_desc & offset for further operation */ > + *((u32 *)new->cb) = pkt_offset; > + skb_queue_tail(&rtwdev->c2h_queue, new); > ieee80211_queue_work(rtwdev->hw, &rtwdev->c2h_work); > } else { > - /* remove rx_desc, maybe use skb_pull? */ > - skb_put(skb, pkt_stat.pkt_len); > - skb_reserve(skb, pkt_offset); > - > - /* alloc a smaller skb to mac80211 */ > - new = dev_alloc_skb(pkt_stat.pkt_len); > - if (!new) { > - new = skb; > - } else { > - skb_put_data(new, skb->data, skb->len); > - dev_kfree_skb_any(skb); > - } > - /* TODO: merge into rx.c */ > - rtw_rx_stats(rtwdev, pkt_stat.vif, skb); > + /* remove rx_desc *
Re: [GIT PULL] clone3 for v5.3
On Mon, Jul 8, 2019 at 8:05 AM Christian Brauner wrote: > > /* Syscall number 435 */ > clone3() uses syscall number 435 and is coordinated with pidfd_open() which > uses syscall number 434. I'm not aware of any other syscall targeted for > 5.3 that has chosen the same number. You say that, and 434/435 would make sense, but that's not what the code I see in the pull request actually does. It seems to use syscall 436. I think it's because openat2() is looking to use 435, but I'm a bit nervous about the conflict between the code and your commentary.. Linus
[PATCH v4 2/2] rtw88: pci: Use DMA sync instead of remapping in RX ISR
Since each skb in RX ring is reused instead of new allocation, we can treat the DMA in a more efficient way by DMA synchronization. Signed-off-by: Jian-Hong Pan Cc: --- drivers/net/wireless/realtek/rtw88/pci.c | 24 +--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/pci.c b/drivers/net/wireless/realtek/rtw88/pci.c index c415f5e94fed..68fae52151dd 100644 --- a/drivers/net/wireless/realtek/rtw88/pci.c +++ b/drivers/net/wireless/realtek/rtw88/pci.c @@ -206,6 +206,23 @@ static int rtw_pci_reset_rx_desc(struct rtw_dev *rtwdev, struct sk_buff *skb, return 0; } +static void rtw_pci_sync_rx_desc_device(struct rtw_dev *rtwdev, dma_addr_t dma, + struct rtw_pci_rx_ring *rx_ring, + u32 idx, u32 desc_sz) +{ + struct device *dev = rtwdev->dev; + struct rtw_pci_rx_buffer_desc *buf_desc; + int buf_sz = RTK_PCI_RX_BUF_SIZE; + + dma_sync_single_for_device(dev, dma, buf_sz, DMA_FROM_DEVICE); + + buf_desc = (struct rtw_pci_rx_buffer_desc *)(rx_ring->r.head + +idx * desc_sz); + memset(buf_desc, 0, sizeof(*buf_desc)); + buf_desc->buf_size = cpu_to_le16(RTK_PCI_RX_BUF_SIZE); + buf_desc->dma = cpu_to_le32(dma); +} + static int rtw_pci_init_rx_ring(struct rtw_dev *rtwdev, struct rtw_pci_rx_ring *rx_ring, u8 desc_size, u32 len) @@ -782,8 +799,8 @@ static void rtw_pci_rx_isr(struct rtw_dev *rtwdev, struct rtw_pci *rtwpci, rtw_pci_dma_check(rtwdev, ring, cur_rp); skb = ring->buf[cur_rp]; dma = *((dma_addr_t *)skb->cb); - pci_unmap_single(rtwpci->pdev, dma, RTK_PCI_RX_BUF_SIZE, -PCI_DMA_FROMDEVICE); + dma_sync_single_for_cpu(rtwdev->dev, dma, RTK_PCI_RX_BUF_SIZE, + DMA_FROM_DEVICE); rx_desc = skb->data; chip->ops->query_rx_desc(rtwdev, rx_desc, &pkt_stat, &rx_status); @@ -818,7 +835,8 @@ static void rtw_pci_rx_isr(struct rtw_dev *rtwdev, struct rtw_pci *rtwpci, next_rp: /* new skb delivered to mac80211, re-enable original skb DMA */ - rtw_pci_reset_rx_desc(rtwdev, skb, ring, cur_rp, buf_desc_sz); + rtw_pci_sync_rx_desc_device(rtwdev, dma, ring, cur_rp, + buf_desc_sz); /* host read next element in ring */ if (++cur_rp >= ring->r.len) -- 2.22.0
[PATCH v4 1/2] rtw88: pci: Rearrange the memory usage for skb in RX ISR
Testing with RTL8822BE hardware, when available memory is low, we frequently see a kernel panic and system freeze. First, rtw_pci_rx_isr encounters a memory allocation failure (trimmed): rx routine starvation WARNING: CPU: 7 PID: 9871 at drivers/net/wireless/realtek/rtw88/pci.c:822 rtw_pci_rx_isr.constprop.25+0x35a/0x370 [rtwpci] [ 2356.580313] RIP: 0010:rtw_pci_rx_isr.constprop.25+0x35a/0x370 [rtwpci] Then we see a variety of different error conditions and kernel panics, such as this one (trimmed): rtw_pci :02:00.0: pci bus timeout, check dma status skbuff: skb_over_panic: text:091b6e66 len:415 put:415 head:d2880c6f data:7a02b1ea tail:0x1df end:0xc0 dev: [ cut here ] kernel BUG at net/core/skbuff.c:105! invalid opcode: [#1] SMP NOPTI RIP: 0010:skb_panic+0x43/0x45 When skb allocation fails and the "rx routine starvation" is hit, the function returns immediately without updating the RX ring. At this point, the RX ring may continue referencing an old skb which was already handed off to ieee80211_rx_irqsafe(). When it comes to be used again, bad things happen. This patch allocates a new, data-sized skb first in RX ISR. After copying the data in, we pass it to the upper layers. However, if skb allocation fails, we effectively drop the frame. In both cases, the original, full size ring skb is reused. In addition, to fixing the kernel crash, the RX routine should now generally behave better under low memory conditions. Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=204053 Signed-off-by: Jian-Hong Pan Cc: --- drivers/net/wireless/realtek/rtw88/pci.c | 49 +++- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/pci.c b/drivers/net/wireless/realtek/rtw88/pci.c index cfe05ba7280d..c415f5e94fed 100644 --- a/drivers/net/wireless/realtek/rtw88/pci.c +++ b/drivers/net/wireless/realtek/rtw88/pci.c @@ -763,6 +763,7 @@ static void rtw_pci_rx_isr(struct rtw_dev *rtwdev, struct rtw_pci *rtwpci, u32 pkt_offset; u32 pkt_desc_sz = chip->rx_pkt_desc_sz; u32 buf_desc_sz = chip->rx_buf_desc_sz; + u32 new_len; u8 *rx_desc; dma_addr_t dma; @@ -790,40 +791,34 @@ static void rtw_pci_rx_isr(struct rtw_dev *rtwdev, struct rtw_pci *rtwpci, pkt_offset = pkt_desc_sz + pkt_stat.drv_info_sz + pkt_stat.shift; - if (pkt_stat.is_c2h) { - /* keep rx_desc, halmac needs it */ - skb_put(skb, pkt_stat.pkt_len + pkt_offset); + /* allocate a new skb for this frame, +* discard the frame if none available +*/ + new_len = pkt_stat.pkt_len + pkt_offset; + new = dev_alloc_skb(new_len); + if (WARN_ONCE(!new, "rx routine starvation\n")) + goto next_rp; + + /* put the DMA data including rx_desc from phy to new skb */ + skb_put_data(new, skb->data, new_len); - /* pass offset for further operation */ - *((u32 *)skb->cb) = pkt_offset; - skb_queue_tail(&rtwdev->c2h_queue, skb); + if (pkt_stat.is_c2h) { +/* pass rx_desc & offset for further operation */ + *((u32 *)new->cb) = pkt_offset; + skb_queue_tail(&rtwdev->c2h_queue, new); ieee80211_queue_work(rtwdev->hw, &rtwdev->c2h_work); } else { - /* remove rx_desc, maybe use skb_pull? */ - skb_put(skb, pkt_stat.pkt_len); - skb_reserve(skb, pkt_offset); - - /* alloc a smaller skb to mac80211 */ - new = dev_alloc_skb(pkt_stat.pkt_len); - if (!new) { - new = skb; - } else { - skb_put_data(new, skb->data, skb->len); - dev_kfree_skb_any(skb); - } - /* TODO: merge into rx.c */ - rtw_rx_stats(rtwdev, pkt_stat.vif, skb); + /* remove rx_desc */ + skb_pull(new, pkt_offset); + + rtw_rx_stats(rtwdev, pkt_stat.vif, new); memcpy(new->cb, &rx_status, sizeof(rx_status)); ieee80211_rx_irqsafe(rtwdev->hw, new); } - /* skb delivered to mac80211, alloc a new one in rx ring */ - new = dev_alloc_skb(RTK_PCI_RX_BUF_SIZE); - if (WARN(!new, "rx routine starvation\n")) - return; - - ring->buf[cur_rp] = new; - rtw_pci_reset_rx_desc(rtwdev, new, ring, cur_rp, buf_desc_sz); +next_rp: + /* new s
RE: [PATCH v6 0/5] net: macb: cover letter
Hi David, Ok, I will resubmit it. Regards, Parshuram Thombare
linux-next: build failure after merge of the block tree
Hi all, After merging the block tree, today's linux-next build (x86_64 allmodconfig) failed like this: fs/f2fs/data.c: In function 'f2fs_merge_page_bio': fs/f2fs/data.c:516:3: error: implicit declaration of function 'wbc_account_io'; did you mean 'blk_account_rq'? [-Werror=implicit-function-declaration] wbc_account_io(fio->io_wbc, page, PAGE_SIZE); ^~ blk_account_rq Caused by commit 34e51a5e1a6e ("blkcg, writeback: Rename wbc_account_io() to wbc_account_cgroup_owner()") interacting with commit 8648de2c581e ("f2fs: add bio cache for IPU") from the f2fs tree. I added the following merge fix patch or today: From: Stephen Rothwell Date: Thu, 11 Jul 2019 15:13:21 +1000 Subject: [PATCH] f2fs: fix for wbc_account_io rename Signed-off-by: Stephen Rothwell --- fs/f2fs/data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 323306630f93..4eb2f3920140 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -513,7 +513,7 @@ int f2fs_merge_page_bio(struct f2fs_io_info *fio) } if (fio->io_wbc) - wbc_account_io(fio->io_wbc, page, PAGE_SIZE); + wbc_account_cgroup_owner(fio->io_wbc, page, PAGE_SIZE); inc_page_count(fio->sbi, WB_DATA_TYPE(page)); -- 2.20.1 -- Cheers, Stephen Rothwell pgpNwc74pmPDS.pgp Description: OpenPGP digital signature
Re: [PATCH net-next] net: mlx5: Fix compiling error in tls.c
On Wed, Jul 10, 2019 at 2:33 AM Mao Wenan wrote: > > There are some errors while compiling tls.c if > CONFIG_MLX5_FPGA_TLS is not obvious on. > > drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c: In function > mlx5e_tls_set_ipv4_flow: > ./include/linux/mlx5/device.h:61:39: error: invalid application of sizeof to > incomplete type struct mlx5_ifc_tls_flow_bits > #define __mlx5_st_sz_bits(typ) sizeof(struct mlx5_ifc_##typ##_bits) >^ > ./include/linux/compiler.h:330:9: note: in definition of macro > __compiletime_assert >if (!(condition)) \ > ^ > ... > > drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c: In function > mlx5e_tls_build_netdev: > drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c:202:13: error: > MLX5_ACCEL_TLS_TX undeclared (first use in this function); did you mean > __MLX5_ACCEL_TLS_H__? > if (caps & MLX5_ACCEL_TLS_TX) { > ^ > __MLX5_ACCEL_TLS_H__ > drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c:207:13: error: > MLX5_ACCEL_TLS_RX undeclared (first use in this function); did you mean > MLX5_ACCEL_TLS_TX? > if (caps & MLX5_ACCEL_TLS_RX) { > ^ > MLX5_ACCEL_TLS_TX > drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c:212:15: error: > MLX5_ACCEL_TLS_LRO undeclared (first use in this function); did you mean > MLX5_ACCEL_TLS_RX? > if (!(caps & MLX5_ACCEL_TLS_LRO)) { >^~ >MLX5_ACCEL_TLS_RX > make[5]: *** [drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.o] Error 1 > make[5]: *** Waiting for unfinished jobs > make[4]: *** [drivers/net/ethernet/mellanox/mlx5/core] Error 2 > make[3]: *** [drivers/net/ethernet/mellanox] Error 2 > make[3]: *** Waiting for unfinished jobs > make[2]: *** [drivers/net/ethernet] Error 2 > make[2]: *** Waiting for unfinished jobs > make[1]: *** [drivers/net] Error 2 > make[1]: *** Waiting for unfinished jobs > make: *** [drivers] Error 2 > make: *** Waiting for unfinished jobs > > this patch is to fix this error using 'depends on MLX5_FPGA_TLS' when > MLX5_TLS is set. > Hi Mao, Thanks for the patch. sorry for the delayed response, I was out of office. Actually MLX5_TLS doesn't depend on MLX5_FPGA_TLS anymore. Tariq prepared a patch to fix this, we will submit it this week. > Fixes: e2869fb2068b ("net/mlx5: Kconfig, Better organize compilation flags") > > Signed-off-by: Mao Wenan > --- > drivers/net/ethernet/mellanox/mlx5/core/Kconfig | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig > b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig > index 37fef8c..1da2770 100644 > --- a/drivers/net/ethernet/mellanox/mlx5/core/Kconfig > +++ b/drivers/net/ethernet/mellanox/mlx5/core/Kconfig > @@ -139,6 +139,7 @@ config MLX5_TLS > depends on MLX5_CORE_EN > depends on TLS_DEVICE > depends on TLS=y || MLX5_CORE=m > + depends on MLX5_FPGA_TLS > select MLX5_ACCEL > default n > help > -- > 2.7.4 >
RE: [PATCH AUTOSEL 5.1 08/39] arm64: dts: ls1028a: Fix CPU idle fail.
Hi Sasha, Thanks for helping port this patch to stable. May I know if I can submit other bug fixes which has been accepted by upstream to stable by myself? If yes, where I can find related process for reference? Thanks & Regards, Ran > -Original Message- > From: Sasha Levin > Sent: Wednesday, July 03, 2019 10:15 > To: linux-kernel@vger.kernel.org; sta...@vger.kernel.org > Cc: Ran Wang ; Shawn Guo ; > Sasha Levin ; devicet...@vger.kernel.org > Subject: [PATCH AUTOSEL 5.1 08/39] arm64: dts: ls1028a: Fix CPU idle fail. > > From: Ran Wang > > [ Upstream commit 53f2ac9d3aa881ed419054076042898b77c27ee4 ] > > PSCI spec define 1st parameter's bit 16 of function CPU_SUSPEND to indicate > CPU State Type: 0 for standby, 1 for power down. In this case, we want to > select > standby for CPU idle feature. But current setting wrongly select power down > and > cause CPU SUSPEND fail every time. Need this fix. > > Fixes: 8897f3255c9c ("arm64: dts: Add support for NXP LS1028A SoC") > Signed-off-by: Ran Wang > Signed-off-by: Shawn Guo > Signed-off-by: Sasha Levin > --- > arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi | 18 +- > 1 file changed, 9 insertions(+), 9 deletions(-) > > diff --git a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi > b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi > index 2896bbcfa3bb..228872549f01 100644 > --- a/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi > +++ b/arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi > @@ -28,7 +28,7 @@ > enable-method = "psci"; > clocks = <&clockgen 1 0>; > next-level-cache = <&l2>; > - cpu-idle-states = <&CPU_PH20>; > + cpu-idle-states = <&CPU_PW20>; > }; > > cpu1: cpu@1 { > @@ -38,7 +38,7 @@ > enable-method = "psci"; > clocks = <&clockgen 1 0>; > next-level-cache = <&l2>; > - cpu-idle-states = <&CPU_PH20>; > + cpu-idle-states = <&CPU_PW20>; > }; > > l2: l2-cache { > @@ -53,13 +53,13 @@ >*/ > entry-method = "arm,psci"; > > - CPU_PH20: cpu-ph20 { > - compatible = "arm,idle-state"; > - idle-state-name = "PH20"; > - arm,psci-suspend-param = <0x0001>; > - entry-latency-us = <1000>; > - exit-latency-us = <1000>; > - min-residency-us = <3000>; > + CPU_PW20: cpu-pw20 { > + compatible = "arm,idle-state"; > + idle-state-name = "PW20"; > + arm,psci-suspend-param = <0x0>; > + entry-latency-us = <2000>; > + exit-latency-us = <2000>; > + min-residency-us = <6000>; > }; > }; > > -- > 2.20.1
linux-next: build failure after merge of the block tree
Hi all, After merging the block tree, today's linux-next build (powerpc ppc64_defconfig) failed like this: fs/xfs/xfs_aops.c: In function 'xfs_add_to_ioend': fs/xfs/xfs_aops.c:799:2: error: implicit declaration of function 'wbc_account_io'; did you mean 'blk_account_rq'? [-Werror=implicit-function-declaration] wbc_account_io(wbc, page, len); ^~ blk_account_rq Caused by commit 34e51a5e1a6e ("blkcg, writeback: Rename wbc_account_io() to wbc_account_cgroup_owner()") interacting with commit adfb5fb46af0 ("xfs: implement cgroup aware writeback") from the xfs tree. I have applied the following merge fix patch: From: Stephen Rothwell Date: Thu, 11 Jul 2019 15:01:54 +1000 Subject: [PATCH] xfs: fix up for wbc_account_io rename Signed-off-by: Stephen Rothwell --- fs/xfs/xfs_aops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 761248ee2778..f16d5f196c6b 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c @@ -796,7 +796,7 @@ xfs_add_to_ioend( } wpc->ioend->io_size += len; - wbc_account_io(wbc, page, len); + wbc_account_cgroup_owner(wbc, page, len); } STATIC void -- 2.20.1 -- Cheers, Stephen Rothwell pgpPNOxt7Dafy.pgp Description: OpenPGP digital signature
Re: [PATCH v3 17/30] locking/lockdep: Add read-write type for a lock dependency
Thanks for review. On Wed, 10 Jul 2019 at 13:18, Boqun Feng wrote: > > On Fri, Jun 28, 2019 at 05:15:15PM +0800, Yuyang Du wrote: > > Direct dependencies need to keep track of their read-write lock types. > > Two bit fields, which share the distance field, are added to lock_list > > struct so the types are stored there. > > > > With a dependecy lock1 -> lock2, lock_type1 has the type for lock1 and > > lock_type2 has the type for lock2, where the values are one of the > > lock_type enums. > > > > Signed-off-by: Yuyang Du > > --- > > include/linux/lockdep.h | 15 ++- > > kernel/locking/lockdep.c | 25 +++-- > > 2 files changed, 37 insertions(+), 3 deletions(-) > > > > diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h > > index eb26e93..fd619ac 100644 > > --- a/include/linux/lockdep.h > > +++ b/include/linux/lockdep.h > > @@ -185,6 +185,8 @@ static inline void lockdep_copy_map(struct lockdep_map > > *to, > > to->class_cache[i] = NULL; > > } > > > > +#define LOCK_TYPE_BITS 2 > > + > > /* > > * Every lock has a list of other locks that were taken after or before > > * it as lock dependencies. These dependencies constitute a graph, which > > @@ -207,7 +209,17 @@ struct lock_list { > > struct list_headchains; > > struct lock_class *class[2]; > > struct lock_trace trace; > > - int distance; > > + > > + /* > > + * The lock_type fields keep track of the lock type of this > > + * dependency. > > + * > > + * With L1 -> L2, lock_type1 stores the lock type of L1, and > > + * lock_type2 stores that of L2. > > + */ > > + unsigned intlock_type1 : LOCK_TYPE_BITS, > > + lock_type2 : LOCK_TYPE_BITS, > > Bad names ;-) Maybe fw_dep_type and bw_dep_type? Which seems to be > aligned with the naming schema other functions. I think the types are for L1 -> L2 respectively, hence the names in question. Let me reconsider this anyway and maybe hear from others. Thanks, Yuyang
Re: [PATCH] Fix perf stat repeat segfault
Hi Numfor, On 7/11/19 2:15 AM, Numfor Mbiziwo-Tiapo wrote: > -static bool perf_evsel__should_store_id(struct perf_evsel *counter) > +static bool perf_evsel__should_store_id(struct perf_evsel *counter, int > run_idx) > { > - return STAT_RECORD || counter->attr.read_format & PERF_FORMAT_ID; > + return STAT_RECORD || counter->attr.read_format & PERF_FORMAT_ID > + && run_idx < 1; > } Build fails for me: builtin-stat.c: In function ‘perf_evsel__should_store_id’: builtin-stat.c:395:3: error: suggest parentheses around ‘&&’ within ‘||’ [-Werror=parentheses] return STAT_RECORD || counter->attr.read_format & PERF_FORMAT_ID ~~ && run_idx < 1; ^~ cc1: all warnings being treated as errors And probably, Fixes: 82bf311e15d2 ("perf stat: Use group read for event groups")
Re: [GIT PULL] vfs: fix copy_file_range bad behavior
The pull request you sent on Tue, 9 Jul 2019 09:39:48 -0700: > git://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git tags/copy-file-range-fixes-1 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/40f06c799539739a08a56be8a096f56aeed05731 Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
Re: [GIT PULL] gfs2: 5.3 merge
The pull request you sent on Thu, 11 Jul 2019 00:22:27 +0200: > git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2.git > tags/gfs2-for-5.3 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/0248a8be6d21dad72b9ce80a7565cf13c11509d8 Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
Re: [GIT PULL] ext4 updates for 5.3-rc1
The pull request you sent on Tue, 9 Jul 2019 18:55:48 -0400: > git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git > tags/ext4_for_linus has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/2e756758e5cb4ea29cba5865d00fad476ce94a93 Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
Re: [PATCH] media: i2c: adv748x: Convert to new i2c device probe()
Hi Kieran, Thanks for your patch. On 2019-07-10 13:37:19 +0100, Kieran Bingham wrote: > The I2C core framework provides a simplified probe framework from commit > b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new() call-back type"). > > Convert the ADV748x to utilise this simplfied i2c driver registration. > > Signed-off-by: Kieran Bingham Looks good, Reviewed-by: Niklas Söderlund > --- > drivers/media/i2c/adv748x/adv748x-core.c | 13 ++--- > 1 file changed, 2 insertions(+), 11 deletions(-) > > diff --git a/drivers/media/i2c/adv748x/adv748x-core.c > b/drivers/media/i2c/adv748x/adv748x-core.c > index 097e94279cf7..ae2b6eb93e09 100644 > --- a/drivers/media/i2c/adv748x/adv748x-core.c > +++ b/drivers/media/i2c/adv748x/adv748x-core.c > @@ -677,8 +677,7 @@ static void adv748x_dt_cleanup(struct adv748x_state > *state) > of_node_put(state->endpoints[i]); > } > > -static int adv748x_probe(struct i2c_client *client, > - const struct i2c_device_id *id) > +static int adv748x_probe(struct i2c_client *client) > { > struct adv748x_state *state; > int ret; > @@ -806,13 +805,6 @@ static int adv748x_remove(struct i2c_client *client) > return 0; > } > > -static const struct i2c_device_id adv748x_id[] = { > - { "adv7481", 0 }, > - { "adv7482", 0 }, > - { }, > -}; > -MODULE_DEVICE_TABLE(i2c, adv748x_id); > - > static const struct of_device_id adv748x_of_table[] = { > { .compatible = "adi,adv7481", }, > { .compatible = "adi,adv7482", }, > @@ -825,9 +817,8 @@ static struct i2c_driver adv748x_driver = { > .name = "adv748x", > .of_match_table = adv748x_of_table, > }, > - .probe = adv748x_probe, > + .probe_new = adv748x_probe, > .remove = adv748x_remove, > - .id_table = adv748x_id, > }; > > module_i2c_driver(adv748x_driver); > -- > 2.20.1 > -- Regards, Niklas Söderlund
Re: [GIT PULL] afs: Miscellany for 5.3
The pull request you sent on Fri, 05 Jul 2019 22:45:39 +0100: > git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git > tags/afs-next-20190628 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/8dda9957e3a1c871dfbabf84c4760f9b26032442 Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
Re: [GIT PULL] nfsd changes for 5.3
The pull request you sent on Wed, 10 Jul 2019 18:02:36 -0400: > git://linux-nfs.org/~bfields/linux.git tags/nfsd-5.3 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/d2b6b4c832f7e3067709e8d4970b7b82b44419ac Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
Re: [GIT PULL] file lease fix and tracepoint for v5.3
The pull request you sent on Mon, 08 Jul 2019 08:43:10 -0400: > git://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git > tags/locks-v5.3-1 has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/988052f47adc5c3b0b004180b59bb3761d91b752 Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
Re: [GIT PULL] fscrypt updates for v5.3
The pull request you sent on Mon, 8 Jul 2019 08:53:33 -0700: > git://git.kernel.org/pub/scm/fs/fscrypt/fscrypt.git tags/fscrypt-for-linus has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/25cd6f355dab9d11b7c8a4005867d5a30b8b14ee Thank you! -- Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/prtracker
[PATCH 2/6] pinctrl: aspeed: Rename pin declaration macros
Rename macros as follows: * s/SS_PIN_DECL()/PIN_DECL_1()/ * s/MS_PIN_DECL()/PIN_DECL_2()/ * s/MS_PIN_DECL_()/PIN_DECL_()/ This is in preparation for adding PIN_DECL_3(). We could clean this up with e.g. CPPMAGIC_MAP() from ccan, but that might be a bridge too far given how much of a macro jungle we already have. Signed-off-by: Andrew Jeffery --- drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c | 372 +- drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c | 418 ++--- drivers/pinctrl/aspeed/pinmux-aspeed.h | 20 +- 3 files changed, 405 insertions(+), 405 deletions(-) diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c b/drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c index 37f325fb5d7c..6d93bb4209f0 100644 --- a/drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c +++ b/drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c @@ -86,14 +86,14 @@ SSSF_PIN_DECL(E6, GPIOA3, TIMER4, SIG_DESC_SET(SCU80, 3)); #define C5 4 SIG_EXPR_LIST_DECL_SINGLE(SCL9, I2C9, I2C9_DESC); SIG_EXPR_LIST_DECL_SINGLE(TIMER5, TIMER5, SIG_DESC_SET(SCU80, 4)); -MS_PIN_DECL(C5, GPIOA4, SCL9, TIMER5); +PIN_DECL_2(C5, GPIOA4, SCL9, TIMER5); FUNC_GROUP_DECL(TIMER5, C5); #define B4 5 SIG_EXPR_LIST_DECL_SINGLE(SDA9, I2C9, I2C9_DESC); SIG_EXPR_LIST_DECL_SINGLE(TIMER6, TIMER6, SIG_DESC_SET(SCU80, 5)); -MS_PIN_DECL(B4, GPIOA5, SDA9, TIMER6); +PIN_DECL_2(B4, GPIOA5, SDA9, TIMER6); FUNC_GROUP_DECL(TIMER6, B4); FUNC_GROUP_DECL(I2C9, C5, B4); @@ -103,14 +103,14 @@ FUNC_GROUP_DECL(I2C9, C5, B4); #define A3 6 SIG_EXPR_LIST_DECL_SINGLE(MDC2, MDIO2, MDIO2_DESC); SIG_EXPR_LIST_DECL_SINGLE(TIMER7, TIMER7, SIG_DESC_SET(SCU80, 6)); -MS_PIN_DECL(A3, GPIOA6, MDC2, TIMER7); +PIN_DECL_2(A3, GPIOA6, MDC2, TIMER7); FUNC_GROUP_DECL(TIMER7, A3); #define D5 7 SIG_EXPR_LIST_DECL_SINGLE(MDIO2, MDIO2, MDIO2_DESC); SIG_EXPR_LIST_DECL_SINGLE(TIMER8, TIMER8, SIG_DESC_SET(SCU80, 7)); -MS_PIN_DECL(D5, GPIOA7, MDIO2, TIMER8); +PIN_DECL_2(D5, GPIOA7, MDIO2, TIMER8); FUNC_GROUP_DECL(TIMER8, D5); FUNC_GROUP_DECL(MDIO2, A3, D5); @@ -131,7 +131,7 @@ SSSF_PIN_DECL(F18, GPIOB3, SALT4, SIG_DESC_SET(SCU80, 11)); SIG_EXPR_DECL(LPCRST, LPCRST, SIG_DESC_SET(SCU80, 12)); SIG_EXPR_DECL(LPCRST, LPCRSTS, SIG_DESC_SET(HW_STRAP1, 14)); SIG_EXPR_LIST_DECL_DUAL(LPCRST, LPCRST, LPCRSTS); -SS_PIN_DECL(E19, GPIOB4, LPCRST); +PIN_DECL_1(E19, GPIOB4, LPCRST); FUNC_GROUP_DECL(LPCRST, E19); @@ -139,7 +139,7 @@ FUNC_GROUP_DECL(LPCRST, E19); #define H19_DESCSIG_DESC_SET(SCU80, 13) SIG_EXPR_LIST_DECL_SINGLE(LPCPD, LPCPD, H19_DESC); SIG_EXPR_LIST_DECL_SINGLE(LPCSMI, LPCSMI, H19_DESC); -MS_PIN_DECL(H19, GPIOB5, LPCPD, LPCSMI); +PIN_DECL_2(H19, GPIOB5, LPCPD, LPCSMI); FUNC_GROUP_DECL(LPCPD, H19); FUNC_GROUP_DECL(LPCSMI, H19); @@ -155,7 +155,7 @@ SIG_EXPR_LIST_DECL_SINGLE(EXTRST, EXTRST, SIG_EXPR_LIST_DECL_SINGLE(SPICS1, SPICS1, SIG_DESC_SET(SCU80, 15), SIG_DESC_SET(SCU90, 31)); -MS_PIN_DECL(E18, GPIOB7, EXTRST, SPICS1); +PIN_DECL_2(E18, GPIOB7, EXTRST, SPICS1); FUNC_GROUP_DECL(EXTRST, E18); FUNC_GROUP_DECL(SPICS1, E18); @@ -166,12 +166,12 @@ FUNC_GROUP_DECL(SPICS1, E18); #define C4 16 SIG_EXPR_LIST_DECL_SINGLE(SD1CLK, SD1, SD1_DESC); SIG_EXPR_LIST_DECL_SINGLE(SCL10, I2C10, I2C10_DESC); -MS_PIN_DECL(C4, GPIOC0, SD1CLK, SCL10); +PIN_DECL_2(C4, GPIOC0, SD1CLK, SCL10); #define B3 17 SIG_EXPR_LIST_DECL_SINGLE(SD1CMD, SD1, SD1_DESC); SIG_EXPR_LIST_DECL_SINGLE(SDA10, I2C10, I2C10_DESC); -MS_PIN_DECL(B3, GPIOC1, SD1CMD, SDA10); +PIN_DECL_2(B3, GPIOC1, SD1CMD, SDA10); FUNC_GROUP_DECL(I2C10, C4, B3); @@ -180,12 +180,12 @@ FUNC_GROUP_DECL(I2C10, C4, B3); #define A2 18 SIG_EXPR_LIST_DECL_SINGLE(SD1DAT0, SD1, SD1_DESC); SIG_EXPR_LIST_DECL_SINGLE(SCL11, I2C11, I2C11_DESC); -MS_PIN_DECL(A2, GPIOC2, SD1DAT0, SCL11); +PIN_DECL_2(A2, GPIOC2, SD1DAT0, SCL11); #define E5 19 SIG_EXPR_LIST_DECL_SINGLE(SD1DAT1, SD1, SD1_DESC); SIG_EXPR_LIST_DECL_SINGLE(SDA11, I2C11, I2C11_DESC); -MS_PIN_DECL(E5, GPIOC3, SD1DAT1, SDA11); +PIN_DECL_2(E5, GPIOC3, SD1DAT1, SDA11); FUNC_GROUP_DECL(I2C11, A2, E5); @@ -194,12 +194,12 @@ FUNC_GROUP_DECL(I2C11, A2, E5); #define D4 20 SIG_EXPR_LIST_DECL_SINGLE(SD1DAT2, SD1, SD1_DESC); SIG_EXPR_LIST_DECL_SINGLE(SCL12, I2C12, I2C12_DESC); -MS_PIN_DECL(D4, GPIOC4, SD1DAT2, SCL12); +PIN_DECL_2(D4, GPIOC4, SD1DAT2, SCL12); #define C3 21 SIG_EXPR_LIST_DECL_SINGLE(SD1DAT3, SD1, SD1_DESC); SIG_EXPR_LIST_DECL_SINGLE(SDA12, I2C12, I2C12_DESC); -MS_PIN_DECL(C3, GPIOC5, SD1DAT3, SDA12); +PIN_DECL_2(C3, GPIOC5, SD1DAT3, SDA12); FUNC_GROUP_DECL(I2C12, D4, C3); @@ -208,12 +208,12 @@ FUNC_GROUP_DECL(I2C12, D4, C3); #define B2 22 SIG_EXPR_LIST_DECL_SINGLE(SD1CD, SD1, SD1_DESC); SIG_EXPR_LIST_DECL_SINGLE(SCL13, I2C13, I2C13_DESC); -MS_PIN_DECL(B2, GPIOC6, SD1CD, SCL13); +PIN_DECL_2(B2, GPIOC6, SD1CD, SCL13); #define A1 23 SIG_EXPR_LIST_DECL_SINGLE(SD1WP, SD1, SD1_DESC); SIG_EXPR_LIST_DECL_SINGLE(SDA13, I2C13, I2C13_DESC); -MS_PIN_DECL(A1, GPIOC7, SD1WP, SDA13); +PIN_DECL_2(A1, GPIOC7,
[PATCH 5/6] pinctrl: aspeed: Add SIG_DESC_CLEAR() helper
The complement of SIG_DESC_SET(). Signed-off-by: Andrew Jeffery --- drivers/pinctrl/aspeed/pinmux-aspeed.h | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pinctrl/aspeed/pinmux-aspeed.h b/drivers/pinctrl/aspeed/pinmux-aspeed.h index 474820df6263..c59e936a7dde 100644 --- a/drivers/pinctrl/aspeed/pinmux-aspeed.h +++ b/drivers/pinctrl/aspeed/pinmux-aspeed.h @@ -508,6 +508,7 @@ struct aspeed_pin_desc { * @idx: The bit index in the register */ #define SIG_DESC_SET(reg, idx) SIG_DESC_IP_BIT(ASPEED_IP_SCU, reg, idx, 1) +#define SIG_DESC_CLEAR(reg, idx) SIG_DESC_IP_BIT(ASPEED_IP_SCU, reg, idx, 0) #define SIG_DESC_LIST_SYM(sig, group) sig_descs_ ## sig ## _ ## group #define SIG_DESC_LIST_DECL(sig, group, ...) \ -- 2.20.1
[PATCH 1/6] dt-bindings: pinctrl: aspeed: Document AST2600 pinmux
The AST260 differs from the 2400 and 2500 in that it supports multiple groups for a subset of functions. Signed-off-by: Andrew Jeffery --- .../pinctrl/aspeed,ast2600-pinctrl.yaml | 128 ++ 1 file changed, 128 insertions(+) create mode 100644 Documentation/devicetree/bindings/pinctrl/aspeed,ast2600-pinctrl.yaml diff --git a/Documentation/devicetree/bindings/pinctrl/aspeed,ast2600-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/aspeed,ast2600-pinctrl.yaml new file mode 100644 index ..dd31f8e62433 --- /dev/null +++ b/Documentation/devicetree/bindings/pinctrl/aspeed,ast2600-pinctrl.yaml @@ -0,0 +1,128 @@ +# SPDX-License-Identifier: GPL-2.0+ +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pinctrl/aspeed,ast2600-pinctrl.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: ASPEED AST2600 Pin Controller + +maintainers: + - Andrew Jeffery + +description: |+ + The pin controller node should be the child of a syscon node with the + required property: + + - compatible: Should be one of the following: +"aspeed,ast2600-scu", "syscon", "simple-mfd" + + Refer to the the bindings described in + Documentation/devicetree/bindings/mfd/syscon.txt + +properties: + compatible: +const: aspeed,ast2600-pinctrl + +patternProperties: + '^.*$': +if: + type: object +then: + patternProperties: +"^function$": + allOf: +- $ref: "/schemas/types.yaml#/definitions/string" +- enum: [ "ADC0", "ADC1", "ADC10", "ADC11", "ADC12", "ADC13", + "ADC14", "ADC15", "ADC2", "ADC3", "ADC4", "ADC5", "ADC6", "ADC7", + "ADC8", "ADC9", "BMCINT", "ESPI", "ESPIALT", "FSI1", "FSI2", + "FWSPIABR", "FWSPID", "FWSPIWP", "GPIT0", "GPIT1", "GPIT2", + "GPIT3", "GPIT4", "GPIT5", "GPIT6", "GPIT7", "GPIU0", "GPIU1", + "GPIU2", "GPIU3", "GPIU4", "GPIU5", "GPIU6", "GPIU7", "I2C1", + "I2C10", "I2C11", "I2C12", "I2C13", "I2C14", "I2C15", "I2C16", + "I2C2", "I2C3", "I2C4", "I2C5", "I2C6", "I2C7", "I2C8", "I2C9", + "I3C3", "I3C4", "I3C5", "I3C6", "JTAGM", "LHPD", "LHSIRQ", "LPC", + "LPCHC", "LPCPD", "LPCPME", "LPCSMI", "LSIRQ", "MACLINK1", + "MACLINK2", "MACLINK3", "MACLINK4", "MDIO1", "MDIO2", "MDIO3", + "MDIO4", "NCTS1", "NCTS2", "NCTS3", "NCTS4", "NDCD1", "NDCD2", + "NDCD3", "NDCD4", "NDSR1", "NDSR2", "NDSR3", "NDSR4", "NDTR1", + "NDTR2", "NDTR3", "NDTR4", "NRI1", "NRI2", "NRI3", "NRI4", + "NRTS1", "NRTS2", "NRTS3", "NRTS4", "OSCCLK", "PEWAKE", "PWM0", + "PWM1", "PWM10", "PWM11", "PWM12", "PWM13", "PWM14", "PWM15", + "PWM2", "PWM3", "PWM4", "PWM5", "PWM6", "PWM7", "PWM8", "PWM9", + "RGMII1", "RGMII2", "RGMII3", "RGMII4", "RMII1", "RMII2", + "RMII3", "RMII4", "RXD1", "RXD2", "RXD3", "RXD4", "SALT1", + "SALT10", "SALT11", "SALT12", "SALT13", "SALT14", "SALT15", + "SALT16", "SALT2", "SALT3", "SALT4", "SALT5", "SALT6", "SALT7", + "SALT8", "SALT9", "SD1", "SD2", "SD3", "SD3DAT4", "SD3DAT5", + "SD3DAT6", "SD3DAT7", "SGPM1", "SGPS1", "SIOONCTRL", "SIOPBI", + "SIOPBO", "SIOPWREQ", "SIOPWRGD", "SIOS3", "SIOS5", "SIOSCI", + "SPI1", "SPI1ABR", "SPI1CS1", "SPI1WP", "SPI2", "SPI2CS1", + "SPI2CS2", "TACH0", "TACH1", "TACH10", "TACH11", "TACH12", + "TACH13", "TACH14", "TACH15", "TACH2", "TACH3", "TACH4", "TACH5", + "TACH6", "TACH7", "TACH8", "TACH9", "THRU0", "THRU1", "THRU2", + "THRU3", "TXD1", "TXD2", "TXD3", "TXD4", "UART10", "UART11", + "UART12", "UART13", "UART6", "UART7", "UART8", "UART9", "VB", + "VGAHS", "VGAVS", "WDTRST1", "WDTRST2", "WDTRST3", "WDTRST4", ] +"^groups$": + allOf: +- $ref: "/schemas/types.yaml#/definitions/string" +- enum: [ "ADC0", "ADC1", "ADC10", "ADC11", "ADC12", "ADC13", + "ADC14", "ADC15", "ADC2", "ADC3", "ADC4", "ADC5", "ADC6", "ADC7", + "ADC8", "ADC9", "BMCINT", "ESPI", "ESPIALT", "FSI1", "FSI2", + "FWSPIABR", "FWSPID", "FWQSPID", "FWSPIWP", "GPIT0", "GPIT1", + "GPIT2", "GPIT3", "GPIT4", "GPIT5", "GPIT6", "GPIT7", "GPIU0", + "GPIU1", "GPIU2", "GPIU3", "GPIU4", "GPIU5", "GPIU6", "GPIU7", + "HVI3C3", "HVI3C4", "I2C1", "I2C10", "I2C11", "I2C12", "I2C13", + "I2C14", "I2C15", "I2C16", "I2C2", "I2C3", "I2C4", "I2C5", + "I2C6", "I2C7", "I2C8", "I2C9", "I3C3", "I3C4", "I3C5", "I3C6", + "JTAGM", "LHPD", "LHSIRQ", "LPC", "LPCHC", "LPCPD", "LPCPME", + "LPCSMI", "LSIRQ", "MACLINK1", "MACLINK2", "MACLINK3", + "MACLINK4", "MDIO1", "MDIO2", "MDIO3", "MDIO4", "NCTS1", "NCTS2", + "NCTS3", "NCTS4", "NDCD1", "NDCD2", "NDCD3", "NDCD4", "NDSR1
[PATCH 6/6] pinctrl: aspeed: Add AST2600 pinmux support
The AST2600 pinmux is fairly similar to the previous generations of ASPEED BMC SoCs in terms of architecture, though differ in some of the design details. The complexity of the pin expressions is largely reduced (e.g. there are no-longer signals with multiple expressions muxing them to the associated pin), and there are now signals and buses with multiple pin groups. The driver implements pinmux support for all 244 GPIO-capable pins plus a further four pins that are not GPIO capable but which expose multiple signals. pinconf will be implemented in a follow-up patch. The implementation has been smoke-tested under qemu, and run on hardware by ASPEED. Debugged-by: Johnny Huang Signed-off-by: Andrew Jeffery --- drivers/pinctrl/aspeed/Kconfig |8 + drivers/pinctrl/aspeed/Makefile|1 + drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c | 2395 3 files changed, 2404 insertions(+) create mode 100644 drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c diff --git a/drivers/pinctrl/aspeed/Kconfig b/drivers/pinctrl/aspeed/Kconfig index 998eabef3a65..ceb415583dc0 100644 --- a/drivers/pinctrl/aspeed/Kconfig +++ b/drivers/pinctrl/aspeed/Kconfig @@ -22,3 +22,11 @@ config PINCTRL_ASPEED_G5 help Say Y here to enable pin controller support for Aspeed's 5th generation SoCs. GPIO is provided by a separate GPIO driver. + +config PINCTRL_ASPEED_G6 + bool "Aspeed G6 SoC pin control" + depends on (MACH_ASPEED_G6 || COMPILE_TEST) && OF + select PINCTRL_ASPEED + help + Say Y here to enable pin controller support for Aspeed's 6th + generation SoCs. GPIO is provided by a separate GPIO driver. diff --git a/drivers/pinctrl/aspeed/Makefile b/drivers/pinctrl/aspeed/Makefile index 3a94e4db0c8e..3888ba601b7b 100644 --- a/drivers/pinctrl/aspeed/Makefile +++ b/drivers/pinctrl/aspeed/Makefile @@ -4,3 +4,4 @@ ccflags-y += $(call cc-option,-Woverride-init) obj-$(CONFIG_PINCTRL_ASPEED) += pinctrl-aspeed.o pinmux-aspeed.o obj-$(CONFIG_PINCTRL_ASPEED_G4)+= pinctrl-aspeed-g4.o obj-$(CONFIG_PINCTRL_ASPEED_G5)+= pinctrl-aspeed-g5.o +obj-$(CONFIG_PINCTRL_ASPEED_G6)+= pinctrl-aspeed-g6.o diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c b/drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c new file mode 100644 index ..6012d7d4a22a --- /dev/null +++ b/drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c @@ -0,0 +1,2395 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* Copyright (C) 2019 IBM Corp. */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../core.h" +#include "../pinctrl-utils.h" +#include "pinctrl-aspeed.h" + +#define SCU400 0x400 /* Multi-function Pin Control #1 */ +#define SCU404 0x404 /* Multi-function Pin Control #2 */ +#define SCU410 0x410 /* Multi-function Pin Control #4 */ +#define SCU414 0x414 /* Multi-function Pin Control #5 */ +#define SCU418 0x418 /* Multi-function Pin Control #6 */ +#define SCU41C 0x41C /* Multi-function Pin Control #7 */ +#define SCU430 0x430 /* Multi-function Pin Control #8 */ +#define SCU434 0x434 /* Multi-function Pin Control #9 */ +#define SCU438 0x438 /* Multi-function Pin Control #10 */ +#define SCU450 0x450 /* Multi-function Pin Control #14 */ +#define SCU4B0 0x4B0 /* Multi-function Pin Control #17 */ +#define SCU4B4 0x4B4 /* Multi-function Pin Control #18 */ +#define SCU4B8 0x4B8 /* Multi-function Pin Control #19 */ +#define SCU4BC 0x4BC /* Multi-function Pin Control #20 */ +#define SCU4D4 0x4D4 /* Multi-function Pin Control #22 */ +#define SCU4D8 0x4D8 /* Multi-function Pin Control #23 */ +#define SCU500 0x500 /* Hardware Strap 1 */ +#define SCU510 0x510 /* Hardware Strap 2 */ +#define SCU694 0x694 /* Multi-function Pin Control #25 */ + +#define ASPEED_G6_NR_PINS 248 + +#define M24 0 +SIG_EXPR_LIST_DECL_SESG(M24, MDC3, MDIO3, SIG_DESC_SET(SCU410, 0)); +SIG_EXPR_LIST_DECL_SESG(M24, SCL11, I2C11, SIG_DESC_SET(SCU4B0, 0)); +PIN_DECL_2(M24, GPIOA0, MDC3, SCL11); + +#define M25 1 +SIG_EXPR_LIST_DECL_SESG(M25, MDIO3, MDIO3, SIG_DESC_SET(SCU410, 1)); +SIG_EXPR_LIST_DECL_SESG(M25, SDA11, I2C11, SIG_DESC_SET(SCU4B0, 1)); +PIN_DECL_2(M25, GPIOA1, MDIO3, SDA11); + +FUNC_GROUP_DECL(MDIO3, M24, M25); +FUNC_GROUP_DECL(I2C11, M24, M25); + +#define L26 2 +SIG_EXPR_LIST_DECL_SESG(L26, MDC4, MDIO4, SIG_DESC_SET(SCU410, 2)); +SIG_EXPR_LIST_DECL_SESG(L26, SCL12, I2C12, SIG_DESC_SET(SCU4B0, 2)); +PIN_DECL_2(L26, GPIOA2, MDC4, SCL12); + +#define K24 3 +SIG_EXPR_LIST_DECL_SESG(K24, MDIO4, MDIO4, SIG_DESC_SET(SCU410, 3)); +SIG_EXPR_LIST_DECL_SESG(K24, SDA12, I2C12, SIG_DESC_SET(SCU4B0, 3)); +PIN_DECL_2(K24, GPIOA3, MDIO4, SDA12); + +FUNC_GROUP_DECL(MDIO4, L26, K24); +FUNC_GROUP_DECL(I2C12, L26, K24); + +#define K26 4 +SIG_EXPR_LIST_DECL_
[PATCH 3/6] pinctrl: aspeed: Add PIN_DECL_3() helper
This case is common in the AST2600, so add to the collection. Signed-off-by: Andrew Jeffery --- drivers/pinctrl/aspeed/pinmux-aspeed.h | 72 ++ 1 file changed, 40 insertions(+), 32 deletions(-) diff --git a/drivers/pinctrl/aspeed/pinmux-aspeed.h b/drivers/pinctrl/aspeed/pinmux-aspeed.h index 0406beedd5ba..964dd5b242ac 100644 --- a/drivers/pinctrl/aspeed/pinmux-aspeed.h +++ b/drivers/pinctrl/aspeed/pinmux-aspeed.h @@ -604,38 +604,6 @@ struct aspeed_pin_desc { static const struct aspeed_pin_desc PIN_SYM(pin) = \ { #pin, PIN_EXPRS_PTR(pin) } -/** - * Declare a two-signal pin - * - * @pin: The pin number - * @other: Macro name for "other" functionality (subjected to stringification) - * @high: Macro name for the highest priority signal functions - * @low: Macro name for the low signal functions - * - * For example: - * - * #define A8 56 - * SIG_EXPR_DECL(ROMD8, ROM16, SIG_DESC_SET(SCU90, 6)); - * SIG_EXPR_DECL(ROMD8, ROM16S, SIG_DESC_SET(HW_STRAP1, 4), - * { HW_STRAP1, GENMASK(1, 0), 0, 0 }); - * SIG_EXPR_LIST_DECL(ROMD8, SIG_EXPR_PTR(ROMD8, ROM16), - * SIG_EXPR_PTR(ROMD8, ROM16S)); - * SIG_EXPR_LIST_DECL_SINGLE(NCTS6, NCTS6, SIG_DESC_SET(SCU90, 7)); - * PIN_DECL_2(A8, GPIOH0, ROMD8, NCTS6); - */ -#define PIN_DECL_2(pin, other, high, low) \ - SIG_EXPR_LIST_DECL_SINGLE(other, other); \ - PIN_DECL_(pin, \ - SIG_EXPR_LIST_PTR(high), \ - SIG_EXPR_LIST_PTR(low), \ - SIG_EXPR_LIST_PTR(other)) - -#define PIN_GROUP_SYM(func) pins_ ## func -#define FUNC_GROUP_SYM(func) groups_ ## func -#define FUNC_GROUP_DECL(func, ...) \ - static const int PIN_GROUP_SYM(func)[] = { __VA_ARGS__ }; \ - static const char *FUNC_GROUP_SYM(func)[] = { #func } - /** * Declare a single signal pin * @@ -670,6 +638,46 @@ struct aspeed_pin_desc { SIG_EXPR_LIST_DECL_SINGLE(other, other); \ PIN_DECL_(pin, SIG_EXPR_LIST_PTR(sig), SIG_EXPR_LIST_PTR(other)); \ FUNC_GROUP_DECL(sig, pin) +/** + * Declare a two-signal pin + * + * @pin: The pin number + * @other: Macro name for "other" functionality (subjected to stringification) + * @high: Macro name for the highest priority signal functions + * @low: Macro name for the low signal functions + * + * For example: + * + * #define A8 56 + * SIG_EXPR_DECL(ROMD8, ROM16, SIG_DESC_SET(SCU90, 6)); + * SIG_EXPR_DECL(ROMD8, ROM16S, SIG_DESC_SET(HW_STRAP1, 4), + * { HW_STRAP1, GENMASK(1, 0), 0, 0 }); + * SIG_EXPR_LIST_DECL(ROMD8, SIG_EXPR_PTR(ROMD8, ROM16), + * SIG_EXPR_PTR(ROMD8, ROM16S)); + * SIG_EXPR_LIST_DECL_SINGLE(NCTS6, NCTS6, SIG_DESC_SET(SCU90, 7)); + * PIN_DECL_2(A8, GPIOH0, ROMD8, NCTS6); + */ +#define PIN_DECL_2(pin, other, high, low) \ + SIG_EXPR_LIST_DECL_SINGLE(other, other); \ + PIN_DECL_(pin, \ + SIG_EXPR_LIST_PTR(high), \ + SIG_EXPR_LIST_PTR(low), \ + SIG_EXPR_LIST_PTR(other)) + +#define PIN_DECL_3(pin, other, high, medium, low) \ + SIG_EXPR_LIST_DECL_SINGLE(other, other); \ + PIN_DECL_(pin, \ + SIG_EXPR_LIST_PTR(high), \ + SIG_EXPR_LIST_PTR(medium), \ + SIG_EXPR_LIST_PTR(low), \ + SIG_EXPR_LIST_PTR(other)) + +#define PIN_GROUP_SYM(func) pins_ ## func +#define FUNC_GROUP_SYM(func) groups_ ## func +#define FUNC_GROUP_DECL(func, ...) \ + static const int PIN_GROUP_SYM(func)[] = { __VA_ARGS__ }; \ + static const char *FUNC_GROUP_SYM(func)[] = { #func } + #define GPIO_PIN_DECL(pin, gpio) \ SIG_EXPR_LIST_DECL_SINGLE(gpio, gpio); \ -- 2.20.1
[PATCH 0/6] pinctrl: aspeed: Add AST2600 pinmux support
Hello! This series adds pinmux support for the AST2600. Some more rework was required on top of the previous cleanup series, but this rework was focussed on supporting features of the AST2600 pinmux rather than fixing issues with the existing infrastructure for the ASPEED drivers. Due to the dependences it's based on top of pinctrl/devel, so should avoid any more SPDX issues. ASPEED have been testing the patches on hardware, so even for an initial pass there's some confidence in the implementation. Please review! Andrew Andrew Jeffery (6): dt-bindings: pinctrl: aspeed: Document AST2600 pinmux pinctrl: aspeed: Rename pin declaration macros pinctrl: aspeed: Add PIN_DECL_3() helper pinctrl: aspeed: Add multiple pin group support for functions pinctrl: aspeed: Add SIG_DESC_CLEAR() helper pinctrl: aspeed: Add AST2600 pinmux support .../pinctrl/aspeed,ast2600-pinctrl.yaml | 128 + drivers/pinctrl/aspeed/Kconfig|8 + drivers/pinctrl/aspeed/Makefile |1 + drivers/pinctrl/aspeed/pinctrl-aspeed-g4.c| 1821 +++-- drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c| 1865 +++-- drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c| 2395 + drivers/pinctrl/aspeed/pinmux-aspeed.h| 227 +- 7 files changed, 4643 insertions(+), 1802 deletions(-) create mode 100644 Documentation/devicetree/bindings/pinctrl/aspeed,ast2600-pinctrl.yaml create mode 100644 drivers/pinctrl/aspeed/pinctrl-aspeed-g6.c -- 2.20.1
Re: [PATCH RFC 2/4] arm64: mm: Add RAS extension system register check to SEA handling
Hi James, Mark, On Tue, Jul 9, 2019 at 8:52 PM Tyler Baicar OS wrote: > On Mon, Jul 8, 2019 at 10:10 AM James Morse wrote: > > On 02/07/2019 17:51, Tyler Baicar OS wrote: > > > @@ -632,6 +633,8 @@ static int do_sea(unsigned long addr, unsigned int > > > esr, struct pt_regs *regs) > > > > > > inf = esr_to_fault_info(esr); > > > > > > + arch_arm_ras_report_error(); > > > + > > > /* > > >* Return value ignored as we rely on signal merging. > > >* Future patches will make this more robust. > > > > > > > If we interrupted a preemptible context, do_sea() is preemptible too... > > This means we > > can't know if we're still running on the same CPU as the one that took the > > external-abort. > > (until this series, it hasn't mattered). > > > > Fixing this means cramming something into entry.S's el1_da, as this may > > unmask interrupts > > before calling do_mem_abort(). But its going to be ugly because some of > > do_mem_abort()s > > ESR values need to be preemptible because they sleep, e.g. page-faults > > calling > > handle_mm_fault(). > > For do_sea(), do_exit() will 'fix' the preempt count if we kill the thread, > > but if we > > don't, it still needs to be balanced. Doing all this in assembly is going > > to be unreadable! > > > > Mark Rutland has a series to move the entry assembly into C [0]. Based on > > that that it > > should be possible for the new el1_abort() to spot a > > Synchronous-External-Abort ESR, and > > wrap the do_mem_abort() with preempt enable/disable, before inheriting the > > flags. (which > > for synchronous exceptions, I think we should always do) > > > > [0] > > https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/log/?h=arm64/entry-deasm > > Hey James, > > Good catch! I didn't think the synchronous route was preemptible. > > I wasn't seeing this issue when testing this on emulation, but I was able to > test and prove the issue on a Neoverse N1 SDP: > > root@genericarmv8:~# echo 0x1 > /proc/cached_read > [ 42.985622] Reading from address 0x1 > [ 42.989893] WARNING: CPU: 0 PID: 2812 at > /home/tyler/neoverse/arm-reference- > platforms/linux/arch/arm64/kernel/cpufeature.c:1940 this_cpu_has_cap+0x68/0x78 > [..] > [ 43.119083] Call trace: > [ 43.121515] this_cpu_has_cap+0x68/0x78 > [ 43.125338] do_sea+0x34/0x70 > [ 43.128292] do_mem_abort+0x3c/0x98 > [ 43.131765] el1_da+0x20/0x94 > [ 43.134722] cached_read+0x30/0x68 > [ 43.138112] simple_attr_write+0xbc/0x128 > [ 43.142109] proc_reg_write+0x60/0xa8 > [ 43.145757] __vfs_write+0x18/0x40 > [ 43.149145] vfs_write+0xa4/0x1b8 > [ 43.152445] ksys_write+0x64/0xe0 > [ 43.155746] __arm64_sys_write+0x14/0x20 > [ 43.159654] el0_svc_common.constprop.0+0xa8/0x100 > [ 43.164430] el0_svc_handler+0x28/0x78 > [ 43.168165] el0_svc+0x8/0xc > [ 43.171031] ---[ end trace 2c27619659261a1d ]--- > [ 43.175647] Internal error: synchronous external abort: 96000410 [#1] > PREEMPT SMP > [..] > > That warning is because it's preemptible: > > if (!WARN_ON(preemptible()) && n < ARM64_NCAPS) { > > I'll pull Mark's series in and add the preempt enable/disable around the call > to do_mem_abort() in el1_abort() and test that out! I was able to pull in the series mentioned [0] and add a patch to wrap do_mem_abort with preempt disable/enable and the warning has gone away. diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c index 43aa78331e72..26cdf7db511a 100644 --- a/arch/arm64/kernel/entry-common.c +++ b/arch/arm64/kernel/entry-common.c @@ -118,7 +118,25 @@ static void el1_abort(struct pt_regs *regs, unsigned long esr) unsigned long far = read_sysreg(far_el1); local_daif_inherit(regs); far = untagged_addr(far); - do_mem_abort(far, esr, regs); + + switch (esr & ESR_ELx_FSC) { + case ESR_ELx_FSC_EXTABT:// Synchronous External Abort + case 0x14: // SEA level 0 translation table walk + case 0x15: // SEA level 1 translation table walk + case 0x16: // SEA level 2 translation table walk + case 0x17: // SEA level 3 translation table walk + case 0x18: // Synchronous ECC error + case 0x1c: // SECC level 0 translation table walk + case 0x1d: // SECC level 1 translation table walk + case 0x1e: // SECC level 2 translation table walk + case 0x1f: // SECC level 3 translation table walk + preempt_disable(); + do_mem_abort(far, esr, regs); + preempt_enable(); + break; + default: + do_mem_abort(far, esr, regs); + }; } /* Stack or PC alignment exception handling */ -- Is that what you had in mind James? Has this series [0] been accepted and is just waiting to b
Re: [PATCH] kbuild: Inform user to pass ARCH= for make mrproper
On Wed, Jul 10, 2019 at 1:30 AM Christoph Hellwig wrote: > > Is there any chance we could save ARCH in .config? That would make > cross compile builds so much easier.. Same for CROSS_COMPILE. Then, I have no idea how "make clean", "make help", etc. should work. If a user has configured the kernel, do they work for CONFIG_ARCH stored in the .config file or still for the host-arch? If not yet, do they fall-back to host-arch? -- Best Regards Masahiro Yamada
Re: [PATCH V34 10/29] hibernate: Disable when the kernel is locked down
Hi experts, On Mon, Jun 24, 2019 at 03:21:23PM +0200, Jiri Kosina wrote: > On Sat, 22 Jun 2019, Pavel Machek wrote: > > > > There is currently no way to verify the resume image when returning > > > from hibernate. This might compromise the signed modules trust model, > > > so until we can work with signed hibernate images we disable it when the > > > kernel is locked down. > > > > I keep getting these... > > > > IIRC suse has patches to verify the images. > > Yeah, Joey Lee is taking care of those. CCing. > The last time that I sent for hibernation encryption and authentication is here: https://lkml.org/lkml/2019/1/3/281 It needs some big changes after review: - Simplify the design: remove keyring dependency and trampoline. - Encrypted whole snapshot image instead of only data pages. - Using TPM: - Direct use TPM API in hibernation instead of keyring - Localities (suggested by James Bottomley) I am still finding enough time to implement those changes, especial TPM parts. Thanks Joey Lee
Re: [PATCH] x86/stacktrace: Fix infinite loop in arch_stack_walk_user()
On Wed, Jul 10, 2019 at 7:35 PM Eiichi Tsukata wrote: > > Once we find a lack of return address, there is no need to continue > loop, so let's break out. Looks good to me, feel free to add Acked-by: Linus Torvalds and I'll assume this comes through the x86 -tip tree.. Linus
Re: [GIT PULL] dlm updates for 5.3
On Tue, Jul 9, 2019 at 9:57 AM David Teigland wrote: > > Apart from a couple trivial fixes, the more notable fix makes the dlm > continuing waiting for a user space result if a signal interrupts the > wait event. What? No. That's not sensible at all. If wait_event_interruptible() returns -ERESTARTSYS, it means that we have a signal pending. And if we have a signal pending, then you can't go back and call wait_event_interruptible() in a loop, because the signal will *continue* to be pending, so now your "wait event" becomes a kernel busy loop. If you don't want to react to signals, then you shouldn't use the "interruptible()" version of wait-event. I'm not pulling this. Because the code looks completely and utterly wrong to me. Am I missing something? Feel free to educate me and re-submit. Linus
Re: [PATCH v3 1/2] rtw88: pci: Rearrange the memory usage for skb in RX ISR
David Laight 於 2019年7月10日 週三 下午4:57寫道: > > From: Jian-Hong Pan > > Sent: 10 July 2019 09:38 > > > > Testing with RTL8822BE hardware, when available memory is low, we > > frequently see a kernel panic and system freeze. > > > > First, rtw_pci_rx_isr encounters a memory allocation failure (trimmed): > > > > rx routine starvation > > WARNING: CPU: 7 PID: 9871 at drivers/net/wireless/realtek/rtw88/pci.c:822 > > rtw_pci_rx_isr.constprop.25+0x35a/0x370 [rtwpci] > > [ 2356.580313] RIP: 0010:rtw_pci_rx_isr.constprop.25+0x35a/0x370 [rtwpci] > > > > Then we see a variety of different error conditions and kernel panics, > > such as this one (trimmed): > > > > rtw_pci :02:00.0: pci bus timeout, check dma status > > skbuff: skb_over_panic: text:091b6e66 len:415 put:415 > > head:d2880c6f > > data:7a02b1ea tail:0x1df end:0xc0 dev: > > [ cut here ] > > kernel BUG at net/core/skbuff.c:105! > > invalid opcode: [#1] SMP NOPTI > > RIP: 0010:skb_panic+0x43/0x45 > > > > When skb allocation fails and the "rx routine starvation" is hit, the > > function returns immediately without updating the RX ring. At this > > point, the RX ring may continue referencing an old skb which was already > > handed off to ieee80211_rx_irqsafe(). When it comes to be used again, > > bad things happen. > > > > This patch allocates a new, data-sized skb first in RX ISR. After > > copying the data in, we pass it to the upper layers. However, if skb > > allocation fails, we effectively drop the frame. In both cases, the > > original, full size ring skb is reused. > > > > In addition, by fixing the kernel crash, the RX routine should now > > generally behave better under low memory conditions. > > A couple of minor nits (see below). > You may want to do a followup patch that changes the rx buffers > (used by the hardware) to by just memory buffers. > Nothing (probably) relies on them being skb with all the accociated > baggage. It is a good idea for later commit. > David > > > > > Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=204053 > > Signed-off-by: Jian-Hong Pan > > Cc: > > --- > > v2: > > - Allocate new data-sized skb and put data into it, then pass it to > >mac80211. Reuse the original skb in RX ring by DMA sync. > > - Modify the commit message. > > - Introduce following [PATCH v3 2/2] rtw88: pci: Use DMA sync instead > >of remapping in RX ISR. > > > > v3: > > - Same as v2. > > > > drivers/net/wireless/realtek/rtw88/pci.c | 49 +++- > > 1 file changed, 22 insertions(+), 27 deletions(-) > > > > diff --git a/drivers/net/wireless/realtek/rtw88/pci.c > > b/drivers/net/wireless/realtek/rtw88/pci.c > > index cfe05ba7280d..e9fe3ad896c8 100644 > > --- a/drivers/net/wireless/realtek/rtw88/pci.c > > +++ b/drivers/net/wireless/realtek/rtw88/pci.c > > @@ -763,6 +763,7 @@ static void rtw_pci_rx_isr(struct rtw_dev *rtwdev, > > struct rtw_pci *rtwpci, > > u32 pkt_offset; > > u32 pkt_desc_sz = chip->rx_pkt_desc_sz; > > u32 buf_desc_sz = chip->rx_buf_desc_sz; > > + u32 new_len; > > u8 *rx_desc; > > dma_addr_t dma; > > > > @@ -790,40 +791,34 @@ static void rtw_pci_rx_isr(struct rtw_dev *rtwdev, > > struct rtw_pci *rtwpci, > > pkt_offset = pkt_desc_sz + pkt_stat.drv_info_sz + > >pkt_stat.shift; > > > > - if (pkt_stat.is_c2h) { > > - /* keep rx_desc, halmac needs it */ > > - skb_put(skb, pkt_stat.pkt_len + pkt_offset); > > + /* discard current skb if the new skb cannot be allocated as a > > + * new one in rx ring later > > + */ > > That comment isn't quite right. > maybe: "Allocate a new skb for this frame, discard if none available" Thanks! I will tweak it. > > + new_len = pkt_stat.pkt_len + pkt_offset; > > + new = dev_alloc_skb(new_len); > > + if (WARN_ONCE(!new, "rx routine starvation\n")) > > I think you should count these?? Larry has a different idea here. [1] I agree with Larry that just need to know not enough memory here. [1] https://lkml.org/lkml/2019/7/8/1049 Jian-Hong Pan > > + goto next_rp; > > + > > + /* put the DMA data including rx_desc from phy to new skb */ > > + skb_put_data(new, skb->data, new_len); > > > > - /* pass offset for further operation */ > > - *((u32 *)skb->cb) = pkt_offset; > > - skb_queue_tail(&rtwdev->c2h_queue, skb); > > + if (pkt_stat.is_c2h) { > > + /* pass rx_desc & offset for further operation */ > > + *((u32 *)new->cb) = pkt_offset; > > + skb_queue_tail(&rtwdev->c2h_queue, new); > > ieee80211_queue_work(rtwdev->hw, &rtwdev->c2h_work); > > } else { > > - /* remove rx_desc, maybe use skb_
[PATCH] ipvs: remove unnecessary space
this patch removes the extra space and use bitmap_zalloc instead Signed-off-by: yangxingwu --- net/netfilter/ipvs/ip_vs_mh.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/netfilter/ipvs/ip_vs_mh.c b/net/netfilter/ipvs/ip_vs_mh.c index 94d9d34..3229867 100644 --- a/net/netfilter/ipvs/ip_vs_mh.c +++ b/net/netfilter/ipvs/ip_vs_mh.c @@ -174,8 +174,7 @@ static int ip_vs_mh_populate(struct ip_vs_mh_state *s, return 0; } - table = kcalloc(BITS_TO_LONGS(IP_VS_MH_TAB_SIZE), -sizeof(unsigned long), GFP_KERNEL); + table = bitmap_zalloc(IP_VS_MH_TAB_SIZE, GFP_KERNEL); if (!table) return -ENOMEM; -- 1.8.3.1
Re: [PATCH] dax: Fix missed PMD wakeups
On Wed, Jul 10, 2019 at 09:02:04PM +0200, Jan Kara wrote: > So how about the attached patch? That keeps the interface sane and passes a > smoketest for me (full fstest run running). Obviously it also needs a > proper changelog... Changelog and slightly massaged version along the lines of my two comments attached. >From 57b63fdd38e7bea7eb8d6332f0163fb028570def Mon Sep 17 00:00:00 2001 From: "Matthew Wilcox (Oracle)" Date: Wed, 3 Jul 2019 23:21:25 -0400 Subject: [PATCH] dax: Fix missed wakeup with PMD faults RocksDB can hang indefinitely when using a DAX file. This is due to a bug in the XArray conversion when handling a PMD fault and finding a PTE entry. We use the wrong index in the hash and end up waiting on the wrong waitqueue. There's actually no need to wait; if we find a PTE entry while looking for a PMD entry, we can return immediately as we know we should fall back to a PTE fault (which may not conflict with the lock held). Cc: sta...@vger.kernel.org Fixes: b15cd800682f ("dax: Convert page fault handlers to XArray") Signed-off-by: Matthew Wilcox (Oracle) --- fs/dax.c | 47 -- include/linux/xarray.h | 4 ++-- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/fs/dax.c b/fs/dax.c index 2e48c7ebb973..1ce1059af266 100644 --- a/fs/dax.c +++ b/fs/dax.c @@ -195,11 +195,13 @@ static void dax_wake_entry(struct xa_state *xas, void *entry, bool wake_all) * Look up entry in page cache, wait for it to become unlocked if it * is a DAX entry and return it. The caller must subsequently call * put_unlocked_entry() if it did not lock the entry or dax_unlock_entry() - * if it did. + * if it did. The entry returned may have a larger order than @order. + * If @order is larger than the order of the entry found in i_pages, this + * function returns a CONFLICT entry. * * Must be called with the i_pages lock held. */ -static void *get_unlocked_entry(struct xa_state *xas) +static void *get_unlocked_entry(struct xa_state *xas, unsigned int order) { void *entry; struct wait_exceptional_entry_queue ewait; @@ -210,6 +212,8 @@ static void *get_unlocked_entry(struct xa_state *xas) for (;;) { entry = xas_find_conflict(xas); + if (dax_entry_order(entry) < order) + return XA_DAX_CONFLICT_ENTRY; if (!entry || WARN_ON_ONCE(!xa_is_value(entry)) || !dax_is_locked(entry)) return entry; @@ -254,7 +258,7 @@ static void wait_entry_unlocked(struct xa_state *xas, void *entry) static void put_unlocked_entry(struct xa_state *xas, void *entry) { /* If we were the only waiter woken, wake the next one */ - if (entry) + if (entry && entry != XA_DAX_CONFLICT_ENTRY) dax_wake_entry(xas, entry, false); } @@ -461,7 +465,7 @@ void dax_unlock_page(struct page *page, dax_entry_t cookie) * overlap with xarray value entries. */ static void *grab_mapping_entry(struct xa_state *xas, - struct address_space *mapping, unsigned long size_flag) + struct address_space *mapping, unsigned int order) { unsigned long index = xas->xa_index; bool pmd_downgrade = false; /* splitting PMD entry into PTE entries? */ @@ -469,20 +473,17 @@ static void *grab_mapping_entry(struct xa_state *xas, retry: xas_lock_irq(xas); - entry = get_unlocked_entry(xas); + entry = get_unlocked_entry(xas, order); if (entry) { + if (entry == XA_DAX_CONFLICT_ENTRY) + goto fallback; if (!xa_is_value(entry)) { xas_set_err(xas, EIO); goto out_unlock; } - if (size_flag & DAX_PMD) { - if (dax_is_pte_entry(entry)) { - put_unlocked_entry(xas, entry); - goto fallback; - } - } else { /* trying to grab a PTE entry */ + if (order == 0) { if (dax_is_pmd_entry(entry) && (dax_is_zero_entry(entry) || dax_is_empty_entry(entry))) { @@ -523,7 +524,11 @@ static void *grab_mapping_entry(struct xa_state *xas, if (entry) { dax_lock_entry(xas, entry); } else { - entry = dax_make_entry(pfn_to_pfn_t(0), size_flag | DAX_EMPTY); + unsigned long flags = DAX_EMPTY; + + if (order > 0) + flags |= DAX_PMD; + entry = dax_make_entry(pfn_to_pfn_t(0), flags); dax_lock_entry(xas, entry); if (xas_error(xas)) goto out_unlock; @@ -594,7 +599,7 @@ struct page *dax_layout_busy_page(struct address_space *mapping) if (WARN_ON_ONCE(!xa_is_value(entry)))
[PATCH -next] mfd: rk808: Mark rk8xx_resume and rk8xx_suspend as __maybe_unused
Fix build warning: drivers/mfd/rk808.c:752:12: warning: 'rk8xx_resume' defined but not used [-Wunused-function] drivers/mfd/rk808.c:732:12: warning: 'rk8xx_suspend' defined but not used [-Wunused-function] The function is declared unconditionally but only called while CONFIG_PM_SLEEP is set. Reported-by: Hulk Robot Signed-off-by: YueHaibing --- drivers/mfd/rk808.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index 601cefb..9a9e631 100644 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -729,7 +729,7 @@ static int rk808_remove(struct i2c_client *client) return 0; } -static int rk8xx_suspend(struct device *dev) +static int __maybe_unused rk8xx_suspend(struct device *dev) { struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client); int ret = 0; @@ -749,7 +749,7 @@ static int rk8xx_suspend(struct device *dev) return ret; } -static int rk8xx_resume(struct device *dev) +static int __maybe_unused rk8xx_resume(struct device *dev) { struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client); int ret = 0; -- 2.7.4
Re: linux-next: build failure after merge of the net-next tree
Hi all, On Thu, 11 Jul 2019 13:16:03 +1000 Stephen Rothwell wrote: > > On Thu, 11 Jul 2019 13:13:44 +1000 Stephen Rothwell > wrote: > > > > On Thu, 11 Jul 2019 02:26:27 + Jason Gunthorpe > > wrote: > > > > > > On Thu, Jul 11, 2019 at 11:50:54AM +1000, Stephen Rothwell wrote: > > > > > > > So today this failed to build after I merged the rdma tree (previously > > > > it didn;t until after the net-next tree was merged (I assume a > > > > dependency changed). It failed because in_dev_for_each_ifa_rcu (and > > > > in_dev_for_each_ifa_rtnl) is only defined in a commit in the net-next > > > > tree :-( > > > > > > ? I'm confused.. > > > > > > rdma.git builds fine stand alone (I hope!) > > > > I have "Fixup to build SIW issue" from Leon (which switches to using > > in_dev_for_each_ifa_rcu) included in the rmda tree merge commit because > > without that the rdma tree would not build for me. Are you saying that > > I don't need that at all, now? > > Actually , I get it now, "Fixup to build SIW issue" is really just a > fixup for the net-next and rdma trees merge ... OK, I will fix that up > tomorrow. Sorry for my confusion. Actually, I have rewound my tree and am starting from the merge of the rdma tree again, so hopefully it should all be good today. -- Cheers, Stephen Rothwell pgpWW2KrxtW0_.pgp Description: OpenPGP digital signature
Re: [PATCH v2 6/7] x86/entry/64: Remove TRACE_IRQS_*_DEBUG
On Thu, 04 Jul 2019 21:56:01 +0200 Peter Zijlstra wrote: > Since INT3/#BP no longer runs on an IST, this workaround is no longer > required. > > Tested by running lockdep+ftrace as described in the initial commit: > > 5963e317b1e9 ("ftrace/x86: Do not change stacks in DEBUG when calling > lockdep") It looks like a clean revert, and it passed my ftrace smoke tests with lockdep enabled (although I triggered a locked warning unrelated to this, with the text_mutex and module_mutex, but I'm hoping my tree has the fixes for that). Reviewed-by: Steven Rostedt (VMware) Hmm, does this mean we can remove the IDT switching in the NMI handler as well? -- Steve > > Signed-off-by: Peter Zijlstra (Intel) > --- > arch/x86/entry/entry_64.S | 46 > ++ > 1 file changed, 2 insertions(+), 44 deletions(-) > > --- a/arch/x86/entry/entry_64.S > +++ b/arch/x86/entry/entry_64.S > @@ -68,44 +68,6 @@ END(native_usergs_sysret64) > .endm > > /* > - * When dynamic function tracer is enabled it will add a breakpoint > - * to all locations that it is about to modify, sync CPUs, update > - * all the code, sync CPUs, then remove the breakpoints. In this time > - * if lockdep is enabled, it might jump back into the debug handler > - * outside the updating of the IST protection. (TRACE_IRQS_ON/OFF). > - * > - * We need to change the IDT table before calling TRACE_IRQS_ON/OFF to > - * make sure the stack pointer does not get reset back to the top > - * of the debug stack, and instead just reuses the current stack. > - */ > -#if defined(CONFIG_DYNAMIC_FTRACE) && defined(CONFIG_TRACE_IRQFLAGS) > - > -.macro TRACE_IRQS_OFF_DEBUG > - calldebug_stack_set_zero > - TRACE_IRQS_OFF > - calldebug_stack_reset > -.endm > - > -.macro TRACE_IRQS_ON_DEBUG > - calldebug_stack_set_zero > - TRACE_IRQS_ON > - calldebug_stack_reset > -.endm > - > -.macro TRACE_IRQS_IRETQ_DEBUG > - btl $9, EFLAGS(%rsp)/* interrupts off? */ > - jnc 1f > - TRACE_IRQS_ON_DEBUG > -1: > -.endm > - > -#else > -# define TRACE_IRQS_OFF_DEBUGTRACE_IRQS_OFF > -# define TRACE_IRQS_ON_DEBUG TRACE_IRQS_ON > -# define TRACE_IRQS_IRETQ_DEBUG TRACE_IRQS_IRETQ > -#endif > - > -/* > * 64-bit SYSCALL instruction entry. Up to 6 arguments in registers. > * > * This is the only entry point used for 64-bit system calls. The > @@ -879,11 +841,7 @@ apicinterrupt IRQ_WORK_VECTORirq_work > GET_CR2_INTO(%rdx); /* can clobber %rax */ > .endif > > - .if \shift_ist != -1 > - TRACE_IRQS_OFF_DEBUG/* reload IDT in case of > recursion */ > - .else > TRACE_IRQS_OFF > - .endif > > .if \paranoid == 0 > testb $3, CS(%rsp) > @@ -1292,7 +1250,7 @@ END(paranoid_entry) > ENTRY(paranoid_exit) > UNWIND_HINT_REGS > DISABLE_INTERRUPTS(CLBR_ANY) > - TRACE_IRQS_OFF_DEBUG > + TRACE_IRQS_OFF > > /* Handle GS depending on FSGSBASE availability */ > ALTERNATIVE "jmp .Lparanoid_exit_checkgs", "nop",X86_FEATURE_FSGSBASE > @@ -1312,7 +1270,7 @@ ENTRY(paranoid_exit) > jmp .Lparanoid_exit_restore > > .Lparanoid_exit_no_swapgs: > - TRACE_IRQS_IRETQ_DEBUG > + TRACE_IRQS_IRETQ > /* Always restore stashed CR3 value (see paranoid_entry) */ > RESTORE_CR3 scratch_reg=%rbx save_reg=%r14 > >
Re: linux-next: build failure after merge of the net-next tree
Hi all, On Thu, 11 Jul 2019 13:13:44 +1000 Stephen Rothwell wrote: > > On Thu, 11 Jul 2019 02:26:27 + Jason Gunthorpe wrote: > > > > On Thu, Jul 11, 2019 at 11:50:54AM +1000, Stephen Rothwell wrote: > > > > > So today this failed to build after I merged the rdma tree (previously > > > it didn;t until after the net-next tree was merged (I assume a > > > dependency changed). It failed because in_dev_for_each_ifa_rcu (and > > > in_dev_for_each_ifa_rtnl) is only defined in a commit in the net-next > > > tree :-( > > > > ? I'm confused.. > > > > rdma.git builds fine stand alone (I hope!) > > I have "Fixup to build SIW issue" from Leon (which switches to using > in_dev_for_each_ifa_rcu) included in the rmda tree merge commit because > without that the rdma tree would not build for me. Are you saying that > I don't need that at all, now? Actually , I get it now, "Fixup to build SIW issue" is really just a fixup for the net-next and rdma trees merge ... OK, I will fix that up tomorrow. Sorry for my confusion. -- Cheers, Stephen Rothwell pgp8K9IVUrTBo.pgp Description: OpenPGP digital signature
[PATCH v2 1/6] ARM: tegra: Remove cpuidle drivers
Remove the old drivers to replace them cleanly with a new one later on. Signed-off-by: Dmitry Osipenko --- arch/arm/mach-tegra/Makefile | 13 -- arch/arm/mach-tegra/cpuidle-tegra114.c | 89 --- arch/arm/mach-tegra/cpuidle-tegra20.c | 212 - arch/arm/mach-tegra/cpuidle-tegra30.c | 132 --- arch/arm/mach-tegra/cpuidle.c | 50 -- arch/arm/mach-tegra/cpuidle.h | 21 --- arch/arm/mach-tegra/irq.c | 18 --- arch/arm/mach-tegra/irq.h | 11 -- arch/arm/mach-tegra/pm.c | 7 - arch/arm/mach-tegra/pm.h | 1 - arch/arm/mach-tegra/reset-handler.S| 11 -- arch/arm/mach-tegra/reset.h| 9 +- arch/arm/mach-tegra/sleep-tegra20.S| 190 +- arch/arm/mach-tegra/sleep.h| 12 -- arch/arm/mach-tegra/tegra.c| 3 - drivers/soc/tegra/Kconfig | 1 - include/soc/tegra/cpuidle.h| 4 - 17 files changed, 5 insertions(+), 779 deletions(-) delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra114.c delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra20.c delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra30.c delete mode 100644 arch/arm/mach-tegra/cpuidle.c delete mode 100644 arch/arm/mach-tegra/cpuidle.h delete mode 100644 arch/arm/mach-tegra/irq.h diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile index 6c1dff2eccc2..5d93a0b36866 100644 --- a/arch/arm/mach-tegra/Makefile +++ b/arch/arm/mach-tegra/Makefile @@ -8,29 +8,16 @@ obj-y += reset.o obj-y += reset-handler.o obj-y += sleep.o obj-y += tegra.o -obj-$(CONFIG_CPU_IDLE) += cpuidle.o obj-$(CONFIG_ARCH_TEGRA_2x_SOC)+= sleep-tegra20.o obj-$(CONFIG_ARCH_TEGRA_2x_SOC)+= pm-tegra20.o -ifeq ($(CONFIG_CPU_IDLE),y) -obj-$(CONFIG_ARCH_TEGRA_2x_SOC)+= cpuidle-tegra20.o -endif obj-$(CONFIG_ARCH_TEGRA_3x_SOC)+= sleep-tegra30.o obj-$(CONFIG_ARCH_TEGRA_3x_SOC)+= pm-tegra30.o -ifeq ($(CONFIG_CPU_IDLE),y) -obj-$(CONFIG_ARCH_TEGRA_3x_SOC)+= cpuidle-tegra30.o -endif obj-$(CONFIG_SMP) += platsmp.o obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o obj-$(CONFIG_ARCH_TEGRA_114_SOC) += sleep-tegra30.o obj-$(CONFIG_ARCH_TEGRA_114_SOC) += pm-tegra30.o -ifeq ($(CONFIG_CPU_IDLE),y) -obj-$(CONFIG_ARCH_TEGRA_114_SOC) += cpuidle-tegra114.o -endif obj-$(CONFIG_ARCH_TEGRA_124_SOC) += sleep-tegra30.o obj-$(CONFIG_ARCH_TEGRA_124_SOC) += pm-tegra30.o -ifeq ($(CONFIG_CPU_IDLE),y) -obj-$(CONFIG_ARCH_TEGRA_124_SOC) += cpuidle-tegra114.o -endif obj-$(CONFIG_ARCH_TEGRA_2x_SOC)+= board-paz00.o diff --git a/arch/arm/mach-tegra/cpuidle-tegra114.c b/arch/arm/mach-tegra/cpuidle-tegra114.c deleted file mode 100644 index 5118f777fd66.. --- a/arch/arm/mach-tegra/cpuidle-tegra114.c +++ /dev/null @@ -1,89 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Copyright (c) 2013, NVIDIA Corporation. All rights reserved. - */ - -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -#include "cpuidle.h" -#include "pm.h" -#include "sleep.h" - -#ifdef CONFIG_PM_SLEEP -#define TEGRA114_MAX_STATES 2 -#else -#define TEGRA114_MAX_STATES 1 -#endif - -#ifdef CONFIG_PM_SLEEP -static int tegra114_idle_power_down(struct cpuidle_device *dev, - struct cpuidle_driver *drv, - int index) -{ - local_fiq_disable(); - - tegra_set_cpu_in_lp2(); - cpu_pm_enter(); - - call_firmware_op(prepare_idle, TF_PM_MODE_LP2_NOFLUSH_L2); - - /* Do suspend by ourselves if the firmware does not implement it */ - if (call_firmware_op(do_idle, 0) == -ENOSYS) - cpu_suspend(0, tegra30_sleep_cpu_secondary_finish); - - cpu_pm_exit(); - tegra_clear_cpu_in_lp2(); - - local_fiq_enable(); - - return index; -} - -static void tegra114_idle_enter_s2idle(struct cpuidle_device *dev, - struct cpuidle_driver *drv, - int index) -{ - tegra114_idle_power_down(dev, drv, index); -} -#endif - -static struct cpuidle_driver tegra_idle_driver = { - .name = "tegra_idle", - .owner = THIS_MODULE, - .state_count = TEGRA114_MAX_STATES, - .states = { - [0] = ARM_CPUIDLE_WFI_STATE_PWR(600), -#ifdef CONFIG_PM_SLEEP - [1] = { - .enter = tegra114_idle_power_down, - .enter_s2idle = tegra114_idle_enter_s2idle, - .exit_latency = 500, - .t
[PATCH v2 4/6] cpuidle: tegra: Support CPU cluster power-down on Tegra30
The new CPU Idle driver has all necessary features in order to allow the deepest idling state on Tegra30 SoC where the whole CPU cluster is power-gated using the coupled idle state. Note that outer_disable() now need to be invoked directly since it produces erroneous warning message about secondary CPUs being online because it doesn't know that secondaries are turned off at that point by the cpuidle driver. Signed-off-by: Dmitry Osipenko --- arch/arm/mach-tegra/pm.c| 4 ++-- drivers/cpuidle/cpuidle-tegra.c | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-tegra/pm.c b/arch/arm/mach-tegra/pm.c index f9c9bce9e15d..cc941b0c97e8 100644 --- a/arch/arm/mach-tegra/pm.c +++ b/arch/arm/mach-tegra/pm.c @@ -146,8 +146,8 @@ static int tegra_sleep_cpu(unsigned long v2p) * if any of secondary CPU's is online and this is the LP2-idle * code-path only for Tegra20/30. */ - if (trusted_foundations_registered()) - outer_disable(); + if (trusted_foundations_registered() && outer_cache.disable) + outer_cache.disable(); /* * Note that besides of setting up CPU reset vector this firmware diff --git a/drivers/cpuidle/cpuidle-tegra.c b/drivers/cpuidle/cpuidle-tegra.c index 54974cd2255f..1412c4b0f6ee 100644 --- a/drivers/cpuidle/cpuidle-tegra.c +++ b/drivers/cpuidle/cpuidle-tegra.c @@ -278,7 +278,6 @@ static int tegra_cpuidle_probe(struct platform_device *pdev) tegra_idle_driver.states[TEGRA_C7].disabled = true; break; case TEGRA30: - tegra_idle_driver.states[TEGRA_CC6].disabled = true; break; case TEGRA114: case TEGRA124: -- 2.22.0
[PATCH v2 6/6] ARM: tegra: Enable Tegra cpuidle driver in tegra_defconfig
The Tegra CPU Idle driver was moved out into driver/cpuidle/ directory and it is now a proper platform driver. Signed-off-by: Dmitry Osipenko --- arch/arm/configs/tegra_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/configs/tegra_defconfig b/arch/arm/configs/tegra_defconfig index 8f5c6a5b444c..9a2f11a780a8 100644 --- a/arch/arm/configs/tegra_defconfig +++ b/arch/arm/configs/tegra_defconfig @@ -25,6 +25,7 @@ CONFIG_CPU_FREQ=y CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y CONFIG_CPUFREQ_DT=y CONFIG_CPU_IDLE=y +CONFIG_ARM_TEGRA_CPUIDLE=y CONFIG_VFP=y CONFIG_NEON=y CONFIG_TRUSTED_FOUNDATIONS=y -- 2.22.0
Re: linux-next: build failure after merge of the net-next tree
Hi Jason, On Thu, 11 Jul 2019 02:26:27 + Jason Gunthorpe wrote: > > On Thu, Jul 11, 2019 at 11:50:54AM +1000, Stephen Rothwell wrote: > > > So today this failed to build after I merged the rdma tree (previously > > it didn;t until after the net-next tree was merged (I assume a > > dependency changed). It failed because in_dev_for_each_ifa_rcu (and > > in_dev_for_each_ifa_rtnl) is only defined in a commit in the net-next > > tree :-( > > ? I'm confused.. > > rdma.git builds fine stand alone (I hope!) I have "Fixup to build SIW issue" from Leon (which switches to using in_dev_for_each_ifa_rcu) included in the rmda tree merge commit because without that the rdma tree would not build for me. Are you saying that I don't need that at all, now? -- Cheers, Stephen Rothwell pgpV4K8k1bq2t.pgp Description: OpenPGP digital signature
[PATCH v2 2/6] ARM: tegra: Expose functions required for cpuidle driver
The upcoming unified CPUIDLE driver will be added to the drivers/cpuidle/ directory and it will require all these Tegra PM-core functions. Signed-off-by: Dmitry Osipenko --- arch/arm/mach-tegra/Makefile | 2 +- arch/arm/mach-tegra/platsmp.c | 2 -- arch/arm/mach-tegra/pm.c | 16 +++- arch/arm/mach-tegra/pm.h | 3 --- arch/arm/mach-tegra/sleep.h | 1 - include/linux/clk/tegra.h | 13 + include/soc/tegra/pm.h| 28 7 files changed, 49 insertions(+), 16 deletions(-) diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile index 5d93a0b36866..27bd5d9865e3 100644 --- a/arch/arm/mach-tegra/Makefile +++ b/arch/arm/mach-tegra/Makefile @@ -13,7 +13,7 @@ obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += pm-tegra20.o obj-$(CONFIG_ARCH_TEGRA_3x_SOC)+= sleep-tegra30.o obj-$(CONFIG_ARCH_TEGRA_3x_SOC)+= pm-tegra30.o obj-$(CONFIG_SMP) += platsmp.o -obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o +obj-y += hotplug.o obj-$(CONFIG_ARCH_TEGRA_114_SOC) += sleep-tegra30.o obj-$(CONFIG_ARCH_TEGRA_114_SOC) += pm-tegra30.o diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c index e6911a14c096..c8a63719a143 100644 --- a/arch/arm/mach-tegra/platsmp.c +++ b/arch/arm/mach-tegra/platsmp.c @@ -183,8 +183,6 @@ const struct smp_operations tegra_smp_ops __initconst = { .smp_prepare_cpus = tegra_smp_prepare_cpus, .smp_secondary_init = tegra_secondary_init, .smp_boot_secondary = tegra_boot_secondary, -#ifdef CONFIG_HOTPLUG_CPU .cpu_kill = tegra_cpu_kill, .cpu_die= tegra_cpu_die, -#endif }; diff --git a/arch/arm/mach-tegra/pm.c b/arch/arm/mach-tegra/pm.c index 6aaacb5757e1..f9c9bce9e15d 100644 --- a/arch/arm/mach-tegra/pm.c +++ b/arch/arm/mach-tegra/pm.c @@ -123,11 +123,9 @@ void tegra_clear_cpu_in_lp2(void) spin_unlock(&tegra_lp2_lock); } -bool tegra_set_cpu_in_lp2(void) +void tegra_set_cpu_in_lp2(void) { int phy_cpu_id = cpu_logical_map(smp_processor_id()); - bool last_cpu = false; - cpumask_t *cpu_lp2_mask = tegra_cpu_lp2_mask; u32 *cpu_in_lp2 = tegra_cpu_lp2_mask; spin_lock(&tegra_lp2_lock); @@ -135,11 +133,7 @@ bool tegra_set_cpu_in_lp2(void) BUG_ON((*cpu_in_lp2 & BIT(phy_cpu_id))); *cpu_in_lp2 |= BIT(phy_cpu_id); - if ((phy_cpu_id == 0) && cpumask_equal(cpu_lp2_mask, cpu_online_mask)) - last_cpu = true; - spin_unlock(&tegra_lp2_lock); - return last_cpu; } static int tegra_sleep_cpu(unsigned long v2p) @@ -195,14 +189,16 @@ static void tegra_pm_set(enum tegra_suspend_mode mode) tegra_pmc_enter_suspend_mode(mode); } -void tegra_idle_lp2_last(void) +int tegra_idle_lp2_last(void) { + int err; + tegra_pm_set(TEGRA_SUSPEND_LP2); cpu_cluster_pm_enter(); suspend_cpu_complex(); - cpu_suspend(PHYS_OFFSET - PAGE_OFFSET, &tegra_sleep_cpu); + err = cpu_suspend(PHYS_OFFSET - PAGE_OFFSET, &tegra_sleep_cpu); /* * Resume L2 cache if it wasn't re-enabled early during resume, @@ -214,6 +210,8 @@ void tegra_idle_lp2_last(void) restore_cpu_complex(); cpu_cluster_pm_exit(); + + return err; } enum tegra_suspend_mode tegra_pm_validate_suspend_mode( diff --git a/arch/arm/mach-tegra/pm.h b/arch/arm/mach-tegra/pm.h index 1e51a9b636eb..81525f5f4a44 100644 --- a/arch/arm/mach-tegra/pm.h +++ b/arch/arm/mach-tegra/pm.h @@ -23,9 +23,6 @@ void tegra20_sleep_core_init(void); void tegra30_lp1_iram_hook(void); void tegra30_sleep_core_init(void); -void tegra_clear_cpu_in_lp2(void); -bool tegra_set_cpu_in_lp2(void); -void tegra_idle_lp2_last(void); extern void (*tegra_tear_down_cpu)(void); #ifdef CONFIG_PM_SLEEP diff --git a/arch/arm/mach-tegra/sleep.h b/arch/arm/mach-tegra/sleep.h index d219872b7546..0d9956e9a8ea 100644 --- a/arch/arm/mach-tegra/sleep.h +++ b/arch/arm/mach-tegra/sleep.h @@ -124,7 +124,6 @@ void tegra30_hotplug_shutdown(void); #endif void tegra20_tear_down_cpu(void); -int tegra30_sleep_cpu_secondary_finish(unsigned long); void tegra30_tear_down_cpu(void); #endif diff --git a/include/linux/clk/tegra.h b/include/linux/clk/tegra.h index b8aef62cc3f5..cf0f2cb5e109 100644 --- a/include/linux/clk/tegra.h +++ b/include/linux/clk/tegra.h @@ -108,6 +108,19 @@ static inline void tegra_cpu_clock_resume(void) tegra_cpu_car_ops->resume(); } +#else +static inline bool tegra_cpu_rail_off_ready(void) +{ + return false; +} + +static inline void tegra_cpu_clock_suspend(void) +{ +} + +static inline void tegra_cpu_clock_resume(void) +{ +} #endif extern void tegra210_xusb_pll_hw_control_enable(void); diff --git a/include/soc/tegra/pm.h b/include/soc/tegra/pm.h index 951fcd738d55..fa18c2df5028 100644 --- a/include/soc/tegra/
[PATCH v2 3/6] cpuidle: Add unified driver for NVIDIA Tegra SoCs
The new driver is based on the old CPU Idle drivers that are removed now from arm/arch/mach-tegra/ directory. Those removed drivers were reworked and squashed into a single unified driver that covers multiple hardware generations, starting from Tegra20 and ending with Tegra124. Signed-off-by: Dmitry Osipenko --- arch/arm/mach-tegra/tegra.c | 4 + drivers/cpuidle/Kconfig.arm | 8 + drivers/cpuidle/Makefile| 1 + drivers/cpuidle/cpuidle-tegra.c | 304 include/soc/tegra/cpuidle.h | 4 + 5 files changed, 321 insertions(+) create mode 100644 drivers/cpuidle/cpuidle-tegra.c diff --git a/arch/arm/mach-tegra/tegra.c b/arch/arm/mach-tegra/tegra.c index d9237769a37c..f1ce2857a251 100644 --- a/arch/arm/mach-tegra/tegra.c +++ b/arch/arm/mach-tegra/tegra.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include "board.h" @@ -92,6 +93,9 @@ static void __init tegra_dt_init_late(void) if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && of_machine_is_compatible("nvidia,tegra20")) platform_device_register_simple("tegra20-cpufreq", -1, NULL, 0); + + if (IS_ENABLED(CONFIG_ARM_TEGRA_CPUIDLE) && !psci_smp_available()) + platform_device_register_simple("tegra-cpuidle", -1, NULL, 0); } static const char * const tegra_dt_board_compat[] = { diff --git a/drivers/cpuidle/Kconfig.arm b/drivers/cpuidle/Kconfig.arm index 48cb3d4bb7d1..d90861361f1d 100644 --- a/drivers/cpuidle/Kconfig.arm +++ b/drivers/cpuidle/Kconfig.arm @@ -76,3 +76,11 @@ config ARM_MVEBU_V7_CPUIDLE depends on ARCH_MVEBU && !ARM64 help Select this to enable cpuidle on Armada 370, 38x and XP processors. + +config ARM_TEGRA_CPUIDLE + bool "CPU Idle Driver for NVIDIA Tegra SoCs" + depends on ARCH_TEGRA && !ARM64 + select ARCH_NEEDS_CPU_IDLE_COUPLED if SMP + select ARM_CPU_SUSPEND + help + Select this to enable cpuidle for NVIDIA Tegra20/30/114/124 SoCs. diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile index 9d7176cee3d3..470d17fa8746 100644 --- a/drivers/cpuidle/Makefile +++ b/drivers/cpuidle/Makefile @@ -20,6 +20,7 @@ obj-$(CONFIG_ARM_U8500_CPUIDLE) += cpuidle-ux500.o obj-$(CONFIG_ARM_AT91_CPUIDLE) += cpuidle-at91.o obj-$(CONFIG_ARM_EXYNOS_CPUIDLE)+= cpuidle-exynos.o obj-$(CONFIG_ARM_CPUIDLE) += cpuidle-arm.o +obj-$(CONFIG_ARM_TEGRA_CPUIDLE)+= cpuidle-tegra.o ### # MIPS drivers diff --git a/drivers/cpuidle/cpuidle-tegra.c b/drivers/cpuidle/cpuidle-tegra.c new file mode 100644 index ..54974cd2255f --- /dev/null +++ b/drivers/cpuidle/cpuidle-tegra.c @@ -0,0 +1,304 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * CPU idle driver for Tegra CPUs + * + * Copyright (c) 2010-2013, NVIDIA Corporation. + * Copyright (c) 2011 Google, Inc. + * Author: Colin Cross + * Gary King + * + * Rework for 3.3 by Peter De Schrijver + * + * Tegra20/124 driver unification by Dmitry Osipenko + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#define TEGRA_C1 0 +#define TEGRA_C7 1 +#define TEGRA_CC6 2 + +static atomic_t tegra_idle_barrier; + +static inline bool tegra_cpuidle_using_firmware(void) +{ + return firmware_ops->prepare_idle && firmware_ops->do_idle; +} + +static int tegra_shutdown_secondary_cpu(unsigned long cpu) +{ + tegra_cpu_die(cpu); + + return -EINVAL; +} + +static int tegra_await_secondary_cpus_shutdown(void) +{ + ktime_t timeout = ktime_add_ms(ktime_get(), 1); + + /* +* The boot CPU shall await for the secondaries shutdown in order +* to power-off CPU's cluster safely. +*/ + do { + if (tegra_cpu_rail_off_ready()) + return 0; + + } while (ktime_compare(ktime_get(), timeout) < 0); + + return -ETIMEDOUT; +} + +static void tegra_wake_up_secondary_cpus(void) +{ + unsigned int cpu, lcpu; + + for_each_cpu(lcpu, cpu_online_mask) { + cpu = cpu_logical_map(lcpu); + + if (cpu > 0) { + tegra_enable_cpu_clock(cpu); + tegra_cpu_out_of_reset(cpu); + flowctrl_write_cpu_halt(cpu, 0); + } + } +} + +static int tegra_cpuidle_cc6_enter(void) +{ + int err; + + err = tegra_await_secondary_cpus_shutdown(); + if (err) + return err; + + err = tegra_idle_lp2_last(); + + tegra_wake_up_secondary_cpus(); + + return err; +} + +static int tegra_cpuidle_c7_enter(void) +{ + int err; + + if (tegra_cpuidle_using_firmware()) { + err = call
[PATCH v2 5/6] ARM: multi_v7_defconfig: Enable Tegra cpuidle driver
The Tegra CPU Idle driver was moved out into driver/cpuidle/ directory and it is now a proper platform driver. Signed-off-by: Dmitry Osipenko --- arch/arm/configs/multi_v7_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig index 6a40bc2ef271..2c0fc7968c42 100644 --- a/arch/arm/configs/multi_v7_defconfig +++ b/arch/arm/configs/multi_v7_defconfig @@ -107,6 +107,7 @@ CONFIG_CPU_IDLE=y CONFIG_ARM_CPUIDLE=y CONFIG_ARM_ZYNQ_CPUIDLE=y CONFIG_ARM_EXYNOS_CPUIDLE=y +CONFIG_ARM_TEGRA_CPUIDLE=y CONFIG_KERNEL_MODE_NEON=y CONFIG_RASPBERRYPI_FIRMWARE=y CONFIG_TRUSTED_FOUNDATIONS=y -- 2.22.0
[PATCH v2 0/6] Consolidate and improve NVIDIA Tegra CPUIDLE driver(s)
Hello, I was spending quite some time recently trying to hunt down CPU-suspend bug on Tegra30 SoC and in the end it was nailed. During that time I realized that the CPU Idle drivers could get some polish and gain new features, thus that's what this series does: 1. Unifies Tegra20/30/114 drivers into a single driver and moves it out into common drivers/cpuidle/ directory. 2. Enables CPU cluster power-down idling state on Tegra30. In the end there is a quite nice clean up of the Tegra CPUIDLE driver(s) and of the Tegra's arch code in general. Please review, thanks! Changelog: v2: - Added patches to enable the new cpuidle driver in the defconfigs: ARM: multi_v7_defconfig: Enable Tegra cpuidle driver ARM: tegra: Enable Tegra cpuidle driver in tegra_defconfig - Dropped patches that removed CPUIDLE_FLAG_TIMER_STOP from the idling states because that flag actually doesn't have any negative effects, but still is correct for the case of a local CPU timer on older Tegra SoCs: cpuidle: tegra: Remove CPUIDLE_FLAG_TIMER_STOP from Tegra114/124 idle-state cpuidle: tegra: Remove CPUIDLE_FLAG_TIMER_STOP from all states - The "Add unified driver for NVIDIA Tegra SoCs" patch got more polish. Tegra30 and Terga114 states are now squashed into a single common C7 state (following Parker TRM terminology, see 17.2.2.2 Power Management States), more comments added, etc minor changes. Dmitry Osipenko (6): ARM: tegra: Remove cpuidle drivers ARM: tegra: Expose functions required for cpuidle driver cpuidle: Add unified driver for NVIDIA Tegra SoCs cpuidle: tegra: Support CPU cluster power-down on Tegra30 ARM: multi_v7_defconfig: Enable Tegra cpuidle driver ARM: tegra: Enable Tegra cpuidle driver in tegra_defconfig arch/arm/configs/multi_v7_defconfig| 1 + arch/arm/configs/tegra_defconfig | 1 + arch/arm/mach-tegra/Makefile | 15 +- arch/arm/mach-tegra/cpuidle-tegra114.c | 89 arch/arm/mach-tegra/cpuidle-tegra20.c | 212 - arch/arm/mach-tegra/cpuidle-tegra30.c | 132 --- arch/arm/mach-tegra/cpuidle.c | 50 arch/arm/mach-tegra/cpuidle.h | 21 -- arch/arm/mach-tegra/irq.c | 18 -- arch/arm/mach-tegra/irq.h | 11 - arch/arm/mach-tegra/platsmp.c | 2 - arch/arm/mach-tegra/pm.c | 27 +-- arch/arm/mach-tegra/pm.h | 4 - arch/arm/mach-tegra/reset-handler.S| 11 - arch/arm/mach-tegra/reset.h| 9 +- arch/arm/mach-tegra/sleep-tegra20.S| 190 +--- arch/arm/mach-tegra/sleep.h| 13 -- arch/arm/mach-tegra/tegra.c| 7 +- drivers/cpuidle/Kconfig.arm| 8 + drivers/cpuidle/Makefile | 1 + drivers/cpuidle/cpuidle-tegra.c| 303 + drivers/soc/tegra/Kconfig | 1 - include/linux/clk/tegra.h | 13 ++ include/soc/tegra/cpuidle.h| 2 +- include/soc/tegra/pm.h | 28 +++ 25 files changed, 375 insertions(+), 794 deletions(-) delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra114.c delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra20.c delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra30.c delete mode 100644 arch/arm/mach-tegra/cpuidle.c delete mode 100644 arch/arm/mach-tegra/cpuidle.h delete mode 100644 arch/arm/mach-tegra/irq.h create mode 100644 drivers/cpuidle/cpuidle-tegra.c -- 2.22.0
Re: [PATCH] ARM: fix O= building with CONFIG_FPE_FASTFPE
Arnd, Olof, Please ignore this. I wanted to put this patch into Russell's patch tracker, but just sent it to a wrong ML. Masahiro Yamada On Thu, Jul 11, 2019 at 12:08 PM Masahiro Yamada wrote: > > To use Fastfpe, a user is supposed to enable CONFIG_FPE_FASTFPE > and put downstream source files into arch/arm/fastfpe/. > > It is not working for O= build because $(wildcard arch/arm/fastfpe) > checks if it exists in $(objtree), not in $(srctree). > > Add the $(srctree)/ prefix to fix it. > > While I was here, I slightly refactored the code. > > Signed-off-by: Masahiro Yamada > --- > > KernelVersion: 5.2 > > arch/arm/Makefile | 9 ++--- > 1 file changed, 2 insertions(+), 7 deletions(-) > > diff --git a/arch/arm/Makefile b/arch/arm/Makefile > index f863c6935d0e..792f7fa16a24 100644 > --- a/arch/arm/Makefile > +++ b/arch/arm/Makefile > @@ -271,14 +271,9 @@ endif > > export TEXT_OFFSET GZFLAGS MMUEXT > > -# Do we have FASTFPE? > -FASTFPE:=arch/arm/fastfpe > -ifeq ($(FASTFPE),$(wildcard $(FASTFPE))) > -FASTFPE_OBJ:=$(FASTFPE)/ > -endif > - > core-$(CONFIG_FPE_NWFPE) += arch/arm/nwfpe/ > -core-$(CONFIG_FPE_FASTFPE) += $(FASTFPE_OBJ) > +# Put arch/arm/fastfpe/ to use this. > +core-$(CONFIG_FPE_FASTFPE) += $(patsubst $(srctree)/%,%,$(wildcard > $(srctree)/arch/arm/fastfpe/)) > core-$(CONFIG_VFP) += arch/arm/vfp/ > core-$(CONFIG_XEN) += arch/arm/xen/ > core-$(CONFIG_KVM_ARM_HOST)+= arch/arm/kvm/ > -- > 2.17.1 > -- Best Regards Masahiro Yamada
[PATCH 2/2] dmaengine: pl330: use the same attriobutes when freeing pl330->mcode_cpu
In function dmac_alloc_recources(), pl330->mcode_cpu is allocated using dma_alloc_attrs() but freed with dma_free_coherent(). Use the correct dma_free_attrs() function to free pl330->mcode_cpu. Signed-off-by: Fuqian Huang --- drivers/dma/pl330.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 56f9fabc99c4..d9c6ae0732c6 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -1918,9 +1918,10 @@ static int dmac_alloc_resources(struct pl330_dmac *pl330) if (ret) { dev_err(pl330->ddma.dev, "%s:%d Can't to create channels for DMAC!\n", __func__, __LINE__); - dma_free_coherent(pl330->ddma.dev, + dma_free_attrs(pl330->ddma.dev, chans * pl330->mcbufsz, - pl330->mcode_cpu, pl330->mcode_bus); + pl330->mcode_cpu, pl330->mcode_bus, + DMA_ATTR_PRIVILEGED); return ret; } @@ -1999,9 +2000,9 @@ static void pl330_del(struct pl330_dmac *pl330) /* Free DMAC resources */ dmac_free_threads(pl330); - dma_free_coherent(pl330->ddma.dev, + dma_free_attrs(pl330->ddma.dev, pl330->pcfg.num_chan * pl330->mcbufsz, pl330->mcode_cpu, - pl330->mcode_bus); + pl330->mcode_bus, DMA_ATTR_PRIVILEGED); } /* forward declaration */ -- 2.11.0
Re: [PATCH 4/6] irqchip/irq-pruss-intc: Add helper functions to configure internal mapping
On 7/7/19 10:52 PM, Suman Anna wrote: The PRUSS INTC receives a number of system input interrupt source events and supports individual control configuration and hardware prioritization. These input events can be mapped to some output host interrupts through 2 levels of many-to-one mapping i.e. events to channel mapping and channels to host interrupts. This mapping information is provided through the PRU firmware that is loaded onto a PRU core/s or through the device tree node of the PRU What will the device tree bindings for this look like? Looking back at Rob's comment on the initial series [1], I still think that increasing the #interrupt-cells sounds like a reasonable solution. [1]: https://patchwork.kernel.org/patch/10697705/#22375155 application. The mapping is configured by the PRU remoteproc driver, and is setup before the PRU core is started and cleaned up after the PRU core is stopped. This event mapping configuration logic is optimized to program the Channel Map Registers (CMRx) and Host-Interrupt Map Registers (HMRx) only when a new program is being loaded/started and simply disables the same events and interrupt channels without zeroing out the corresponding map registers when stopping a PRU. Add two helper functions: pruss_intc_configure() & pruss_intc_unconfigure() that the PRU remoteproc driver can use to configure the PRUSS INTC. Signed-off-by: Suman Anna Signed-off-by: Andrew F. Davis Signed-off-by: Roger Quadros --- drivers/irqchip/irq-pruss-intc.c | 258 - include/linux/irqchip/irq-pruss-intc.h | 33 2 files changed, 289 insertions(+), 2 deletions(-) create mode 100644 include/linux/irqchip/irq-pruss-intc.h diff --git a/drivers/irqchip/irq-pruss-intc.c b/drivers/irqchip/irq-pruss-intc.c index 142d01b434e0..8118c2a2ac43 100644 --- a/drivers/irqchip/irq-pruss-intc.c +++ b/drivers/irqchip/irq-pruss-intc.c @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -24,8 +25,8 @@ /* minimum starting host interrupt number for MPU */ #define MIN_PRU_HOST_INT 2 -/* maximum number of system events */ -#define MAX_PRU_SYS_EVENTS 64 +/* maximum number of host interrupts */ +#define MAX_PRU_HOST_INT 10 /* PRU_ICSS_INTC registers */ #define PRU_INTC_REVID0x @@ -57,15 +58,29 @@ #define PRU_INTC_HINLR(x) (0x1100 + (x) * 4) #define PRU_INTC_HIER 0x1500 +/* CMR register bit-field macros */ +#define CMR_EVT_MAP_MASK 0xf +#define CMR_EVT_MAP_BITS 8 +#define CMR_EVT_PER_REG4 + +/* HMR register bit-field macros */ +#define HMR_CH_MAP_MASK0xf +#define HMR_CH_MAP_BITS8 +#define HMR_CH_PER_REG 4 + /* HIPIR register bit-fields */ #define INTC_HIPIR_NONE_HINT 0x8000 +/* use -1 to mark unassigned events and channels */ +#define FREE -1 It could be helpful to have this macro in the public header. + /** * struct pruss_intc - PRUSS interrupt controller structure * @irqs: kernel irq numbers corresponding to PRUSS host interrupts * @base: base virtual address of INTC register space * @irqchip: irq chip for this interrupt controller * @domain: irq domain for this interrupt controller + * @config_map: stored INTC configuration mapping data * @lock: mutex to serialize access to INTC * @host_mask: indicate which HOST IRQs are enabled * @shared_intr: bit-map denoting if the MPU host interrupt is shared @@ -76,6 +91,7 @@ struct pruss_intc { void __iomem *base; struct irq_chip *irqchip; struct irq_domain *domain; + struct pruss_intc_config config_map; struct mutex lock; /* PRUSS INTC lock */ u32 host_mask; u16 shared_intr; @@ -107,6 +123,238 @@ static int pruss_intc_check_write(struct pruss_intc *intc, unsigned int reg, return 0; } +static struct pruss_intc *to_pruss_intc(struct device *pru_dev) +{ + struct device_node *np; + struct platform_device *pdev; + struct device *pruss_dev = pru_dev->parent; + struct pruss_intc *intc = ERR_PTR(-ENODEV); + + np = of_get_child_by_name(pruss_dev->of_node, "interrupt-controller"); + if (!np) { + dev_err(pruss_dev, "pruss does not have an interrupt-controller node\n"); + return intc; + } + + pdev = of_find_device_by_node(np); + if (!pdev) { + dev_err(pruss_dev, "no associated platform device\n"); + goto out; + } + + intc = platform_get_drvdata(pdev); + if (!intc) { + dev_err(pruss_dev, "pruss intc device probe failed?\n"); + intc = ERR_PTR(-EINVAL); + } + +out: + of_node_put(np); + return intc; +} + +/** + * pruss_intc_configure() - configure the PRUSS INTC + * @dev: pru device pointer + * @intc_config: PRU core-specific INTC configuration + * + * Configures th
[PATCH 1/2] drm/ttm: use the same attributes when freeing d_page->vaddr
In function __ttm_dma_alloc_page(), d_page->addr is allocated by dma_alloc_attrs() but freed with use dma_free_coherent() in __ttm_dma_free_page(). Use the correct dma_free_attrs() to free d_page->vaddr. Signed-off-by: Fuqian Huang --- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c index d594f7520b7b..7d78e6deac89 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c @@ -285,9 +285,13 @@ static int ttm_set_pages_caching(struct dma_pool *pool, static void __ttm_dma_free_page(struct dma_pool *pool, struct dma_page *d_page) { + unsigned long attrs = 0; dma_addr_t dma = d_page->dma; d_page->vaddr &= ~VADDR_FLAG_HUGE_POOL; - dma_free_coherent(pool->dev, pool->size, (void *)d_page->vaddr, dma); + if (pool->type & IS_HUGE) + attrs = DMA_ATTR_NO_WARN; + + dma_free_attrs(pool->dev, pool->size, (void *)d_page->vaddr, dma, attrs); kfree(d_page); d_page = NULL; -- 2.11.0
[PATCH] ARM: fix O= building with CONFIG_FPE_FASTFPE
To use Fastfpe, a user is supposed to enable CONFIG_FPE_FASTFPE and put downstream source files into arch/arm/fastfpe/. It is not working for O= build because $(wildcard arch/arm/fastfpe) checks if it exists in $(objtree), not in $(srctree). Add the $(srctree)/ prefix to fix it. While I was here, I slightly refactored the code. Signed-off-by: Masahiro Yamada --- KernelVersion: 5.2 arch/arm/Makefile | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/arch/arm/Makefile b/arch/arm/Makefile index f863c6935d0e..792f7fa16a24 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -271,14 +271,9 @@ endif export TEXT_OFFSET GZFLAGS MMUEXT -# Do we have FASTFPE? -FASTFPE:=arch/arm/fastfpe -ifeq ($(FASTFPE),$(wildcard $(FASTFPE))) -FASTFPE_OBJ:=$(FASTFPE)/ -endif - core-$(CONFIG_FPE_NWFPE) += arch/arm/nwfpe/ -core-$(CONFIG_FPE_FASTFPE) += $(FASTFPE_OBJ) +# Put arch/arm/fastfpe/ to use this. +core-$(CONFIG_FPE_FASTFPE) += $(patsubst $(srctree)/%,%,$(wildcard $(srctree)/arch/arm/fastfpe/)) core-$(CONFIG_VFP) += arch/arm/vfp/ core-$(CONFIG_XEN) += arch/arm/xen/ core-$(CONFIG_KVM_ARM_HOST)+= arch/arm/kvm/ -- 2.17.1
Re: [PATCH] dax: Fix missed PMD wakeups
On Wed, Jul 10, 2019 at 09:02:04PM +0200, Jan Kara wrote: > @@ -848,7 +853,7 @@ static int dax_writeback_one(struct xa_state *xas, struct > dax_device *dax_dev, > if (unlikely(dax_is_locked(entry))) { > void *old_entry = entry; > > - entry = get_unlocked_entry(xas); > + entry = get_unlocked_entry(xas, 0); > > /* Entry got punched out / reallocated? */ > if (!entry || WARN_ON_ONCE(!xa_is_value(entry))) I'm not sure about this one. Are we sure there will never be a dirty PMD entry? Even if we can't create one today, it feels like a bit of a landmine to leave for someone who creates one in the future.
[PATCH] ARM: fix O= building with CONFIG_FPE_FASTFPE
To use Fastfpe, a user is supposed to enable CONFIG_FPE_FASTFPE and put downstream source files into arch/arm/fastfpe/. It is not working for O= build because $(wildcard arch/arm/fastfpe) checks if it exists in $(objtree), not in $(srctree). Add the $(srctree)/ prefix to fix it. While I was here, I slightly refactored the code. Signed-off-by: Masahiro Yamada --- KernelVersion: 5.2 arch/arm/Makefile | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/arch/arm/Makefile b/arch/arm/Makefile index f863c6935d0e..792f7fa16a24 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -271,14 +271,9 @@ endif export TEXT_OFFSET GZFLAGS MMUEXT -# Do we have FASTFPE? -FASTFPE:=arch/arm/fastfpe -ifeq ($(FASTFPE),$(wildcard $(FASTFPE))) -FASTFPE_OBJ:=$(FASTFPE)/ -endif - core-$(CONFIG_FPE_NWFPE) += arch/arm/nwfpe/ -core-$(CONFIG_FPE_FASTFPE) += $(FASTFPE_OBJ) +# Put arch/arm/fastfpe/ to use this. +core-$(CONFIG_FPE_FASTFPE) += $(patsubst $(srctree)/%,%,$(wildcard $(srctree)/arch/arm/fastfpe/)) core-$(CONFIG_VFP) += arch/arm/vfp/ core-$(CONFIG_XEN) += arch/arm/xen/ core-$(CONFIG_KVM_ARM_HOST)+= arch/arm/kvm/ -- 2.17.1
Re: [GIT PULL] Keys: Set 4 - Key ACLs for 5.3
Hi Linus, On Wed, 2019-07-10 at 18:59 -0700, Linus Torvalds wrote: > Anyway, since it does seem like David is offline, I've just reverted > this from my tree, and will be continuing my normal merge window pull > requests (the other issues I have seen have fixes in their respective > trees). Sorry for the delay. An exception is needed for loading builtin keys "KEY_ALLOC_BUILT_IN" onto a keyring that is not writable by userspace. The following works, but probably is not how David would handle the exception. diff --git a/security/keys/key.c b/security/keys/key.c index 519211a996e7..a99332c1e014 100644 --- a/security/keys/key.c +++ b/security/keys/key.c @@ -896,7 +896,7 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref, /* if we're going to allocate a new key, we're going to have * to modify the keyring */ ret = key_permission(keyring_ref, KEY_NEED_WRITE); - if (ret < 0) { + if (ret < 0 && !(flags & KEY_ALLOC_BUILT_IN)) { key_ref = ERR_PTR(ret); goto error_link_end; } Mimi
Re: [PATCH] rdma/siw: Use proper enumerated type in map_cqe_status
On Wed, Jul 10, 2019 at 04:53:50PM -0700, Nick Desaulniers wrote: > On Wed, Jul 10, 2019 at 11:26 AM Jason Gunthorpe wrote: > > > > On Wed, Jul 10, 2019 at 10:48:00AM -0700, Nathan Chancellor wrote: > > > clang warns several times: > > > > > > drivers/infiniband/sw/siw/siw_cq.c:31:4: warning: implicit conversion > > > from enumeration type 'enum siw_wc_status' to different enumeration type > > > 'enum siw_opcode' [-Wenum-conversion] > > Weird that gcc doesn't warn on this by default.. > > Based on the sheer number of -Wenum-conversion that Nathan has fixed, > I don't think gcc has -Wenum-conversion (or it's somehow disabled just > for gcc). > -- > Thanks, > ~Nick Desaulniers Yes, as far as I am aware, GCC does not warn on implicit enum conversions (which I think defeats the purpose of enumerated types *shrugs*). Cheers, Nathan
[PATCH 1/2] dt-bindings: imx-ocotp: Add i.MX8MN compatible
From: Anson Huang Add compatible for i.MX8MN and add i.MX8MM/i.MX8MN to the description. Signed-off-by: Anson Huang --- Documentation/devicetree/bindings/nvmem/imx-ocotp.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/nvmem/imx-ocotp.txt b/Documentation/devicetree/bindings/nvmem/imx-ocotp.txt index 96ffd06..904dadf 100644 --- a/Documentation/devicetree/bindings/nvmem/imx-ocotp.txt +++ b/Documentation/devicetree/bindings/nvmem/imx-ocotp.txt @@ -2,7 +2,7 @@ Freescale i.MX6 On-Chip OTP Controller (OCOTP) device tree bindings This binding represents the on-chip eFuse OTP controller found on i.MX6Q/D, i.MX6DL/S, i.MX6SL, i.MX6SX, i.MX6UL, i.MX6ULL/ULZ, i.MX6SLL, -i.MX7D/S, i.MX7ULP and i.MX8MQ SoCs. +i.MX7D/S, i.MX7ULP, i.MX8MQ, i.MX8MM and i.MX8MN SoCs. Required properties: - compatible: should be one of @@ -16,6 +16,7 @@ Required properties: "fsl,imx7ulp-ocotp" (i.MX7ULP), "fsl,imx8mq-ocotp" (i.MX8MQ), "fsl,imx8mm-ocotp" (i.MX8MM), + "fsl,imx8mn-ocotp" (i.MX8MN), followed by "syscon". - #address-cells : Should be 1 - #size-cells : Should be 1 -- 2.7.4
[PATCH 2/2] nvmem: imx-ocotp: Add i.MX8MN support
From: Anson Huang i.MX8MN is a new SoC of i.MX8M series, it is similar to i.MX8MM in terms of addressing and clock setup, add support for its fuse read/write. Signed-off-by: Anson Huang --- drivers/nvmem/imx-ocotp.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c index 42d4451..dff2f3c 100644 --- a/drivers/nvmem/imx-ocotp.c +++ b/drivers/nvmem/imx-ocotp.c @@ -479,6 +479,12 @@ static const struct ocotp_params imx8mm_params = { .set_timing = imx_ocotp_set_imx6_timing, }; +static const struct ocotp_params imx8mn_params = { + .nregs = 256, + .bank_address_words = 0, + .set_timing = imx_ocotp_set_imx6_timing, +}; + static const struct of_device_id imx_ocotp_dt_ids[] = { { .compatible = "fsl,imx6q-ocotp", .data = &imx6q_params }, { .compatible = "fsl,imx6sl-ocotp", .data = &imx6sl_params }, @@ -490,6 +496,7 @@ static const struct of_device_id imx_ocotp_dt_ids[] = { { .compatible = "fsl,imx7ulp-ocotp", .data = &imx7ulp_params }, { .compatible = "fsl,imx8mq-ocotp", .data = &imx8mq_params }, { .compatible = "fsl,imx8mm-ocotp", .data = &imx8mm_params }, + { .compatible = "fsl,imx8mn-ocotp", .data = &imx8mn_params }, { }, }; MODULE_DEVICE_TABLE(of, imx_ocotp_dt_ids); -- 2.7.4
[PATCH 1/1] riscv: Fix perf record without libelf support
This patch fix following perf record error by linking vdso.so with build id. perf.data perf.data.old [ perf record: Woken up 1 times to write data ] free(): double free detected in tcache 2 Aborted perf record use filename__read_build_id(util/symbol-minimal.c) to get build id when libelf is not supported. When vdso.so is linked without build id, the section size of PT_NOTE will be zero, buf size will realloc to zero and cause memory corruption. Signed-off-by: Mao Han Cc: Paul Walmsley Cc: Palmer Dabbelt Cc: Albert Ou --- arch/riscv/kernel/vdso/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile index f1d6ffe..49a5852 100644 --- a/arch/riscv/kernel/vdso/Makefile +++ b/arch/riscv/kernel/vdso/Makefile @@ -37,7 +37,7 @@ $(obj)/vdso.so.dbg: $(src)/vdso.lds $(obj-vdso) FORCE # these symbols in the kernel code rather than hand-coded addresses. SYSCFLAGS_vdso.so.dbg = -shared -s -Wl,-soname=linux-vdso.so.1 \ - -Wl,--hash-style=both + -Wl,--build-id -Wl,--hash-style=both $(obj)/vdso-dummy.o: $(src)/vdso.lds $(obj)/rt_sigreturn.o FORCE $(call if_changed,vdsold) -- 2.7.4
[PATCH] x86/stacktrace: Fix infinite loop in arch_stack_walk_user()
Current arch_stack_walk_user() checks `if (fp == frame.next_fp)` to prevent infinite loop by self reference but it's not enogh for circular reference. Once we find a lack of return address, there is no need to continue loop, so let's break out. Fixes: 02b67518e2b1 ("tracing: add support for userspace stacktraces in tracing/iter_ctrl") Signed-off-by: Eiichi Tsukata --- arch/x86/kernel/stacktrace.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/arch/x86/kernel/stacktrace.c b/arch/x86/kernel/stacktrace.c index 2abf27d7df6b..b1a1f4b4c943 100644 --- a/arch/x86/kernel/stacktrace.c +++ b/arch/x86/kernel/stacktrace.c @@ -129,11 +129,8 @@ void arch_stack_walk_user(stack_trace_consume_fn consume_entry, void *cookie, break; if ((unsigned long)fp < regs->sp) break; - if (frame.ret_addr) { - if (!consume_entry(cookie, frame.ret_addr, false)) - return; - } - if (fp == frame.next_fp) + if (!frame.ret_addr || + !consume_entry(cookie, frame.ret_addr, false)) break; fp = frame.next_fp; } -- 2.21.0
Re: linux-next: build failure after merge of the net-next tree
On Thu, Jul 11, 2019 at 11:50:54AM +1000, Stephen Rothwell wrote: > So today this failed to build after I merged the rdma tree (previously > it didn;t until after the net-next tree was merged (I assume a > dependency changed). It failed because in_dev_for_each_ifa_rcu (and > in_dev_for_each_ifa_rtnl) is only defined in a commit in the net-next > tree :-( ? I'm confused.. rdma.git builds fine stand alone (I hope!) If you merge it with netdev then the above patch is needed afer the merge as netdev changed to ifa_rcu I just did this a few hours ago to make and test the patch I sent above.. Jason
Re: [PATCH v3 1/4] perf pmu: Support more complex PMU event aliasing
On 02/07/2019 20:07, Arnaldo Carvalho de Melo wrote: Em Fri, Jun 28, 2019 at 10:35:49PM +0800, John Garry escreveu: The jevent "Unit" field is used for uncore PMU alias definition. The form uncore_pmu_example_X is supported, where "X" is a wildcard, to support multiple instances of the same PMU in a system. Unfortunately this format not suitable for all uncore PMUs; take the Hisi DDRC uncore PMU for example, where the name is in the form hisi_scclX_ddrcY. For for current jevent parsing, we would be required to hardcode an uncore alias translation for each possible value of X. This is not scalable. Instead, add support for "Unit" field in the form "hisi_sccl,ddrc", where we can match by hisi_scclX and ddrcY. Tokens in Unit field are delimited by ','. Signed-off-by: John Garry --- tools/perf/util/pmu.c | 46 ++- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 7e7299fee550..cfc916819c59 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -700,6 +700,46 @@ struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu) return map; } +static bool pmu_uncore_alias_match(const char *pmu_name, const char *name) +{ + char *tmp, *tok, *str; + bool res; + + str = strdup(pmu_name); + if (!str) + return false; + + /* +* uncore alias may be from different PMU with common prefix +*/ + tok = strtok_r(str, ",", &tmp); In some places, e.g. gcc version 4.1.2: CC /tmp/build/perf/util/pmu.o cc1: warnings being treated as errors util/pmu.c: In function ‘pmu_lookup’: util/pmu.c:706: warning: ‘tmp’ may be used uninitialized in this function mv: cannot stat `/tmp/build/perf/util/.pmu.o.tmp': No such file or directory Hi Arnaldo, Sorry for the delayed resposne. Your fix, below, looks ok. Regards, John This silences it, adding. diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index 913633ae0bf8..55f4de6442e3 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -703,7 +703,7 @@ struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu) static bool pmu_uncore_alias_match(const char *pmu_name, const char *name) { - char *tmp, *tok, *str; + char *tmp = NULL, *tok, *str; bool res; str = strdup(pmu_name); + if (strncmp(pmu_name, tok, strlen(tok))) { + res = false; + goto out; + } + + /* +* Match more complex aliases where the alias name is a comma-delimited +* list of tokens, orderly contained in the matching PMU name. +* +* Example: For alias "socket,pmuname" and PMU "socketX_pmunameY", we +* match "socket" in "socketX_pmunameY" and then "pmuname" in +* "pmunameY". +*/ + for (; tok; name += strlen(tok), tok = strtok_r(NULL, ",", &tmp)) { + name = strstr(name, tok); + if (!name) { + res = false; + goto out; + } + } + + res = true; +out: + free(str); + return res; +} + /* * From the pmu_events_map, find the table of PMU events that corresponds * to the current running CPU. Then, add all PMU events from that table @@ -730,12 +770,8 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu) break; } - /* -* uncore alias may be from different PMU -* with common prefix -*/ if (pmu_is_uncore(name) && - !strncmp(pname, name, strlen(pname))) + pmu_uncore_alias_match(pname, name)) goto new_alias; if (strcmp(pname, name)) -- 2.17.1
[PATCH v1 1/1] arm64: dts: rockchip: Add support for TB-96AI board
Add devicetree support for RK3399Pro TB-96AI board, one of the 96Boards family. The TB-96AI board is a 96Boards Compute SOM design, launched by Linaro, Rockchip and Beiqicloud. More information can be obtained from the following websites: 1.https://www.96boards.org/product/tb-96ai/ 2.http://t.rock-chips.com/ 3.http://www.beiqicloud.com/ This patch add basic node for the board and support booting up to Fedora. Signed-off-by: Elon Zhang diff --git a/arch/arm64/boot/dts/rockchip/Makefile b/arch/arm64/boot/dts/rockchip/Makefile index 5f2687acbf94..3d6c8d4363b5 100644 --- a/arch/arm64/boot/dts/rockchip/Makefile +++ b/arch/arm64/boot/dts/rockchip/Makefile @@ -27,3 +27,4 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock960.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rockpro64.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-sapphire.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-sapphire-excavator.dtb +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399pro-tb-96ai.dtb diff --git a/arch/arm64/boot/dts/rockchip/rk3399pro-tb-96ai.dts b/arch/arm64/boot/dts/rockchip/rk3399pro-tb-96ai.dts new file mode 100644 index ..1935df99065d --- /dev/null +++ b/arch/arm64/boot/dts/rockchip/rk3399pro-tb-96ai.dts @@ -0,0 +1,629 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd. + */ + +/dts-v1/; +#include "rk3399pro.dtsi" +#include "rk3399-opp.dtsi" + +/ { + compatible = "rockchip,rk3399pro-tb-96ai", "rockchip,rk3399pro"; + + chosen { + stdout-path = "serial2:150n8"; + }; + + xin32k: xin32k { + compatible = "fixed-clock"; + clock-frequency = <32768>; + clock-output-names = "xin32k"; + #clock-cells = <0>; + }; + + vcc_phy: vcc-phy-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc_phy"; + regulator-always-on; + regulator-boot-on; + }; + + vcc5v0_sys: vccsys { + compatible = "regulator-fixed"; + regulator-name = "vcc5v0_sys"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <500>; + regulator-max-microvolt = <500>; + }; + + vdd_log: vdd_log { + compatible = "regulator-fixed"; + regulator-name = "vdd_log"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <90>; + regulator-max-microvolt = <90>; + }; + + leds: gpio-leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 =<&leds_gpio>; + + led@1 { + gpios = <&gpio2 5 GPIO_ACTIVE_HIGH>; + label = "system_work_led1"; + retain-state-suspended; + }; + + led@2 { + gpios = <&gpio2 4 GPIO_ACTIVE_HIGH>; + label = "system_work_led2"; + retain-state-suspended; + }; + + led@3 { + gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>; + label = "system_work_led3"; + retain-state-suspended; + }; + }; +}; + +&cpu_l0 { + cpu-supply = <&vdd_cpu_l>; +}; + +&cpu_l1 { + cpu-supply = <&vdd_cpu_l>; +}; + +&cpu_l2 { + cpu-supply = <&vdd_cpu_l>; +}; + +&cpu_l3 { + cpu-supply = <&vdd_cpu_l>; +}; + +&cpu_b0 { + cpu-supply = <&vdd_cpu_b>; +}; + +&cpu_b1 { + cpu-supply = <&vdd_cpu_b>; +}; + +&emmc_phy { + status = "okay"; +}; + +&i2c0 { + status = "okay"; + i2c-scl-rising-time-ns = <180>; + i2c-scl-falling-time-ns = <30>; + clock-frequency = <40>; + + rk809: pmic@20 { + compatible = "rockchip,rk809"; + reg = <0x20>; + interrupt-parent = <&gpio1>; + interrupts = ; + pinctrl-names = "default", "pmic-sleep", + "pmic-power-off", "pmic-reset"; + pinctrl-0 = <&pmic_int_l>; + pinctrl-1 = <&soc_slppin_slp>, <&rk809_slppin_slp>; + pinctrl-2 = <&soc_slppin_gpio>, <&rk809_slppin_pwrdn>; + pinctrl-3 = <&soc_slppin_gpio>,<&rk809_slppin_null>; + rockchip,system-power-controller; + pmic-reset-func = <1>; + wakeup-source; + #clock-cells = <1>; + clock-output-names = "rk808-clkout1", "rk808-clkout2"; + + vcc1-supply = <&vcc5v0_sys>; + vcc2-supply = <&vcc5v0_sys>; + vcc3-supply = <&vcc5v0_sys>; + vcc4-supply = <&vcc5v0_sys>; + vcc5-supply = <&vcc_buck5>; + vcc6-supply = <&vcc_buck5>; + vcc7-supply = <&vcc3v3_sys>; +
[PATCH v2] arm: dts: mediatek: add basic support for MT7629 SoC
From: Ryder Lee This adds basic support for MT7629 reference board. Tested-by: Kevin Hilman Signed-off-by: Ryder Lee --- Changes since v2: - fix 'no newline at end of file'. - fix addresses/sizes cells. - update u3phy0 node. - add eth/pcie related nodes. - add the 'fixed-partitions' nodes in flash node. - remove arm,cpu-registers-not-fw-configured. Changes since v1: -Fix unit-address warnings. -Put all the mmio peripherals under a simple-bus node. -Drop all the 'partitions' nodes in flash node. --- arch/arm/boot/dts/Makefile| 1 + arch/arm/boot/dts/mt7629-rfb.dts | 263 arch/arm/boot/dts/mt7629.dtsi | 481 ++ include/dt-bindings/reset/mt7629-resets.h | 71 4 files changed, 816 insertions(+) create mode 100644 arch/arm/boot/dts/mt7629-rfb.dts create mode 100644 arch/arm/boot/dts/mt7629.dtsi create mode 100644 include/dt-bindings/reset/mt7629-resets.h diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index dab2914fa293..080784da8ae1 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -1258,6 +1258,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \ mt7623a-rfb-nand.dtb \ mt7623n-rfb-emmc.dtb \ mt7623n-bananapi-bpi-r2.dtb \ + mt7629-rfb.dtb \ mt8127-moose.dtb \ mt8135-evbp1.dtb dtb-$(CONFIG_ARCH_MILBEAUT) += milbeaut-m10v-evb.dtb diff --git a/arch/arm/boot/dts/mt7629-rfb.dts b/arch/arm/boot/dts/mt7629-rfb.dts new file mode 100644 index ..3621b7d2b22a --- /dev/null +++ b/arch/arm/boot/dts/mt7629-rfb.dts @@ -0,0 +1,263 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2019 MediaTek Inc. + * Author: Ryder Lee + */ + +/dts-v1/; +#include +#include "mt7629.dtsi" + +/ { + model = "MediaTek MT7629 reference board"; + compatible = "mediatek,mt7629-rfb", "mediatek,mt7629"; + + aliases { + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + reset { + label = "factory"; + linux,code = ; + gpios = <&pio 60 GPIO_ACTIVE_LOW>; + }; + + wps { + label = "wps"; + linux,code = ; + gpios = <&pio 58 GPIO_ACTIVE_LOW>; + }; + }; + + memory@4000 { + device_type = "memory"; + reg = <0x4000 0x1000>; + }; + + reg_3p3v: regulator-3p3v { + compatible = "regulator-fixed"; + regulator-name = "fixed-3.3V"; + regulator-min-microvolt = <330>; + regulator-max-microvolt = <330>; + regulator-boot-on; + regulator-always-on; + }; + + reg_5v: regulator-5v { + compatible = "regulator-fixed"; + regulator-name = "fixed-5V"; + regulator-min-microvolt = <500>; + regulator-max-microvolt = <500>; + regulator-boot-on; + regulator-always-on; + }; +}; + +ð { + pinctrl-names = "default"; + pinctrl-0 = <ð_pins>; + pinctrl-1 = <&ephy_leds_pins>; + status = "okay"; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-handle = <&phy0>; + }; + + mdio: mdio-bus { + #address-cells = <1>; + #size-cells = <0>; + + phy0: ethernet-phy@0 { + reg = <0>; + phy-mode = "gmii"; + }; + }; +}; + +&i2c { + pinctrl-names = "default"; + pinctrl-0 = <&i2c_pins>; + status = "okay"; +}; + +&qspi { + pinctrl-names = "default"; + pinctrl-0 = <&qspi_pins>; + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x6>; + read-only; + }; + + partition@6 { + label = "u-boot-env"; + reg = <0x6 0x1>; + read-only; + }; + + factory: partition@7 { + label = "factory"; + reg = <0x7 0x4>; + read-only; + }; + + partition@b { +
Re: [GIT PULL] Keys: Set 4 - Key ACLs for 5.3
On Wed, Jul 10, 2019 at 1:15 PM Eric Biggers wrote: > > Also worth noting that the key ACL patches were only in linux-next for 9 days > before the pull request was sent. Yes. I was not entirely happy with the whole key subsystem situation. See my concerns in https://lore.kernel.org/lkml/CAHk-=wjeowdfg7v_4ttu3xhf9gqopj1+q1ngg86+mgfgdte...@mail.gmail.com/ for more. That was before I realized it was buggy. So it really would be good to have more people involved, and more structure to the keys development (and, I suspect, much else under security/) Anyway, since it does seem like David is offline, I've just reverted this from my tree, and will be continuing my normal merge window pull requests (the other issues I have seen have fixes in their respective trees). Linus
RE: [PATCH v3 0/3] kernel/notifier.c: avoid duplicate registration
On Wed, July 10, 2019 1:49 PM Vasily Averin wrote: >On 7/10/19 6:09 AM, Xiaoming Ni wrote: >> Registering the same notifier to a hook repeatedly can cause the hook >> list to form a ring or lose other members of the list. > >I think is not enough to _prevent_ 2nd register attempt, >it's enough to detect just attempt and generate warning to mark host in bad >state. > Duplicate registration is prevented in my patch, not just "mark host in bad state" Duplicate registration is checked and exited in notifier_chain_cond_register() Duplicate registration was checked in notifier_chain_register() but only the alarm was triggered without exiting. added by commit 831246570d34692e ("kernel/notifier.c: double register detection") My patch is like a combination of 831246570d34692e and notifier_chain_cond_register(), which triggers an alarm and exits when a duplicate registration is detected. >Unexpected 2nd register of the same hook most likely will lead to 2nd >unregister, >and it can lead to host crash in any time: >you can unregister notifier on first attempt it can be too early, it can be >still in use. >on the other hand you can never call 2nd unregister at all. Since the member was not added to the linked list at the time of the second registration, no linked list ring was formed. The member is released on the first unregistration and -ENOENT on the second unregistration. After patching, the fault has been alleviated It may be more helpful to return an error code when someone tries to register the same notification program a second time. But I noticed that notifier_chain_cond_register() returns 0 when duplicate registration is detected. At the same time, in all the existing export function comments of notify, "Currently always returns zero" I am a bit confused: which is better? > >Unfortunately I do not see any ways to handle such cases properly, >and it seems for me your patches does not resolve this problem. > >Am I missed something probably? > >> case1: An infinite loop in notifier_chain_register() can cause soft lockup >> atomic_notifier_chain_register(&test_notifier_list, &test1); >> atomic_notifier_chain_register(&test_notifier_list, &test1); >> atomic_notifier_chain_register(&test_notifier_list, &test2); Thanks Xiaoming Ni
Re: [PATCH 08/16] nfsd: escape high characters in binary data
On Wed, Jul 10, 2019 at 06:09:31PM -0400, J. Bruce Fields wrote: > On Fri, Jun 28, 2019 at 12:33:58PM -0400, J. Bruce Fields wrote: > > But I may just give up and go with my existing patch and put > > off that project indefinitely, especially if there's no real need to fix > > the existing callers. > > I went with the existing patch, but gave a little more thought to > string_escape_mem. Stuff that bugs me: > > - ESCAPE_NP sounds like it means "escape nonprinting > characters", but actually means "do not escape printing > characters" > - the use of the "only" string to limit the list of escaped > characters rather than supplement them is confusing and kind > of unhelpful. > - most of the flags are actually totally unused > > So what I'd like to do is: > > - eliminate unused flags > - use the "only" string to add to, rather than replace, the list > of characters to escape > - separate flags into those that select which characters to > escape, and those that choose the format of the escaping ("\ " > vs "\x20" vs "\040".) > > I've got some patches that do all that and I think it works. I need to > clean them up a bit and fix up the tests. This sounds amazing; thanks! Luckily there are self-tests for this code, so anything really surprising should stand out. I'm looking forward to it -- I want to see if I can refactor a few of the callers (if you haven't already do so) too. Yay! -- Kees Cook
Re: linux-next: build failure after merge of the net-next tree
Hi all, On Wed, 10 Jul 2019 17:52:17 + Jason Gunthorpe wrote: > > On Tue, Jul 09, 2019 at 09:43:46AM +0300, Leon Romanovsky wrote: > > On Tue, Jul 09, 2019 at 01:56:36PM +1000, Stephen Rothwell wrote: > > > Hi all, > > > > > > After merging the net-next tree, today's linux-next build (x86_64 > > > allmodconfig) failed like this: > > > > > > drivers/infiniband/sw/siw/siw_cm.c: In function 'siw_create_listen': > > > drivers/infiniband/sw/siw/siw_cm.c:1978:3: error: implicit declaration of > > > function 'for_ifa'; did you mean 'fork_idle'? > > > [-Werror=implicit-function-declaration] > > >for_ifa(in_dev) > > >^~~ > > >fork_idle > > > drivers/infiniband/sw/siw/siw_cm.c:1978:18: error: expected ';' before > > > '{' token > > >for_ifa(in_dev) > > > ^ > > > ; > > >{ > > >~ > > > > > > Caused by commit > > > > > > 6c52fdc244b5 ("rdma/siw: connection management") > > > > > > from the rdma tree. I don't know why this didn't fail after I mereged > > > that tree. > > > > I had the same question, because I have this fix for a couple of days > > already. > > > > From 56c9e15ec670af580daa8c3ffde9503af3042d67 Mon Sep 17 00:00:00 2001 > > From: Leon Romanovsky > > Date: Sun, 7 Jul 2019 10:43:42 +0300 > > Subject: [PATCH] Fixup to build SIW issue > > > > Signed-off-by: Leon Romanovsky > > drivers/infiniband/sw/siw/siw_cm.c | 5 ++--- > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/infiniband/sw/siw/siw_cm.c > > b/drivers/infiniband/sw/siw/siw_cm.c > > index 8e618cb7261f..c883bf514341 100644 > > +++ b/drivers/infiniband/sw/siw/siw_cm.c > > @@ -1954,6 +1954,7 @@ static void siw_drop_listeners(struct iw_cm_id *id) > > int siw_create_listen(struct iw_cm_id *id, int backlog) > > { > > struct net_device *dev = to_siw_dev(id->device)->netdev; > > + const struct in_ifaddr *ifa; > > int rv = 0, listeners = 0; > > > > siw_dbg(id->device, "id 0x%p: backlog %d\n", id, backlog); > > @@ -1975,8 +1976,7 @@ int siw_create_listen(struct iw_cm_id *id, int > > backlog) > > id, &s_laddr.sin_addr, ntohs(s_laddr.sin_port), > > &s_raddr->sin_addr, ntohs(s_raddr->sin_port)); > > > > - for_ifa(in_dev) > > - { > > + in_dev_for_each_ifa_rcu(ifa, in_dev) { > > if (ipv4_is_zeronet(s_laddr.sin_addr.s_addr) || > > Hum. There is no rcu lock held here and we can't use RCU anyhow as > siw_listen_address will sleep. > > I think this needs to use rtnl, as below. Bernard, please urgently > confirm. Thanks > > diff --git a/drivers/infiniband/sw/siw/siw_cm.c > b/drivers/infiniband/sw/siw/siw_cm.c > index 8e618cb7261f62..ee98e96a5bfaba 100644 > --- a/drivers/infiniband/sw/siw/siw_cm.c > +++ b/drivers/infiniband/sw/siw/siw_cm.c > @@ -1965,6 +1965,7 @@ int siw_create_listen(struct iw_cm_id *id, int backlog) >*/ > if (id->local_addr.ss_family == AF_INET) { > struct in_device *in_dev = in_dev_get(dev); > + const struct in_ifaddr *ifa; > struct sockaddr_in s_laddr, *s_raddr; > > memcpy(&s_laddr, &id->local_addr, sizeof(s_laddr)); > @@ -1975,8 +1976,8 @@ int siw_create_listen(struct iw_cm_id *id, int backlog) > id, &s_laddr.sin_addr, ntohs(s_laddr.sin_port), > &s_raddr->sin_addr, ntohs(s_raddr->sin_port)); > > - for_ifa(in_dev) > - { > + rtnl_lock(); > + in_dev_for_each_ifa_rtnl(ifa, in_dev) { > if (ipv4_is_zeronet(s_laddr.sin_addr.s_addr) || > s_laddr.sin_addr.s_addr == ifa->ifa_address) { > s_laddr.sin_addr.s_addr = ifa->ifa_address; > @@ -1988,7 +1989,7 @@ int siw_create_listen(struct iw_cm_id *id, int backlog) > listeners++; > } > } > - endfor_ifa(in_dev); > + rtnl_unlock(); > in_dev_put(in_dev); > } else if (id->local_addr.ss_family == AF_INET6) { > struct inet6_dev *in6_dev = in6_dev_get(dev); So today this failed to build after I merged the rdma tree (previously it didn;t until after the net-next tree was merged (I assume a dependency changed). It failed because in_dev_for_each_ifa_rcu (and in_dev_for_each_ifa_rtnl) is only defined in a commit in the net-next tree :-( I have disabled the driver again. -- Cheers, Stephen Rothwell pgpJEKLB09OgD.pgp Description: OpenPGP digital signature
Re: [PATCH 2/3 v2] ARM: dts: aspeed: Add SGPIO driver
On Thu, 11 Jul 2019, at 00:56, Hongwei Zhang wrote: > Add SGPIO driver support for Aspeed AST2500 SoC. > > Signed-off-by: Hongwei Zhang > --- > drivers/gpio/sgpio-aspeed.c | 450 > > 1 file changed, 450 insertions(+) > create mode 100644 drivers/gpio/sgpio-aspeed.c > > diff --git a/drivers/gpio/sgpio-aspeed.c b/drivers/gpio/sgpio-aspeed.c > new file mode 100644 > index 000..0743d22 > --- /dev/null > +++ b/drivers/gpio/sgpio-aspeed.c > @@ -0,0 +1,450 @@ > +// SPDX-License-Identifier: GPL-2.0+ > +/* > + * Copyright 2019 American Megatrends International LLC. > + * > + * Author: Karthikeyan Mani > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#define NR_SGPIO80 > + > +struct aspeed_sgpio { > + struct gpio_chip chip; > + spinlock_t lock; > + void __iomem *base; > + int irq; > +}; > + > +struct aspeed_sgpio_bank { > + uint16_tval_regs; > + uint16_trdata_reg; > + uint16_tirq_regs; > + const char names[4][3]; > +}; > + > +/* > + * Note: The "value" register returns the input value sampled on the > + * line even when the GPIO is configured as an output. Since > + * that input goes through synchronizers, writing, then reading > + * back may not return the written value right away. > + * > + * The "rdata" register returns the content of the write latch > + * and thus can be used to read back what was last written > + * reliably. > + */ > + > +static const struct aspeed_sgpio_bank aspeed_sgpio_banks[] = { > + { > + .val_regs = 0x, > + .rdata_reg = 0x0070, > + .irq_regs = 0x0004, > + .names = { "A", "B", "C", "D" }, > + }, > + { > + .val_regs = 0x001C, > + .rdata_reg = 0x0074, > + .irq_regs = 0x0020, > + .names = { "E", "F", "G", "H" }, > + }, > + { > + .val_regs = 0x0038, > + .rdata_reg = 0x0078, > + .irq_regs = 0x003C, > + .names = { "I", "J" }, > + }, > +}; > + > +enum aspeed_sgpio_reg { > + reg_val, > + reg_rdata, > + reg_irq_enable, > + reg_irq_type0, > + reg_irq_type1, > + reg_irq_type2, > + reg_irq_status, > +}; > + > +#define GPIO_VAL_VALUE 0x00 > +#define GPIO_VAL_DIR0x04 > +#define GPIO_IRQ_ENABLE 0x00 > +#define GPIO_IRQ_TYPE0 0x04 > +#define GPIO_IRQ_TYPE1 0x08 > +#define GPIO_IRQ_TYPE2 0x0C > +#define GPIO_IRQ_STATUS 0x10 > + > +/* This will be resolved at compile time */ > +static inline void __iomem *bank_reg(struct aspeed_sgpio *gpio, > + const struct aspeed_sgpio_bank *bank, > + const enum aspeed_sgpio_reg reg) > +{ > + switch (reg) { > + case reg_val: > + return gpio->base + bank->val_regs + GPIO_VAL_VALUE; > + case reg_rdata: > + return gpio->base + bank->rdata_reg; > + case reg_irq_enable: > + return gpio->base + bank->irq_regs + GPIO_IRQ_ENABLE; > + case reg_irq_type0: > + return gpio->base + bank->irq_regs + GPIO_IRQ_TYPE0; > + case reg_irq_type1: > + return gpio->base + bank->irq_regs + GPIO_IRQ_TYPE1; > + case reg_irq_type2: > + return gpio->base + bank->irq_regs + GPIO_IRQ_TYPE2; > + case reg_irq_status: > + return gpio->base + bank->irq_regs + GPIO_IRQ_STATUS; > + default: > + /* acturally if code runs to here, it's an error case */ > + WARN_ON(reg); > + return gpio->base; > + } > +} > + > +#define GPIO_BANK(x)((x) >> 5) > +#define GPIO_OFFSET(x) ((x) & 0x1f) > +#define GPIO_BIT(x) BIT(GPIO_OFFSET(x)) > + > +static const struct aspeed_sgpio_bank *to_bank(unsigned int offset) > +{ > + unsigned int bank = GPIO_BANK(offset); > + > + WARN_ON(bank >= ARRAY_SIZE(aspeed_sgpio_banks)); > + return &aspeed_sgpio_banks[bank]; > +} > + > +static int aspeed_sgpio_get(struct gpio_chip *gc, unsigned int offset) > +{ > + struct aspeed_sgpio *gpio = gpiochip_get_data(gc); > + const struct aspeed_sgpio_bank *bank = to_bank(offset); > + > + return !!(ioread32(bank_reg(gpio, bank, reg_val)) & GPIO_BIT(offset)); > +} > + > +static void aspeed_sgpio_set(struct gpio_chip *gc, unsigned int > offset, int val) > +{ > + struct aspeed_sgpio *gpio = gpiochip_get_data(gc); > + const struct aspeed_sgpio_bank *bank = to_bank(offset); > + unsigned long flags; > + void __iomem *addr; > + u32 reg = 0; > + > + spin_lock_irqsave(&gpio->lock, flags); > + > + addr = bank_reg(gpio, bank, reg_val); > + > + if (val) > + reg |= GPIO_BIT(offset); > + else > + reg &= ~GPIO_BIT(offset); > + > + iowrite32(reg, addr); > + spin_unl