/* * Support for the w100 frame buffer. * * Copyright (c) 2004-2005 Richard Purdie * Copyright (c) 2005 Ian Molton * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #define W100_GPIO_PORT_A 0 #define W100_GPIO_PORT_B 1 #define CLK_SRC_XTAL 0 #define CLK_SRC_PLL 1 struct w100fb_par; unsigned long w100fb_gpio_read(int port); void w100fb_gpio_write(int port, unsigned long value); unsigned long w100fb_get_hsynclen(struct device *dev); /* LCD Specific Routines and Config */ struct w100_tg_info { void (*change)(struct w100fb_par*); void (*suspend)(struct w100fb_par*); void (*resume)(struct w100fb_par*); }; /* General Platform Specific w100 Register Values */ struct w100_gen_regs { unsigned long lcd_format; unsigned long lcdd_cntl1; unsigned long lcdd_cntl2; unsigned long genlcd_cntl1; unsigned long genlcd_cntl2; unsigned long genlcd_cntl3; }; struct w100_gpio_regs { unsigned long init_data1; unsigned long init_data2; unsigned long gpio_dir1; unsigned long gpio_oe1; unsigned long gpio_dir2; unsigned long gpio_oe2; }; /* Optional External Memory Configuration */ struct w100_mem_info { unsigned long ext_cntl; unsigned long sdram_mode_reg; unsigned long ext_timing_cntl; unsigned long io_cntl; unsigned int size; }; struct w100_bm_mem_info { unsigned long ext_mem_bw; unsigned long offset; unsigned long ext_timing_ctl; unsigned long ext_cntl; unsigned long mode_reg; unsigned long io_cntl; unsigned long config; }; /* LCD Mode definition */ struct w100_mode { unsigned int xres; unsigned int yres; unsigned short left_margin; unsigned short right_margin; unsigned short upper_margin; unsigned short lower_margin; unsigned long crtc_ss; unsigned long crtc_ls; unsigned long crtc_gs; unsigned long crtc_vpos_gs; unsigned long crtc_rev; unsigned long crtc_dclk; unsigned long crtc_gclk; unsigned long crtc_goe; unsigned long crtc_ps1_active; char pll_freq; char fast_pll_freq; int sysclk_src; int sysclk_divider; int pixclk_src; int pixclk_divider; int pixclk_divider_rotated; }; struct w100_pll_info { uint16_t freq; /* desired Fout for PLL (Mhz) */ uint8_t M; /* input divider */ uint8_t N_int; /* VCO multiplier */ uint8_t N_fac; /* VCO multiplier fractional part */ uint8_t tfgoal; uint8_t lock_time; }; /* Initial Video mode orientation flags */ #define INIT_MODE_ROTATED 0x1 #define INIT_MODE_FLIPPED 0x2 /* * This structure describes the machine which we are running on. * It is set by machine specific code and used in the probe routine * of drivers/video/w100fb.c */ struct w100fb_mach_info { /* General Platform Specific Registers */ struct w100_gen_regs *regs; /* Table of modes the LCD is capable of */ struct w100_mode *modelist; unsigned int num_modes; /* Hooks for any platform specific tg/lcd code (optional) */ struct w100_tg_info *tg; /* External memory definition (if present) */ struct w100_mem_info *mem; /* Additional External memory definition (if present) */ struct w100_bm_mem_info *bm_mem; /* GPIO definitions (optional) */ struct w100_gpio_regs *gpio; /* Initial Mode flags */ unsigned int init_mode; /* Xtal Frequency */ unsigned int xtal_freq; /* Enable Xtal input doubler (1 == enable) */ unsigned int xtal_dbl; }; /* General frame buffer data structure */ struct w100fb_par { unsigned int chip_id; unsigned int xres; unsigned int yres; unsigned int extmem_active; unsigned int flip; unsigned int blanked; unsigned int fastpll_mode; unsigned long hsync_len; struct w100_mode *mode; struct w100_pll_info *pll_table; struct w100fb_mach_info *mach; uint32_t *saved_intmem; uint32_t *saved_extmem; }; t name='context' onchange='this.form.submit();'>space:mode:
Diffstat (limited to 'net/atm/common.h')
parent1b1bc42c1692e9b62756323c675a44cb1a1f9dbd (diff)
percpu-refcount: fix reference leak during percpu-atomic transition
percpu_ref_tryget() and percpu_ref_tryget_live() should return "true" IFF they acquire a reference. But the return value from atomic_long_inc_not_zero() is a long and may have high bits set, e.g. PERCPU_COUNT_BIAS, and the return value of the tryget routines is bool so the reference may actually be acquired but the routines return "false" which results in a reference leak since the caller assumes it does not need to do a corresponding percpu_ref_put(). This was seen when performing CPU hotplug during I/O, as hangs in blk_mq_freeze_queue_wait where percpu_ref_kill (blk_mq_freeze_queue_start) raced with percpu_ref_tryget (blk_mq_timeout_work). Sample stack trace: __switch_to+0x2c0/0x450 __schedule+0x2f8/0x970 schedule+0x48/0xc0 blk_mq_freeze_queue_wait+0x94/0x120 blk_mq_queue_reinit_work+0xb8/0x180 blk_mq_queue_reinit_prepare+0x84/0xa0 cpuhp_invoke_callback+0x17c/0x600 cpuhp_up_callbacks+0x58/0x150 _cpu_up+0xf0/0x1c0 do_cpu_up+0x120/0x150 cpu_subsys_online+0x64/0xe0 device_online+0xb4/0x120 online_store+0xb4/0xc0 dev_attr_store+0x68/0xa0 sysfs_kf_write+0x80/0xb0 kernfs_fop_write+0x17c/0x250 __vfs_write+0x6c/0x1e0 vfs_write+0xd0/0x270 SyS_write+0x6c/0x110 system_call+0x38/0xe0 Examination of the queue showed a single reference (no PERCPU_COUNT_BIAS, and __PERCPU_REF_DEAD, __PERCPU_REF_ATOMIC set) and no requests. However, conditions at the time of the race are count of PERCPU_COUNT_BIAS + 0 and __PERCPU_REF_DEAD and __PERCPU_REF_ATOMIC set. The fix is to make the tryget routines use an actual boolean internally instead of the atomic long result truncated to a int. Fixes: e625305b3907 percpu-refcount: make percpu_ref based on longs instead of ints Link: https://bugzilla.kernel.org/show_bug.cgi?id=190751 Signed-off-by: Douglas Miller <dougmill@linux.vnet.ibm.com> Reviewed-by: Jens Axboe <axboe@fb.com> Signed-off-by: Tejun Heo <tj@kernel.org> Fixes: e625305b3907 ("percpu-refcount: make percpu_ref based on longs instead of ints") Cc: stable@vger.kernel.org # v3.18+
Diffstat (limited to 'net/hsr')