Re: [PATCH v4 1/4] kgdb: Remove irq flags from roundup
On Mon, Nov 12, 2018 at 10:26:55AM -0800, Douglas Anderson wrote: > The function kgdb_roundup_cpus() was passed a parameter that was > documented as: > > > the flags that will be used when restoring the interrupts. There is > > local_irq_save() call before kgdb_roundup_cpus(). > > Nobody used those flags. Anyone who wanted to temporarily turn on > interrupts just did local_irq_enable() and local_irq_disable() without > looking at them. So we can definitely remove the flags. > > Signed-off-by: Douglas Anderson > --- Acked-by: Will Deacon I'm hopeful that you'll keep hacking on kgdb, because it definitely needs some love in its current state. Will ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH v4 2/4] kgdb: Fix kgdb_roundup_cpus() for arches who used smp_call_function()
On Mon, Nov 12, 2018 at 10:26:56AM -0800, Douglas Anderson wrote: > When I had lockdep turned on and dropped into kgdb I got a nice splat > on my system. Specifically it hit: > DEBUG_LOCKS_WARN_ON(current->hardirq_context) > > Specifically it looked like this: > sysrq: SysRq : DEBUG > [ cut here ] > DEBUG_LOCKS_WARN_ON(current->hardirq_context) > WARNING: CPU: 0 PID: 0 at .../kernel/locking/lockdep.c:2875 > lockdep_hardirqs_on+0xf0/0x160 > CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.19.0 #27 > pstate: 604003c9 (nZCv DAIF +PAN -UAO) > pc : lockdep_hardirqs_on+0xf0/0x160 > ... > Call trace: >lockdep_hardirqs_on+0xf0/0x160 >trace_hardirqs_on+0x188/0x1ac >kgdb_roundup_cpus+0x14/0x3c >kgdb_cpu_enter+0x53c/0x5cc >kgdb_handle_exception+0x180/0x1d4 >kgdb_compiled_brk_fn+0x30/0x3c >brk_handler+0x134/0x178 >do_debug_exception+0xfc/0x178 >el1_dbg+0x18/0x78 >kgdb_breakpoint+0x34/0x58 >sysrq_handle_dbg+0x54/0x5c >__handle_sysrq+0x114/0x21c >handle_sysrq+0x30/0x3c >qcom_geni_serial_isr+0x2dc/0x30c > ... > ... > irq event stamp: ...45 > hardirqs last enabled at (...44): [...] __do_softirq+0xd8/0x4e4 > hardirqs last disabled at (...45): [...] el1_irq+0x74/0x130 > softirqs last enabled at (...42): [...] _local_bh_enable+0x2c/0x34 > softirqs last disabled at (...43): [...] irq_exit+0xa8/0x100 > ---[ end trace adf21f830c46e638 ]--- > > Looking closely at it, it seems like a really bad idea to be calling > local_irq_enable() in kgdb_roundup_cpus(). If nothing else that seems > like it could violate spinlock semantics and cause a deadlock. > > Instead, let's use a private csd alongside > smp_call_function_single_async() to round up the other CPUs. Using > smp_call_function_single_async() doesn't require interrupts to be > enabled so we can remove the offending bit of code. > > In order to avoid duplicating this across all the architectures that > use the default kgdb_roundup_cpus(), we'll add a "weak" implementation > to debug_core.c. > > Looking at all the people who previously had copies of this code, > there were a few variants. I've attempted to keep the variants > working like they used to. Specifically: > * For arch/arc we passed NULL to kgdb_nmicallback() instead of > get_irq_regs(). > * For arch/mips there was a bit of extra code around > kgdb_nmicallback() > > NOTE: In this patch we will still get into trouble if we try to round > up a CPU that failed to round up before. We'll try to round it up > again and potentially hang when we try to grab the csd lock. That's > not new behavior but we'll still try to do better in a future patch. > > Suggested-by: Daniel Thompson > Signed-off-by: Douglas Anderson > --- > > Changes in v4: None > Changes in v3: > - No separate init call. > - Don't round up the CPU that is doing the rounding up. > - Add "#ifdef CONFIG_SMP" to match the rest of the file. > - Updated desc saying we don't solve the "failed to roundup" case. > - Document the ignored parameter. > > Changes in v2: > - Removing irq flags separated from fixing lockdep splat. > - Don't use smp_call_function (Daniel). > > arch/arc/kernel/kgdb.c | 10 ++ > arch/arm/kernel/kgdb.c | 12 > arch/arm64/kernel/kgdb.c | 12 > arch/hexagon/kernel/kgdb.c | 27 --- > arch/mips/kernel/kgdb.c| 9 + > arch/powerpc/kernel/kgdb.c | 4 ++-- > arch/sh/kernel/kgdb.c | 12 > include/linux/kgdb.h | 15 +-- > kernel/debug/debug_core.c | 35 +++ > 9 files changed, 53 insertions(+), 83 deletions(-) [...] > diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c > index f3cadda45f07..23f2b5613afa 100644 > --- a/kernel/debug/debug_core.c > +++ b/kernel/debug/debug_core.c > @@ -55,6 +55,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -220,6 +221,40 @@ int __weak kgdb_skipexception(int exception, struct > pt_regs *regs) > return 0; > } > > +#ifdef CONFIG_SMP > + > +/* > + * Default (weak) implementation for kgdb_roundup_cpus > + */ > + > +static DEFINE_PER_CPU(call_single_data_t, kgdb_roundup_csd); > + > +void __weak kgdb_call_nmi_hook(void *ignored) > +{ > + kgdb_nmicallback(raw_smp_processor_id(), get_irq_regs()); > +} I suppose you could pass the cpu as an argument, but it doesn't really matter. Also, I think there are cases where the CSD callback can run without having received an IPI, so we could potentially up passing NULL for the regs here which probably goes boom. > + > +void __weak kgdb_roundup_cpus(void) > +{ > + call_single_data_t *csd; > + int this_cpu = get_cpu(); Do you actually need to disable preemption here? afaict, irqs are already disabled by the kgdb core. > + int cpu; > + > + for_each_cpu(cpu, cpu_online_mask) { for_each_online_cpu(cpu) ? I'm assuming thi
[PATCH] u-boot: Add mkenvimage tool
This utility is used for creation of images containing usable in run-time U-Boot environment. As of today this utility is added per-board like here [1] for Intel Edison board, here [2] for Altera's SoCFPGA and I may guess there're others so instead of adding another one for ARC why don't we package it for each and everyone. [1] http://git.yoctoproject.org/cgit/cgit.cgi/meta-intel-edison/tree/meta-intel-edison-bsp/recipes-bsp/u-boot/u-boot-tools_2014.04.bb [2] https://github.com/kraj/meta-altera/blob/master/recipes-bsp/u-boot/u-boot-mkenvimage_v2016.11.bb Signed-off-by: Alexey Brodkin Cc: Alexander Kanavin Cc: Richard Purdie Cc: Otavio Salvador Cc: Ross Burton Cc: Marek Vasut --- .../u-boot/u-boot-mkenvimage_2018.07.bb| 27 ++ 1 file changed, 27 insertions(+) create mode 100644 meta/recipes-bsp/u-boot/u-boot-mkenvimage_2018.07.bb diff --git a/meta/recipes-bsp/u-boot/u-boot-mkenvimage_2018.07.bb b/meta/recipes-bsp/u-boot/u-boot-mkenvimage_2018.07.bb new file mode 100644 index 00..4770f3db08 --- /dev/null +++ b/meta/recipes-bsp/u-boot/u-boot-mkenvimage_2018.07.bb @@ -0,0 +1,27 @@ +require u-boot-common_${PV}.inc + +SUMMARY = "U-Boot bootloader environment image creation tool" +DEPENDS += "openssl" + +EXTRA_OEMAKE_class-target = 'CROSS_COMPILE="${TARGET_PREFIX}" CC="${CC} ${CFLAGS} ${LDFLAGS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" STRIP=true V=1' +EXTRA_OEMAKE_class-native = 'CC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" STRIP=true V=1' +EXTRA_OEMAKE_class-nativesdk = 'CROSS_COMPILE="${HOST_PREFIX}" CC="${CC} ${CFLAGS} ${LDFLAGS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" STRIP=true V=1' + +do_compile () { + oe_runmake sandbox_defconfig + + # Disable CONFIG_CMD_LICENSE, license.h is not used by tools and + # generating it requires bin2header tool, which for target build + # is built with target tools and thus cannot be executed on host. + sed -i "s/CONFIG_CMD_LICENSE=.*/# CONFIG_CMD_LICENSE is not set/" .config + + oe_runmake cross_tools NO_SDL=1 +} + +do_install () { + install -d ${D}${bindir} + install -m 0755 tools/mkenvimage ${D}${bindir}/uboot-mkenvimage + ln -sf uboot-mkenvimage ${D}${bindir}/mkenvimage +} + +BBCLASSEXTEND = "native nativesdk" -- 2.16.2 ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH] u-boot: Add mkenvimage tool
On Wed, Nov 14, 2018 at 8:00 PM Alexey Brodkin wrote: > > This utility is used for creation of images containing > usable in run-time U-Boot environment. > > As of today this utility is added per-board like here [1] > for Intel Edison board, here [2] for Altera's SoCFPGA and > I may guess there're others so instead of adding another one for > ARC why don't we package it for each and everyone. > > [1] > http://git.yoctoproject.org/cgit/cgit.cgi/meta-intel-edison/tree/meta-intel-edison-bsp/recipes-bsp/u-boot/u-boot-tools_2014.04.bb > [2] > https://github.com/kraj/meta-altera/blob/master/recipes-bsp/u-boot/u-boot-mkenvimage_v2016.11.bb If this is applicable/works for all u-boot based machines then I think it makes sense to have it on OE-core. > > Signed-off-by: Alexey Brodkin > Cc: Alexander Kanavin > Cc: Richard Purdie > Cc: Otavio Salvador > Cc: Ross Burton > Cc: Marek Vasut > --- > .../u-boot/u-boot-mkenvimage_2018.07.bb| 27 > ++ > 1 file changed, 27 insertions(+) > create mode 100644 meta/recipes-bsp/u-boot/u-boot-mkenvimage_2018.07.bb > > diff --git a/meta/recipes-bsp/u-boot/u-boot-mkenvimage_2018.07.bb > b/meta/recipes-bsp/u-boot/u-boot-mkenvimage_2018.07.bb > new file mode 100644 > index 00..4770f3db08 > --- /dev/null > +++ b/meta/recipes-bsp/u-boot/u-boot-mkenvimage_2018.07.bb > @@ -0,0 +1,27 @@ > +require u-boot-common_${PV}.inc > + > +SUMMARY = "U-Boot bootloader environment image creation tool" > +DEPENDS += "openssl" > + > +EXTRA_OEMAKE_class-target = 'CROSS_COMPILE="${TARGET_PREFIX}" CC="${CC} > ${CFLAGS} ${LDFLAGS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" > STRIP=true V=1' > +EXTRA_OEMAKE_class-native = 'CC="${BUILD_CC} ${BUILD_CFLAGS} > ${BUILD_LDFLAGS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" > STRIP=true V=1' > +EXTRA_OEMAKE_class-nativesdk = 'CROSS_COMPILE="${HOST_PREFIX}" CC="${CC} > ${CFLAGS} ${LDFLAGS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" > STRIP=true V=1' > + > +do_compile () { > + oe_runmake sandbox_defconfig > + > + # Disable CONFIG_CMD_LICENSE, license.h is not used by tools and > + # generating it requires bin2header tool, which for target build > + # is built with target tools and thus cannot be executed on host. > + sed -i "s/CONFIG_CMD_LICENSE=.*/# CONFIG_CMD_LICENSE is not set/" > .config > + > + oe_runmake cross_tools NO_SDL=1 > +} > + > +do_install () { > + install -d ${D}${bindir} > + install -m 0755 tools/mkenvimage ${D}${bindir}/uboot-mkenvimage > + ln -sf uboot-mkenvimage ${D}${bindir}/mkenvimage > +} > + > +BBCLASSEXTEND = "native nativesdk" > -- > 2.16.2 > ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH] u-boot: Add mkenvimage tool
Hi Khem, On Wed, 2018-11-14 at 20:57 -0800, Khem Raj wrote: > On Wed, Nov 14, 2018 at 8:00 PM Alexey Brodkin > wrote: > > This utility is used for creation of images containing > > usable in run-time U-Boot environment. > > > > As of today this utility is added per-board like here [1] > > for Intel Edison board, here [2] for Altera's SoCFPGA and > > I may guess there're others so instead of adding another one for > > ARC why don't we package it for each and everyone. > > > > [1] > > https://urldefense.proofpoint.com/v2/url?u=http-3A__git.yoctoproject.org_cgit_cgit.cgi_meta-2Dintel-2Dedison_tree_meta-2Dintel-2Dedison-2Dbsp_recipes-2Dbsp_u-2Dboot_u-2Dboot-2Dtools-5F2014.04.bb&d=DwIBaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=lqdeeSSEes0GFDDl656eViXO7breS55ytWkhpk5R81I&m=U0I6P-1P3vft6mR4soZ9Y6ptJqYWloOoS0ogvO2Rzv4&s=WEknmJT4TnByCWMMzh4D-2sDrYv5_kx2V1Qk8SYtJY8&e= > > [2] > > https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_kraj_meta-2Daltera_blob_master_recipes-2Dbsp_u-2Dboot_u-2Dboot-2Dmkenvimage-5Fv2016.11.bb&d=DwIBaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=lqdeeSSEes0GFDDl656eViXO7breS55ytWkhpk5R81I&m=U0I6P-1P3vft6mR4soZ9Y6ptJqYWloOoS0ogvO2Rzv4&s=OiXy88hL3o5z9JN0O88EUo3ttvvgFQnC2LnDc_xhGyY&e= > > If this is applicable/works for all u-boot based machines then I think it > makes > sense to have it on OE-core. Well "mkenvimage" is one of standard U-Boot tools so it has nothing specific for any architecture or board whatsoever. It is not used that often as "mkimage" probably because people mostly depends on default U-Boot env settings which are compiled-in U-Boot binary with help of CONFIG_EXTRA_ENV_SETTINGS="..." but IMHO it is rather useful as we may prepare fine-tuned environment setups for a particular use-case from pure text-based input. -Alexey ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH] u-boot: Add mkenvimage tool
On 11/15/2018 05:57 AM, Khem Raj wrote: > On Wed, Nov 14, 2018 at 8:00 PM Alexey Brodkin > wrote: >> >> This utility is used for creation of images containing >> usable in run-time U-Boot environment. >> >> As of today this utility is added per-board like here [1] >> for Intel Edison board, here [2] for Altera's SoCFPGA and >> I may guess there're others so instead of adding another one for >> ARC why don't we package it for each and everyone. >> >> [1] >> http://git.yoctoproject.org/cgit/cgit.cgi/meta-intel-edison/tree/meta-intel-edison-bsp/recipes-bsp/u-boot/u-boot-tools_2014.04.bb >> [2] >> https://github.com/kraj/meta-altera/blob/master/recipes-bsp/u-boot/u-boot-mkenvimage_v2016.11.bb > > If this is applicable/works for all u-boot based machines then I think it > makes > sense to have it on OE-core. It is. >> Signed-off-by: Alexey Brodkin >> Cc: Alexander Kanavin >> Cc: Richard Purdie >> Cc: Otavio Salvador >> Cc: Ross Burton >> Cc: Marek Vasut Reviewed-by: Marek Vasut That said, could the recipe for mkimage and mkenvimage be somehow deduplicated ? There seems to be a lot of common stuff. >> --- >> .../u-boot/u-boot-mkenvimage_2018.07.bb| 27 >> ++ btw why was U-Boot not updated using AUH to 2018.09/2018.11 ? -- Best regards, Marek Vasut ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH] u-boot: Add mkenvimage tool
Hi Marek, On Thu, 2018-11-15 at 06:03 +0100, Marek Vasut wrote: > On 11/15/2018 05:57 AM, Khem Raj wrote: > > On Wed, Nov 14, 2018 at 8:00 PM Alexey Brodkin > > wrote: > > > This utility is used for creation of images containing > > > usable in run-time U-Boot environment. > > > > > > As of today this utility is added per-board like here [1] > > > for Intel Edison board, here [2] for Altera's SoCFPGA and > > > I may guess there're others so instead of adding another one for > > > ARC why don't we package it for each and everyone. > > > > > > [1] > > > https://urldefense.proofpoint.com/v2/url?u=http-3A__git.yoctoproject.org_cgit_cgit.cgi_meta-2Dintel-2Dedison_tree_meta-2Dintel-2Dedison-2Dbsp_recipes-2Dbsp_u-2Dboot_u-2Dboot-2Dtools-5F2014.04.bb&d=DwICaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=lqdeeSSEes0GFDDl656eViXO7breS55ytWkhpk5R81I&m=cK5urAA7P2ER1AvKZdD3CEL5r23DwdtJ4Iohy_QCUSQ&s=VyVOHq5I3FsOXvOf7SQgVlwtTfKX0bN5ZmPPehjD-zw&e= > > > [2] > > > https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_kraj_meta-2Daltera_blob_master_recipes-2Dbsp_u-2Dboot_u-2Dboot-2Dmkenvimage-5Fv2016.11.bb&d=DwICaQ&c=DPL6_X_6JkXFx7AXWqB0tg&r=lqdeeSSEes0GFDDl656eViXO7breS55ytWkhpk5R81I&m=cK5urAA7P2ER1AvKZdD3CEL5r23DwdtJ4Iohy_QCUSQ&s=TDPtpmofctGuP4dejRGli0SBUReQQPoiFQsWPHs4vV8&e= > > > > If this is applicable/works for all u-boot based machines then I think it > > makes > > sense to have it on OE-core. > > It is. > > > > Signed-off-by: Alexey Brodkin > > > Cc: Alexander Kanavin > > > Cc: Richard Purdie > > > Cc: Otavio Salvador > > > Cc: Ross Burton > > > Cc: Marek Vasut > > Reviewed-by: Marek Vasut > > That said, could the recipe for mkimage and mkenvimage be somehow > deduplicated ? There seems to be a lot of common stuff. I'd say why don't we just have one recipe for all U-Boot tools instead of adding tools one-by-one? -Alexey ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc