Re: [PATCH 00/15] kbuild: refactor headers_install and support compile-test of UAPI headers
On Tue, Jun 4, 2019 at 7:15 PM Masahiro Yamada wrote: > > > Multiple people have suggested to compile-test UAPI headers. > > Currently, Kbuild provides simple sanity checks by headers_check > but they are not enough to catch bugs. > > The most recent patch I know is David Howells' work: > https://patchwork.kernel.org/patch/10590203/ > > I agree that we need better tests for UAPI headers, > but I want to integrate it in a clean way. > > The idea that has been in my mind is to compile each header > to make sure the selfcontainedness. > > Recently, Jani Nikula proposed a new syntax 'header-test-y'. > https://patchwork.kernel.org/patch/10947005/ > > So, I implemented UAPI compile-testing on top of that. > > When adding a new feature, cleaning the code first is a > good practice. > > [1] Remove headers_install_all > > This target installs UAPI headers of all architectures > in a single tree. > It does not make sense to compile test of headers from > multiple arches at the same time. Hence, removed. > > [2] Split header installation into 'make headers' and 'make headers_install' > > To compile-test UAPI headers, we need a work-directory somewhere > to save objects and .*.cmd files. > > usr/include/ will be the work-directory. > > Since we cannot pollute the final destination of headers_install, > > I split the header installation into two stages. > > 'make headers' will build up > the ready-to-install headers in usr/include, > which will be also used as a work-directory for the compile-test. > > 'make headers_install' will copy headers > from usr/include to $(INSTALL_HDR_PATH)/include. > > [3] Support compile-test of UAPI headers > > This is implemented in usr/include/Makefile > > > Jani Nikula (1): > kbuild: add support for ensuring headers are self-contained > > Masahiro Yamada (14): > kbuild: remove headers_{install,check}_all > kbuild: remove stale dependency between Documentation/ and > headers_install > kbuild: make gdb_script depend on prepare0 instead of prepare > kbuild: fix Kconfig prompt of CONFIG_HEADERS_CHECK > kbuild: add CONFIG_HEADERS_INSTALL and loosen the dependency of > samples > kbuild: remove build_unifdef target in scripts/Makefile > kbuild: build all prerequisite of headers_install simultaneously > kbuild: add 'headers' target to build up ready-to-install uapi headers > kbuild: re-implement Makefile.headersinst without directory descending > kbuild: move hdr-inst shorthand to top Makefile > kbuild: simplify scripts/headers_install.sh > kbuild: deb-pkg: do not run headers_check > fixup: kbuild: add support for ensuring headers are self-contained > kbuild: compile test UAPI headers to ensure they are self-contained Series, applied to linux-kbuild. > Documentation/kbuild/headers_install.txt | 7 -- > Documentation/kbuild/makefiles.txt | 13 ++- > Makefile | 56 +- > arch/arc/configs/tb10x_defconfig | 1 + > arch/nds32/configs/defconfig | 1 + > arch/parisc/configs/a500_defconfig | 1 + > arch/parisc/configs/b180_defconfig | 1 + > arch/parisc/configs/c3000_defconfig | 1 + > arch/parisc/configs/default_defconfig| 1 + > arch/powerpc/configs/ppc6xx_defconfig| 1 + > arch/s390/configs/debug_defconfig| 1 + > include/uapi/{linux => }/Kbuild | 6 +- > init/Kconfig | 20 > lib/Kconfig.debug| 25 +++-- > samples/Kconfig | 14 ++- > samples/Makefile | 4 +- > scripts/Kbuild.include | 6 -- > scripts/Makefile | 5 - > scripts/Makefile.build | 9 ++ > scripts/Makefile.headersinst | 132 ++- > scripts/Makefile.lib | 3 + > scripts/cc-system-headers.sh | 8 ++ > scripts/headers.sh | 29 - > scripts/headers_install.sh | 48 - > scripts/package/builddeb | 2 +- > usr/.gitignore | 1 - > usr/Makefile | 2 + > usr/include/.gitignore | 3 + > usr/include/Makefile | 132 +++ > 29 files changed, 329 insertions(+), 204 deletions(-) > rename include/uapi/{linux => }/Kbuild (77%) > create mode 100755 scripts/cc-system-headers.sh > delete mode 100755 scripts/headers.sh > create mode 100644 usr/include/.gitignore > create mode 100644 usr/include/Makefile > > -- > 2.17.1 > > > ___ > linux-riscv mailing list > linux-ri...@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv -- Best Regards Masahiro Yamada ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailma
Re: [PATCH] mm: Generalize and rename notify_page_fault() as kprobe_page_fault()
+CC Masami San, Eugeniy On 6/13/19 10:57 AM, Vineet Gupta wrote: > On 6/13/19 3:07 AM, Anshuman Khandual wrote: >> Questions: >> >> AFAICT there is no equivalent of erstwhile notify_page_fault() during page >> fault handling in arc and mips archs which can call this generic function. >> Please let me know if that is not the case. > > For ARC do_page_fault() is entered for MMU exceptions (TLB Miss, access > violations > r/w/x etc). kprobes uses a combination of UNIMP_S and TRAP_S instructions > which > don't funnel into do_page_fault(). > > UINMP_S leads to > > instr_service >do_insterror_or_kprobe > notify_die(DIE_IERR) > kprobe_exceptions_notify > arc_kprobe_handler > > > TRAP_S 2 leads to > > EV_Trap >do_non_swi_trap > trap_is_kprobe > notify_die(DIE_TRAP) > kprobe_exceptions_notify >arc_post_kprobe_handler > > But indeed we are *not* calling into kprobe_fault_handler() - from eithet of > those > paths and not sure if the existing arc*_kprobe_handler() combination does the > equivalent in tandem. @Eugeniy can you please investigate this - do we have krpobes bit rot in ARC port. -Vineet ___ linux-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Re: [PATCH] ARC: ARCv2: jump label: implement jump label patching
On 6/14/19 9:41 AM, Eugeniy Paltsev wrote: > Implement jump label patching for ARC. Jump labels provide > an interface to generate dynamic branches using > self-modifying code. > > This allows us to implement conditional branches where > changing branch direction is expensive but branch selection > is basically 'free' > > This implementation uses 32-bit NOP and BRANCH instructions > which forced to be aligned by 4 to guarantee that they don't > cross L1 cache line and can be update atomically. > > Signed-off-by: Eugeniy Paltsev LGTM overall - nits below. > --- > arch/arc/Kconfig | 8 ++ > arch/arc/include/asm/jump_label.h | 68 > arch/arc/kernel/Makefile | 1 + > arch/arc/kernel/jump_label.c | 168 ++ > 4 files changed, 245 insertions(+) > create mode 100644 arch/arc/include/asm/jump_label.h > create mode 100644 arch/arc/kernel/jump_label.c > > diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig > index c781e45d1d99..b1313e016c54 100644 > --- a/arch/arc/Kconfig > +++ b/arch/arc/Kconfig > @@ -47,6 +47,7 @@ config ARC > select OF_EARLY_FLATTREE > select PCI_SYSCALL if PCI > select PERF_USE_VMALLOC if ARC_CACHE_VIPT_ALIASING > + select HAVE_ARCH_JUMP_LABEL if ISA_ARCV2 && !CPU_ENDIAN_BE32 > > config ARCH_HAS_CACHE_LINE_SIZE > def_bool y > @@ -529,6 +530,13 @@ config ARC_DW2_UNWIND > config ARC_DBG_TLB_PARANOIA > bool "Paranoia Checks in Low Level TLB Handlers" > > +config ARC_DBG_STATIC_KEYS > + bool "Paranoid checks in Static Keys code" > + depends on JUMP_LABEL > + select STATIC_KEYS_SELFTEST > + help > + Enable paranoid checks and self-test of both ARC-specific and generic > + part of static-keys-related code. Why can't we just enable this if STATIC_KEYS_SELFTEST > endif > > config ARC_BUILTIN_DTB_NAME > diff --git a/arch/arc/include/asm/jump_label.h > b/arch/arc/include/asm/jump_label.h > new file mode 100644 > index ..8971d0608f2c > --- /dev/null > +++ b/arch/arc/include/asm/jump_label.h > @@ -0,0 +1,68 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +#ifndef _ASM_ARC_JUMP_LABEL_H > +#define _ASM_ARC_JUMP_LABEL_H > + > +#ifndef __ASSEMBLY__ > + > +#include > + > +#define JUMP_LABEL_NOP_SIZE 4 > + > +/* > + * To make atomic update of patched instruction available we need to > guarantee > + * that this instruction doesn't cross L1 cache line boundary. > + * > + * As of today we simply align instruction which can be patched by 4 byte > using > + * ".balign 4" directive. In that case patched instruction is aligned with > one > + * 16-bit NOP_S if this is required. > + * However 'align by 4' directive is much stricter than it actually required. > + * It's enough that our 32-bit instruction don't cross l1 cache line boundary > + * which can be achieved by using ".bundle_align_mode" directive. That will > save > + * us from adding useless NOP_S padding in most of the cases. > + * > + * TODO: switch to ".bundle_align_mode" directive using whin it will be > + * supported by ARC toolchain. > + */ > + So block comments on top of a function imply summary of function etc. What you are doing here is calling out the need for .balign quirk. So better to phrase it is as "Note about .balign" and then describe the thing > +static __always_inline bool arch_static_branch(struct static_key *key, > +bool branch) > +{ > + asm_volatile_goto(".balign 4\n" > + "1:\n" > + "nop \n" > + ".pushsection __jump_table, \"aw\" \n" > + ".word 1b, %l[l_yes], %c0 \n" > + ".popsection \n" > + : : "i" (&((char *)key)[branch]) : : l_yes); > + > + return false; > +l_yes: > + return true; > +} > + > +static __always_inline bool arch_static_branch_jump(struct static_key *key, > + bool branch) > +{ > + asm_volatile_goto(".balign 4\n" > + "1:\n" > + "b %l[l_yes] \n" > + ".pushsection __jump_table, \"aw\" \n" > + ".word 1b, %l[l_yes], %c0 \n" > + ".popsection \n" > + : : "i" (&((char *)key)[branch]) : : l_yes); > + > + return false; > +l_yes: > + return true; > +} > + > +typedef u32 jump_label_t; > + > +struct jump_entry { > + jump_label_t code; > + jump_label_t target; > + jump_label_t key; > +}; > + > +#endif /* __ASSEMBLY__ */ > +#endif > diff --git a/arch/arc/kernel/Makefile b/arch/arc/kernel/Makefile > index 2dc5f4296d44..307f74156d99 100644 > --- a/arch/arc/kernel/Makefile > +++ b/arch/arc/kernel/Makefile > @@ -22,6 +22,7 @@ obj-$(CONFIG_ARC_E