3.8.8-stable review
Subsystems (33)
Greg Kroah-Hartman
maintainercover 3.8.8-stable review
This is the start of the stable review cycle for the 3.8.8 release. There are 27 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed Apr 17 02:41:37 UTC 2013. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.8.8-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 3.8.8-rc1
Sebastian Andrzej Siewior <[email protected]>
tty: don't deadlock while flushing workqueue
Boris Ostrovsky <[email protected]>
x86, mm: Patch out arch_flush_lazy_mmu_mode() when running on bare metal
Samu Kallio <[email protected]>
x86, mm, paravirt: Fix vmalloc_fault oops during lazy MMU updates
Thomas Gleixner <[email protected]>
sched_clock: Prevent 64bit inatomicity on 32bit systems
Steven Rostedt (Red Hat) <[email protected]>
ftrace: Move ftrace_filter_lseek out of CONFIG_DYNAMIC_FTRACE section
Dave Airlie <[email protected]>
udl: handle EDID failure properly.
Namhyung Kim <[email protected]>
tracing: Fix possible NULL pointer dereferences
Dave Hansen <[email protected]>
x86-32: Fix possible incomplete TLB invalidate with PAE pagetables
Haojian Zhuang <[email protected]>
gpio: fix wrong checking condition for gpio range
Linus Torvalds <[email protected]>
kobject: fix kset_find_obj() race with concurrent last kobject_put()
Suleiman Souhlal <[email protected]>
vfs: Revert spurious fix to spinning prevention in prune_icache_sb
Nicholas Bellinger <[email protected]>
target: Fix incorrect fallthrough of ALUA Standby/Offline/Transition CDBs
Sachin Prabhu <[email protected]>
cifs: Allow passwords which begin with a delimitor
Lukasz Dorau <[email protected]>
SCSI: libsas: fix handling vacant phy in sas_set_ex_phy()
Wei Yongjun <[email protected]>
GFS2: return error if malloc failed in gfs2_rs_alloc()
Steven Whitehouse <[email protected]>
GFS2: Fix unlock of fcntl locks during withdrawn state
Stanislav Kinsbursky <[email protected]>
ipc: set msg back to -EAGAIN if copy wasn't performed
John W. Linville <[email protected]>
Revert "brcmsmac: support 4313iPA"
Huacai Chen <[email protected]>
PM / reboot: call syscore_shutdown() after disable_nonboot_cpus()
Peter Ujfalusi <[email protected]>
dmaengine: omap-dma: Start DMA without delay for cyclic channels
Markus Pargmann <[email protected]>
ARM: imx35 Bugfix admux clock
Nigel Roberts <[email protected]>
ARM: Kirkwood: Fix typo in the definition of ix2-200 rebuild LED
Namhyung Kim <[email protected]>
tracing: Fix double free when function profile init failed
Alban Bedel <[email protected]>
ASoC: wm8903: Fix the bypass to HP/LINEOUT when no DAC or ADC is running
Mark Brown <[email protected]>
ASoC: wm5102: Correct lookup of arizona struct in SYSCLK event
Joonyoung Shim <[email protected]>
ASoC: core: Fix to check return value of snd_soc_update_bits_locked()
Eldad Zack <[email protected]>
ALSA: usb-audio: fix endianness bug in snd_nativeinstruments_*
-------------
Diffstat:
Makefile | 4 +- arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts | 14 +- arch/arm/mach-imx/clk-imx35.c | 1 + arch/x86/include/asm/paravirt.h | 5 +- arch/x86/include/asm/paravirt_types.h | 2 + arch/x86/include/asm/tlb.h | 2 +- arch/x86/kernel/paravirt.c | 25 +- arch/x86/lguest/boot.c | 1 + arch/x86/mm/fault.c | 6 +- arch/x86/mm/pgtable.c | 7 + arch/x86/xen/mmu.c | 1 + drivers/dma/omap-dma.c | 20 +- drivers/gpio/gpiolib-of.c | 5 +- drivers/gpu/drm/udl/udl_connector.c | 4 + .../net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c | 369 ++++++++------------- .../wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c | 64 ++-- drivers/scsi/libsas/sas_expander.c | 12 + drivers/target/target_core_alua.c | 3 + drivers/tty/tty_ldisc.c | 10 +- fs/cifs/connect.c | 16 +- fs/gfs2/file.c | 5 +- fs/gfs2/rgrp.c | 2 +- fs/inode.c | 2 +- include/asm-generic/tlb.h | 7 +- include/linux/ftrace.h | 3 +- ipc/msg.c | 1 + kernel/sched/clock.c | 26 ++ kernel/sys.c | 3 +- kernel/trace/ftrace.c | 37 +-- kernel/trace/trace_stack.c | 2 +- lib/kobject.c | 9 +- mm/memory.c | 1 + sound/soc/codecs/wm5102.c | 2 +- sound/soc/codecs/wm8903.c | 2 + sound/soc/soc-core.c | 2 +- sound/usb/mixer_quirks.c | 4 +- sound/usb/quirks.c | 2 +- 37 files changed, 336 insertions(+), 345 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/27 ALSA: usb-audio: fix endianness bug in snd_nativeinstruments_*
3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eldad Zack <[email protected]>
commit 889d66848b12d891248b03abcb2a42047f8e172a upstream.
The usb_control_msg() function expects __u16 types and performs the endianness conversions by itself.
However, in three places, a conversion is performed before it is handed over to usb_control_msg(), which leads to a double conversion (= no conversion):
* snd_usb_nativeinstruments_boot_quirk()
* snd_nativeinstruments_control_get()
* snd_nativeinstruments_control_put()
Caught by sparse:
sound/usb/mixer_quirks.c:512:38: warning: incorrect type in argument 6 (different base types)sound/usb/mixer_quirks.c:512:38: expected unsigned short [unsigned] [usertype] indexsound/usb/mixer_quirks.c:512:38: got restricted __le16 [usertype] <noident>sound/usb/mixer_quirks.c:543:35: warning: incorrect type in argument 5 (different base types)sound/usb/mixer_quirks.c:543:35: expected unsigned short [unsigned] [usertype] valuesound/usb/mixer_quirks.c:543:35: got restricted __le16 [usertype] <noident>sound/usb/mixer_quirks.c:543:56: warning: incorrect type in argument 6 (different base types)sound/usb/mixer_quirks.c:543:56: expected unsigned short [unsigned] [usertype] indexsound/usb/mixer_quirks.c:543:56: got restricted __le16 [usertype] <noident>sound/usb/quirks.c:502:35: warning: incorrect type in argument 5 (different base types)sound/usb/quirks.c:502:35: expected unsigned short [unsigned] [usertype] valuesound/usb/quirks.c:502:35: got restricted __le16 [usertype] <noident>
--- sound/usb/mixer_quirks.c | 4 ++-- sound/usb/quirks.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
sound/usb/mixer_quirks.c +2 -2
@@ -509,7 +509,7 @@ static int snd_nativeinstruments_controlelse ret =usb_control_msg (dev,usb_rcvctrlpipe (dev,0 ), bRequest,USB_TYPE_VENDOR |USB_RECIP_DEVICE |USB_DIR_IN , -0 ,cpu_to_le16 (wIndex), +0 , wIndex, &tmp,sizeof (tmp),1000 );up_read (&mixer->chip->shutdown_rwsem);
@@ -540,7 +540,7 @@ static int snd_nativeinstruments_controlelse ret =usb_control_msg (dev,usb_sndctrlpipe (dev,0 ), bRequest,USB_TYPE_VENDOR |USB_RECIP_DEVICE |USB_DIR_OUT , -cpu_to_le16 (wValue),cpu_to_le16 (wIndex), + wValue, wIndex,NULL ,0 ,1000 );up_read (&mixer->chip->shutdown_rwsem);
sound/usb/quirks.c +1 -1
@@ -486,7 +486,7 @@ static int snd_usb_nativeinstruments_boo {int ret =usb_control_msg (dev,usb_sndctrlpipe (dev,0 ),0xaf ,USB_TYPE_VENDOR |USB_RECIP_DEVICE , -cpu_to_le16 (1 ),0 ,NULL ,0 ,1000 ); +1 ,0 ,NULL ,0 ,1000 );if (ret <0 )return ret;
Greg Kroah-Hartman
maintainerPATCH 2/27 ASoC: core: Fix to check return value of snd_soc_update_bits_locked()
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joonyoung Shim <[email protected]>
commit 0eaa6cca1f75e12e4f5ec62cbe887330fe3b5fe9 upstream.
It can be 0 or 1 return value of snd_soc_update_bits_locked() when it is success. So just check return value is negative.
--- sound/soc/soc-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/soc-core.c +1 -1
@@ -2959,7 +2959,7 @@ int snd_soc_put_volsw_range(struct snd_k val = val << shift; ret =snd_soc_update_bits_locked (codec, reg, val_mask, val); -if (ret !=0 ) +if (ret <0 )return ret;if (snd_soc_volsw_is_stereo (mc)) {
Greg Kroah-Hartman
maintainerPATCH 3/27 ASoC: wm5102: Correct lookup of arizona struct in SYSCLK event
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit f6f629f8332ea70255f6c60c904270640a21a114 upstream.
--- sound/soc/codecs/wm5102.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm5102.c +1 -1
@@ -576,7 +576,7 @@ static int wm5102_sysclk_ev(struct snd_s struct snd_kcontrol *kcontrol, int event) {struct snd_soc_codec *codec = w->codec; -struct arizona *arizona =dev_get_drvdata (codec->dev); +struct arizona *arizona =dev_get_drvdata (codec->dev->parent);struct regmap *regmap = codec->control_data;const struct reg_default *patch =NULL ;int i, patch_size;
Greg Kroah-Hartman
maintainerPATCH 4/27 ASoC: wm8903: Fix the bypass to HP/LINEOUT when no DAC or ADC is running
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alban Bedel <[email protected]>
commit f1ca493b0b5e8f42d3b2dc8877860db2983f47b6 upstream.
The Charge Pump needs the DSP clock to work properly, without it the bypass to HP/LINEOUT is not working properly. This requirement is not mentioned in the datasheet but has been confirmed by Mark Brown from Wolfson.
--- sound/soc/codecs/wm8903.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/codecs/wm8903.c +2 -0
@@ -1083,6 +1083,8 @@ static const struct snd_soc_dapm_route w { "ROP", NULL, "Right Speaker PGA" }, { "RON", NULL, "Right Speaker PGA" }, + { "Charge Pump", NULL, "CLK_DSP" }, + { "Left Headphone Output PGA", NULL, "Charge Pump" }, { "Right Headphone Output PGA", NULL, "Charge Pump" }, { "Left Line Output PGA", NULL, "Charge Pump" },
Greg Kroah-Hartman
maintainerPATCH 5/27 tracing: Fix double free when function profile init failed
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
commit 83e03b3fe4daffdebbb42151d5410d730ae50bd1 upstream.
On the failure path, stat->start and stat->pages will refer same page. So it'll attempt to free the same page again and get kernel panic.
--- kernel/trace/ftrace.c | 1 - 1 file changed, 1 deletion(-)
kernel/trace/ftrace.c +0 -1
@@ -668,7 +668,6 @@ int ftrace_profile_pages_init(struct ftrfree_page (tmp); } -free_page ((unsigned long )stat->pages); stat->pages =NULL ; stat->start =NULL ;
Greg Kroah-Hartman
maintainerPATCH 6/27 ARM: Kirkwood: Fix typo in the definition of ix2-200 rebuild LED
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nigel Roberts <[email protected]>
commit 8f08d6667287241f6818d35e02b223fb5df97cf1 upstream.
In the conversion to pinctrl, an error in the pins for the rebuild LED was introduced. This patch assigns the correct pins and includes the correct name for the LED in kirkwood-iomega_ix2_200.dts.
--- arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts +7 -7
@@ -96,11 +96,11 @@ marvell,function = "gpio"; }; pmx_led_rebuild_brt_ctrl_1: pmx-led-rebuild-brt-ctrl-1 { - marvell,pins = "mpp44"; + marvell,pins = "mpp46"; marvell,function = "gpio"; }; pmx_led_rebuild_brt_ctrl_2: pmx-led-rebuild-brt-ctrl-2 { - marvell,pins = "mpp45"; + marvell,pins = "mpp47"; marvell,function = "gpio"; };
@@ -157,14 +157,14 @@ gpios = <&gpio0 16 0>; linux,default-trigger = "default-on"; }; - health_led1 { + rebuild_led { + label = "status:white:rebuild_led"; + gpios = <&gpio1 4 0>; + }; + health_led { label = "status:red:health_led"; gpios = <&gpio1 5 0>; }; - health_led2 { - label = "status:white:health_led"; - gpios = <&gpio1 4 0>; - }; backup_led { label = "status:blue:backup_led"; gpios = <&gpio0 15 0>;
Greg Kroah-Hartman
maintainerPATCH 7/27 ARM: imx35 Bugfix admux clock
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Markus Pargmann <[email protected]>
commit 75498083e25e96932ad998ffdeadb17234c68d3a upstream.
The admux clock seems to be the audmux clock as tests show. audmux does not work without this clock enabled. Currently imx35 does not register a clock device for audmux. This patch adds this registration. imx-audmux driver already handles a clock device, so no changes are necessary there.
--- arch/arm/mach-imx/clk-imx35.c | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-imx/clk-imx35.c +1 -0
@@ -257,6 +257,7 @@ int __init mx35_clocks_init()clk_register_clkdev (clk[wdog_gate],NULL ,"imx2-wdt.0" );clk_register_clkdev (clk[nfc_div],NULL ,"imx25-nand.0" );clk_register_clkdev (clk[csi_gate],NULL ,"mx3-camera.0" ); +clk_register_clkdev (clk[admux_gate],"audmux" ,NULL );clk_prepare_enable (clk[spba_gate]);clk_prepare_enable (clk[gpio1_gate]);
Greg Kroah-Hartman
maintainerPATCH 8/27 dmaengine: omap-dma: Start DMA without delay for cyclic channels
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Ujfalusi <[email protected]>
commit 765024697807ad1e1cac332aa891253ca4a339da upstream.
cyclic DMA is only used by audio which needs DMA to be started without a delay.
If the DMA for audio is started using the tasklet we experience random channel switch (to be more precise: channel shift).
--- drivers/dma/omap-dma.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/dma/omap-dma.c +14 -6
@@ -276,12 +276,20 @@ static void omap_dma_issue_pending(strucspin_lock_irqsave (&c->vc.lock, flags);if (vchan_issue_pending (&c->vc) && !c->desc) { -struct omap_dmadev *d =to_omap_dma_dev (chan->device); -spin_lock (&d->lock); -if (list_empty (&c->node)) -list_add_tail (&c->node, &d->pending); -spin_unlock (&d->lock); -tasklet_schedule (&d->task); +/* +* c->cyclic is used only by audio and in this case the DMA need +* to be started without delay. +*/ +if (!c->cyclic) { +struct omap_dmadev *d =to_omap_dma_dev (chan->device); +spin_lock (&d->lock); +if (list_empty (&c->node)) +list_add_tail (&c->node, &d->pending); +spin_unlock (&d->lock); +tasklet_schedule (&d->task); + }else { +omap_dma_start_desc (c); + } }spin_unlock_irqrestore (&c->vc.lock, flags); }
Greg Kroah-Hartman
maintainerPATCH 9/27 PM / reboot: call syscore_shutdown() after disable_nonboot_cpus()
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit 6f389a8f1dd22a24f3d9afc2812b30d639e94625 upstream.
As commit 40dc166c (PM / Core: Introduce struct syscore_ops for core subsystems PM) say, syscore_ops operations should be carried with one CPU on-line and interrupts disabled. However, after commit f96972f2d (kernel/sys.c: call disable_nonboot_cpus() in kernel_restart()), syscore_shutdown() is called before disable_nonboot_cpus(), so break the rules. We have a MIPS machine with a 8259A PIC, and there is an external timer (HPET) linked at 8259A. Since 8259A has been shutdown too early (by syscore_shutdown()), disable_nonboot_cpus() runs without timer interrupt, so it hangs and reboot fails. This patch call syscore_shutdown() a little later (after disable_nonboot_cpus()) to avoid reboot failure, this is the same way as poweroff does.
For consistency, add disable_nonboot_cpus() to kernel_halt().
--- kernel/sys.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/sys.c +2 -1
@@ -323,7 +323,6 @@ void kernel_restart_prepare(char *cmd) system_state =SYSTEM_RESTART ;usermodehelper_disable ();device_shutdown (); -syscore_shutdown (); }/**
@@ -369,6 +368,7 @@ void kernel_restart(char *cmd) {kernel_restart_prepare (cmd);disable_nonboot_cpus (); +syscore_shutdown ();if (!cmd)printk (KERN_EMERG "Restarting system.\n" );else
@@ -394,6 +394,7 @@ static void kernel_shutdown_prepare(enumvoid kernel_halt (void ) {kernel_shutdown_prepare (SYSTEM_HALT ); +disable_nonboot_cpus ();syscore_shutdown ();printk (KERN_EMERG "System halted.\n" );kmsg_dump (KMSG_DUMP_HALT );
Greg Kroah-Hartman
maintainerPATCH 10/27 Revert "brcmsmac: support 4313iPA"
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: "John W. Linville" <[email protected]>
commit 54683441a92ebe20c5282465ea6f21e5e74d2974 upstream.
This reverts commit b6fc28a158076ca2764edc9a6d1e1402f56e1c0c.
This commit is reported to cause a regression in the support for some revisions of 4313 ePA devices.
http://marc.info/?l=linux-wireless&m=136360340200943&w=2
Conflicts:
drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c
--- drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c | 375 +++++---------- drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c | 64 +- 2 files changed, 165 insertions(+), 274 deletions(-)
drivers/net/wireless/brcm80211/brcmsmac/phy/phy_lcn.c +133 -242
@@ -1137,9 +1137,8 @@ wlc_lcnphy_set_rx_gain_by_distribution(s gain0_15 = ((biq1 &0xf ) <<12 ) | ((tia &0xf ) <<8 ) | ((lna2 &0x3 ) <<6 ) | - ((lna2 &0x3 ) <<4 ) | - ((lna1 &0x3 ) <<2 ) | - ((lna1 &0x3 ) <<0 ); + ((lna2 & +0x3 ) <<4 ) | ((lna1 &0x3 ) <<2 ) | ((lna1 &0x3 ) <<0 );mod_phy_reg (pi,0x4b6 , (0xffff <<0 ), gain0_15 <<0 );mod_phy_reg (pi,0x4b7 , (0xf <<0 ), gain16_19 <<0 );
@@ -1157,8 +1156,6 @@ wlc_lcnphy_set_rx_gain_by_distribution(s }mod_phy_reg (pi,0x44d , (0x1 <<0 ), (!trsw) <<0 ); -mod_phy_reg (pi,0x4b1 , (0x3 <<11 ), lna1 <<11 ); -mod_phy_reg (pi,0x4e6 , (0x3 <<3 ), lna1 <<3 ); }
@@ -1331,43 +1328,6 @@ static u32 wlc_lcnphy_measure_digital_poreturn (iq_est.i_pwr + iq_est.q_pwr) / nsamples; } -static bool wlc_lcnphy_rx_iq_cal_gain (struct brcms_phy *pi,u16 biq1_gain, -u16 tia_gain,u16 lna2_gain) -{ -u32 i_thresh_l, q_thresh_l; -u32 i_thresh_h, q_thresh_h; -struct lcnphy_iq_est iq_est_h, iq_est_l; - -wlc_lcnphy_set_rx_gain_by_distribution (pi,0 ,0 ,0 , biq1_gain, tia_gain, - lna2_gain,0 ); - -wlc_lcnphy_rx_gain_override_enable (pi, true); -wlc_lcnphy_start_tx_tone (pi,2000 , (40 >>1 ),0 ); -udelay (500 ); -write_radio_reg (pi,RADIO_2064_REG112 ,0 ); -if (!wlc_lcnphy_rx_iq_est (pi,1024 ,32 , &iq_est_l)) -return false; - -wlc_lcnphy_start_tx_tone (pi,2000 ,40 ,0 ); -udelay (500 ); -write_radio_reg (pi,RADIO_2064_REG112 ,0 ); -if (!wlc_lcnphy_rx_iq_est (pi,1024 ,32 , &iq_est_h)) -return false; - - i_thresh_l = (iq_est_l.i_pwr <<1 ); - i_thresh_h = (iq_est_l.i_pwr <<2 ) + iq_est_l.i_pwr; - - q_thresh_l = (iq_est_l.q_pwr <<1 ); - q_thresh_h = (iq_est_l.q_pwr <<2 ) + iq_est_l.q_pwr; -if ((iq_est_h.i_pwr > i_thresh_l) && - (iq_est_h.i_pwr < i_thresh_h) && - (iq_est_h.q_pwr > q_thresh_l) && - (iq_est_h.q_pwr < q_thresh_h)) -return true; - -return false; -} - static bool wlc_lcnphy_rx_iq_cal(struct brcms_phy *pi, const struct lcnphy_rx_iqcomp *iqcomp,
@@ -1382,8 +1342,8 @@ wlc_lcnphy_rx_iq_cal(struct brcms_phy *p RFOverrideVal0_old, rfoverride2_old, rfoverride2val_old, rfoverride3_old, rfoverride3val_old, rfoverride4_old, rfoverride4val_old, afectrlovr_old, afectrlovrval_old; -int tia_gain, lna2_gain, biq1_gain; -bool set_gain; +int tia_gain; +u32 received_power, rx_pwr_threshold;u16 old_sslpnCalibClkEnCtrl, old_sslpnRxFeClkEnCtrl;u16 values_to_save[11 ];s16 *ptr;
@@ -1408,134 +1368,126 @@ wlc_lcnphy_rx_iq_cal(struct brcms_phy *p goto cal_done; } -WARN_ON (module !=1 ); - tx_pwr_ctrl =wlc_lcnphy_get_tx_pwr_ctrl (pi); -wlc_lcnphy_set_tx_pwr_ctrl (pi,LCNPHY_TX_PWR_CTRL_OFF ); - -for (i =0 ; i <11 ; i++) - values_to_save[i] = -read_radio_reg (pi, rxiq_cal_rf_reg[i]); - Core1TxControl_old =read_phy_reg (pi,0x631 ); - -or_phy_reg (pi,0x631 ,0x0015 ); - - RFOverride0_old =read_phy_reg (pi,0x44c ); - RFOverrideVal0_old =read_phy_reg (pi,0x44d ); - rfoverride2_old =read_phy_reg (pi,0x4b0 ); - rfoverride2val_old =read_phy_reg (pi,0x4b1 ); - rfoverride3_old =read_phy_reg (pi,0x4f9 ); - rfoverride3val_old =read_phy_reg (pi,0x4fa ); - rfoverride4_old =read_phy_reg (pi,0x938 ); - rfoverride4val_old =read_phy_reg (pi,0x939 ); - afectrlovr_old =read_phy_reg (pi,0x43b ); - afectrlovrval_old =read_phy_reg (pi,0x43c ); - old_sslpnCalibClkEnCtrl =read_phy_reg (pi,0x6da ); - old_sslpnRxFeClkEnCtrl =read_phy_reg (pi,0x6db ); - - tx_gain_override_old =wlc_lcnphy_tx_gain_override_enabled (pi); -if (tx_gain_override_old) { -wlc_lcnphy_get_tx_gain (pi, &old_gains); - tx_gain_index_old = pi_lcn->lcnphy_current_index; - } +if (module ==1 ) { -wlc_lcnphy_set_tx_pwr_by_index (pi, tx_gain_idx); - -mod_phy_reg (pi,0x4f9 , (0x1 <<0 ),1 <<0 ); -mod_phy_reg (pi,0x4fa , (0x1 <<0 ),0 <<0 ); - -mod_phy_reg (pi,0x43b , (0x1 <<1 ),1 <<1 ); -mod_phy_reg (pi,0x43c , (0x1 <<1 ),0 <<1 ); + tx_pwr_ctrl =wlc_lcnphy_get_tx_pwr_ctrl (pi); +wlc_lcnphy_set_tx_pwr_ctrl (pi,LCNPHY_TX_PWR_CTRL_OFF ); -write_radio_reg (pi,RADIO_2064_REG116 ,0x06 ); -write_radio_reg (pi,RADIO_2064_REG12C ,0x07 ); -write_radio_reg (pi,RADIO_2064_REG06A ,0xd3 ); -write_radio_reg (pi,RADIO_2064_REG098 ,0x03 ); -write_radio_reg (pi,RADIO_2064_REG00B ,0x7 ); -mod_radio_reg (pi,RADIO_2064_REG113 ,1 <<4 ,1 <<4 ); -write_radio_reg (pi,RADIO_2064_REG01D ,0x01 ); -write_radio_reg (pi,RADIO_2064_REG114 ,0x01 ); -write_radio_reg (pi,RADIO_2064_REG02E ,0x10 ); -write_radio_reg (pi,RADIO_2064_REG12A ,0x08 ); - -mod_phy_reg (pi,0x938 , (0x1 <<0 ),1 <<0 ); -mod_phy_reg (pi,0x939 , (0x1 <<0 ),0 <<0 ); -mod_phy_reg (pi,0x938 , (0x1 <<1 ),1 <<1 ); -mod_phy_reg (pi,0x939 , (0x1 <<1 ),1 <<1 ); -mod_phy_reg (pi,0x938 , (0x1 <<2 ),1 <<2 ); -mod_phy_reg (pi,0x939 , (0x1 <<2 ),1 <<2 ); -mod_phy_reg (pi,0x938 , (0x1 <<3 ),1 <<3 ); -mod_phy_reg (pi,0x939 , (0x1 <<3 ),1 <<3 ); -mod_phy_reg (pi,0x938 , (0x1 <<5 ),1 <<5 ); -mod_phy_reg (pi,0x939 , (0x1 <<5 ),0 <<5 ); +for (i =0 ; i <11 ; i++) + values_to_save[i] = +read_radio_reg (pi, rxiq_cal_rf_reg[i]); + Core1TxControl_old =read_phy_reg (pi,0x631 ); + +or_phy_reg (pi,0x631 ,0x0015 ); + + RFOverride0_old =read_phy_reg (pi,0x44c ); + RFOverrideVal0_old =read_phy_reg (pi,0x44d ); + rfoverride2_old =read_phy_reg (pi,0x4b0 ); + rfoverride2val_old =read_phy_reg (pi,0x4b1 ); + rfoverride3_old =read_phy_reg (pi,0x4f9 ); + rfoverride3val_old =read_phy_reg (pi,0x4fa ); + rfoverride4_old =read_phy_reg (pi,0x938 ); + rfoverride4val_old =read_phy_reg (pi,0x939 ); + afectrlovr_old =read_phy_reg (pi,0x43b ); + afectrlovrval_old =read_phy_reg (pi,0x43c ); + old_sslpnCalibClkEnCtrl =read_phy_reg (pi,0x6da ); + old_sslpnRxFeClkEnCtrl =read_phy_reg (pi,0x6db ); + + tx_gain_override_old =wlc_lcnphy_tx_gain_override_enabled (pi); +if (tx_gain_override_old) { +wlc_lcnphy_get_tx_gain (pi, &old_gains); + tx_gain_index_old = pi_lcn->lcnphy_current_index; + } -mod_phy_reg (pi,0x43b , (0x1 <<0 ),1 <<0 ); -mod_phy_reg (pi,0x43c , (0x1 <<0 ),0 <<0 ); +wlc_lcnphy_set_tx_pwr_by_index (pi, tx_gain_idx); -write_phy_reg (pi,0x6da ,0xffff ); -or_phy_reg (pi,0x6db ,0x3 ); +mod_phy_reg (pi,0x4f9 , (0x1 <<0 ),1 <<0 ); +mod_phy_reg (pi,0x4fa , (0x1 <<0 ),0 <<0 ); -wlc_lcnphy_set_trsw_override (pi, tx_switch, rx_switch); - set_gain = false; +mod_phy_reg (pi,0x43b , (0x1 <<1 ),1 <<1 ); +mod_phy_reg (pi,0x43c , (0x1 <<1 ),0 <<1 ); - lna2_gain =3 ; -while ((lna2_gain >=0 ) && !set_gain) { - tia_gain =4 ; - -while ((tia_gain >=0 ) && !set_gain) { - biq1_gain =6 ; - -while ((biq1_gain >=0 ) && !set_gain) { - set_gain =wlc_lcnphy_rx_iq_cal_gain (pi, - (u16 ) - biq1_gain, - (u16 ) - tia_gain, - (u16 ) - lna2_gain); - biq1_gain -=1 ; - } +write_radio_reg (pi,RADIO_2064_REG116 ,0x06 ); +write_radio_reg (pi,RADIO_2064_REG12C ,0x07 ); +write_radio_reg (pi,RADIO_2064_REG06A ,0xd3 ); +write_radio_reg (pi,RADIO_2064_REG098 ,0x03 ); +write_radio_reg (pi,RADIO_2064_REG00B ,0x7 ); +mod_radio_reg (pi,RADIO_2064_REG113 ,1 <<4 ,1 <<4 ); +write_radio_reg (pi,RADIO_2064_REG01D ,0x01 ); +write_radio_reg (pi,RADIO_2064_REG114 ,0x01 ); +write_radio_reg (pi,RADIO_2064_REG02E ,0x10 ); +write_radio_reg (pi,RADIO_2064_REG12A ,0x08 ); + +mod_phy_reg (pi,0x938 , (0x1 <<0 ),1 <<0 ); +mod_phy_reg (pi,0x939 , (0x1 <<0 ),0 <<0 ); +mod_phy_reg (pi,0x938 , (0x1 <<1 ),1 <<1 ); +mod_phy_reg (pi,0x939 , (0x1 <<1 ),1 <<1 ); +mod_phy_reg (pi,0x938 , (0x1 <<2 ),1 <<2 ); +mod_phy_reg (pi,0x939 , (0x1 <<2 ),1 <<2 ); +mod_phy_reg (pi,0x938 , (0x1 <<3 ),1 <<3 ); +mod_phy_reg (pi,0x939 , (0x1 <<3 ),1 <<3 ); +mod_phy_reg (pi,0x938 , (0x1 <<5 ),1 <<5 ); +mod_phy_reg (pi,0x939 , (0x1 <<5 ),0 <<5 ); + +mod_phy_reg (pi,0x43b , (0x1 <<0 ),1 <<0 ); +mod_phy_reg (pi,0x43c , (0x1 <<0 ),0 <<0 ); + +wlc_lcnphy_start_tx_tone (pi,2000 ,120 ,0 ); +write_phy_reg (pi,0x6da ,0xffff ); +or_phy_reg (pi,0x6db ,0x3 ); +wlc_lcnphy_set_trsw_override (pi, tx_switch, rx_switch); +wlc_lcnphy_rx_gain_override_enable (pi, true); + + tia_gain =8 ; + rx_pwr_threshold =950 ; +while (tia_gain >0 ) { tia_gain -=1 ; +wlc_lcnphy_set_rx_gain_by_distribution (pi, +0 ,0 ,2 ,2 , + (u16 ) + tia_gain,1 ,0 ); +udelay (500 ); + + received_power = +wlc_lcnphy_measure_digital_power (pi,2000 ); +if (received_power < rx_pwr_threshold) +break ; } - lna2_gain -=1 ; - } - -if (set_gain) - result =wlc_lcnphy_calc_rx_iq_comp (pi,1024 ); -else - result = false; - -wlc_lcnphy_stop_tx_tone (pi); - -write_phy_reg (pi,0x631 , Core1TxControl_old); - -write_phy_reg (pi,0x44c , RFOverrideVal0_old); -write_phy_reg (pi,0x44d , RFOverrideVal0_old); -write_phy_reg (pi,0x4b0 , rfoverride2_old); -write_phy_reg (pi,0x4b1 , rfoverride2val_old); -write_phy_reg (pi,0x4f9 , rfoverride3_old); -write_phy_reg (pi,0x4fa , rfoverride3val_old); -write_phy_reg (pi,0x938 , rfoverride4_old); -write_phy_reg (pi,0x939 , rfoverride4val_old); -write_phy_reg (pi,0x43b , afectrlovr_old); -write_phy_reg (pi,0x43c , afectrlovrval_old); -write_phy_reg (pi,0x6da , old_sslpnCalibClkEnCtrl); -write_phy_reg (pi,0x6db , old_sslpnRxFeClkEnCtrl); + result =wlc_lcnphy_calc_rx_iq_comp (pi,0xffff ); -wlc_lcnphy_clear_trsw_override (pi); +wlc_lcnphy_stop_tx_tone (pi); -mod_phy_reg (pi,0x44c , (0x1 <<2 ),0 <<2 ); +write_phy_reg (pi,0x631 , Core1TxControl_old); -for (i =0 ; i <11 ; i++) -write_radio_reg (pi, rxiq_cal_rf_reg[i], - values_to_save[i]); +write_phy_reg (pi,0x44c , RFOverrideVal0_old); +write_phy_reg (pi,0x44d , RFOverrideVal0_old); +write_phy_reg (pi,0x4b0 , rfoverride2_old); +write_phy_reg (pi,0x4b1 , rfoverride2val_old); +write_phy_reg (pi,0x4f9 , rfoverride3_old); +write_phy_reg (pi,0x4fa , rfoverride3val_old); +write_phy_reg (pi,0x938 , rfoverride4_old); +write_phy_reg (pi,0x939 , rfoverride4val_old); +write_phy_reg (pi,0x43b , afectrlovr_old); +write_phy_reg (pi,0x43c , afectrlovrval_old); +write_phy_reg (pi,0x6da , old_sslpnCalibClkEnCtrl); +write_phy_reg (pi,0x6db , old_sslpnRxFeClkEnCtrl); + +wlc_lcnphy_clear_trsw_override (pi); + +mod_phy_reg (pi,0x44c , (0x1 <<2 ),0 <<2 ); + +for (i =0 ; i <11 ; i++) +write_radio_reg (pi, rxiq_cal_rf_reg[i], + values_to_save[i]); -if (tx_gain_override_old) -wlc_lcnphy_set_tx_pwr_by_index (pi, tx_gain_index_old); -else -wlc_lcnphy_disable_tx_gain_override (pi); +if (tx_gain_override_old) +wlc_lcnphy_set_tx_pwr_by_index (pi, tx_gain_index_old); +else +wlc_lcnphy_disable_tx_gain_override (pi); -wlc_lcnphy_set_tx_pwr_ctrl (pi, tx_pwr_ctrl); -wlc_lcnphy_rx_gain_override_enable (pi, false); +wlc_lcnphy_set_tx_pwr_ctrl (pi, tx_pwr_ctrl); +wlc_lcnphy_rx_gain_override_enable (pi, false); + } cal_done:kfree (ptr);
@@ -1829,17 +1781,6 @@ wlc_lcnphy_radio_2064_channel_tune_4313(write_radio_reg (pi,RADIO_2064_REG038 ,3 );write_radio_reg (pi,RADIO_2064_REG091 ,7 ); } - -if (!(pi->sh->boardflags &BFL_FEM )) { -u8 reg038[14 ] = {0xd ,0xe ,0xd ,0xd ,0xd ,0xc , -0xa ,0xb ,0xb ,0x3 ,0x3 ,0x2 ,0x0 ,0x0 }; - -write_radio_reg (pi,RADIO_2064_REG02A ,0xf ); -write_radio_reg (pi,RADIO_2064_REG091 ,0x3 ); -write_radio_reg (pi,RADIO_2064_REG038 ,0x3 ); - -write_radio_reg (pi,RADIO_2064_REG038 , reg038[channel -1 ]); - } } static int
@@ -2034,16 +1975,6 @@ wlc_lcnphy_set_tssi_mux(struct brcms_phy }else {mod_radio_reg (pi,RADIO_2064_REG03A ,1 ,0x1 );mod_radio_reg (pi,RADIO_2064_REG11A ,0x8 ,0x8 ); -mod_radio_reg (pi,RADIO_2064_REG028 ,0x1 ,0x0 ); -mod_radio_reg (pi,RADIO_2064_REG11A ,0x4 ,1 <<2 ); -mod_radio_reg (pi,RADIO_2064_REG036 ,0x10 ,0x0 ); -mod_radio_reg (pi,RADIO_2064_REG11A ,0x10 ,1 <<4 ); -mod_radio_reg (pi,RADIO_2064_REG036 ,0x3 ,0x0 ); -mod_radio_reg (pi,RADIO_2064_REG035 ,0xff ,0x77 ); -mod_radio_reg (pi,RADIO_2064_REG028 ,0x1e ,0xe <<1 ); -mod_radio_reg (pi,RADIO_2064_REG112 ,0x80 ,1 <<7 ); -mod_radio_reg (pi,RADIO_2064_REG005 ,0x7 ,1 <<1 ); -mod_radio_reg (pi,RADIO_2064_REG029 ,0xf0 ,0 <<4 ); } }else {mod_phy_reg (pi,0x4d9 , (0x1 <<2 ), (0x1 ) <<2 );
@@ -2130,14 +2061,12 @@ static void wlc_lcnphy_pwrctrl_rssiparam (auxpga_vmid_temp << 0) | (auxpga_gain_temp << 12));mod_radio_reg (pi,RADIO_2064_REG082 , (1 <<5 ), (1 <<5 )); -mod_radio_reg (pi,RADIO_2064_REG07C , (1 <<0 ), (1 <<0 )); }static void wlc_lcnphy_tssi_setup (struct brcms_phy *pi) {struct phytbl_info tab;u32 rfseq, ind; -u8 tssi_sel; tab.tbl_id =LCNPHY_TBL_ID_TXPWRCTL ; tab.tbl_width =32 ;
@@ -2159,13 +2088,7 @@ static void wlc_lcnphy_tssi_setup(structmod_phy_reg (pi,0x503 , (0x1 <<4 ), (1 ) <<4 ); -if (pi->sh->boardflags &BFL_FEM ) { - tssi_sel =0x1 ; -wlc_lcnphy_set_tssi_mux (pi,LCNPHY_TSSI_EXT ); - }else { - tssi_sel =0xe ; -wlc_lcnphy_set_tssi_mux (pi,LCNPHY_TSSI_POST_PA ); - } +wlc_lcnphy_set_tssi_mux (pi,LCNPHY_TSSI_EXT );mod_phy_reg (pi,0x4a4 , (0x1 <<14 ), (0 ) <<14 );mod_phy_reg (pi,0x4a4 , (0x1 <<15 ), (1 ) <<15 );
@@ -2201,10 +2124,9 @@ static void wlc_lcnphy_tssi_setup(structmod_phy_reg (pi,0x49a , (0x1ff <<0 ), (0xff ) <<0 );if (LCNREV_IS (pi->pubpi.phy_rev,2 )) { -mod_radio_reg (pi,RADIO_2064_REG028 ,0xf , tssi_sel); +mod_radio_reg (pi,RADIO_2064_REG028 ,0xf ,0xe );mod_radio_reg (pi,RADIO_2064_REG086 ,0x4 ,0x4 ); }else { -mod_radio_reg (pi,RADIO_2064_REG028 ,0x1e , tssi_sel <<1 );mod_radio_reg (pi,RADIO_2064_REG03A ,0x1 ,1 );mod_radio_reg (pi,RADIO_2064_REG11A ,0x8 ,1 <<3 ); }
@@ -2251,10 +2173,6 @@ static void wlc_lcnphy_tssi_setup(structmod_phy_reg (pi,0x4d7 , (0xf <<8 ), (0 ) <<8 ); -mod_radio_reg (pi,RADIO_2064_REG035 ,0xff ,0x0 ); -mod_radio_reg (pi,RADIO_2064_REG036 ,0x3 ,0x0 ); -mod_radio_reg (pi,RADIO_2064_REG11A ,0x8 ,0x8 ); -wlc_lcnphy_pwrctrl_rssiparams (pi); }
@@ -2873,8 +2791,6 @@ static void wlc_lcnphy_idle_tssi_est(strread_radio_reg (pi,RADIO_2064_REG007 ) &1 ;u16 SAVE_jtag_auxpga =read_radio_reg (pi,RADIO_2064_REG0FF ) &0x10 ;u16 SAVE_iqadc_aux_en =read_radio_reg (pi,RADIO_2064_REG11F ) &4 ; -u8 SAVE_bbmult =wlc_lcnphy_get_bbmult (pi); - idleTssi =read_phy_reg (pi,0x4ab ); suspend = (0 == (bcma_read32 (pi->d11core,D11REGOFFS (maccontrol)) &MCTL_EN_MAC ));
@@ -2892,12 +2808,6 @@ static void wlc_lcnphy_idle_tssi_est(strmod_radio_reg (pi,RADIO_2064_REG0FF ,0x10 ,1 <<4 );mod_radio_reg (pi,RADIO_2064_REG11F ,0x4 ,1 <<2 );wlc_lcnphy_tssi_setup (pi); - -mod_phy_reg (pi,0x4d7 , (0x1 <<0 ), (1 <<0 )); -mod_phy_reg (pi,0x4d7 , (0x1 <<6 ), (1 <<6 )); - -wlc_lcnphy_set_bbmult (pi,0x0 ); -wlc_phy_do_dummy_tx (pi, true,OFF ); idleTssi = ((read_phy_reg (pi,0x4ab ) & (0x1ff <<0 )) >>0 );
@@ -2919,7 +2829,6 @@ static void wlc_lcnphy_idle_tssi_est(strmod_phy_reg (pi,0x44c , (0x1 <<12 ), (0 ) <<12 ); -wlc_lcnphy_set_bbmult (pi, SAVE_bbmult);wlc_lcnphy_set_tx_gain_override (pi, tx_gain_override_old);wlc_lcnphy_set_tx_gain (pi, &old_gains);wlc_lcnphy_set_tx_pwr_ctrl (pi, SAVE_txpwrctrl);
@@ -3133,11 +3042,6 @@ static void wlc_lcnphy_tx_pwr_ctrl_init(wlc_lcnphy_write_table (pi, &tab); tab.tbl_offset++; } -mod_phy_reg (pi,0x4d0 , (0x1 <<0 ), (0 ) <<0 ); -mod_phy_reg (pi,0x4d3 , (0xff <<0 ), (0 ) <<0 ); -mod_phy_reg (pi,0x4d3 , (0xff <<8 ), (0 ) <<8 ); -mod_phy_reg (pi,0x4d0 , (0x1 <<4 ), (0 ) <<4 ); -mod_phy_reg (pi,0x4d0 , (0x1 <<2 ), (0 ) <<2 );mod_phy_reg (pi,0x410 , (0x1 <<7 ), (0 ) <<7 );
@@ -3939,6 +3843,7 @@ static void wlc_lcnphy_txpwrtbl_iqlo_cal target_gains.pad_gain =21 ; target_gains.dac_gain =0 ;wlc_lcnphy_set_tx_gain (pi, &target_gains); +wlc_lcnphy_set_tx_pwr_by_index (pi,16 );if (LCNREV_IS (pi->pubpi.phy_rev,1 ) || pi_lcn->lcnphy_hw_iqcal_en) {
@@ -3949,7 +3854,6 @@ static void wlc_lcnphy_txpwrtbl_iqlo_cal lcnphy_recal ?LCNPHY_CAL_RECAL : LCNPHY_CAL_FULL), false); }else { -wlc_lcnphy_set_tx_pwr_by_index (pi,16 );wlc_lcnphy_tx_iqlo_soft_cal_full (pi); }
@@ -4374,22 +4278,17 @@ wlc_lcnphy_load_tx_gain_table(struct brcif (CHSPEC_IS5G (pi->radio_chanspec)) pa_gain =0x70 ;else - pa_gain =0x60 ; + pa_gain =0x70 ;if (pi->sh->boardflags &BFL_FEM ) pa_gain =0x10 ; - tab.tbl_id =LCNPHY_TBL_ID_TXPWRCTL ; tab.tbl_width =32 ; tab.tbl_len =1 ; tab.tbl_ptr = &val;for (j =0 ; j <128 ; j++) { -if (pi->sh->boardflags &BFL_FEM ) - gm_gain = gain_table[j].gm; -else - gm_gain =15 ; - + gm_gain = gain_table[j].gm; val = (((u32 ) pa_gain <<24 ) | (gain_table[j].pad <<16 ) | (gain_table[j].pga <<8 ) | gm_gain);
@@ -4600,10 +4499,7 @@ static void wlc_radio_2064_init(struct bwrite_phy_reg (pi,0x4ea ,0x4688 ); -if (pi->sh->boardflags &BFL_FEM ) -mod_phy_reg (pi,0x4eb , (0x7 <<0 ),2 <<0 ); -else -mod_phy_reg (pi,0x4eb , (0x7 <<0 ),3 <<0 ); +mod_phy_reg (pi,0x4eb , (0x7 <<0 ),2 <<0 );mod_phy_reg (pi,0x4eb , (0x7 <<6 ),0 <<6 );
@@ -4614,13 +4510,6 @@ static void wlc_radio_2064_init(struct bwlc_lcnphy_rcal (pi);wlc_lcnphy_rc_cal (pi); - -if (!(pi->sh->boardflags &BFL_FEM )) { -write_radio_reg (pi,RADIO_2064_REG032 ,0x6f ); -write_radio_reg (pi,RADIO_2064_REG033 ,0x19 ); -write_radio_reg (pi,RADIO_2064_REG039 ,0xe ); - } - }static void wlc_lcnphy_radio_init (struct brcms_phy *pi)
@@ -4650,20 +4539,22 @@ static void wlc_lcnphy_tbl_init(struct bwlc_lcnphy_write_table (pi, &tab); } -if (!(pi->sh->boardflags &BFL_FEM )) { - tab.tbl_id =LCNPHY_TBL_ID_RFSEQ ; - tab.tbl_width =16 ; - tab.tbl_ptr = &val; - tab.tbl_len =1 ; + tab.tbl_id =LCNPHY_TBL_ID_RFSEQ ; + tab.tbl_width =16 ; + tab.tbl_ptr = &val; + tab.tbl_len =1 ; - val =150 ; - tab.tbl_offset =0 ; -wlc_lcnphy_write_table (pi, &tab); + val =114 ; + tab.tbl_offset =0 ; +wlc_lcnphy_write_table (pi, &tab); - val =220 ; - tab.tbl_offset =1 ; -wlc_lcnphy_write_table (pi, &tab); - } + val =130 ; + tab.tbl_offset =1 ; +wlc_lcnphy_write_table (pi, &tab); + + val =6 ; + tab.tbl_offset =8 ; +wlc_lcnphy_write_table (pi, &tab);if (CHSPEC_IS2G (pi->radio_chanspec)) {if (pi->sh->boardflags &BFL_FEM )
@@ -5055,7 +4946,6 @@ void wlc_phy_chanspec_set_lcnphy(structwlc_lcnphy_load_tx_iir_filter (pi, true,3 );mod_phy_reg (pi,0x4eb , (0x7 <<3 ), (1 ) <<3 ); -wlc_lcnphy_tssi_setup (pi); }void wlc_phy_detach_lcnphy (struct brcms_phy *pi)
@@ -5094,7 +4984,8 @@ bool wlc_phy_attach_lcnphy(struct brcms_if (!wlc_phy_txpwr_srom_read_lcnphy (pi))return false; -if (LCNREV_IS (pi->pubpi.phy_rev,1 )) { +if ((pi->sh->boardflags &BFL_FEM ) && + (LCNREV_IS (pi->pubpi.phy_rev,1 ))) {if (pi_lcn->lcnphy_tempsense_option ==3 ) { pi->hwpwrctrl = true; pi->hwpwrctrl_capable = true;
drivers/net/wireless/brcm80211/brcmsmac/phy/phytbl_lcn.c +32 -32
102 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 11/27 ipc: set msg back to -EAGAIN if copy wasnt performed
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Kinsbursky <[email protected]>
commit 2dc958fa2fe6987e7ab106bd97029a09a82fcd8d upstream.
Make sure that msg pointer is set back to error value in case of MSG_COPY flag is set and desired message to copy wasn't found. This garantees that msg is either a error pointer or a copy address.
Otherwise the last message in queue will be freed without unlinking from the queue (which leads to memory corruption) and the dummy allocated copy won't be released.
--- ipc/msg.c | 1 + 1 file changed, 1 insertion(+)
ipc/msg.c +1 -0
@@ -872,6 +872,7 @@ long do_msgrcv(int msqid, void __user *b goto out_unlock;break ; } + msg =ERR_PTR (-EAGAIN ); }else break ; msg_counter++;
Greg Kroah-Hartman
maintainerPATCH 12/27 GFS2: Fix unlock of fcntl locks during withdrawn state
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Whitehouse <[email protected]>
commit c2952d202f710d326ac36a8ea6bd216b20615ec8 upstream.
When withdraw occurs, we need to continue to allow unlocks of fcntl locks to occur, however these will only be local, since the node has withdrawn from the cluster. This prevents triggering a VFS level bug trap due to locks remaining when a file is closed.
--- fs/gfs2/file.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/gfs2/file.c +4 -1
@@ -924,8 +924,11 @@ static int gfs2_lock(struct file *file, cmd =F_SETLK ; fl->fl_type =F_UNLCK ; } -if (unlikely (test_bit (SDF_SHUTDOWN , &sdp->sd_flags))) +if (unlikely (test_bit (SDF_SHUTDOWN , &sdp->sd_flags))) { +if (fl->fl_type ==F_UNLCK ) +posix_lock_file_wait (file, fl);return -EIO ; + }if (IS_GETLK (cmd))return dlm_posix_get (ls->ls_dlm, ip->i_no_addr, file, fl);else if (fl->fl_type ==F_UNLCK )
Greg Kroah-Hartman
maintainerPATCH 13/27 GFS2: return error if malloc failed in gfs2_rs_alloc()
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Yongjun <[email protected]>
commit 441362d06be349430d06e37286adce4b90e6ce96 upstream.
The error code in gfs2_rs_alloc() is set to ENOMEM when error but never be used, instead, gfs2_rs_alloc() always return 0. Fix to return 'error'.
--- fs/gfs2/rgrp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/gfs2/rgrp.c +1 -1
@@ -576,7 +576,7 @@ int gfs2_rs_alloc(struct gfs2_inode *ip)RB_CLEAR_NODE (&ip->i_res->rs_node); out:up_write (&ip->i_rw_mutex); -return 0 ; +return error; }static void dump_rs (struct seq_file *seq,const struct gfs2_blkreserv *rs)
Greg Kroah-Hartman
maintainerPATCH 14/27 SCSI: libsas: fix handling vacant phy in sas_set_ex_phy()
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukasz Dorau <[email protected]>
commit d4a2618fa77b5e58ec15342972bd3505a1c3f551 upstream.
If a result of the SMP discover function is PHY VACANT, the content of discover response structure (dr) is not valid. It sometimes happens that dr->attached_sas_addr can contain even SAS address of other phy. In such case an invalid phy is created, what causes NULL pointer dereference during destruction of expander's phys.
So if a result of SMP function is PHY VACANT, the content of discover response structure (dr) must not be copied to phy structure.
This patch fixes the following bug:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000030 IP: [<ffffffff811c9002>] sysfs_find_dirent+0x12/0x90 Call Trace: [<ffffffff811c95f5>] sysfs_get_dirent+0x35/0x80 [<ffffffff811cb55e>] sysfs_unmerge_group+0x1e/0xb0 [<ffffffff813329f4>] dpm_sysfs_remove+0x24/0x90 [<ffffffff8132b0f4>] device_del+0x44/0x1d0 [<ffffffffa016fc59>] sas_rphy_delete+0x9/0x20 [scsi_transport_sas] [<ffffffffa01a16f6>] sas_destruct_devices+0xe6/0x110 [libsas] [<ffffffff8107ac7c>] process_one_work+0x16c/0x350 [<ffffffff8107d84a>] worker_thread+0x17a/0x410 [<ffffffff81081b76>] kthread+0x96/0xa0 [<ffffffff81464944>] kernel_thread_helper+0x4/0x10
--- drivers/scsi/libsas/sas_expander.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/scsi/libsas/sas_expander.c +12 -0
@@ -235,6 +235,17 @@ static void sas_set_ex_phy(struct domain linkrate = phy->linkrate;memcpy (sas_addr, phy->attached_sas_addr,SAS_ADDR_SIZE ); +/* Handle vacant phy - rest of dr data is not valid so skip it */ +if (phy->phy_state ==PHY_VACANT ) { +memset (phy->attached_sas_addr,0 ,SAS_ADDR_SIZE ); + phy->attached_dev_type =NO_DEVICE ; +if (!test_bit (SAS_HA_ATA_EH_ACTIVE , &ha->state)) { + phy->phy_id = phy_id; + goto skip; + }else + goto out; + } + phy->attached_dev_type =to_dev_type (dr);if (test_bit (SAS_HA_ATA_EH_ACTIVE , &ha->state)) goto out;
@@ -272,6 +283,7 @@ static void sas_set_ex_phy(struct domain phy->phy->maximum_linkrate = dr->pmax_linkrate; phy->phy->negotiated_linkrate = phy->linkrate; + skip:if (new_phy)if (sas_phy_add (phy->phy)) {sas_phy_free (phy->phy);
Greg Kroah-Hartman
maintainerPATCH 15/27 cifs: Allow passwords which begin with a delimitor
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sachin Prabhu <[email protected]>
commit c369c9a4a7c82d33329d869cbaf93304cc7a0c40 upstream.
Fixes a regression in cifs_parse_mount_options where a password which begins with a delimitor is parsed incorrectly as being a blank password.
--- fs/cifs/connect.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
fs/cifs/connect.c +13 -3
@@ -1546,14 +1546,24 @@ cifs_parse_mount_options(const char *mou }break ;case Opt_blank_pass: - vol->password =NULL ; -break ; -case Opt_pass:/* passwords have to be handled differently * to allow the character used for deliminator * to be passed within them */ +/* +* Check if this is a case where the password +* starts with a delimiter +*/ + tmp_end =strchr (data,'=' ); + tmp_end++; +if (!(tmp_end < end && tmp_end[1 ] == delim)) { +/* No it is not. Set the password to NULL */ + vol->password =NULL ; +break ; + } +/* Yes it is. Drop down to Opt_pass below.*/ +case Opt_pass:/* Obtain the value string */ value =strchr (data,'=' ); value++;
Greg Kroah-Hartman
maintainerPATCH 16/27 target: Fix incorrect fallthrough of ALUA Standby/Offline/Transition CDBs
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicholas Bellinger <[email protected]>
commit 30f359a6f9da65a66de8cadf959f0f4a0d498bba upstream.
This patch fixes a bug where a handful of informational / control CDBs that should be allowed during ALUA access state Standby/Offline/Transition where incorrectly returning CHECK_CONDITION + ASCQ_04H_ALUA_TG_PT_*.
This includes INQUIRY + REPORT_LUNS, which would end up preventing LUN registration when LUN scanning occured during these ALUA access states.
--- drivers/target/target_core_alua.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/target/target_core_alua.c +3 -0
@@ -408,6 +408,7 @@ static inline int core_alua_state_standbcase REPORT_LUNS :case RECEIVE_DIAGNOSTIC :case SEND_DIAGNOSTIC : +return 0 ;case MAINTENANCE_IN :switch (cdb[1 ] &0x1f ) {case MI_REPORT_TARGET_PGS :
@@ -450,6 +451,7 @@ static inline int core_alua_state_unavaiswitch (cdb[0 ]) {case INQUIRY :case REPORT_LUNS : +return 0 ;case MAINTENANCE_IN :switch (cdb[1 ] &0x1f ) {case MI_REPORT_TARGET_PGS :
@@ -490,6 +492,7 @@ static inline int core_alua_state_transiswitch (cdb[0 ]) {case INQUIRY :case REPORT_LUNS : +return 0 ;case MAINTENANCE_IN :switch (cdb[1 ] &0x1f ) {case MI_REPORT_TARGET_PGS :
Greg Kroah-Hartman
maintainerPATCH 17/27 vfs: Revert spurious fix to spinning prevention in prune_icache_sb
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suleiman Souhlal <[email protected]>
commit 5b55d708335a9e3e4f61f2dadf7511502205ccd1 upstream.
Revert commit 62a3ddef6181 ("vfs: fix spinning prevention in prune_icache_sb").
This commit doesn't look right: since we are looking at the tail of the list (sb->s_inode_lru.prev) if we want to skip an inode, we should put it back at the head of the list instead of the tail, otherwise we will keep spinning on it.
Discovered when investigating why prune_icache_sb came top in perf reports of a swapping load.
--- fs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/inode.c +1 -1
@@ -725,7 +725,7 @@ void prune_icache_sb(struct super_block* inode to the back of the list so we don't spin on it. */ if (!spin_trylock (&inode->i_lock)) { -list_move_tail (&inode->i_lru, &sb->s_inode_lru); +list_move (&inode->i_lru, &sb->s_inode_lru);continue ; }
Greg Kroah-Hartman
maintainerPATCH 18/27 kobject: fix kset_find_obj() race with concurrent last kobject_put()
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit a49b7e82cab0f9b41f483359be83f44fbb6b4979 upstream.
Anatol Pomozov identified a race condition that hits module unloading and re-loading. To quote Anatol:
"This is a race codition that exists between kset_find_obj() and
kobject_put(). kset_find_obj() might return kobject that has refcount equal to 0 if this kobject is freeing by kobject_put() in other thread.
Here is timeline for the crash in case if kset_find_obj() searches for an object tht nobody holds and other thread is doing kobject_put() on the same kobject:
THREAD A (calls kset_find_obj()) THREAD B (calls kobject_put())
splin_lock()
atomic_dec_return(kobj->kref), counter gets zero here ... starts kobject cleanup .... spin_lock() // WAIT thread A in kobj_kset_leave()
iterate over kset->list
atomic_inc(kobj->kref) (counter becomes 1)
spin_unlock()
spin_lock() // taken
// it does not know that thread A increased counter so it remove obj from list
spin_unlock()
vfree(module) // frees module object with containing kobj
// kobj points to freed memory area!!
kobject_put(kobj) // OOPS!!!!
The race above happens because module.c tries to use kset_find_obj() when somebody unloads module. The module.c code was introduced in commit 6494a93d55fa"
Anatol supplied a patch specific for module.c that worked around the problem by simply not using kset_find_obj() at all, but rather than make a local band-aid, this just fixes kset_find_obj() to be thread-safe using the proper model of refusing the get a new reference if the refcount has already dropped to zero.
See examples of this proper refcount handling not only in the kref documentation, but in various other equivalent uses of this pattern by grepping for atomic_inc_not_zero().
[ Side note: the module race does indicate that module loading and
unloading is not properly serialized wrt sysfs information using the module mutex. That may require further thought, but this is the correct fix at the kobject layer regardless. ]
--- lib/kobject.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
lib/kobject.c +8 -1
@@ -529,6 +529,13 @@ struct kobject *kobject_get(struct kobjereturn kobj; } +static struct kobject *kobject_get_unless_zero (struct kobject *kobj) +{ +if (!kref_get_unless_zero (&kobj->kref)) + kobj =NULL ; +return kobj; +} +/* * kobject_cleanup - free kobject resources. * @kobj: object to cleanup
@@ -751,7 +758,7 @@ struct kobject *kset_find_obj(struct kselist_for_each_entry (k, &kset->list, entry) {if (kobject_name (k) && !strcmp (kobject_name (k), name)) { - ret =kobject_get (k); + ret =kobject_get_unless_zero (k);break ; } }
Greg Kroah-Hartman
maintainerPATCH 19/27 gpio: fix wrong checking condition for gpio range
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haojian Zhuang <[email protected]>
commit ad4e1a7caf937ad395ced585ca85a7d14395dc80 upstream.
If index++ calculates from 0, the checking condition of "while (index++)" fails & it doesn't check any more. It doesn't follow the loop that used at here.
Replace it by endless loop at here. Then it keeps parsing "gpio-ranges" property until it ends.
--- drivers/gpio/gpiolib-of.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpio/gpiolib-of.c +2 -3
@@ -228,7 +228,7 @@ static void of_gpiochip_add_pin_range(stif (!np)return ; - do { +for (;; index++) { ret =of_parse_phandle_with_args (np,"gpio-ranges" ,"#gpio-range-cells" , index, &pinspec);if (ret)
@@ -257,8 +257,7 @@ static void of_gpiochip_add_pin_range(stif (ret) break; - - }while (index++); + } }#else
Greg Kroah-Hartman
maintainerPATCH 20/27 x86-32: Fix possible incomplete TLB invalidate with PAE pagetables
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Hansen <[email protected]>
commit 1de14c3c5cbc9bb17e9dcc648cda51c0c85d54b9 upstream.
This patch attempts to fix:
https://bugzilla.kernel.org/show_bug.cgi?id=56461
The symptom is a crash and messages like this:
chrome: Corrupted page table at address 34a03000 *pdpt = 0000000000000000 *pde = 0000000000000000 Bad pagetable: 000f [#1] PREEMPT SMP
Ingo guesses this got introduced by commit 611ae8e3f520 ("x86/tlb:
enable tlb flush range support for x86") since that code started to free unused pagetables.
On x86-32 PAE kernels, that new code has the potential to free an entire PMD page and will clear one of the four page-directory-pointer-table (aka pgd_t entries).
The hardware aggressively "caches" these top-level entries and invlpg does not actually affect the CPU's copy. If we clear one we *HAVE* to do a full TLB flush, otherwise we might continue using a freed pmd page. (note, we do this properly on the population side in pud_populate()).
This patch tracks whenever we clear one of these entries in the 'struct mmu_gather', and ensures that we follow up with a full tlb flush.
BTW, I disassembled and checked that:
if (tlb->fullmm == 0) and if (!tlb->fullmm && !tlb->need_flush_all)
generate essentially the same code, so there should be zero impact there to the !PAE case.
--- arch/x86/include/asm/tlb.h | 2 +- arch/x86/mm/pgtable.c | 7 +++++++ include/asm-generic/tlb.h | 7 ++++++- mm/memory.c | 1 + 4 files changed, 15 insertions(+), 2 deletions(-)
arch/x86/include/asm/tlb.h +1 -1
@@ -7,7 +7,7 @@#define tlb_flush (tlb) \ { \ - if (tlb->fullmm == 0) \ + if (!tlb->fullmm && !tlb->need_flush_all) \ flush_tlb_mm_range(tlb->mm, tlb->start, tlb->end, 0UL); \ else \ flush_tlb_mm_range(tlb->mm, 0UL, TLB_FLUSH_ALL, 0UL); \
arch/x86/mm/pgtable.c +7 -0
@@ -58,6 +58,13 @@ void ___pte_free_tlb(struct mmu_gather *void ___pmd_free_tlb (struct mmu_gather *tlb,pmd_t *pmd) {paravirt_release_pmd (__pa (pmd) >>PAGE_SHIFT ); +/* +* NOTE! For PAE, any changes to the top page-directory-pointer-table +* entries need a full cr3 reload to flush. +*/ +#ifdef CONFIG_X86_PAE + tlb->need_flush_all =1 ; +#endif tlb_remove_page (tlb,virt_to_page (pmd)); }
include/asm-generic/tlb.h +6 -1
@@ -99,7 +99,12 @@ struct mmu_gather { unsigned int need_flush : 1, /* Did free PTEs */ fast_mode : 1; /* No batching */ -unsigned int fullmm; +/* we are in the middle of an operation to clear +* a full mm and can make some optimizations */ + unsigned int fullmm : 1, +/* we have performed an operation which +* requires a complete flush of the tlb */ + need_flush_all : 1;struct mmu_gather_batch *active;struct mmu_gather_batch local;
mm/memory.c +1 -0
@@ -212,6 +212,7 @@ void tlb_gather_mmu(struct mmu_gather *t tlb->mm = mm; tlb->fullmm = fullmm; + tlb->need_flush_all =0 ; tlb->start =-1UL ; tlb->end =0 ; tlb->need_flush =0 ;
Greg Kroah-Hartman
maintainerPATCH 21/27 tracing: Fix possible NULL pointer dereferences
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
commit 6a76f8c0ab19f215af2a3442870eeb5f0e81998d upstream.
Currently set_ftrace_pid and set_graph_function files use seq_lseek for their fops. However seq_open() is called only for FMODE_READ in the fops->open() so that if an user tries to seek one of those file when she open it for writing, it sees NULL seq_file and then panic.
It can be easily reproduced with following command:
$ cd /sys/kernel/debug/tracing $ echo 1234 | sudo tee -a set_ftrace_pid
In this example, GNU coreutils' tee opens the file with fopen(, "a") and then the fopen() internally calls lseek().
--- include/linux/ftrace.h | 2 +- kernel/trace/ftrace.c | 10 +++++----- kernel/trace/trace_stack.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)
include/linux/ftrace.h +1 -1
@@ -394,7 +394,7 @@ ssize_t ftrace_filter_write(struct file size_t cnt, loff_t *ppos);ssize_t ftrace_notrace_write (struct file *file,const char __user *ubuf,size_t cnt,loff_t *ppos); -loff_t ftrace_regex_lseek (struct file *file,loff_t offset,int whence); +loff_t ftrace_filter_lseek (struct file *file,loff_t offset,int whence);int ftrace_regex_release (struct inode *inode,struct file *file);void __init
kernel/trace/ftrace.c +5 -5
@@ -2674,7 +2674,7 @@ ftrace_notrace_open(struct inode *inode, }loff_t -ftrace_regex_lseek (struct file *file,loff_t offset,int whence) +ftrace_filter_lseek (struct file *file,loff_t offset,int whence) {loff_t ret;
@@ -3548,7 +3548,7 @@ static const struct file_operations ftra .open = ftrace_filter_open, .read = seq_read, .write = ftrace_filter_write, - .llseek = ftrace_regex_lseek, + .llseek = ftrace_filter_lseek, .release = ftrace_regex_release, };
@@ -3556,7 +3556,7 @@ static const struct file_operations ftra .open = ftrace_notrace_open, .read = seq_read, .write = ftrace_notrace_write, - .llseek = ftrace_regex_lseek, + .llseek = ftrace_filter_lseek, .release = ftrace_regex_release, };
@@ -3761,8 +3761,8 @@ static const struct file_operations ftra .open = ftrace_graph_open, .read = seq_read, .write = ftrace_graph_write, + .llseek = ftrace_filter_lseek, .release = ftrace_graph_release, - .llseek = seq_lseek, };#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
@@ -4420,7 +4420,7 @@ static const struct file_operations ftra .open = ftrace_pid_open, .write = ftrace_pid_write, .read = seq_read, - .llseek = seq_lseek, + .llseek = ftrace_filter_lseek, .release = ftrace_pid_release, };
kernel/trace/trace_stack.c +1 -1
@@ -322,7 +322,7 @@ static const struct file_operations stac .open = stack_trace_filter_open, .read = seq_read, .write = ftrace_filter_write, - .llseek = ftrace_regex_lseek, + .llseek = ftrace_filter_lseek, .release = ftrace_regex_release, };
Greg Kroah-Hartman
maintainerPATCH 22/27 udl: handle EDID failure properly.
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Airlie <[email protected]>
commit 1baee58638fc58248625255f5c5fcdb987f11b1f upstream.
Don't oops seems proper.
--- drivers/gpu/drm/udl/udl_connector.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/udl/udl_connector.c +4 -0
@@ -61,6 +61,10 @@ static int udl_get_modes(struct drm_connint ret; edid = (struct edid *)udl_get_edid (udl); +if (!edid) { +drm_mode_connector_update_edid_property (connector,NULL ); +return 0 ; + }/* * We only read the main block, but if the monitor reports extension
Greg Kroah-Hartman
maintainerPATCH 23/27 ftrace: Move ftrace_filter_lseek out of CONFIG_DYNAMIC_FTRACE section
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Steven Rostedt (Red Hat)" <[email protected]>
commit 7f49ef69db6bbf756c0abca7e9b65b32e999eec8 upstream.
As ftrace_filter_lseek is now used with ftrace_pid_fops, it needs to be moved out of the #ifdef CONFIG_DYNAMIC_FTRACE section as the ftrace_pid_fops is defined when DYNAMIC_FTRACE is not.
--- include/linux/ftrace.h | 3 ++- kernel/trace/ftrace.c | 28 ++++++++++++++-------------- 2 files changed, 16 insertions(+), 15 deletions(-)
include/linux/ftrace.h +2 -1
@@ -394,7 +394,6 @@ ssize_t ftrace_filter_write(struct file size_t cnt, loff_t *ppos);ssize_t ftrace_notrace_write (struct file *file,const char __user *ubuf,size_t cnt,loff_t *ppos); -loff_t ftrace_filter_lseek (struct file *file,loff_t offset,int whence);int ftrace_regex_release (struct inode *inode,struct file *file);void __init
@@ -567,6 +566,8 @@ static inline int ftrace_regex_release(struct inode *inode, struct file *file) { return -ENODEV; }#endif /* CONFIG_DYNAMIC_FTRACE */ +loff_t ftrace_filter_lseek (struct file *file,loff_t offset,int whence); +/* totally disable ftrace - can not re-enable after this */ void ftrace_kill (void );
kernel/trace/ftrace.c +14 -14
@@ -1027,6 +1027,19 @@ static __init void ftrace_profile_debugfstatic struct pid *const ftrace_swapper_pid = &init_struct_pid; +loff_t +ftrace_filter_lseek (struct file *file,loff_t offset,int whence) +{ +loff_t ret; + +if (file->f_mode &FMODE_READ ) + ret =seq_lseek (file, offset, whence); +else + file->f_pos = ret =1 ; + +return ret; +} +#ifdef CONFIG_DYNAMIC_FTRACE #ifndef CONFIG_FTRACE_MCOUNT_RECORD
@@ -2589,7 +2602,7 @@ static void ftrace_filter_reset(struct f* routine, you can use ftrace_filter_write() for the write * routine if @flag has FTRACE_ITER_FILTER set, or * ftrace_notrace_write() if @flag has FTRACE_ITER_NOTRACE set. -* ftrace_regex_lseek() should be used as the lseek routine, and +* ftrace_filter_lseek() should be used as the lseek routine, and * release must call ftrace_regex_release(). */ int
@@ -2673,19 +2686,6 @@ ftrace_notrace_open(struct inode *inode, inode, file); } -loff_t -ftrace_filter_lseek (struct file *file,loff_t offset,int whence) -{ -loff_t ret; - -if (file->f_mode &FMODE_READ ) - ret =seq_lseek (file, offset, whence); -else - file->f_pos = ret =1 ; - -return ret; -} -static int ftrace_match (char *str,char *regex,int len,int type) {int matched =0 ;
Greg Kroah-Hartman
maintainerPATCH 24/27 sched_clock: Prevent 64bit inatomicity on 32bit systems
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit a1cbcaa9ea87b87a96b9fc465951dcf36e459ca2 upstream.
The sched_clock_remote() implementation has the following inatomicity problem on 32bit systems when accessing the remote scd->clock, which is a 64bit value.
CPU0 CPU1
sched_clock_local() sched_clock_remote(CPU0)
...
remote_clock = scd[CPU0]->clock read_low32bit(scd[CPU0]->clock) cmpxchg64(scd->clock,...) read_high32bit(scd[CPU0]->clock)
While the update of scd->clock is using an atomic64 mechanism, the readout on the remote cpu is not, which can cause completely bogus readouts.
It is a quite rare problem, because it requires the update to hit the narrow race window between the low/high readout and the update must go across the 32bit boundary.
The resulting misbehaviour is, that CPU1 will see the sched_clock on CPU1 ~4 seconds ahead of it's own and update CPU1s sched_clock value to this bogus timestamp. This stays that way due to the clamping implementation for about 4 seconds until the synchronization with CLOCK_MONOTONIC undoes the problem.
The issue is hard to observe, because it might only result in a less accurate SCHED_OTHER timeslicing behaviour. To create observable damage on realtime scheduling classes, it is necessary that the bogus update of CPU1 sched_clock happens in the context of an realtime thread, which then gets charged 4 seconds of RT runtime, which results in the RT throttler mechanism to trigger and prevent scheduling of RT tasks for a little less than 4 seconds. So this is quite unlikely as well.
The issue was quite hard to decode as the reproduction time is between 2 days and 3 weeks and intrusive tracing makes it less likely, but the following trace recorded with trace_clock=global, which uses sched_clock_local(), gave the final hint:
<idle>-0 0d..30 400269.477150: hrtimer_cancel: hrtimer=0xf7061e80
<idle>-0 0d..30 400269.477151: hrtimer_start: hrtimer=0xf7061e80 ...
irq/20-S-587 1d..32 400273.772118: sched_wakeup: comm= ... target_cpu=0
<idle>-0 0dN.30 400273.772118: hrtimer_cancel: hrtimer=0xf7061e80
What happens is that CPU0 goes idle and invokes sched_clock_idle_sleep_event() which invokes sched_clock_local() and CPU1 runs a remote wakeup for CPU0 at the same time, which invokes sched_remote_clock(). The time jump gets propagated to CPU0 via sched_remote_clock() and stays stale on both cores for ~4 seconds.
There are only two other possibilities, which could cause a stale sched clock:
1) ktime_get() which reads out CLOCK_MONOTONIC returns a sporadic wrong value.
2) sched_clock() which reads the TSC returns a sporadic wrong value.
#1 can be excluded because sched_clock would continue to increase for
one jiffy and then go stale.
#2 can be excluded because it would not make the clock jump
forward. It would just result in a stale sched_clock for one jiffy.
After quite some brain twisting and finding the same pattern on other traces, sched_clock_remote() remained the only place which could cause such a problem and as explained above it's indeed racy on 32bit systems.
So while on 64bit systems the readout is atomic, we need to verify the remote readout on 32bit machines. We need to protect the local->clock readout in sched_clock_remote() on 32bit as well because an NMI could hit between the low and the high readout, call sched_clock_local() and modify local->clock.
Thanks to Siegfried Wulsch for bearing with my debug requests and going through the tedious tasks of running a bunch of reproducer systems to generate the debug information which let me decode the issue.
--- kernel/sched/clock.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
kernel/sched/clock.c +26 -0
@@ -176,10 +176,36 @@ static u64 sched_clock_remote(struct schu64 this_clock, remote_clock;u64 *ptr, old_val, val; +#if BITS_PER_LONG !=64 +again: +/* +* Careful here: The local and the remote clock values need to +* be read out atomic as we need to compare the values and +* then update either the local or the remote side. So the +* cmpxchg64 below only protects one readout. +* +* We must reread via sched_clock_local() in the retry case on +* 32bit as an NMI could use sched_clock_local() via the +* tracer and hit between the readout of +* the low32bit and the high 32bit portion. +*/ + this_clock =sched_clock_local (my_scd); +/* +* We must enforce atomic readout on 32bit, otherwise the +* update on the remote cpu can hit inbetween the readout of +* the low32bit and the high 32bit portion. +*/ + remote_clock =cmpxchg64 (&scd->clock,0 ,0 ); +#else +/* +* On 64bit the read of [my]scd->clock is atomic versus the +* update, so we can avoid the above 32bit dance. +*/ sched_clock_local (my_scd); again: this_clock = my_scd->clock; remote_clock = scd->clock; +#endif /* * Use the opportunity that we have both locks
Greg Kroah-Hartman
maintainerPATCH 25/27 x86, mm, paravirt: Fix vmalloc_fault oops during lazy MMU updates
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Samu Kallio <[email protected]>
commit 1160c2779b826c6f5c08e5cc542de58fd1f667d5 upstream.
In paravirtualized x86_64 kernels, vmalloc_fault may cause an oops when lazy MMU updates are enabled, because set_pgd effects are being deferred.
One instance of this problem is during process mm cleanup with memory cgroups enabled. The chain of events is as follows:
- zap_pte_range enables lazy MMU updates
- zap_pte_range eventually calls mem_cgroup_charge_statistics, which accesses the vmalloc'd mem_cgroup per-cpu stat area
- vmalloc_fault is triggered which tries to sync the corresponding PGD entry with set_pgd, but the update is deferred
- vmalloc_fault oopses due to a mismatch in the PUD entries
The OOPs usually looks as so:
------------[ cut here ]------------ kernel BUG at arch/x86/mm/fault.c:396!
invalid opcode: 0000 [#1] SMP
.. snip ..
CPU 1
Pid: 10866, comm: httpd Not tainted 3.6.10-4.fc18.x86_64 #1
RIP: e030:[<ffffffff816271bf>] [<ffffffff816271bf>] vmalloc_fault+0x11f/0x208 .. snip .. Call Trace: [<ffffffff81627759>] do_page_fault+0x399/0x4b0 [<ffffffff81004f4c>] ? xen_mc_extend_args+0xec/0x110 [<ffffffff81624065>] page_fault+0x25/0x30 [<ffffffff81184d03>] ? mem_cgroup_charge_statistics.isra.13+0x13/0x50 [<ffffffff81186f78>] __mem_cgroup_uncharge_common+0xd8/0x350 [<ffffffff8118aac7>] mem_cgroup_uncharge_page+0x57/0x60 [<ffffffff8115fbc0>] page_remove_rmap+0xe0/0x150 [<ffffffff8115311a>] ? vm_normal_page+0x1a/0x80 [<ffffffff81153e61>] unmap_single_vma+0x531/0x870 [<ffffffff81154962>] unmap_vmas+0x52/0xa0 [<ffffffff81007442>] ? pte_mfn_to_pfn+0x72/0x100 [<ffffffff8115c8f8>] exit_mmap+0x98/0x170 [<ffffffff810050d9>] ? __raw_callee_save_xen_pmd_val+0x11/0x1e [<ffffffff81059ce3>] mmput+0x83/0xf0 [<ffffffff810624c4>] exit_mm+0x104/0x130 [<ffffffff8106264a>] do_exit+0x15a/0x8c0 [<ffffffff810630ff>] do_group_exit+0x3f/0xa0 [<ffffffff81063177>] sys_exit_group+0x17/0x20 [<ffffffff8162bae9>] system_call_fastpath+0x16/0x1b
Calling arch_flush_lazy_mmu_mode immediately after set_pgd makes the changes visible to the consistency checks.
RedHat-Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=914737
--- arch/x86/mm/fault.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/x86/mm/fault.c +4 -2
@@ -378,10 +378,12 @@ static noinline __kprobes int vmalloc_faif (pgd_none (*pgd_ref))return -1 ; -if (pgd_none (*pgd)) +if (pgd_none (*pgd)) {set_pgd (pgd, *pgd_ref); -else +arch_flush_lazy_mmu_mode (); + }else {BUG_ON (pgd_page_vaddr (*pgd) !=pgd_page_vaddr (*pgd_ref)); + }/* * Below here mismatches are bugs because these lower tables
Greg Kroah-Hartman
maintainerPATCH 26/27 x86, mm: Patch out arch_flush_lazy_mmu_mode() when running on bare metal
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Ostrovsky <[email protected]>
commit 511ba86e1d386f671084b5d0e6f110bb30b8eeb2 upstream.
Invoking arch_flush_lazy_mmu_mode() results in calls to preempt_enable()/disable() which may have performance impact.
Since lazy MMU is not used on bare metal we can patch away arch_flush_lazy_mmu_mode() so that it is never called in such environment.
[ hpa: the previous patch "Fix vmalloc_fault oops during lazy MMU
updates" may cause a minor performance regression on
bare metal. This patch resolves that performance regression. It is somewhat unclear to me if this is a good -stable candidate. ]
--- arch/x86/include/asm/paravirt.h | 5 ++++- arch/x86/include/asm/paravirt_types.h | 2 ++ arch/x86/kernel/paravirt.c | 25 +++++++++++++------------ arch/x86/lguest/boot.c | 1 + arch/x86/xen/mmu.c | 1 + 5 files changed, 21 insertions(+), 13 deletions(-)
arch/x86/include/asm/paravirt.h +4 -1
@@ -703,7 +703,10 @@ static inline void arch_leave_lazy_mmu_mPVOP_VCALL0 (pv_mmu_ops.lazy_mode.leave); } -void arch_flush_lazy_mmu_mode (void ); +static inline void arch_flush_lazy_mmu_mode (void ) +{ +PVOP_VCALL0 (pv_mmu_ops.lazy_mode.flush); +}static inline void __set_fixmap (unsigned /* enum fixed_addresses */ idx,phys_addr_t phys,pgprot_t flags)
arch/x86/include/asm/paravirt_types.h +2 -0
@@ -91,6 +91,7 @@ struct pv_lazy_ops {/* Set deferred update mode, used for batching operations. */ void (*enter)(void );void (*leave)(void ); +void (*flush)(void ); };struct pv_time_ops {
@@ -679,6 +680,7 @@ void paravirt_end_context_switch(structvoid paravirt_enter_lazy_mmu (void );void paravirt_leave_lazy_mmu (void ); +void paravirt_flush_lazy_mmu (void );void _paravirt_nop (void );u32 _paravirt_ident_32 (u32 );
arch/x86/kernel/paravirt.c +13 -12
@@ -263,6 +263,18 @@ void paravirt_leave_lazy_mmu(void)leave_lazy (PARAVIRT_LAZY_MMU ); } +void paravirt_flush_lazy_mmu (void ) +{ +preempt_disable (); + +if (paravirt_get_lazy_mode () ==PARAVIRT_LAZY_MMU ) { +arch_leave_lazy_mmu_mode (); +arch_enter_lazy_mmu_mode (); + } + +preempt_enable (); +} +void paravirt_start_context_switch (struct task_struct *prev) {BUG_ON (preemptible ());
@@ -292,18 +304,6 @@ enum paravirt_lazy_mode paravirt_get_lazreturn this_cpu_read (paravirt_lazy_mode); } -void arch_flush_lazy_mmu_mode (void ) -{ -preempt_disable (); - -if (paravirt_get_lazy_mode () ==PARAVIRT_LAZY_MMU ) { -arch_leave_lazy_mmu_mode (); -arch_enter_lazy_mmu_mode (); - } - -preempt_enable (); -} -struct pv_info pv_info = { .name ="bare hardware" , .paravirt_enabled =0 ,
@@ -475,6 +475,7 @@ struct pv_mmu_ops pv_mmu_ops = { .lazy_mode = { .enter = paravirt_nop, .leave = paravirt_nop, + .flush = paravirt_nop, }, .set_fixmap = native_set_fixmap,
arch/x86/lguest/boot.c +1 -0
@@ -1333,6 +1333,7 @@ __init void lguest_init(void) pv_mmu_ops.read_cr3 = lguest_read_cr3; pv_mmu_ops.lazy_mode.enter = paravirt_enter_lazy_mmu; pv_mmu_ops.lazy_mode.leave = lguest_leave_lazy_mmu_mode; + pv_mmu_ops.lazy_mode.flush = paravirt_flush_lazy_mmu; pv_mmu_ops.pte_update = lguest_pte_update; pv_mmu_ops.pte_update_defer = lguest_pte_update;
arch/x86/xen/mmu.c +1 -0
@@ -2190,6 +2190,7 @@ static const struct pv_mmu_ops xen_mmu_o .lazy_mode = { .enter = paravirt_enter_lazy_mmu, .leave = xen_leave_lazy_mmu, + .flush = paravirt_flush_lazy_mmu, }, .set_fixmap = xen_set_fixmap,
Greg Kroah-Hartman
maintainerPATCH 27/27 tty: dont deadlock while flushing workqueue
In reply to Greg Kroah-Hartman3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
commit 852e4a8152b427c3f318bb0e1b5e938d64dcdc32 upstream.
Since commit 89c8d91e31f2 ("tty: localise the lock") I see a dead lock in one of my dummy_hcd + g_nokia test cases. The first run was usually okay, the second often resulted in a splat by lockdep and the third was usually a dead lock.
Lockdep complained about tty->hangup_work and tty->legacy_mutex taken both ways:
| ======================================================
| [ INFO: possible circular locking dependency detected ]
| 3.7.0-rc6+ #204 Not tainted
| -------------------------------------------------------
| kworker/2:1/35 is trying to acquire lock:
| (&tty->legacy_mutex){+.+.+.}, at: [<c14051e6>] tty_lock_nested+0x36/0x80
|
| but task is already holding lock:
| ((&tty->hangup_work)){+.+...}, at: [<c104f6e4>] process_one_work+0x124/0x5e0
|
| which lock already depends on the new lock.
|
| the existing dependency chain (in reverse order) is:
|
| -> #2 ((&tty->hangup_work)){+.+...}:
| [<c107fe74>] lock_acquire+0x84/0x190
| [<c104d82d>] flush_work+0x3d/0x240
| [<c12e6986>] tty_ldisc_flush_works+0x16/0x30
| [<c12e7861>] tty_ldisc_release+0x21/0x70
| [<c12e0dfc>] tty_release+0x35c/0x470
| [<c1105e28>] __fput+0xd8/0x270
| [<c1105fcd>] ____fput+0xd/0x10
| [<c1051dd9>] task_work_run+0xb9/0xf0
| [<c1002a51>] do_notify_resume+0x51/0x80
| [<c140550a>] work_notifysig+0x35/0x3b
|
| -> #1 (&tty->legacy_mutex/1){+.+...}:
| [<c107fe74>] lock_acquire+0x84/0x190
| [<c140276c>] mutex_lock_nested+0x6c/0x2f0
| [<c14051e6>] tty_lock_nested+0x36/0x80
| [<c1405279>] tty_lock_pair+0x29/0x70
| [<c12e0bb8>] tty_release+0x118/0x470
| [<c1105e28>] __fput+0xd8/0x270
| [<c1105fcd>] ____fput+0xd/0x10
| [<c1051dd9>] task_work_run+0xb9/0xf0
| [<c1002a51>] do_notify_resume+0x51/0x80
| [<c140550a>] work_notifysig+0x35/0x3b
|
| -> #0 (&tty->legacy_mutex){+.+.+.}:
| [<c107f3c9>] __lock_acquire+0x1189/0x16a0
| [<c107fe74>] lock_acquire+0x84/0x190
| [<c140276c>] mutex_lock_nested+0x6c/0x2f0
| [<c14051e6>] tty_lock_nested+0x36/0x80
| [<c140523f>] tty_lock+0xf/0x20
| [<c12df8e4>] __tty_hangup+0x54/0x410
| [<c12dfcb2>] do_tty_hangup+0x12/0x20
| [<c104f763>] process_one_work+0x1a3/0x5e0
| [<c104fec9>] worker_thread+0x119/0x3a0
| [<c1055084>] kthread+0x94/0xa0
| [<c140ca37>] ret_from_kernel_thread+0x1b/0x28
|
|other info that might help us debug this:
|
|Chain exists of:
| &tty->legacy_mutex --> &tty->legacy_mutex/1 --> (&tty->hangup_work)
|
| Possible unsafe locking scenario:
|
| CPU0 CPU1
| ---- ----
| lock((&tty->hangup_work));
| lock(&tty->legacy_mutex/1);
| lock((&tty->hangup_work));
| lock(&tty->legacy_mutex);
|
| *** DEADLOCK ***Before the path mentioned tty_ldisc_release() look like this:
| tty_ldisc_halt(tty); | tty_ldisc_flush_works(tty); | tty_lock();
As it can be seen, it first flushes the workqueue and then grabs the tty_lock. Now we grab the lock first:
| tty_lock_pair(tty, o_tty); | tty_ldisc_halt(tty); | tty_ldisc_flush_works(tty);
so lockdep's complaint seems valid.
The earlier version of this patch took the ldisc_mutex since the other user of tty_ldisc_flush_works() (tty_set_ldisc()) did this. Peter Hurley then said that it is should not be requried. Since it wasn't done earlier, I dropped this part.
The code under tty_ldisc_kill() was executed earlier with the tty lock taken so it is taken again.
I was able to reproduce the deadlock on v3.8-rc1, this patch fixes the problem in my testcase. I didn't notice any problems so far.
--- drivers/tty/tty_ldisc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/tty/tty_ldisc.c +5 -5
@@ -934,17 +934,17 @@ void tty_ldisc_release(struct tty_struct* race with the set_ldisc code path. */ -tty_lock_pair (tty, o_tty);tty_ldisc_halt (tty); -tty_ldisc_flush_works (tty); -if (o_tty) { +if (o_tty)tty_ldisc_halt (o_tty); + +tty_ldisc_flush_works (tty); +if (o_tty)tty_ldisc_flush_works (o_tty); - } +tty_lock_pair (tty, o_tty);/* This will need doing differently if we need to lock */ tty_ldisc_kill (tty); -if (o_tty)tty_ldisc_kill (o_tty);
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.8.8 release. There are 27 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed Apr 17 02:41:37 UTC 2013. Anything received after that time might be too late.
Quoted 8 lines
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.8.8-rc1.gzand the diffstat can be found below.
thanks,
greg k-h
Patches applied cleanly to 3.0.73, 3.4.40, and 3.8.7
Compiled and booted on the following systems:
HP ProBook 6475b AMD A10-4600M APU with Radeon(tm) HD Graphics (on the road, only one system and no cross compile tests this time)
dmesgs for all releases look good. No regressions compared to the previous dmesgs for each of these releases.
cross compile tests - skipped
-- Shuah
Greg Kroah-Hartman
maintainerQuoted 22 lines · Shuah Khan
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.8.8 release. There are 27 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Wed Apr 17 02:41:37 UTC 2013. Anything received after that time might be too late.
Quoted 8 lines
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.8.8-rc1.gzand the diffstat can be found below.
thanks,
greg k-h
Patches applied cleanly to 3.0.73, 3.4.40, and 3.8.7
Compiled and booted on the following systems:
Quoted 7 lines
HP ProBook 6475b AMD A10-4600M APU with Radeon(tm) HD Graphics (on the road, only one system and no cross compile tests this time)
dmesgs for all releases look good. No regressions compared to the previous dmesgs for each of these releases.
cross compile tests - skipped
Thanks for testing and letting us know.
greg k-h
Re: [ 27/27] tty: dont deadlock while flushing workqueue
In reply to Greg Kroah-Hartman[ -cc Alan Cox ]
Quoted 7 lines · Greg Kroah-Hartman
3.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
commit
852e4a8152b427c3f318bb0e1b5e938d64dcdc32upstream.
Greg,
So many other serious error conditions are possible here, it seems pointless to add this to 3.8-stable.
Regards,
Peter Hurley
Greg Kroah-Hartman
maintainerRe: [ 27/27] tty: dont deadlock while flushing workqueue
Quoted 7 lines · Peter Hurley
[ -cc Alan Cox ]
Quoted 4 lines · Greg Kroah-Hartman
3.8-stable review patch. If anyone has any objections, please let me know.
------------------
Quoted 8 lines
Quoted 3 lines
From: Sebastian Andrzej Siewior <[email protected]>
commit
852e4a8152b427c3f318bb0e1b5e938d64dcdc32upstream.Greg,
So many other serious error conditions are possible here, it seems pointless to add this to 3.8-stable.
The submitter said it fixed a real problem that they were having in the 3.8 kernel, so I think it is relevant for that reason alone.
thanks,
greg k-h