From b70295cf051e6d3e0cd697c9cdf8ab91586ca66f Mon Sep 17 00:00:00 2001 From: Ming Lei Date: Wed, 31 Aug 2011 00:03:13 +0800 Subject: usb: ehci: make HC see up-to-date qh/qtd descriptor ASAP This patch introduces the helper of ehci_sync_mem to flush qtd/qh into memory immediately on some ARM, so that HC can see the up-to-date qtd/qh descriptor asap. This patch fixs one performance bug on ARM Cortex A9 dual core platform, which has been reported on quite a few ARM machines (OMAP4, Tegra 2, snowball...), see details from link of https://bugs.launchpad.net/bugs/709245. The patch has been tested ok on OMAP4 panda A1 board, and the performance of 'dd' over usb mass storage can be increased from 4~5MB/sec to 14~16MB/sec after applying this patch. Cc: Russell King Signed-off-by: Ming Lei Signed-off-by: Alan Stern --- drivers/usb/host/ehci-q.c | 18 ++++++++++++++++++ drivers/usb/host/ehci.h | 17 +++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index 3d989028c836..7842997e06a3 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c @@ -1012,6 +1012,12 @@ static void qh_link_async (struct ehci_hcd *ehci, struct ehci_qh *qh) head->qh_next.qh = qh; head->hw->hw_next = dma; + /* + * flush qh descriptor into memory immediately, + * see comments in qh_append_tds. + */ + ehci_sync_mem(); + qh->xacterrs = 0; qh->qh_state = QH_STATE_LINKED; /* qtd completions reported later by interrupt */ @@ -1100,6 +1106,18 @@ static struct ehci_qh *qh_append_tds ( wmb (); dummy->hw_token = token; + /* + * Writing to dma coherent buffer on ARM may + * be delayed to reach memory, so HC may not see + * hw_token of dummy qtd in time, which can cause + * the qtd transaction to be executed very late, + * and degrade performance a lot. ehci_sync_mem + * is added to flush 'token' immediatelly into + * memory, so that ehci can execute the transaction + * ASAP. + */ + ehci_sync_mem(); + urb->hcpriv = qh; } } diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index 9dadc7118d68..53e4b49ca735 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h @@ -758,6 +758,23 @@ static inline u32 hc32_to_cpup (const struct ehci_hcd *ehci, const __hc32 *x) #endif +/* + * Writing to dma coherent memory on ARM may be delayed via L2 + * writing buffer, so introduce the helper which can flush L2 writing + * buffer into memory immediately, especially used to flush ehci + * descriptor to memory. + */ +#ifdef CONFIG_ARM_DMA_MEM_BUFFERABLE +static inline void ehci_sync_mem() +{ + mb(); +} +#else +static inline void ehci_sync_mem() +{ +} +#endif + /*-------------------------------------------------------------------------*/ #define ehci_dbg(ehci, fmt, args...) \ -- cgit v1.2.3 From 165375830743e8d8de29f8ddd5e899c9e1971111 Mon Sep 17 00:00:00 2001 From: Andrey Konovalov Date: Wed, 31 Oct 2012 13:32:51 +0400 Subject: ARM: dtb: add versatile dtb target to common Makefile Makes 'make dtbs' build the versatile .dtb files when versatile is enabled. Signed-off-by: Andrey Konovalov --- arch/arm/boot/dts/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index e44da40d984f..50438d6a6781 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -144,6 +144,8 @@ dtb-$(CONFIG_ARCH_TEGRA) += tegra20-harmony.dtb \ tegra20-whistler.dtb \ tegra30-cardhu-a02.dtb \ tegra30-cardhu-a04.dtb +dtb-$(CONFIG_ARCH_VERSATILE) += versatile-ab.dtb \ + versatile-pb.dtb dtb-$(CONFIG_ARCH_VEXPRESS) += vexpress-v2p-ca5s.dtb \ vexpress-v2p-ca9.dtb \ vexpress-v2p-ca15-tc1.dtb \ -- cgit v1.2.3 From 3ecbd243ccdf2fd949dbcf4a4ef6541c6c0dcb80 Mon Sep 17 00:00:00 2001 From: John Rigby Date: Tue, 10 Jan 2012 12:01:41 -0700 Subject: KBuild: Allow scripts/* to be cross compiled Cross compiling the binaries in scripts/* is not possible because various makefiles assume that $(obj)/whatever is executable on the build host. This patch introduces a new variable called KBUILD_SCRIPTROOT that points to script/binaries to use while cross compiling. Usage: Build scripts for the build host: make O=path/to/buildhost/buildscripts \ silentoldconfig prepare scripts Then cross build script for target: make O=path/to/target/buildscripts \ HOSTCC=$CROSS_COMPILE \ KBUILD_SCRIPTROOT=path/to/buildhost/buildscripts silentoldconfig prepare scripts This patch does not use KBUILD_SCRIPTROOT for all script invocations it only redefines the following if KBUILD_SCRIPTROOT is defined. scripts/Makefile.build scripts/basic/fixdep --> $(KBUILD_SCRIPTROOT)/scripts/basic/fixdep scripts/kconfig/Makefile $(obj)/conf --> $(KBUILD_SCRIPTROOT)/scripts/kconfig/conf scripts/mod/Makefile $(obj)mk_elfconfig --> $(KBUILD_SCRIPTROOT)/scripts/mod/mk_elfconfig Signed-off-by: John Rigby --- scripts/Kbuild.include | 6 +++++- scripts/Makefile.build | 6 +++++- scripts/kconfig/Makefile | 30 ++++++++++++++++++------------ scripts/mod/Makefile | 10 ++++++++-- 4 files changed, 36 insertions(+), 16 deletions(-) diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 978416dd31ca..5ecac2ae6fd3 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -222,11 +222,15 @@ if_changed = $(if $(strip $(any-prereq) $(arg-check)), \ $(echo-cmd) $(cmd_$(1)); \ echo 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd) +ifeq ($(KBUILD_SCRIPTROOT),) +KBUILD_SCRIPTROOT=. +endif + # Execute the command and also postprocess generated .d dependencies file. if_changed_dep = $(if $(strip $(any-prereq) $(arg-check) ), \ @set -e; \ $(echo-cmd) $(cmd_$(1)); \ - scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).tmp;\ + $(KBUILD_SCRIPTROOT)/scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).tmp;\ rm -f $(depfile); \ mv -f $(dot-target).tmp $(dot-target).cmd) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 0e801c3cdaf8..641a7bbdaad9 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -290,13 +290,17 @@ cmd_record_mcount = \ fi; endif +ifeq ($(KBUILD_SCRIPTROOT),) +KBUILD_SCRIPTROOT=. +endif + define rule_cc_o_c $(call echo-cmd,checksrc) $(cmd_checksrc) \ $(call echo-cmd,cc_o_c) $(cmd_cc_o_c); \ $(cmd_modversions) \ $(call echo-cmd,record_mcount) \ $(cmd_record_mcount) \ - scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \ + $(KBUILD_SCRIPTROOT)/scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' > \ $(dot-target).tmp; \ rm -f $(depfile); \ mv -f $(dot-target).tmp $(dot-target).cmd diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 3091794e9354..ee7797d9eaf1 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -11,6 +11,12 @@ else Kconfig := Kconfig endif +ifdef KBUILD_SCRIPTROOT +CONF = $(KBUILD_SCRIPTROOT)/scripts/kconfig/conf +else +CONF = $(obj)/conf +endif + xconfig: $(obj)/qconf $< $(Kconfig) @@ -20,31 +26,31 @@ gconfig: $(obj)/gconf menuconfig: $(obj)/mconf $< $(Kconfig) -config: $(obj)/conf +config: $(CONF) $< --oldaskconfig $(Kconfig) nconfig: $(obj)/nconf $< $(Kconfig) -oldconfig: $(obj)/conf +oldconfig: $(CONF) $< --$@ $(Kconfig) -silentoldconfig: $(obj)/conf +silentoldconfig: $(CONF) $(Q)mkdir -p include/generated $< --$@ $(Kconfig) -localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf +localyesconfig localmodconfig: $(obj)/streamline_config.pl $(CONF) $(Q)mkdir -p include/generated $(Q)perl $< --$@ $(srctree) $(Kconfig) > .tmp.config $(Q)if [ -f .config ]; then \ cmp -s .tmp.config .config || \ (mv -f .config .config.old.1; \ mv -f .tmp.config .config; \ - $(obj)/conf --silentoldconfig $(Kconfig); \ + $(CONF) --silentoldconfig $(Kconfig); \ mv -f .config.old.1 .config.old) \ else \ mv -f .tmp.config .config; \ - $(obj)/conf --silentoldconfig $(Kconfig); \ + $(CONF) --silentoldconfig $(Kconfig); \ fi $(Q)rm -f .tmp.config @@ -73,24 +79,24 @@ update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h PHONY += allnoconfig allyesconfig allmodconfig alldefconfig randconfig -allnoconfig allyesconfig allmodconfig alldefconfig randconfig: $(obj)/conf +allnoconfig allyesconfig allmodconfig alldefconfig randconfig: $(CONF) $< --$@ $(Kconfig) PHONY += listnewconfig olddefconfig oldnoconfig savedefconfig defconfig -listnewconfig olddefconfig: $(obj)/conf +listnewconfig olddefconfig: $(CONF) $< --$@ $(Kconfig) # oldnoconfig is an alias of olddefconfig, because people already are dependent # on its behavior(sets new symbols to their default value but not 'n') with the # counter-intuitive name. -oldnoconfig: $(obj)/conf +oldnoconfig: $(CONF) $< --olddefconfig $(Kconfig) -savedefconfig: $(obj)/conf +savedefconfig: $(CONF) $< --$@=defconfig $(Kconfig) -defconfig: $(obj)/conf +defconfig: $(CONF) ifeq ($(KBUILD_DEFCONFIG),) $< --defconfig $(Kconfig) else @@ -98,7 +104,7 @@ else $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig) endif -%_defconfig: $(obj)/conf +%_defconfig: $(CONF) $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig) # Help text used by make help diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile index ff954f8168c1..258d4ba32d51 100644 --- a/scripts/mod/Makefile +++ b/scripts/mod/Makefile @@ -1,6 +1,12 @@ hostprogs-y := modpost mk_elfconfig always := $(hostprogs-y) empty.o +ifdef KBUILD_SCRIPTROOT +MKELFCONFIG = $(KBUILD_SCRIPTROOT)/scripts/mod/mk_elfconfig +else +MKELFCONFIG = $(obj)/mk_elfconfig +endif + modpost-objs := modpost.o file2alias.o sumversion.o # dependencies on generated files need to be listed explicitly @@ -8,9 +14,9 @@ modpost-objs := modpost.o file2alias.o sumversion.o $(obj)/modpost.o $(obj)/file2alias.o $(obj)/sumversion.o: $(obj)/elfconfig.h quiet_cmd_elfconfig = MKELF $@ - cmd_elfconfig = $(obj)/mk_elfconfig < $< > $@ + cmd_elfconfig = $(MKELFCONFIG) < $< > $@ -$(obj)/elfconfig.h: $(obj)/empty.o $(obj)/mk_elfconfig FORCE +$(obj)/elfconfig.h: $(obj)/empty.o $(MKELFCONFIG) FORCE $(call if_changed,elfconfig) targets += elfconfig.h -- cgit v1.2.3 From 4a3540ede442907c8024ecd9e23df42c505ae3bc Mon Sep 17 00:00:00 2001 From: Jon Medhurst Date: Tue, 27 Nov 2012 15:29:55 +0000 Subject: ARM: ftrace: Ensure code modifications are synchronised across all cpus When the generic ftrace implementation modifies code for trace-points it uses stop_machine() to call ftrace_modify_all_code() on one CPU. This ultimately calls the ARM specific function ftrace_modify_code() which updates the instruction and then does flush_icache_range(). As this cache flushing only operates on the local CPU then other cores may end up execute the old instruction if it's still in their icaches. This may or may not cause problems for the use of ftrace on kernels compiled for ARM instructions. However, Thumb2 instructions can straddle two cache lines so its possible for half the old instruction to be in the cache and half the new one, leading the the CPU executing garbage. This patch fixes this situation by providing and arch specific implementation of arch_ftrace_update_code() which ensures that after one core has modified all the code, the other cores invalidate their icaches before continuing. Signed-off-by: Jon Medhurst --- arch/arm/kernel/ftrace.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c index 34e56647dcee..38b670cea08c 100644 --- a/arch/arm/kernel/ftrace.c +++ b/arch/arm/kernel/ftrace.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -156,6 +157,39 @@ int ftrace_make_nop(struct module *mod, return ret; } +struct afmc_data { + int command; + atomic_t cpu; + atomic_t done; +}; + +static int __arch_ftrace_modify_code(void *data) +{ + struct afmc_data *afmcd = data; + + if (atomic_inc_return(&afmcd->cpu) == num_online_cpus()) { + /* Last cpu to get into this function does the actual work */ + ftrace_modify_all_code(afmcd->command); + wmb(); + atomic_set(&afmcd->done, true); + } else { + /* Other cpus wait for the code modifications to be done */ + rmb(); + while (!atomic_read(&afmcd->done)) + cpu_relax(); + /* Ensure icache is consistent with the code changes */ + __flush_icache_all(); + } + + return 0; +} + +void arch_ftrace_update_code(int command) +{ + struct afmc_data afmcd = { command }; + stop_machine(__arch_ftrace_modify_code, &afmcd, cpu_online_mask); +} + int __init ftrace_dyn_arch_init(void *data) { *(unsigned long *)data = 0; -- cgit v1.2.3 From c47f0a04055667de076aacb549f198205dadc999 Mon Sep 17 00:00:00 2001 From: Zhangfei Gao Date: Mon, 3 Dec 2012 15:36:10 +0800 Subject: merge_config.sh: Add option to specify output dir Provide a -O option to specify dir to put generated .config Then merge_config.sh does not need to be copied to target dir, for easy re-usage in other script Signed-off-by: Zhangfei Gao Tested-by: Jon Medhurst (Tixy) Acked-by: John Stultz --- scripts/kconfig/merge_config.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh index 974d5cb7e30a..05274fccb88e 100755 --- a/scripts/kconfig/merge_config.sh +++ b/scripts/kconfig/merge_config.sh @@ -32,11 +32,13 @@ usage() { echo " -m only merge the fragments, do not execute the make command" echo " -n use allnoconfig instead of alldefconfig" echo " -r list redundant entries when merging fragments" + echo " -O dir to put generated output files" } MAKE=true ALLTARGET=alldefconfig WARNREDUN=false +OUTPUT=. while true; do case $1 in @@ -59,6 +61,16 @@ while true; do shift continue ;; + "-O") + if [ -d $2 ];then + OUTPUT=$(echo $2 | sed 's/\/*$//') + else + echo "output directory $2 does not exist" 1>&2 + exit 1 + fi + shift 2 + continue + ;; *) break ;; @@ -100,9 +112,9 @@ for MERGE_FILE in $MERGE_LIST ; do done if [ "$MAKE" = "false" ]; then - cp $TMP_FILE .config + cp $TMP_FILE $OUTPUT/.config echo "#" - echo "# merged configuration written to .config (needs make)" + echo "# merged configuration written to $OUTPUT/.config (needs make)" echo "#" clean_up exit @@ -111,14 +123,14 @@ fi # Use the merged file as the starting point for: # alldefconfig: Fills in any missing symbols with Kconfig default # allnoconfig: Fills in any missing symbols with # CONFIG_* is not set -make KCONFIG_ALLCONFIG=$TMP_FILE $ALLTARGET +make KCONFIG_ALLCONFIG=$TMP_FILE O=$OUTPUT $ALLTARGET # Check all specified config values took (might have missed-dependency issues) for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE) - ACTUAL_VAL=$(grep -w -e "$CFG" .config) + ACTUAL_VAL=$(grep -w -e "$CFG" $OUTPUT/.config) if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then echo "Value requested for $CFG not in final .config" echo "Requested value: $REQUESTED_VAL" -- cgit v1.2.3 From 57efe68d9601c3c3519871e41f665feb63e8291c Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Fri, 9 Nov 2012 16:45:51 +0000 Subject: drm/omap: fix typo, s/GET_OMAP_REVISION()/GET_OMAP_TYPE/ The patch 'drm/omap: add support for ARCH_MULTIPLATFORM' had a small mistake, using GET_OMAP_REVISION() instead of GET_OMAP_TYPE. Signed-off-by: Rob Clark --- arch/arm/mach-omap2/drm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-omap2/drm.c b/arch/arm/mach-omap2/drm.c index 4c7566c7e24a..5c76c01523b1 100644 --- a/arch/arm/mach-omap2/drm.c +++ b/arch/arm/mach-omap2/drm.c @@ -27,6 +27,7 @@ #include "omap_device.h" #include "omap_hwmod.h" +#include "soc.h" #if defined(CONFIG_DRM_OMAP) || (CONFIG_DRM_OMAP_MODULE) @@ -56,7 +57,7 @@ static int __init omap_init_drm(void) oh->name); } - platform_data.omaprev = GET_OMAP_REVISION(); + platform_data.omaprev = GET_OMAP_TYPE; return platform_device_register(&omap_drm_device); -- cgit v1.2.3