Re: [PATCH 0/6] ARM: cpuidle: Unify the ARM64/ARM DT approach
On 03/13/2015 06:03 PM, Kevin Hilman wrote: Daniel Lezcano daniel.lezc...@linaro.org writes: There is a big number of cpuidle drivers for the ARM architecture. These drivers have been cleaned up and grouped into the drivers/cpuidle directory to keep track of the changes more easily and ensure the code is following the same scheme across the drivers. That had the benefit of simplifying the code and factor out a lot of common parts. Beside that, as the drivers belong to the 'drivers' directory, we had to split the arch specific bits and the generic code in order to keep everything self contained. The platform driver paradigm was used for this purpose. Unfortunately, this approach is now no longer accepted and a different solution must be provided to reach the same goal: one example is the Qualcomm cpuidle driver upstreaming attempt [1]. In the meantime, ARM64 developed a generic cpuidle driver based on DT definition. The DT definition provides an 'enable-method' to specify one of the cpu operations (PSCI, ...). This patchset unify this driver with ARM32, using the same DT definition. Thanks with this patchset we can use the 'enable-method' to specify a cpu operations, hence get rid of the platform driver approach and go further in the cpuidle driver flexibility via the DT. I really like that these two are unified now. Acked-by: Kevin Hilman khil...@linaro.org Thanks for reviewing the patchset. -- Daniel -- http://www.linaro.org/ Linaro.org │ Open source software for ARM SoCs Follow Linaro: http://www.facebook.com/pages/Linaro Facebook | http://twitter.com/#!/linaroorg Twitter | http://www.linaro.org/linaro-blog/ Blog -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] vxlan: fix wrong usage of VXLAN_VID_MASK
From: Alexey Kodanev alexey.koda...@oracle.com Date: Fri, 13 Mar 2015 19:13:53 +0300 commit dfd8645ea1bd9127 wrongly assumes that VXLAN_VDI_MASK includes eight lower order reserved bits of VNI field that are using for remote checksum offload. Right now, when VNI number greater then 0x, vxlan_udp_encap_recv() will always return with 'bad_flag' error, reducing the usable vni range from 0..16777215 to 0..65535. Also, it doesn't really check whether RCO bits processed or not. Fix it by adding new VNI mask which has all 32 bits of VNI field: 24 bits for id and 8 bits for other usage. Signed-off-by: Alexey Kodanev alexey.koda...@oracle.com Looks good, applied, thanks! -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: rcu: frequent rcu lockups
On Thu, Mar 12, 2015 at 07:07:49AM -0700, Paul E. McKenney wrote: On Thu, Mar 12, 2015 at 08:32:05AM -0400, Sasha Levin wrote: On 03/12/2015 08:28 AM, Sasha Levin wrote: On 03/11/2015 07:16 PM, Paul E. McKenney wrote: On Wed, Mar 11, 2015 at 07:06:40PM -0400, Sasha Levin wrote: On 03/11/2015 07:01 PM, Paul E. McKenney wrote: With the commit I didn't hit it yet, but I do see 4 different WARNings: I wish that I could say that I am surprised, but the sad fact is that I am still shaking the bugs out. I have one more to add: [ 93.330539] WARNING: CPU: 1 PID: 8 at kernel/rcu/tree_plugin.h:476 rcu_gp_kthread+0x1eaa/0x4dd0() A bit different, but still in the class of a combining-tree bitmask handling bug. I left it overnight, and am still seeing hangs. Although (and don't catch me by that) it seems to be significantly less of them. In one of the cases, KASan ended up complaining about something odd going on in rcu_check_callbacks(): Hmmm... Looks like I have a synchronization blow between RCU CPU stall warnings and task exit or some such. Promising clue, thank you! But I am not seeing it. There should be no synchronization issues with sched_show_task(current), as the current task cannot exit while it is calling sched_show_task(current). There is a remote-task sched_show_task(t), but it is invoked only on tasks that are on RCU's list of tasks that have blocked within an RCU read-side critical section during the current grace period. Such a task might exit while in in this critical section, but in that case exit_rcu() will take care of this, and it will acquire the same lock held across the call to sched_show_task(t). I suppose this could happen if someone re-enabled preemption late in the exit() code path and then entered an RCU read-side critical section, but that would be a bad breakage of the exit() path. Am I missing something here? Thanx, Paul [ 7170.779042] BUG: KASan: out of bounds on stack in sched_show_task+0x324/0x3d0 at addr 88075315fdd8 [ 7170.779042] Read of size 8 by task trinity-c0/15862 [ 7170.779042] page:ea001d4c57c0 count:0 mapcount:0 mapping: (null) index:0x0 [ 7170.779042] flags: 0x5af8000() [ 7170.779042] page dumped because: kasan: bad access detected [ 7170.779042] CPU: 0 PID: 15862 Comm: trinity-c0 Tainted: GW 4.0.0-rc3-next-20150311-sasha-00035-g0a45b48-dirty #2052 [ 7170.779042] 88075315fdd8 ac401e1d 880050607cd8 9da97e89 [ 7170.779042] 1d4003a98aff 880050607d68 880050607d58 9360eda4 [ 7170.779042] 880050607d98 9da8c9df 0082 a0260429 [ 7170.779042] Call Trace: [ 7170.779042] IRQ dump_stack (lib/dump_stack.c:52) [ 7170.779042] kasan_report_error (mm/kasan/report.c:132 mm/kasan/report.c:193) [ 7170.779042] ? printk (kernel/printk/printk.c:1854) [ 7170.779042] ? bitmap_weight (include/linux/bitmap.h:303) [ 7170.779042] __asan_report_load8_noabort (mm/kasan/report.c:230 mm/kasan/report.c:251) [ 7170.779042] ? sched_show_task (kernel/sched/core.c:4526) [ 7170.779042] sched_show_task (kernel/sched/core.c:4526) [ 7170.779042] rcu_check_callbacks (kernel/rcu/tree.c:1225 kernel/rcu/tree.c:1331 kernel/rcu/tree.c:3400 kernel/rcu/tree.c:3464 kernel/rcu/tree.c:2682) [ 7170.779042] update_process_times (./arch/x86/include/asm/preempt.h:22 kernel/time/timer.c:1386) [ 7170.779042] tick_periodic (kernel/time/tick-common.c:92) [ 7170.779042] ? tick_handle_periodic (kernel/time/tick-common.c:105) [ 7170.779042] tick_handle_periodic (kernel/time/tick-common.c:105) [ 7170.779042] local_apic_timer_interrupt (arch/x86/kernel/apic/apic.c:891) [ 7170.779042] ? irq_enter (kernel/softirq.c:338) [ 7170.779042] smp_apic_timer_interrupt (./arch/x86/include/asm/apic.h:650 arch/x86/kernel/apic/apic.c:915) [ 7170.779042] apic_timer_interrupt (arch/x86/kernel/entry_64.S:920) [ 7170.779042] EOI ? do_raw_read_lock (include/asm-generic/qrwlock.h:104 kernel/locking/spinlock_debug.c:204) [ 7170.779042] _raw_read_lock (kernel/locking/spinlock.c:224) [ 7170.779042] ? do_wait (kernel/exit.c:1498 (discriminator 1)) [ 7170.779042] do_wait (kernel/exit.c:1498 (discriminator 1)) [ 7170.779042] ? wait_consider_task (kernel/exit.c:1465) [ 7170.779042] ? find_get_pid (kernel/pid.c:490) [ 7170.779042] SyS_wait4 (kernel/exit.c:1618 kernel/exit.c:1586) [ 7170.779042] ? SyS_waitid (kernel/exit.c:1586) [ 7170.779042] ? kill_orphaned_pgrp (kernel/exit.c:1444) [ 7170.779042] ? syscall_trace_enter_phase2 (arch/x86/kernel/ptrace.c:1592) [ 7170.779042] ? trace_hardirqs_on_thunk (arch/x86/lib/thunk_64.S:42) [ 7170.779042] tracesys_phase2 (arch/x86/kernel/entry_64.S:347) [ 7170.779042] Memory state around the buggy address: [ 7170.779042]
[GIT PULL] kselftest fixes for 4.0-rc4
Hi Linus, Please pull the kselftest fix for 4.0-rc4. thanks, -- Shuah The following changes since commit 9eccca0843205f87c00404b663188b88eb248051: Linux 4.0-rc3 (2015-03-08 16:09:09 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest tags/linux-kselftest-4.0-rc4 for you to fetch changes up to 9a0b57451ae8142c74d65bddb6d7765818babbed: selftests/exec: Check if the syscall exists and bail if not (2015-03-11 10:15:19 -0600) Kselftest fixes for Linux 4.0-rc4 selftests/exec: Check if the syscall exists and bail if not Michael Ellerman (1): selftests/exec: Check if the syscall exists and bail if not tools/testing/selftests/exec/execveat.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) -- Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) shua...@osg.samsung.com | (970) 217-8978 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/6] i2c: qup: Change qup_wait_writeready function to use for all timeouts
qup_wait_writeready waits only on a output fifo empty event. Change the same function to accept the event and data length to wait as parameters. This way the same function can be used for timeouts in otherplaces as well. Signed-off-by: Sricharan R sricha...@codeaurora.org --- drivers/i2c/busses/i2c-qup.c | 30 +++--- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c index 4dad23b..49c6cba 100644 --- a/drivers/i2c/busses/i2c-qup.c +++ b/drivers/i2c/busses/i2c-qup.c @@ -221,26 +221,42 @@ static int qup_i2c_change_state(struct qup_i2c_dev *qup, u32 state) return 0; } -static int qup_i2c_wait_writeready(struct qup_i2c_dev *qup) +/** + * qup_i2c_wait_ready - wait for a give number of bytes in tx/rx path + * @qup: The qup_i2c_dev device + * @op: The bit/event to wait on + * @val: value of the bit to wait on, 0 or 1 + * @len: The length the bytes to be transferred + */ +static int qup_i2c_wait_ready(struct qup_i2c_dev *qup, int op, bool val, + int len) { unsigned long timeout; u32 opflags; u32 status; + u32 shift = __ffs(op); - timeout = jiffies + HZ; + len *= qup-one_byte_t; + /* timeout after a wait of twice the max time */ + timeout = jiffies + len * 4; for (;;) { opflags = readl(qup-base + QUP_OPERATIONAL); status = readl(qup-base + QUP_I2C_STATUS); - if (!(opflags QUP_OUT_NOT_EMPTY) - !(status I2C_STATUS_BUS_ACTIVE)) - return 0; + if (((opflags op) shift) == val) { + if (op == QUP_OUT_NOT_EMPTY) { + if (!(status I2C_STATUS_BUS_ACTIVE)) + return 0; + } else { + return 0; + } + } if (time_after(jiffies, timeout)) return -ETIMEDOUT; - usleep_range(qup-one_byte_t, qup-one_byte_t * 2); + usleep_range(len, len * 2); } } @@ -347,7 +363,7 @@ static int qup_i2c_write_one(struct qup_i2c_dev *qup, struct i2c_msg *msg) } while (qup-pos msg-len); /* Wait for the outstanding data in the fifo to drain */ - ret = qup_i2c_wait_writeready(qup); + ret = qup_i2c_wait_ready(qup, QUP_OUT_NOT_EMPTY, 0, 1); err: disable_irq(qup-irq); -- 1.8.2.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/6] i2c: qup: Add bam dma capabilities
QUP cores can be attached to a BAM module, which acts as a dma engine for the QUP core. When DMA with BAM is enabled, the BAM consumer pipe transmitted data is written to the output FIFO and the BAM producer pipe received data is read from the input FIFO. With BAM capabilities, qup-i2c core can transfer more than 256 bytes, without a 'stop' which is not possible otherwise. Signed-off-by: Sricharan R sricha...@codeaurora.org --- drivers/i2c/busses/i2c-qup.c | 365 ++- 1 file changed, 359 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c index e4e223f..11ea6af 100644 --- a/drivers/i2c/busses/i2c-qup.c +++ b/drivers/i2c/busses/i2c-qup.c @@ -25,6 +25,11 @@ #include linux/platform_device.h #include linux/pm_runtime.h #include linux/slab.h +#include linux/dma-mapping.h +#include linux/scatterlist.h +#include linux/atomic.h +#include linux/dmaengine.h +#include linux/dmapool.h /* QUP Registers */ #define QUP_CONFIG 0x000 @@ -34,6 +39,7 @@ #define QUP_OPERATIONAL0x018 #define QUP_ERROR_FLAGS0x01c #define QUP_ERROR_FLAGS_EN 0x020 +#define QUP_OPERATIONAL_MASK 0x028 #define QUP_HW_VERSION 0x030 #define QUP_MX_OUTPUT_CNT 0x100 #define QUP_OUT_FIFO_BASE 0x110 @@ -44,6 +50,7 @@ #define QUP_I2C_CLK_CTL0x400 #define QUP_I2C_STATUS 0x404 #define QUP_I2C_MASTER_GEN 0x408 +#define QUP_I2C_MASTER_CONFIG 0x408 /* QUP States and reset values */ #define QUP_RESET_STATE0 @@ -53,6 +60,7 @@ #define QUP_STATE_VALIDBIT(2) #define QUP_I2C_MAST_GEN BIT(4) +#define QUP_I2C_FLUSH BIT(6) #define QUP_OPERATIONAL_RESET 0x000ff0 #define QUP_I2C_STATUS_RESET 0xfc @@ -78,7 +86,10 @@ /* Packing/Unpacking words in FIFOs, and IO modes */ #define QUP_OUTPUT_BLK_MODE(1 10) +#define QUP_OUTPUT_BAM_MODE(3 10) #define QUP_INPUT_BLK_MODE (1 12) +#define QUP_INPUT_BAM_MODE (3 12) +#define QUP_BAM_MODE (QUP_OUTPUT_BAM_MODE | QUP_INPUT_BAM_MODE) #define QUP_UNPACK_EN BIT(14) #define QUP_PACK_ENBIT(15) @@ -105,6 +116,10 @@ #define QUP_TAG_V2_DATARD 0x85 #define QUP_TAG_V2_DATARD_STOP 0x87 +/* QUP BAM v2 tags */ +#define QUP_BAM_INPUT_EOT 0x93 +#define QUP_BAM_FLUSH_STOP 0x96 + /* frequency definitions for high speed and max speed */ #define I2C_QUP_CLK_FAST_FREQ 100 #define I2C_QUP_CLK_MAX_FREQ 340 @@ -116,12 +131,21 @@ #define QUP_STATUS_ERROR_FLAGS 0x7c #define QUP_READ_LIMIT 256 +#define MX_TX_RX_LEN SZ_64K +#define MX_BLOCKS (MX_TX_RX_LEN / QUP_READ_LIMIT) + +#define TOUT_MAX 300 /* Max timeout for 32k tx/tx */ struct qup_i2c_config { int tag_ver; int max_freq; }; +struct tag { + u8 *start; + dma_addr_t addr; +}; + struct qup_i2c_dev { struct device *dev; void __iomem*base; @@ -157,9 +181,35 @@ struct qup_i2c_dev { /* QUP core errors */ u32 qup_err; + /* dma parameters */ + boolis_dma; + struct dma_pool *dpool; + struct tag start_tag; + struct tag scratch_tag; + struct tag footer_tag; + struct dma_chan *dma_tx; + struct dma_chan *dma_rx; + struct scatterlist *sg_tx; + struct scatterlist *sg_rx; + dma_addr_t sg_tx_phys; + dma_addr_t sg_rx_phys; + struct completion xfer; }; +struct i2c_bam_xfer { + struct qup_i2c_dev *qup; + u32 start_len; + + u32 rx_nents; + u32 tx_nents; + + struct dma_async_tx_descriptor *tx_desc; + dma_cookie_t tx_cookie; + struct dma_async_tx_descriptor *rx_desc; + dma_cookie_t rx_cookie; +}; + static irqreturn_t qup_i2c_interrupt(int irq, void *dev) { struct qup_i2c_dev *qup = dev; @@ -233,6 +283,14 @@ static int qup_i2c_poll_state(struct qup_i2c_dev *qup, u32 req_state) return qup_i2c_poll_state_mask(qup, req_state, QUP_STATE_MASK); } +static void qup_i2c_flush(struct qup_i2c_dev *qup) +{ + u32 val = readl(qup-base + QUP_STATE); + + val |= QUP_I2C_FLUSH; + writel(val, qup-base + QUP_STATE); +} + static int qup_i2c_poll_state_valid(struct qup_i2c_dev *qup) { return qup_i2c_poll_state_mask(qup, 0, 0); @@ -719,12 +777,244 @@ err: return ret; } +static void bam_i2c_callback(void *data) +{ + struct qup_i2c_dev *qup = data; + + complete(qup-xfer); +} + +static int get_start_tag(u8 *tag, struct i2c_msg *msg, int first, int last, +
[PATCH 00/12] Remove mach-msm and associated code
The maintainers for mach-msm no longer have any plans to support or test the platforms supported by this architecture[1]. Most likely there aren't any active users of this code anyway, so let's delete it and the associated drivers/code. We should probably merge this as one big series through arm-soc. Although some patches should be fine to take through maintainers, some things like mmc and usb have header file dependencies for platform_data. [1] http://lkml.kernel.org/r/20150307031212.ga8...@fifo99.com Stephen Boyd (12): ARM: Remove mach-msm and associated ARM architecture code gpio: Remove gpio-msm-v1 driver tty: serial: Remove orphaned serial driver tty: serial: msm_serial: Remove dead code net: smc91x: Remove dead code mmc: Remove msm_sdcc driver clocksource: qcom: Remove dead code ehci-msm: Remove dead dependency usb: phy: msm: Remove dead code phy: qcom-ufs: Switch dependency to ARCH_QCOM ufs-qcom: Switch dependency to ARCH_QCOM msm: msm_fb: Remove dead code Documentation/arm/00-INDEX |2 - Documentation/arm/msm/gpiomux.txt | 176 --- MAINTAINERS | 20 +- arch/arm/Kconfig| 14 - arch/arm/Kconfig.debug | 31 +- arch/arm/Makefile |2 - arch/arm/configs/msm_defconfig | 121 -- arch/arm/include/debug/msm.S| 14 - arch/arm/mach-msm/Kconfig | 109 -- arch/arm/mach-msm/Makefile | 23 - arch/arm/mach-msm/Makefile.boot |3 - arch/arm/mach-msm/board-halibut.c | 104 -- arch/arm/mach-msm/board-msm7x30.c | 191 --- arch/arm/mach-msm/board-qsd8x50.c | 248 --- arch/arm/mach-msm/board-sapphire.c | 114 -- arch/arm/mach-msm/board-trout-gpio.c| 233 --- arch/arm/mach-msm/board-trout-mmc.c | 185 --- arch/arm/mach-msm/board-trout-panel.c | 292 arch/arm/mach-msm/board-trout.c | 111 -- arch/arm/mach-msm/board-trout.h | 162 -- arch/arm/mach-msm/clock-pcom.c | 176 --- arch/arm/mach-msm/clock-pcom.h | 145 -- arch/arm/mach-msm/clock.c | 28 - arch/arm/mach-msm/clock.h | 43 - arch/arm/mach-msm/common.h | 41 - arch/arm/mach-msm/devices-msm7x00.c | 480 -- arch/arm/mach-msm/devices-msm7x30.c | 246 --- arch/arm/mach-msm/devices-qsd8x50.c | 388 - arch/arm/mach-msm/devices.h | 53 - arch/arm/mach-msm/dma.c | 298 arch/arm/mach-msm/gpiomux-8x50.c| 51 - arch/arm/mach-msm/gpiomux-v1.h | 67 - arch/arm/mach-msm/gpiomux.c | 111 -- arch/arm/mach-msm/gpiomux.h | 84 - arch/arm/mach-msm/include/mach/clk.h| 31 - arch/arm/mach-msm/include/mach/dma.h| 151 -- arch/arm/mach-msm/include/mach/entry-macro.S| 36 - arch/arm/mach-msm/include/mach/hardware.h | 18 - arch/arm/mach-msm/include/mach/irqs-7x00.h | 75 - arch/arm/mach-msm/include/mach/irqs-7x30.h | 153 -- arch/arm/mach-msm/include/mach/irqs-8x50.h | 88 -- arch/arm/mach-msm/include/mach/irqs.h | 37 - arch/arm/mach-msm/include/mach/msm_gpiomux.h| 38 - arch/arm/mach-msm/include/mach/msm_iomap-7x00.h | 108 -- arch/arm/mach-msm/include/mach/msm_iomap-7x30.h | 103 -- arch/arm/mach-msm/include/mach/msm_iomap-8x50.h | 125 -- arch/arm/mach-msm/include/mach/msm_iomap.h | 53 - arch/arm/mach-msm/include/mach/msm_smd.h| 109 -- arch/arm/mach-msm/include/mach/sirc.h | 98 -- arch/arm/mach-msm/include/mach/vreg.h | 29 - arch/arm/mach-msm/io.c | 161 -- arch/arm/mach-msm/irq-vic.c | 363 - arch/arm/mach-msm/irq.c | 151 -- arch/arm/mach-msm/last_radio_log.c | 71 - arch/arm/mach-msm/proc_comm.c | 129 -- arch/arm/mach-msm/proc_comm.h | 258 arch/arm/mach-msm/sirc.c| 172 --- arch/arm/mach-msm/smd.c | 1034 - arch/arm/mach-msm/smd_debug.c | 311 arch/arm/mach-msm/smd_private.h | 403 - arch/arm/mach-msm/vreg.c| 220 --- drivers/clocksource/qcom-timer.c| 59 - drivers/gpio/Kconfig|8 - drivers/gpio/Makefile |1 - drivers/gpio/gpio-msm-v1.c | 714 - drivers/mmc/host/Kconfig|8 - drivers/mmc/host/Makefile |1 -
Re: [RFC] capabilities: Ambient capabilities
On Fri, 13 Mar 2015, Andy Lutomirski wrote: The functionalty here depends on CAP_SETPCAP. That was intended as some point to be off by default? You can have distros/kernels with that being off. Not in my version. I don't want to further encourage people to hand out CAP_SETPCAP. Owww... But if you leave it in then maybe Andrew will be satisfied with this approach? -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC] capabilities: Ambient capabilities
On Fri, Mar 13, 2015 at 10:57 AM, Andy Lutomirski l...@amacapital.net wrote: On Mar 13, 2015 6:24 AM, Andrew G. Morgan mor...@kernel.org wrote: I think it is safe to say that naive privilege inheritance has a fair track record of being exploited orders of magnitude more frequently than this. After all, these are the reasons LD_PRELOAD and shell script setuid bits are suppressed. I don't know what you mean here by naive privilege inheritance. The examples you're taking about aren't inheritance at all; they're exploring privilege *grants* during execve. My patch deliberately leaves grants like that alone. Just to clarify (at least for myself), I think the issue here is the perception of privileges leaking into newly execed processes that may have flaws that allow arbitrary execution control. Case A: daemon is running (with whatever set of privileges), has a flaw and an attacker now has those same privileges. Case B: running as root, runs some child (which stays root) with a flaw and an attacker now has root privileges. Case C: running with pE=CAP_NET_ADMIN, runs some child (which loses the cap) with a flaw and an attacker now has only user privileges. Case D: running with pE=pI=CAP_NET_ADMIN, runs some child that has fI=CAP_NET_ADMIN, but other children don't and lose the cap as in case C. The privileged attack surface is reduced to only the child with fI set. Case E: running with CAP_NET_ADMIN in pA, runs some child (which gets pE=pA=CAP_NET_ADMIN), and has an attack surface larger (all children) than Case D, but with a scope smaller (only CAP_NET_ADMIN) than Case B. We don't need to talk about Case A, since we're not crossing an exec boundary and the attacker already has execution control. We all lose. Case B is the poster-child for don't run daemons as root, since privileges aren't dropped, and we're basically back to Case A again. Case C is the classic just give the daemon what caps it needs case, and if the daemon itself isn't flawed (Case A), then the privileges don't leak out to any children (usually helpers of some kind) since the cap doesn't cross the exec boundary. This lack of leaking is really frustrating for daemons that need to give caps to helpers (e.g. containers). Case D is the standard solution to the frustrations in Case C, but requires filesystem capabilities (and/or SELinux) to pass capabilities, and comes with various limitations as described in Andy's first email. Case E would be possible with Andy's patch. It lacks the limitations and frustrations of C and D, but opens us up to a limited version of the risks in Case B. So, I don't think it's as bad as Case B since a process must opt into it (by setting pA), and it passes only the limited set of capabilities. I think this boils down to accepting the elevated risk while recognizing that it may be less than Case B but greater than Case C. All this said, almost half of the capabilities, if passed to flawed children with attacker controlled execution, can be elevated to full root privileges pretty easily[1], so I think any documentation around this feature should include some pretty dire warnings about using this. -Kees [1] https://forums.grsecurity.net/viewtopic.php?f=7t=2522 -- Kees Cook Chrome OS Security -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 man-pages] bpf.2: new page documenting bpf(2)
v1: initial draft v2: fixed tons of grammar mistakes pointed by Silvan Jegen v3: introduce BPF abbreviation sooner as suggested by Walter Harms Signed-off-by: Alexei Starovoitov a...@plumgrid.com --- man2/bpf.2 | 630 1 file changed, 630 insertions(+) create mode 100644 man2/bpf.2 diff --git a/man2/bpf.2 b/man2/bpf.2 new file mode 100644 index 000..64eaef9 --- /dev/null +++ b/man2/bpf.2 @@ -0,0 +1,630 @@ +.\ Copyright (C) 2015 Alexei Starovoitov a...@kernel.org +.\ +.\ %%%LICENSE_START(VERBATIM) +.\ Permission is granted to make and distribute verbatim copies of this +.\ manual provided the copyright notice and this permission notice are +.\ preserved on all copies. +.\ +.\ Permission is granted to copy and distribute modified versions of this +.\ manual under the conditions for verbatim copying, provided that the +.\ entire resulting derived work is distributed under the terms of a +.\ permission notice identical to this one. +.\ +.\ Since the Linux kernel and libraries are constantly changing, this +.\ manual page may be incorrect or out-of-date. The author(s) assume no +.\ responsibility for errors or omissions, or for damages resulting from +.\ the use of the information contained herein. The author(s) may not +.\ have taken the same level of care in the production of this manual, +.\ which is licensed free of charge, as they might when working +.\ professionally. +.\ +.\ Formatted or processed versions of this manual, if unaccompanied by +.\ the source, must acknowledge the copyright and authors of this work. +.\ %%%LICENSE_END +.\ +.TH BPF 2 2015-03-10 Linux Linux Programmer's Manual +.SH NAME +bpf - perform a command on an extended BPF map or program +.SH SYNOPSIS +.nf +.B #include linux/bpf.h +.sp +.BI int bpf(int cmd, union bpf_attr *attr, unsigned int size); + +.SH DESCRIPTION +.BR bpf() +syscall is a multiplexor for a range of different operations on extended +Berkeley Packet Filter which can be characterized as +universal in-kernel virtual machine. The extended BPF (or eBPF) is similar to +the original BPF (or classic BPF) used to filter network packets. Both +statically analyze the programs before loading them into the kernel to +ensure that they cannot harm the running system. +.P +eBPF extends classic BPF in multiple ways including the ability to call +in-kernel helper functions and access shared data structures like BPF maps. +The programs can be written in a restricted C that is compiled into +eBPF bytecode and executed on the in-kernel virtual machine or JITed into +native code. +.SS Extended BPF Design/Architecture +.P +BPF maps are a generic data structure for storage of different data types. +A user process can create multiple maps (with key/value-pairs being +opaque bytes of data) and access them via file descriptor. +BPF programs can access maps from inside the kernel in parallel. +It's up to the user process and BPF program to decide what they store +inside maps. +.P +BPF programs are similar to kernel modules. They are loaded by the user +process and automatically unloaded when the process exits. +Each BPF program is a set of instructions that is safe to run until +its completion. The BPF verifier statically determines that the program +terminates and is safe to execute. During +verification the program takes hold of maps that it intends to use, +so selected maps cannot be removed until the program is unloaded. The program +can be attached to different events. These events can be packets, tracing +events and other types that may be added in the future. A new event triggers +execution of the program which may store information about the event in the maps. +Beyond storing data the programs may call into in-kernel helper functions. +The same program can be attached to multiple events and different programs can +access the same map: +.nf + tracing tracing tracing packet packet + event A event B event C on eth0on eth1 + | | | | | + | | | | | + -- tracing -- tracing socket socket +prog_1 prog_2 prog_3 prog_4 +| | || + |--- -| |---| map_3 + map_1 map_2 +.fi +.SS Syscall Arguments +.B bpf() +syscall operation is determined by +.IR cmd +which can be one of the following: +.TP +.B BPF_MAP_CREATE +Create a map with the given type and attributes and return map FD +.TP +.B BPF_MAP_LOOKUP_ELEM +Lookup element by key in a given map and return its value +.TP +.B BPF_MAP_UPDATE_ELEM +Create or update element (key/value pair) in a given map +.TP +.B BPF_MAP_DELETE_ELEM +Lookup and delete element by key in a given map +.TP +.B BPF_MAP_GET_NEXT_KEY +Lookup element by key in a given map and return key of next element +.TP +.B BPF_PROG_LOAD +Verify and load BPF program +.TP +.B attr +is a pointer to a
Re: [Patch v3 1/3] dt: OF_UNITTEST make dependency broken, framework fixes
On 3/13/2015 6:13 AM, Rob Herring wrote: On Thu, Mar 12, 2015 at 8:15 AM, Frank Rowand frowand.l...@gmail.com wrote: From: Frank Rowand frank.row...@sonymobile.com This 3 patch series is not bisectable. If CONFIG_OF_UNITTEST=y then the kernel will not build with just patch 1 or just patches 1 and 2 applied. If you did 2 patches with the move first, wouldn't that make it bisectable. However, I'd rather avoid the move. Yes, I did not like the move either. Fortunately you gave me the cluebat I needed to avoid the move. If CONFIG_OF_UNITTEST=y then a kernel image make will always cause .version to be incremented, even if there are not source changes. This is caused by a lack of dependency tracking and checking for drivers/of/unittest-data/testcases.dtb.o. Fixing the problem was made more complicated by the fact that testcases.dtb.o was linked into ../of_unittest.o. Couldn't we change that to be 2 modules. Thanks, that was just the hint I needed to realize that of_unittest.o was just an artifact of the problem I was trying to solve. I will send a new patch that removes the of_unittest.o cruft and does not need to move unittest.c Patch 1 modifies makefiles to move of_unittest.c into unittest-data/ and creates missing dependency tracking for testcases.dtb.o. Patch 2 will move of_unittest.c into unittest-data/ Patch 3 will fix an of_unittest.c include path to account for the move. This should all be in an intro email, not patch #1. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/4] x86/fpu: don't abuse drop_init_fpu() in flush_thread()
On Fri, Mar 13, 2015 at 05:26:54PM +0100, Oleg Nesterov wrote: One example where drop_init_fpu() seems to make sense is __kernel_fpu_end(): kernel is done with FPU and current was using the FPU prior so let's restore it for the eagerfpu case. No, no, this is another case or I misunderstood you. __kernel_fpu_end() needs to restore FPU from current's fpu-state exactly because current used FPU prior. And that state was saved by __save_init_fpu() in __kernel_fpu_begin(). That's exactly what I mean. See: ... kernel is done with FPU and current was using the FPU prior... :-D -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. -- -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 01/32] do_fork(): Rename 'stack_size' argument to reflect actual use
The 'stack_size' argument is never used to pass a stack size. It's only used when forking a kernel thread, in which case it is an argument which should be passed to the 'main' function which the kernel thread executes. Hence, rename it to 'kthread_arg'. Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- Hi, The following patches in this series perform a similar cleanup for the arch-specific implementations of copy_thread(). Each patch has been sent to the maintainers for the relevant arch. Thanks, AD kernel/fork.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/kernel/fork.c b/kernel/fork.c index cf65139..5a40dfd 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -1186,10 +1186,12 @@ init_task_pid(struct task_struct *task, enum pid_type type, struct pid *pid) * It copies the registers, and all the appropriate * parts of the process environment (as per the clone * flags). The actual kick-off is left to the caller. */ static struct task_struct *copy_process(unsigned long clone_flags, unsigned long stack_start, - unsigned long stack_size, + unsigned long kthread_arg, int __user *child_tidptr, struct pid *pid, int trace) @@ -1401,7 +1403,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, retval = copy_io(clone_flags, p); if (retval) goto bad_fork_cleanup_namespaces; - retval = copy_thread(clone_flags, stack_start, stack_size, p); + retval = copy_thread(clone_flags, stack_start, kthread_arg, p); if (retval) goto bad_fork_cleanup_io; @@ -1630,7 +1632,7 @@ struct task_struct *fork_idle(int cpu) */ long do_fork(unsigned long clone_flags, unsigned long stack_start, - unsigned long stack_size, + unsigned long kthread_arg, int __user *parent_tidptr, int __user *child_tidptr) { @@ -1656,7 +1658,7 @@ long do_fork(unsigned long clone_flags, trace = 0; } - p = copy_process(clone_flags, stack_start, stack_size, + p = copy_process(clone_flags, stack_start, kthread_arg, child_tidptr, NULL, trace); /* * Do this prior waking up the new thread - the thread pointer @@ -1740,7 +1742,7 @@ SYSCALL_DEFINE5(clone, unsigned long, newsp, unsigned long, clone_flags, int, tls_val) #elif defined(CONFIG_CLONE_BACKWARDS3) SYSCALL_DEFINE6(clone, unsigned long, clone_flags, unsigned long, newsp, - int, stack_size, + int, ignored, int __user *, parent_tidptr, int __user *, child_tidptr, int, tls_val) -- 2.0.0.GIT -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v4 2/9] kbuild: Don't pass LDFLAGS to selftest Makefile
On 03/10/2015 10:05 PM, Michael Ellerman wrote: The makefile in arch/x86/Makefile.um sets LDFLAGS and exports it, which is then propagated to the selftest Makefiles and leads to build errors there. The build errors occur because we are passing LDFLAGS to CC, but the option set in Makefile.um (-m elf_x86_64) is not understood by CC. We could fix that by using -Wl, but that might break the UM build if it's actually passing that option to LD directly. We don't actually want the LDFLAGS from kbuild in the selftest Makefile, so the simplest fix seems to be to clear LDFLAGS before invoking the selftest Makefile. Signed-off-by: Michael Ellerman m...@ellerman.id.au --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0836e9d628f0..5cef1d4c2ea0 100644 --- a/Makefile +++ b/Makefile @@ -1085,7 +1085,7 @@ headers_check: headers_install PHONY += kselftest kselftest: - $(Q)$(MAKE) -C tools/testing/selftests MAKEFLAGS=$(filter-out rR,$(MAKEFLAGS)) run_tests + $(Q)$(MAKE) LDFLAGS= -C tools/testing/selftests MAKEFLAGS=$(filter-out rR,$(MAKEFLAGS)) run_tests # --- # Modules Thanks for finding the problem and fix. I want to handle this in the selftests/Makefile level instead. I have a patch ready to send out for review. thanks, -- Shuah -- Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) shua...@osg.samsung.com | (970) 217-8978 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 06/32] avr32: copy_thread(): rename 'arg' argument to 'kthread_arg'
The 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()). Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- arch/avr32/kernel/process.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/avr32/kernel/process.c b/arch/avr32/kernel/process.c index 42a53e74..a255bd3 100644 --- a/arch/avr32/kernel/process.c +++ b/arch/avr32/kernel/process.c @@ -279,20 +279,25 @@ asmlinkage void ret_from_fork(void); asmlinkage void ret_from_kernel_thread(void); asmlinkage void syscall_return(void); +/* + * Copy architecture-specific thread state + */ int copy_thread(unsigned long clone_flags, unsigned long usp, - unsigned long arg, + unsigned long kthread_arg, struct task_struct *p) { struct pt_regs *childregs = task_pt_regs(p); if (unlikely(p-flags PF_KTHREAD)) { + /* kernel thread */ memset(childregs, 0, sizeof(struct pt_regs)); - p-thread.cpu_context.r0 = arg; + p-thread.cpu_context.r0 = kthread_arg; p-thread.cpu_context.r1 = usp; /* fn */ p-thread.cpu_context.r2 = (unsigned long)syscall_return; p-thread.cpu_context.pc = (unsigned long)ret_from_kernel_thread; childregs-sr = MODE_SUPERVISOR; } else { + /* user thread */ *childregs = *current_pt_regs(); if (usp) childregs-sp = usp; -- 2.0.0.GIT -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 04/32] arm: copy_thread(): rename 'stk_sz' argument to 'kthread_arg'
'stk_sz' is a misnomer: it is never used for a stack size. Rather, it is an argument which is passed to the main function executed by a kernel thread, when forking a new kthread. The most appropriate name is 'kthread_arg'. Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- arch/arm/kernel/process.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index fdfa3a7..4183ebd 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -342,9 +342,12 @@ void release_thread(struct task_struct *dead_task) asmlinkage void ret_from_fork(void) __asm__(ret_from_fork); +/* + * Copy architecture-specific thread state + */ int copy_thread(unsigned long clone_flags, unsigned long stack_start, - unsigned long stk_sz, struct task_struct *p) + unsigned long kthread_arg, struct task_struct *p) { struct thread_info *thread = task_thread_info(p); struct pt_regs *childregs = task_pt_regs(p); @@ -352,13 +355,15 @@ copy_thread(unsigned long clone_flags, unsigned long stack_start, memset(thread-cpu_context, 0, sizeof(struct cpu_context_save)); if (likely(!(p-flags PF_KTHREAD))) { + /* user thread */ *childregs = *current_pt_regs(); childregs-ARM_r0 = 0; if (stack_start) childregs-ARM_sp = stack_start; } else { + /* kernel thread */ memset(childregs, 0, sizeof(struct pt_regs)); - thread-cpu_context.r4 = stk_sz; + thread-cpu_context.r4 = kthread_arg; thread-cpu_context.r5 = stack_start; childregs-ARM_cpsr = SVC_MODE; } -- 2.0.0.GIT -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 09/32] cris/arch-v10: copy_thread(): rename 'arg' argument to 'kthread_arg'
The 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()). Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- arch/cris/arch-v10/kernel/process.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/cris/arch-v10/kernel/process.c b/arch/cris/arch-v10/kernel/process.c index 02b7834..c8c73d3 100644 --- a/arch/cris/arch-v10/kernel/process.c +++ b/arch/cris/arch-v10/kernel/process.c @@ -94,8 +94,11 @@ unsigned long thread_saved_pc(struct task_struct *t) asmlinkage void ret_from_fork(void); asmlinkage void ret_from_kernel_thread(void); +/* + * Copy architecture-specific thread state + */ int copy_thread(unsigned long clone_flags, unsigned long usp, - unsigned long arg, struct task_struct *p) + unsigned long kthread_arg, struct task_struct *p) { struct pt_regs *childregs = task_pt_regs(p); struct switch_stack *swstack = ((struct switch_stack *)childregs) - 1; @@ -105,10 +108,11 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, */ if (unlikely(p-flags PF_KTHREAD)) { + /* kernel thread */ memset(swstack, 0, sizeof(struct switch_stack) + sizeof(struct pt_regs)); swstack-r1 = usp; - swstack-r2 = arg; + swstack-r2 = kthread_arg; childregs-dccr = 1 I_DCCR_BITNR; swstack-return_ip = (unsigned long) ret_from_kernel_thread; p-thread.ksp = (unsigned long) swstack; -- 2.0.0.GIT -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 08/32] c6x: copy_thread(): rename 'ustk_size' argument to 'kthread_arg'
'ustk_size' is a misnomer: it is never used for the size of the user stack. It is only used when forking a new kernel thread, as the argument passed to the kthread's main function. Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- arch/c6x/kernel/process.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/c6x/kernel/process.c b/arch/c6x/kernel/process.c index 57d2ea8..b519377 100644 --- a/arch/c6x/kernel/process.c +++ b/arch/c6x/kernel/process.c @@ -109,10 +109,10 @@ void start_thread(struct pt_regs *regs, unsigned int pc, unsigned long usp) } /* - * Copy a new thread context in its stack. + * Copy architecture-specific thread state */ int copy_thread(unsigned long clone_flags, unsigned long usp, - unsigned long ustk_size, + unsigned long kthread_arg, struct task_struct *p) { struct pt_regs *childregs; @@ -125,9 +125,9 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, childregs-sp = (unsigned long)(childregs + 1); p-thread.pc = (unsigned long) ret_from_kernel_thread; childregs-a0 = usp;/* function */ - childregs-a1 = ustk_size; /* argument */ + childregs-a1 = kthread_arg; } else { - /* Otherwise use the given stack */ + /* user thread: use the given stack */ *childregs = *current_pt_regs(); if (usp) childregs-sp = usp; -- 2.0.0.GIT -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] mm/slub: fix lockups on PREEMPT !SMP kernels
On Fri, Mar 13, 2015 at 04:29:23PM +, Christoph Lameter wrote: On Fri, 13 Mar 2015, Mark Rutland wrote: */ - do { - tid = this_cpu_read(s-cpu_slab-tid); - c = raw_cpu_ptr(s-cpu_slab); - } while (IS_ENABLED(CONFIG_PREEMPT) unlikely(tid != c-tid)); + c = raw_cpu_ptr(s-cpu_slab); + tid = READ_ONCE(c-tid); Ok that works for the !SMP case. What about SMP and PREEMPT now? From testing on boards I have access to, things seem fine so far with SMP PREEMPT. If we have any allocator stress tests I'm more than happy to give them a go. As I mentioned, it's not clear to me that the the READ_ONCE(c-tid) is safe (i.e. it is atomic and non-destructive). If READ_ONCE(c-tid) is not safe then the code added in 9aabf810a67cd97e is similarly broken given the access in the loop condition, in addition to the hoisting done by the compiler. And yes code like this was deemed safe for years and the race condition is very subtle and difficult to trigger (also given that PREEMPT is rarely used these days). The this_cpu_cmpxchg_double is the saving grace here: if c-tid is read from a different CPU it will fail and we'll retry the whole thing. That's exactly what the original patch relied on in the case a preemption occured after the loop. w.r.t. CONFIG_PREEMPT, git grep tells me otherwise: [mark@leverpostej:~/src/linux]% git grep -w 'CONFIG_PREEMPT' -- arch/*/configs/* | wc -l 109 [mark@leverpostej:~/src/linux]% git grep -w 'CONFIG_PREEMPT is not set' -- arch/*/configs/* | wc -l 2 [mark@leverpostej:~/src/linux]% git grep -w 'CONFIG_PREEMPT=y' -- arch/*/configs/* | wc -l 107 [mark@leverpostej:~/src/linux]% git grep -w 'CONFIG_PREEMPT=n' -- arch/*/configs/* | wc -l 0 Mark. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 27/32] sparc: copy_thread(): rename 'arg' argument to 'kthread_arg'
The 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()). Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- arch/sparc/kernel/process_32.c | 10 -- arch/sparc/kernel/process_64.c | 6 -- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c index 50e7b62..ba6492f 100644 --- a/arch/sparc/kernel/process_32.c +++ b/arch/sparc/kernel/process_32.c @@ -305,8 +305,11 @@ asmlinkage int sparc_do_fork(unsigned long clone_flags, extern void ret_from_fork(void); extern void ret_from_kernel_thread(void); +/* + * Copy architecture-specific thread state + */ int copy_thread(unsigned long clone_flags, unsigned long sp, - unsigned long arg, struct task_struct *p) + unsigned long kthread_arg, struct task_struct *p) { struct thread_info *ti = task_thread_info(p); struct pt_regs *childregs, *regs = current_pt_regs(); @@ -343,6 +346,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, p-thread.kregs = childregs; if (unlikely(p-flags PF_KTHREAD)) { + /* kernel thread */ extern int nwindows; unsigned long psr; memset(new_stack, 0, STACKFRAME_SZ + TRACEREG_SZ); @@ -350,12 +354,14 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, p-thread.current_ds = KERNEL_DS; ti-kpc = (((unsigned long) ret_from_kernel_thread) - 0x8); childregs-u_regs[UREG_G1] = sp; /* function */ - childregs-u_regs[UREG_G2] = arg; + childregs-u_regs[UREG_G2] = kthread_arg; psr = childregs-psr = get_psr(); ti-kpsr = psr | PSR_PIL; ti-kwim = 1 (((psr PSR_CWP) + 1) % nwindows); return 0; } + + /* user thread */ memcpy(new_stack, (char *)regs - STACKFRAME_SZ, STACKFRAME_SZ + TRACEREG_SZ); childregs-u_regs[UREG_FP] = sp; p-thread.flags = ~SPARC_FLAG_KTHREAD; diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c index 0be7bf9..3f203c8 100644 --- a/arch/sparc/kernel/process_64.c +++ b/arch/sparc/kernel/process_64.c @@ -613,7 +613,7 @@ asmlinkage long sparc_do_fork(unsigned long clone_flags, * Child -- %o0 == parents pid, %o1 == 1 */ int copy_thread(unsigned long clone_flags, unsigned long sp, - unsigned long arg, struct task_struct *p) + unsigned long kthread_arg, struct task_struct *p) { struct thread_info *t = task_thread_info(p); struct pt_regs *regs = current_pt_regs(); @@ -633,15 +633,17 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, t-fpsaved[0] = 0; if (unlikely(p-flags PF_KTHREAD)) { + /* kernel thread */ memset(child_trap_frame, 0, child_stack_sz); __thread_flag_byte_ptr(t)[TI_FLAG_BYTE_CWP] = (current_pt_regs()-tstate + 1) TSTATE_CWP; t-current_ds = ASI_P; t-kregs-u_regs[UREG_G1] = sp; /* function */ - t-kregs-u_regs[UREG_G2] = arg; + t-kregs-u_regs[UREG_G2] = kthread_arg; return 0; } + /* user thread */ parent_sf = ((struct sparc_stackf *) regs) - 1; memcpy(child_trap_frame, parent_sf, child_stack_sz); if (t-flags _TIF_32BIT) { -- 2.0.0.GIT -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 28/32] tile: copy_thread(): rename 'arg' argument to 'kthread_arg'
The 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()). Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- arch/tile/kernel/process.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/tile/kernel/process.c b/arch/tile/kernel/process.c index 48e5773..bff52e4 100644 --- a/arch/tile/kernel/process.c +++ b/arch/tile/kernel/process.c @@ -97,8 +97,11 @@ void arch_release_thread_info(struct thread_info *info) static void save_arch_state(struct thread_struct *t); +/* + * Copy architecture-specific thread state + */ int copy_thread(unsigned long clone_flags, unsigned long sp, - unsigned long arg, struct task_struct *p) + unsigned long kthread_arg, struct task_struct *p) { struct pt_regs *childregs = task_pt_regs(p); unsigned long ksp; @@ -130,15 +133,15 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, memset(callee_regs[2], 0, (CALLEE_SAVED_REGS_COUNT - 2) * sizeof(unsigned long)); callee_regs[0] = sp; /* r30 = function */ - callee_regs[1] = arg; /* r31 = arg */ + callee_regs[1] = kthread_arg; /* r31 = arg */ childregs-ex1 = PL_ICS_EX1(KERNEL_PL, 0); p-thread.pc = (unsigned long) ret_from_kernel_thread; return 0; } /* -* Start new thread in ret_from_fork so it schedules properly -* and then return from interrupt like the parent. +* user thread: start in ret_from_fork so it schedules properly +* and then returns from interrupt like the parent. */ p-thread.pc = (unsigned long) ret_from_fork; -- 2.0.0.GIT -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 32/32] xtensa: copy_thread(): rename 'arg' argument to 'kthread_arg'
Rename the 'thread_fn_arg' it to 'kthread_arg' for consistency with do_fork() and other arch-specific implementations of copy_thread(). Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- arch/xtensa/kernel/process.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c index 1c85323..b12f5dc 100644 --- a/arch/xtensa/kernel/process.c +++ b/arch/xtensa/kernel/process.c @@ -147,7 +147,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) } /* - * Copy thread. + * Copy architecture-specific thread state * * There are two modes in which this function is called: * 1) Userspace thread creation, @@ -156,7 +156,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) *in the clone_flags) and set up passed usp in the childregs. * 2) Kernel thread creation, *regs == NULL, usp_thread_fn is the function to run in the new thread - *and thread_fn_arg is its parameter. + *and kthread_arg is its parameter. *childregs are not used for the kernel threads. * * The stack layout for the new thread looks like this: @@ -187,9 +187,8 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) * One solution is to spill windows to the parent stack, but that's fairly * involved. Much simpler to just not copy those live frames across. */ - int copy_thread(unsigned long clone_flags, unsigned long usp_thread_fn, - unsigned long thread_fn_arg, struct task_struct *p) + unsigned long kthread_arg, struct task_struct *p) { struct pt_regs *childregs = task_pt_regs(p); @@ -204,6 +203,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp_thread_fn, p-thread.sp = (unsigned long)childregs; if (!(p-flags PF_KTHREAD)) { + /* user thread */ struct pt_regs *regs = current_pt_regs(); unsigned long usp = usp_thread_fn ? usp_thread_fn : regs-areg[1]; @@ -254,13 +254,14 @@ int copy_thread(unsigned long clone_flags, unsigned long usp_thread_fn, if (clone_flags CLONE_SETTLS) childregs-threadptr = childregs-areg[5]; } else { + /* kernel thread */ p-thread.ra = MAKE_RA_FOR_CALL( (unsigned long)ret_from_kernel_thread, 1); /* pass parameters to ret_from_kernel_thread: * a2 = thread_fn, a3 = thread_fn arg */ - *((int *)childregs - 1) = thread_fn_arg; + *((int *)childregs - 1) = kthread_arg; *((int *)childregs - 2) = usp_thread_fn; /* Childregs are only used when we're going to userspace -- 2.0.0.GIT -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 25/32] score: copy_thread(): rename 'arg' argument to 'kthread_arg'
The 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()). Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- arch/score/kernel/process.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/score/kernel/process.c b/arch/score/kernel/process.c index a1519ad3..a72d15f 100644 --- a/arch/score/kernel/process.c +++ b/arch/score/kernel/process.c @@ -66,10 +66,10 @@ void exit_thread(void) {} void flush_thread(void) {} /* - * set up the kernel stack and exception frames for a new process + * Copy architecture-specific thread state */ int copy_thread(unsigned long clone_flags, unsigned long usp, - unsigned long arg, struct task_struct *p) + unsigned long kthread_arg, struct task_struct *p) { struct thread_info *ti = task_thread_info(p); struct pt_regs *childregs = task_pt_regs(p); @@ -77,11 +77,13 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, p-thread.reg0 = (unsigned long) childregs; if (unlikely(p-flags PF_KTHREAD)) { + /* kernel thread */ memset(childregs, 0, sizeof(struct pt_regs)); p-thread.reg12 = usp; - p-thread.reg13 = arg; + p-thread.reg13 = kthread_arg; p-thread.reg3 = (unsigned long) ret_from_kernel_thread; } else { + /* user thread */ *childregs = *current_pt_regs(); childregs-regs[7] = 0; /* Clear error flag */ childregs-regs[4] = 0; /* Child gets zero as return value */ -- 2.0.0.GIT -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 30/32] unicore32: copy_thread(): rename 'stk_sz' argument to 'kthread_arg'
'stk_sz' is misleading, since this argument is never used for a stack size. Rather, it is an argument passed to the main function executed by a new kernel thread. Therefore, rename it to 'kthread_arg'. Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- arch/unicore32/kernel/process.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/unicore32/kernel/process.c b/arch/unicore32/kernel/process.c index b008e99..11e19e0 100644 --- a/arch/unicore32/kernel/process.c +++ b/arch/unicore32/kernel/process.c @@ -227,9 +227,12 @@ void release_thread(struct task_struct *dead_task) asmlinkage void ret_from_fork(void) __asm__(ret_from_fork); asmlinkage void ret_from_kernel_thread(void) __asm__(ret_from_kernel_thread); +/* + * Copy architecture-specific thread state + */ int copy_thread(unsigned long clone_flags, unsigned long stack_start, - unsigned long stk_sz, struct task_struct *p) + unsigned long kthread_arg, struct task_struct *p) { struct thread_info *thread = task_thread_info(p); struct pt_regs *childregs = task_pt_regs(p); @@ -237,11 +240,13 @@ copy_thread(unsigned long clone_flags, unsigned long stack_start, memset(thread-cpu_context, 0, sizeof(struct cpu_context_save)); thread-cpu_context.sp = (unsigned long)childregs; if (unlikely(p-flags PF_KTHREAD)) { + /* kernel thread */ thread-cpu_context.pc = (unsigned long)ret_from_kernel_thread; thread-cpu_context.r4 = stack_start; - thread-cpu_context.r5 = stk_sz; + thread-cpu_context.r5 = kthread_arg; memset(childregs, 0, sizeof(struct pt_regs)); } else { + /* user thread */ thread-cpu_context.pc = (unsigned long)ret_from_fork; *childregs = *current_pt_regs(); childregs-UCreg_00 = 0; -- 2.0.0.GIT -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 29/32] um: copy_thread(): rename 'arg' argument to 'kthread_arg'
The 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()). Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- arch/um/kernel/process.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c index f17bca8..80ac9fe 100644 --- a/arch/um/kernel/process.c +++ b/arch/um/kernel/process.c @@ -149,8 +149,11 @@ void fork_handler(void) userspace(current-thread.regs.regs); } +/* + * Copy architecture-specific thread state + */ int copy_thread(unsigned long clone_flags, unsigned long sp, - unsigned long arg, struct task_struct * p) + unsigned long kthread_arg, struct task_struct *p) { void (*handler)(void); int kthread = current-flags PF_KTHREAD; @@ -159,6 +162,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, p-thread = (struct thread_struct) INIT_THREAD; if (!kthread) { + /* user thread */ memcpy(p-thread.regs.regs, current_pt_regs(), sizeof(p-thread.regs.regs)); PT_REGS_SET_SYSCALL_RETURN(p-thread.regs, 0); @@ -169,9 +173,10 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, arch_copy_thread(current-thread.arch, p-thread.arch); } else { + /* kernel thread */ get_safe_registers(p-thread.regs.regs.gp, p-thread.regs.regs.fp); p-thread.request.u.thread.proc = (int (*)(void *))sp; - p-thread.request.u.thread.arg = (void *)arg; + p-thread.request.u.thread.arg = (void *)kthread_arg; handler = new_thread_handler; } -- 2.0.0.GIT -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 23/32] powerpc: copy_thread(): rename 'arg' argument to 'kthread_arg'
The 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()). Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- arch/powerpc/kernel/process.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index b4cc7be..febb50d 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -1114,8 +1114,11 @@ static void setup_ksp_vsid(struct task_struct *p, unsigned long sp) */ extern unsigned long dscr_default; /* defined in arch/powerpc/kernel/sysfs.c */ +/* + * Copy architecture-specific thread state + */ int copy_thread(unsigned long clone_flags, unsigned long usp, - unsigned long arg, struct task_struct *p) + unsigned long kthread_arg, struct task_struct *p) { struct pt_regs *childregs, *kregs; extern void ret_from_fork(void); @@ -1127,6 +1130,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, sp -= sizeof(struct pt_regs); childregs = (struct pt_regs *) sp; if (unlikely(p-flags PF_KTHREAD)) { + /* kernel thread */ struct thread_info *ti = (void *)task_stack_page(p); memset(childregs, 0, sizeof(struct pt_regs)); childregs-gpr[1] = sp + sizeof(struct pt_regs); @@ -1137,11 +1141,12 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, clear_tsk_thread_flag(p, TIF_32BIT); childregs-softe = 1; #endif - childregs-gpr[15] = arg; + childregs-gpr[15] = kthread_arg; p-thread.regs = NULL; /* no user register state */ ti-flags |= _TIF_RESTOREALL; f = ret_from_kernel_thread; } else { + /* user thread */ struct pt_regs *regs = current_pt_regs(); CHECK_FULL_REGS(regs); *childregs = *regs; -- 2.0.0.GIT -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 31/32] x86: copy_thread(): rename 'arg' argument to 'kthread_arg'
The 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()). Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- arch/x86/kernel/process_32.c | 9 +++-- arch/x86/kernel/process_64.c | 9 +++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c index 603c4f9..efb4a6b 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c @@ -129,8 +129,11 @@ void release_thread(struct task_struct *dead_task) release_vm86_irqs(dead_task); } +/* + * Copy architecture-specific thread state + */ int copy_thread(unsigned long clone_flags, unsigned long sp, - unsigned long arg, struct task_struct *p) + unsigned long kthread_arg, struct task_struct *p) { struct pt_regs *childregs = task_pt_regs(p); struct task_struct *tsk; @@ -149,13 +152,15 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, childregs-es = __USER_DS; childregs-fs = __KERNEL_PERCPU; childregs-bx = sp; /* function */ - childregs-bp = arg; + childregs-bp = kthread_arg; childregs-orig_ax = -1; childregs-cs = __KERNEL_CS | get_kernel_rpl(); childregs-flags = X86_EFLAGS_IF | X86_EFLAGS_FIXED; p-thread.io_bitmap_ptr = NULL; return 0; } + + /* user thread */ *childregs = *current_pt_regs(); childregs-ax = 0; if (sp) diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c index 67fcc43..a27abb6 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c @@ -151,8 +151,11 @@ static inline u32 read_32bit_tls(struct task_struct *t, int tls) return get_desc_base(t-thread.tls_array[tls]); } +/* + * Copy architecture-specific thread state + */ int copy_thread(unsigned long clone_flags, unsigned long sp, - unsigned long arg, struct task_struct *p) + unsigned long kthread_arg, struct task_struct *p) { int err; struct pt_regs *childregs; @@ -179,12 +182,14 @@ int copy_thread(unsigned long clone_flags, unsigned long sp, childregs-sp = (unsigned long)childregs; childregs-ss = __KERNEL_DS; childregs-bx = sp; /* function */ - childregs-bp = arg; + childregs-bp = kthread_arg; childregs-orig_ax = -1; childregs-cs = __KERNEL_CS | get_kernel_rpl(); childregs-flags = X86_EFLAGS_IF | X86_EFLAGS_FIXED; return 0; } + + /* user thread */ *childregs = *current_pt_regs(); childregs-ax = 0; -- 2.0.0.GIT -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 26/32] sh: copy_thread(): rename 'arg' argument to 'kthread_arg'
The 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()). Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- arch/sh/kernel/process_32.c | 10 -- arch/sh/kernel/process_64.c | 12 +--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c index 2885fc9..fded1b4 100644 --- a/arch/sh/kernel/process_32.c +++ b/arch/sh/kernel/process_32.c @@ -123,8 +123,11 @@ EXPORT_SYMBOL(dump_fpu); asmlinkage void ret_from_fork(void); asmlinkage void ret_from_kernel_thread(void); +/* + * Copy architecture-specific thread state + */ int copy_thread(unsigned long clone_flags, unsigned long usp, - unsigned long arg, struct task_struct *p) + unsigned long kthread_arg, struct task_struct *p) { struct thread_info *ti = task_thread_info(p); struct pt_regs *childregs; @@ -146,9 +149,10 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, childregs = task_pt_regs(p); p-thread.sp = (unsigned long) childregs; if (unlikely(p-flags PF_KTHREAD)) { + /* kernel thread */ memset(childregs, 0, sizeof(struct pt_regs)); p-thread.pc = (unsigned long) ret_from_kernel_thread; - childregs-regs[4] = arg; + childregs-regs[4] = kthread_arg; childregs-regs[5] = usp; childregs-sr = SR_MD; #if defined(CONFIG_SH_FPU) @@ -159,6 +163,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, p-thread.fpu_counter = 0; return 0; } + + /* user thread */ *childregs = *current_pt_regs(); if (usp) diff --git a/arch/sh/kernel/process_64.c b/arch/sh/kernel/process_64.c index e2062e6..693105d 100644 --- a/arch/sh/kernel/process_64.c +++ b/arch/sh/kernel/process_64.c @@ -371,8 +371,11 @@ EXPORT_SYMBOL(dump_fpu); asmlinkage void ret_from_fork(void); asmlinkage void ret_from_kernel_thread(void); +/* + * Copy architecture-specific thread state + */ int copy_thread(unsigned long clone_flags, unsigned long usp, - unsigned long arg, struct task_struct *p) + unsigned long kthread_arg, struct task_struct *p) { struct pt_regs *childregs; @@ -391,14 +394,17 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, p-thread.sp = (unsigned long) childregs; if (unlikely(p-flags PF_KTHREAD)) { + /* kernel thread */ memset(childregs, 0, sizeof(struct pt_regs)); - childregs-regs[2] = (unsigned long)arg; - childregs-regs[3] = (unsigned long)usp; + childregs-regs[2] = kthread_arg; + childregs-regs[3] = usp; childregs-sr = (1 30); /* not user_mode */ childregs-sr |= SR_FD; /* Invalidate FPU flag */ p-thread.pc = (unsigned long) ret_from_kernel_thread; return 0; } + + /* user thread */ *childregs = *current_pt_regs(); /* -- 2.0.0.GIT -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ath10k: htc: match wait_for_completion_timeout return type
Return type of wait_for_completion_timeout is unsigned long not int. An appropriately named unsigned long is added and the assignments fixed up. Signed-off-by: Nicholas Mc Guire hof...@osadl.org --- Patch was only compile tested with x86_64_defconfig + CONFIG_ATH_CARDS=m, CONFIG_ATH10K=m Patch is against 4.0-rc3 (localversion-next is -next-20150313) drivers/net/wireless/ath/ath10k/htc.c | 23 +-- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c index 2fd9e18..690a2f5 100644 --- a/drivers/net/wireless/ath/ath10k/htc.c +++ b/drivers/net/wireless/ath/ath10k/htc.c @@ -548,6 +548,7 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc) { struct ath10k *ar = htc-ar; int i, status = 0; + unsigned long time_left; struct ath10k_htc_svc_conn_req conn_req; struct ath10k_htc_svc_conn_resp conn_resp; struct ath10k_htc_msg *msg; @@ -555,9 +556,9 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc) u16 credit_count; u16 credit_size; - status = wait_for_completion_timeout(htc-ctl_resp, -ATH10K_HTC_WAIT_TIMEOUT_HZ); - if (status == 0) { + time_left = wait_for_completion_timeout(htc-ctl_resp, + ATH10K_HTC_WAIT_TIMEOUT_HZ); + if (!time_left) { /* Workaround: In some cases the PCI HIF doesn't * receive interrupt for the control response message * even if the buffer was completed. It is suspected @@ -569,10 +570,11 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc) for (i = 0; i CE_COUNT; i++) ath10k_hif_send_complete_check(htc-ar, i, 1); - status = wait_for_completion_timeout(htc-ctl_resp, - ATH10K_HTC_WAIT_TIMEOUT_HZ); + time_left = + wait_for_completion_timeout(htc-ctl_resp, + ATH10K_HTC_WAIT_TIMEOUT_HZ); - if (status == 0) + if (!time_left) status = -ETIMEDOUT; } @@ -646,6 +648,7 @@ int ath10k_htc_connect_service(struct ath10k_htc *htc, struct sk_buff *skb; unsigned int max_msg_size = 0; int length, status; + unsigned long time_left; bool disable_credit_flow_ctrl = false; u16 message_id, service_id, flags = 0; u8 tx_alloc = 0; @@ -701,10 +704,10 @@ int ath10k_htc_connect_service(struct ath10k_htc *htc, } /* wait for response */ - status = wait_for_completion_timeout(htc-ctl_resp, -ATH10K_HTC_CONN_SVC_TIMEOUT_HZ); - if (status == 0) { - ath10k_err(ar, Service connect timeout: %d\n, status); + time_left = wait_for_completion_timeout(htc-ctl_resp, + ATH10K_HTC_CONN_SVC_TIMEOUT_HZ); + if (!time_left) { + ath10k_err(ar, Service connect timeout\n); return -ETIMEDOUT; } -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC] capabilities: Ambient capabilities
On Fri, Mar 13, 2015 at 11:52 AM, Kees Cook keesc...@chromium.org wrote: All this said, almost half of the capabilities, if passed to flawed children with attacker controlled execution, can be elevated to full root privileges pretty easily[1], so I think any documentation around this feature should include some pretty dire warnings about using this. That's a good point. I'll make sure to document that. It's worth noting that, for many applications, that list is overstated. For example, many of the suggested privilege escalations don't work if you're in a sufficiently restrictive mount namespace. For my own use, I plan on adding only CAP_NET_BIND_SERVICE and CAP_NET_RAW to pA, and I'll be layering seccomp on top to the extent possible. --Andy -Kees [1] https://forums.grsecurity.net/viewtopic.php?f=7t=2522 -- Kees Cook Chrome OS Security -- Andy Lutomirski AMA Capital Management, LLC -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 0/2] drm/msm: Add support for NV12MT format in mdp4
Resending a v2 on behalf of Beeresh with comments from Daniel and Rob addressed. Beeresh Gopal (2): drm/msm: update generated headers drm/msm/mdp4: Support NV12MT format in mdp4 drivers/gpu/drm/msm/mdp/mdp4/mdp4.xml.h | 36 --- drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c | 2 ++ drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c | 22 +++ include/uapi/drm/drm_fourcc.h | 5 + 4 files changed, 43 insertions(+), 22 deletions(-) -- Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 2/2] drm/msm/mdp4: Support NV12MT format in mdp4
From: Beeresh Gopal gbeer...@codeaurora.org Using fb modifier flag, support NV12MT format in MDP4. v2: - rework the modifier's description [Daniel Vetter's comment] - drop .set_mode_config() callback [Rob Clark's comment] Signed-off-by: Beeresh Gopal gbeer...@codeaurora.org Signed-off-by: Stephane Viau sv...@codeaurora.org --- drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c | 2 ++ drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c | 22 ++ include/uapi/drm/drm_fourcc.h | 5 + 3 files changed, 29 insertions(+) diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c index d81e19d..6387881 100644 --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c @@ -119,6 +119,8 @@ static int mdp4_hw_init(struct msm_kms *kms) if (mdp4_kms-rev 1) mdp4_write(mdp4_kms, REG_MDP4_RESET_STATUS, 1); + dev-mode_config.allow_fb_modifiers = true; + out: pm_runtime_put_sync(dev-dev); diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c index cde2500..2c2d6a5 100644 --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c @@ -33,6 +33,21 @@ struct mdp4_plane { }; #define to_mdp4_plane(x) container_of(x, struct mdp4_plane, base) +/* MDP format helper functions */ +static inline +enum mdp4_frame_format mdp4_get_frame_format(struct drm_framebuffer *fb) +{ + bool is_tile = false; + + if (fb-modifier[1] == DRM_FORMAT_MOD_SAMSUNG_64_32_TILE) + is_tile = true; + + if (fb-pixel_format == DRM_FORMAT_NV12 is_tile) + return FRAME_TILE_YCBCR_420; + + return FRAME_LINEAR; +} + static void mdp4_plane_set_scanout(struct drm_plane *plane, struct drm_framebuffer *fb); static int mdp4_plane_mode_set(struct drm_plane *plane, @@ -203,6 +218,7 @@ static int mdp4_plane_mode_set(struct drm_plane *plane, uint32_t op_mode = 0; uint32_t phasex_step = MDP4_VG_PHASE_STEP_DEFAULT; uint32_t phasey_step = MDP4_VG_PHASE_STEP_DEFAULT; + enum mdp4_frame_format frame_type = mdp4_get_frame_format(fb); if (!(crtc fb)) { DBG(%s: disabled!, mdp4_plane-name); @@ -302,6 +318,7 @@ static int mdp4_plane_mode_set(struct drm_plane *plane, MDP4_PIPE_SRC_FORMAT_UNPACK_COUNT(format-unpack_count - 1) | MDP4_PIPE_SRC_FORMAT_FETCH_PLANES(format-fetch_type) | MDP4_PIPE_SRC_FORMAT_CHROMA_SAMP(format-chroma_sample) | + MDP4_PIPE_SRC_FORMAT_FRAME_FORMAT(frame_type) | COND(format-unpack_tight, MDP4_PIPE_SRC_FORMAT_UNPACK_TIGHT)); mdp4_write(mdp4_kms, REG_MDP4_PIPE_SRC_UNPACK(pipe), @@ -322,6 +339,11 @@ static int mdp4_plane_mode_set(struct drm_plane *plane, mdp4_write(mdp4_kms, REG_MDP4_PIPE_PHASEX_STEP(pipe), phasex_step); mdp4_write(mdp4_kms, REG_MDP4_PIPE_PHASEY_STEP(pipe), phasey_step); + if (frame_type != FRAME_LINEAR) + mdp4_write(mdp4_kms, REG_MDP4_PIPE_SSTILE_FRAME_SIZE(pipe), + MDP4_PIPE_SSTILE_FRAME_SIZE_WIDTH(src_w) | + MDP4_PIPE_SSTILE_FRAME_SIZE_HEIGHT(src_h)); + return 0; } diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h index 188e61f..2ff79cb 100644 --- a/include/uapi/drm/drm_fourcc.h +++ b/include/uapi/drm/drm_fourcc.h @@ -161,4 +161,9 @@ * authoritative source for all of these. */ +/* Samsung framebuffer modifiers */ + +/* Tiled: 64x32 pixel macroblocks */ +#define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1) + #endif /* DRM_FOURCC_H */ -- Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[GIT PULL] at91: cleanup for 4.1 #2
Arnd, Olof, Kevin, Another cleanup series on top of the previous one that I sent you this afternoon ;-) I think it is the last time that we can remove a whole bunch of files and legacy code... We were getting used to it! I still have another one dealing with at91rm9200 ST cleanup that I plan to send early next week (dependencies between trees to solve). Thanks, best regards, The following changes since commit 385acc0dac88d79447a03a1363072fc258429dec: ARM: at91/pm: flush data cache and clean, invalidate and disable the L2 cache (2015-03-13 13:34:55 +0100) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/nferre/linux-at91.git tags/at91-cleanup2 for you to fetch changes up to 598e085590fc5ac1fecff00e842a8a6c2ae010e5: ARM: at91: remove old setup (2015-03-13 18:01:10 +0100) Second batch of cleanup for 4.1: - remove unused matrix header files - dbgu + chip identification: new driver for SoC detection this allow to remove all additional io mapping - remove old non-standard AT91 setup code Alexandre Belloni (8): ARM: at91: remove unused at91_ioremap_matrix and header ARM: at91: remove unused _matrix.h headers ARM: at91/dt: introduce atmel,chip-dbgu ARM: at91: at91rm9200 use SoC detection infrastructure ARM: at91: at91sam9: use SoC detection infrastructure ARM: at91: sama5 use SoC detection infrastructure ARM: at91: sama5d4: remove useless map_io ARM: at91: remove old setup Arnd Bergmann (1): ARM: at91: remove NEED_MACH_IO_H Boris BREZILLON (1): ARM: at91: add soc detection infrastructure .../devicetree/bindings/serial/atmel-usart.txt | 3 +- arch/arm/Kconfig | 2 +- arch/arm/boot/dts/at91rm9200.dtsi | 2 +- arch/arm/boot/dts/at91sam9260.dtsi | 2 +- arch/arm/boot/dts/at91sam9261.dtsi | 2 +- arch/arm/boot/dts/at91sam9263.dtsi | 2 +- arch/arm/boot/dts/at91sam9g45.dtsi | 2 +- arch/arm/boot/dts/at91sam9n12.dtsi | 2 +- arch/arm/boot/dts/at91sam9rl.dtsi | 2 +- arch/arm/boot/dts/at91sam9x5.dtsi | 2 +- arch/arm/boot/dts/sama5d3.dtsi | 2 +- arch/arm/boot/dts/sama5d4.dtsi | 2 +- arch/arm/mach-at91/Kconfig | 1 + arch/arm/mach-at91/Makefile| 2 +- arch/arm/mach-at91/at91rm9200.c| 29 +- arch/arm/mach-at91/at91sam9.c | 76 +++-- arch/arm/mach-at91/generic.h | 4 - arch/arm/mach-at91/include/mach/at91_matrix.h | 23 -- .../mach-at91/include/mach/at91sam9260_matrix.h| 80 - .../mach-at91/include/mach/at91sam9261_matrix.h| 64 .../mach-at91/include/mach/at91sam9263_matrix.h| 129 .../mach-at91/include/mach/at91sam9g45_matrix.h| 153 -- .../mach-at91/include/mach/at91sam9n12_matrix.h| 53 .../arm/mach-at91/include/mach/at91sam9rl_matrix.h | 96 -- .../arm/mach-at91/include/mach/at91sam9x5_matrix.h | 53 arch/arm/mach-at91/include/mach/io.h | 27 -- arch/arm/mach-at91/sama5.c | 81 +++-- arch/arm/mach-at91/setup.c | 330 - arch/arm/mach-at91/soc.c | 97 ++ arch/arm/mach-at91/soc.h | 78 + drivers/pcmcia/Kconfig | 1 + drivers/pcmcia/at91_cf.c | 13 +- 32 files changed, 301 insertions(+), 1114 deletions(-) delete mode 100644 arch/arm/mach-at91/include/mach/at91_matrix.h delete mode 100644 arch/arm/mach-at91/include/mach/at91sam9260_matrix.h delete mode 100644 arch/arm/mach-at91/include/mach/at91sam9261_matrix.h delete mode 100644 arch/arm/mach-at91/include/mach/at91sam9263_matrix.h delete mode 100644 arch/arm/mach-at91/include/mach/at91sam9g45_matrix.h delete mode 100644 arch/arm/mach-at91/include/mach/at91sam9n12_matrix.h delete mode 100644 arch/arm/mach-at91/include/mach/at91sam9rl_matrix.h delete mode 100644 arch/arm/mach-at91/include/mach/at91sam9x5_matrix.h delete mode 100644 arch/arm/mach-at91/include/mach/io.h delete mode 100644 arch/arm/mach-at91/setup.c create mode 100644 arch/arm/mach-at91/soc.c create mode 100644 arch/arm/mach-at91/soc.h -- Nicolas Ferre -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 4/4] x86/fpu: don't abuse drop_init_fpu() in flush_thread()
flush_thread() - drop_init_fpu() is suboptimal and confusing. It does drop_fpu() or restore_init_xstate() depending on !use_eager_fpu(). But flush_thread() too checks eagerfpu right after that, and if it is true then restore_init_xstate() just burns CPU for no reason. We are going to load init_xstate_buf again after we set used_math/user_has_fpu, until then the FPU state can't survive after switch_to(). Remove it, and change the if (!use_eager_fpu()) to call drop_fpu(). While at it, clean up the tsk/current usage. Signed-off-by: Oleg Nesterov o...@redhat.com --- arch/x86/kernel/process.c | 15 ++- 1 files changed, 6 insertions(+), 9 deletions(-) diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index c396de2..c236306 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c @@ -131,17 +131,14 @@ void flush_thread(void) flush_ptrace_hw_breakpoint(tsk); memset(tsk-thread.tls_array, 0, sizeof(tsk-thread.tls_array)); - drop_init_fpu(tsk); - /* -* Free the FPU state for non xsave platforms. They get reallocated -* lazily at the first use. -*/ - if (!use_eager_fpu()) + if (!use_eager_fpu()) { + /* FPU state will be reallocated lazily at the first use. */ + drop_fpu(tsk); free_thread_xstate(tsk); - else if (!used_math()) { + } else if (!used_math()) { /* kthread execs. TODO: cleanup this horror. */ - if (WARN_ON(init_fpu(current))) - force_sig(SIGKILL, current); + if (WARN_ON(init_fpu(tsk))) + force_sig(SIGKILL, tsk); user_fpu_begin(); restore_init_xstate(); } -- 1.5.5.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 03/12] tty: serial: Remove orphaned serial driver
This driver is orphaned now that mach-msm has been removed. Delete it. Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: David Brown dav...@codeaurora.org Cc: Bryan Huntsman bry...@codeaurora.org Cc: Daniel Walker dwal...@fifo99.com Signed-off-by: Stephen Boyd sb...@codeaurora.org --- This can be acked and go through arm-soc or applied directly to serial tree. drivers/tty/serial/Kconfig | 12 - drivers/tty/serial/Makefile |1 - drivers/tty/serial/msm_serial_hs.c | 1874 --- include/linux/platform_data/msm_serial_hs.h | 49 - 4 files changed, 1936 deletions(-) delete mode 100644 drivers/tty/serial/msm_serial_hs.c delete mode 100644 include/linux/platform_data/msm_serial_hs.h diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index d2501f01cd03..965c80f9fc50 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig @@ -1063,18 +1063,6 @@ config SERIAL_MSM_CONSOLE select SERIAL_CORE_CONSOLE select SERIAL_EARLYCON -config SERIAL_MSM_HS - tristate MSM UART High Speed: Serial Driver - depends on ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50 - select SERIAL_CORE - help - If you have a machine based on MSM family of SoCs, you - can enable its onboard high speed serial port by enabling - this option. - - Choose M here to compile it as a module. The module will be - called msm_serial_hs. - config SERIAL_VT8500 bool VIA VT8500 on-chip serial port support depends on ARCH_VT8500 diff --git a/drivers/tty/serial/Makefile b/drivers/tty/serial/Makefile index 599be4b05a26..91565e8d2e4c 100644 --- a/drivers/tty/serial/Makefile +++ b/drivers/tty/serial/Makefile @@ -62,7 +62,6 @@ obj-$(CONFIG_SERIAL_SGI_IOC3) += ioc3_serial.o obj-$(CONFIG_SERIAL_ATMEL) += atmel_serial.o obj-$(CONFIG_SERIAL_UARTLITE) += uartlite.o obj-$(CONFIG_SERIAL_MSM) += msm_serial.o -obj-$(CONFIG_SERIAL_MSM_HS) += msm_serial_hs.o obj-$(CONFIG_SERIAL_NETX) += netx-serial.o obj-$(CONFIG_SERIAL_OF_PLATFORM) += of_serial.o obj-$(CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL) += nwpserial.o diff --git a/drivers/tty/serial/msm_serial_hs.c b/drivers/tty/serial/msm_serial_hs.c deleted file mode 100644 index 62da8534ba75.. --- a/drivers/tty/serial/msm_serial_hs.c +++ /dev/null @@ -1,1874 +0,0 @@ -/* - * MSM 7k/8k High speed uart driver - * - * Copyright (c) 2007-2011, Code Aurora Forum. All rights reserved. - * Copyright (c) 2008 Google Inc. - * Modified: Nick Pelly npe...@google.com - * - * 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. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * Has optional support for uart power management independent of linux - * suspend/resume: - * - * RX wakeup. - * UART wakeup can be triggered by RX activity (using a wakeup GPIO on the - * UART RX pin). This should only be used if there is not a wakeup - * GPIO on the UART CTS, and the first RX byte is known (for example, with the - * Bluetooth Texas Instruments HCILL protocol), since the first RX byte will - * always be lost. RTS will be asserted even while the UART is off in this mode - * of operation. See msm_serial_hs_platform_data.rx_wakeup_irq. - */ - -#include linux/module.h - -#include linux/serial.h -#include linux/serial_core.h -#include linux/tty.h -#include linux/tty_flip.h -#include linux/slab.h -#include linux/init.h -#include linux/interrupt.h -#include linux/irq.h -#include linux/io.h -#include linux/ioport.h -#include linux/kernel.h -#include linux/timer.h -#include linux/clk.h -#include linux/platform_device.h -#include linux/pm_runtime.h -#include linux/dma-mapping.h -#include linux/dmapool.h -#include linux/wait.h -#include linux/workqueue.h - -#include linux/atomic.h -#include asm/irq.h - -#include mach/hardware.h -#include mach/dma.h -#include linux/platform_data/msm_serial_hs.h - -/* HSUART Registers */ -#define UARTDM_MR1_ADDR 0x0 -#define UARTDM_MR2_ADDR 0x4 - -/* Data Mover result codes */ -#define RSLT_FIFO_CNTR_BMSK (0xE 28) -#define RSLT_VLDBIT(1) - -/* write only register */ -#define UARTDM_CSR_ADDR 0x8 -#define UARTDM_CSR_115200 0xFF -#define UARTDM_CSR_57600 0xEE -#define UARTDM_CSR_38400 0xDD -#define UARTDM_CSR_28800 0xCC -#define UARTDM_CSR_19200 0xBB -#define UARTDM_CSR_14400 0xAA -#define UARTDM_CSR_9600 0x99 -#define UARTDM_CSR_7200 0x88 -#define UARTDM_CSR_4800 0x77 -#define UARTDM_CSR_3600 0x66 -#define UARTDM_CSR_2400 0x55 -#define UARTDM_CSR_1200 0x44 -#define UARTDM_CSR_6000x33 -#define UARTDM_CSR_3000x22 -#define UARTDM_CSR_1500x11
[PATCH 09/12] usb: phy: msm: Remove dead code
This code is no longer used now that mach-msm has been removed. Delete it. Cc: Felipe Balbi ba...@ti.com Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: linux-...@vger.kernel.org Cc: David Brown dav...@codeaurora.org Cc: Bryan Huntsman bry...@codeaurora.org Cc: Daniel Walker dwal...@fifo99.com Signed-off-by: Stephen Boyd sb...@codeaurora.org --- This needs an ack to go through arm-soc with patch 1 that removes the platform code using these ops. drivers/usb/phy/Kconfig | 2 +- drivers/usb/phy/phy-msm-usb.c | 18 ++ include/linux/usb/msm_hsusb.h | 4 3 files changed, 3 insertions(+), 21 deletions(-) diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig index 52d3d58252e1..2fb3828b5089 100644 --- a/drivers/usb/phy/Kconfig +++ b/drivers/usb/phy/Kconfig @@ -139,7 +139,7 @@ config USB_ISP1301 config USB_MSM_OTG tristate Qualcomm on-chip USB OTG controller support - depends on (USB || USB_GADGET) (ARCH_MSM || ARCH_QCOM || COMPILE_TEST) + depends on (USB || USB_GADGET) (ARCH_QCOM || COMPILE_TEST) depends on RESET_CONTROLLER select USB_PHY help diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c index 000fd892455f..b50c45c62da7 100644 --- a/drivers/usb/phy/phy-msm-usb.c +++ b/drivers/usb/phy/phy-msm-usb.c @@ -263,9 +263,7 @@ static int msm_otg_link_clk_reset(struct msm_otg *motg, bool assert) { int ret; - if (motg-pdata-link_clk_reset) - ret = motg-pdata-link_clk_reset(motg-clk, assert); - else if (assert) + if (assert) ret = reset_control_assert(motg-link_rst); else ret = reset_control_deassert(motg-link_rst); @@ -281,9 +279,7 @@ static int msm_otg_phy_clk_reset(struct msm_otg *motg) { int ret = 0; - if (motg-pdata-phy_clk_reset) - ret = motg-pdata-phy_clk_reset(motg-phy_reset_clk); - else if (motg-phy_rst) + if (motg-phy_rst) ret = reset_control_reset(motg-phy_rst); if (ret) @@ -1551,16 +1547,6 @@ static int msm_otg_probe(struct platform_device *pdev) phy = motg-phy; phy-dev = pdev-dev; - if (motg-pdata-phy_clk_reset) { - motg-phy_reset_clk = devm_clk_get(pdev-dev, - np ? phy : usb_phy_clk); - - if (IS_ERR(motg-phy_reset_clk)) { - dev_err(pdev-dev, failed to get usb_phy_clk\n); - return PTR_ERR(motg-phy_reset_clk); - } - } - motg-clk = devm_clk_get(pdev-dev, np ? core : usb_hs_clk); if (IS_ERR(motg-clk)) { dev_err(pdev-dev, failed to get usb_hs_clk\n); diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h index b0a39243295a..7dbecf9a4656 100644 --- a/include/linux/usb/msm_hsusb.h +++ b/include/linux/usb/msm_hsusb.h @@ -117,8 +117,6 @@ struct msm_otg_platform_data { enum otg_control_type otg_control; enum msm_usb_phy_type phy_type; void (*setup_gpio)(enum usb_otg_state state); - int (*link_clk_reset)(struct clk *link_clk, bool assert); - int (*phy_clk_reset)(struct clk *phy_clk); }; /** @@ -128,7 +126,6 @@ struct msm_otg_platform_data { * @irq: IRQ number assigned for HSUSB controller. * @clk: clock struct of usb_hs_clk. * @pclk: clock struct of usb_hs_pclk. - * @phy_reset_clk: clock struct of usb_phy_clk. * @core_clk: clock struct of usb_hs_core_clk. * @regs: ioremapped register base address. * @inputs: OTG state machine inputs(Id, SessValid etc). @@ -148,7 +145,6 @@ struct msm_otg { int irq; struct clk *clk; struct clk *pclk; - struct clk *phy_reset_clk; struct clk *core_clk; void __iomem *regs; #define ID 0 -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 06/12] mmc: Remove msm_sdcc driver
This driver is orphaned now that mach-msm has been removed. Delete it. Cc: Ulf Hansson ulf.hans...@linaro.org Cc: Chris Ball ch...@printf.net Cc: David Brown dav...@codeaurora.org Cc: Bryan Huntsman bry...@codeaurora.org Cc: Daniel Walker dwal...@fifo99.com Signed-off-by: Stephen Boyd sb...@codeaurora.org --- I'd appreciate an ack here from mmc maintainers so this can go with patch 1 through arm-soc. drivers/mmc/host/Kconfig |8 - drivers/mmc/host/Makefile |1 - drivers/mmc/host/msm_sdcc.c| 1474 drivers/mmc/host/msm_sdcc.h| 256 - include/linux/platform_data/mmc-msm_sdcc.h | 27 - 5 files changed, 1766 deletions(-) delete mode 100644 drivers/mmc/host/msm_sdcc.c delete mode 100644 drivers/mmc/host/msm_sdcc.h delete mode 100644 include/linux/platform_data/mmc-msm_sdcc.h diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index 61ac63a3776a..37d1d80fdf04 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -393,14 +393,6 @@ config MMC_SDHCI_MSM If unsure, say N. -config MMC_MSM - tristate Qualcomm SDCC Controller Support - depends on MMC (ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50) - help - This provides support for the SD/MMC cell found in the - MSM and QSD SOCs from Qualcomm. The controller also has - support for SDIO devices. - config MMC_MXC tristate Freescale i.MX21/27/31 or MPC512x Multimedia Card support depends on ARCH_MXC || PPC_MPC512x diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile index 6a7cfe0de332..47f9421d0281 100644 --- a/drivers/mmc/host/Makefile +++ b/drivers/mmc/host/Makefile @@ -24,7 +24,6 @@ obj-$(CONFIG_MMC_OMAP)+= omap.o obj-$(CONFIG_MMC_OMAP_HS) += omap_hsmmc.o obj-$(CONFIG_MMC_ATMELMCI) += atmel-mci.o obj-$(CONFIG_MMC_TIFM_SD) += tifm_sd.o -obj-$(CONFIG_MMC_MSM) += msm_sdcc.o obj-$(CONFIG_MMC_MVSDIO) += mvsdio.o obj-$(CONFIG_MMC_DAVINCI) += davinci_mmc.o obj-$(CONFIG_MMC_GOLDFISH) += android-goldfish.o diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c deleted file mode 100644 index 90c60fd4ff6e.. --- a/drivers/mmc/host/msm_sdcc.c +++ /dev/null @@ -1,1474 +0,0 @@ -/* - * linux/drivers/mmc/host/msm_sdcc.c - Qualcomm MSM 7X00A SDCC Driver - * - * Copyright (C) 2007 Google Inc, - * Copyright (C) 2003 Deep Blue Solutions, Ltd, All Rights Reserved. - * Copyright (C) 2009, Code Aurora Forum. All Rights Reserved. - * - * 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. - * - * Based on mmci.c - * - * Author: San Mehat (s...@android.com) - * - */ - -#include linux/module.h -#include linux/moduleparam.h -#include linux/init.h -#include linux/ioport.h -#include linux/device.h -#include linux/interrupt.h -#include linux/delay.h -#include linux/err.h -#include linux/highmem.h -#include linux/log2.h -#include linux/mmc/host.h -#include linux/mmc/card.h -#include linux/mmc/sdio.h -#include linux/clk.h -#include linux/scatterlist.h -#include linux/platform_device.h -#include linux/dma-mapping.h -#include linux/debugfs.h -#include linux/io.h -#include linux/memory.h -#include linux/gfp.h -#include linux/gpio.h - -#include asm/cacheflush.h -#include asm/div64.h -#include asm/sizes.h - -#include linux/platform_data/mmc-msm_sdcc.h -#include mach/dma.h -#include mach/clk.h - -#include msm_sdcc.h - -#define DRIVER_NAME msm-sdcc - -#define BUSCLK_PWRSAVE 1 -#define BUSCLK_TIMEOUT (HZ) -static unsigned int msmsdcc_fmin = 144000; -static unsigned int msmsdcc_fmax = 5000; -static unsigned int msmsdcc_4bit = 1; -static unsigned int msmsdcc_pwrsave = 1; -static unsigned int msmsdcc_piopoll = 1; -static unsigned int msmsdcc_sdioirq; - -#define PIO_SPINMAX 30 -#define CMD_SPINMAX 20 - - -static inline void -msmsdcc_disable_clocks(struct msmsdcc_host *host, int deferr) -{ - WARN_ON(!host-clks_on); - - BUG_ON(host-curr.mrq); - - if (deferr) { - mod_timer(host-busclk_timer, jiffies + BUSCLK_TIMEOUT); - } else { - del_timer_sync(host-busclk_timer); - /* Need to check clks_on again in case the busclk -* timer fired -*/ - if (host-clks_on) { - clk_disable(host-clk); - clk_disable(host-pclk); - host-clks_on = 0; - } - } -} - -static inline int -msmsdcc_enable_clocks(struct msmsdcc_host *host) -{ - int rc; - - del_timer_sync(host-busclk_timer); - - if (!host-clks_on) { - rc = clk_enable(host-pclk); - if (rc) - return rc; - rc = clk_enable(host-clk); - if
[PATCH 11/12] ufs-qcom: Switch dependency to ARCH_QCOM
This device only exists on platforms under ARCH_QCOM, not ARCH_MSM. Cc: Yaniv Gardi yga...@codeaurora.org Cc: Dov Levenglick d...@codeaurora.org Cc: Christoph Hellwig h...@lst.de Cc: David Brown dav...@codeaurora.org Cc: Bryan Huntsman bry...@codeaurora.org Cc: Daniel Walker dwal...@fifo99.com Signed-off-by: Stephen Boyd sb...@codeaurora.org --- This can be acked and go through arm-soc or applied directly. drivers/scsi/ufs/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/Kconfig b/drivers/scsi/ufs/Kconfig index 8a1f4b355416..e94538362536 100644 --- a/drivers/scsi/ufs/Kconfig +++ b/drivers/scsi/ufs/Kconfig @@ -73,7 +73,7 @@ config SCSI_UFSHCD_PLATFORM config SCSI_UFS_QCOM bool QCOM specific hooks to UFS controller platform driver - depends on SCSI_UFSHCD_PLATFORM ARCH_MSM + depends on SCSI_UFSHCD_PLATFORM ARCH_QCOM select PHY_QCOM_UFS help This selects the QCOM specific additions to UFSHCD platform driver. -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] x86: simplify task_pt_regs() macro definition
On Fri, 13 Mar 2015 15:09:03 +0100 Denys Vlasenko dvlas...@redhat.com wrote: Before this change, task_pt_regs() was using KSTK_TOP(), and it was the only use of that macro. In turn, KSTK_TOP used THREAD_SIZE_LONGS, and it was the only use of that macro too. Fold these macros into task_pt_regs(). Tweak comment about - 8 - we now use a symbolic constant, not literal 8. I wonder if we should mention 8 at all? As for the patch, from what I can tell, it keeps the same logic. Reviewed-by: Steven Rostedt rost...@goodmis.org -- Steve Signed-off-by: Denys Vlasenko dvlas...@redhat.com CC: Linus Torvalds torva...@linux-foundation.org CC: Steven Rostedt rost...@goodmis.org CC: Ingo Molnar mi...@kernel.org CC: Borislav Petkov b...@alien8.de CC: H. Peter Anvin h...@zytor.com CC: Andy Lutomirski l...@amacapital.net CC: Oleg Nesterov o...@redhat.com CC: Frederic Weisbecker fweis...@gmail.com CC: Alexei Starovoitov a...@plumgrid.com CC: Will Drewry w...@chromium.org CC: Kees Cook keesc...@chromium.org CC: x...@kernel.org CC: linux-kernel@vger.kernel.org --- arch/x86/include/asm/processor.h | 20 ++-- 1 file changed, 6 insertions(+), 14 deletions(-) -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] mm/slub: fix lockups on PREEMPT !SMP kernels
On Fri, 13 Mar 2015, Mark Rutland wrote: w.r.t. CONFIG_PREEMPT, git grep tells me otherwise: Grep does not tell you what is deployed. Its more of a reflection of the thought of the kernel devs what they think are reasonable configurations. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] phy: Add a driver for dm816x USB PHY
Given that the documentation mentions the actual phy used, it may be worth mentioning this also in the driver? i.e. that it's not a dm816x phy but a SR70LX Synopsys USB 2.0 OTG nanoPHY (in contrast to the dm814x and am335x which use a phy TI made themselves) USB is one of the few subsystems of the DM814x I've never really examined in any detail, but it appears nearly identical to the AM335x. (e.g. the phy registers in the control module are nearly identical, differing only in some bits related to GPIO-mode) On 9 March 2015 at 22:41, Tony Lindgren t...@atomide.com wrote: Note that we still are missing basic support for dm814x in mainline, I'm planning to tackle that at some point but I don't know when I'm going to get to it.. Do ping me if you have questions. While I still don't have time to really throw myself on the task myself, and I'm still hindered by insufficient knowledge of the kernel, I do have quite a bit of experience with the processor itself. BTW, w.r.t. the old official TI kernel for dm81xx: there are actually two relevant forks of the unmaintained arago-omap3/ti81xx-master branch, namely: http://arago-project.org/git/projects/?p=linux-ipnc-rdk-dm81xx.git http://arago-project.org/git/projects/?p=linux-dvr-rdk-dm81xx.git which contain various bugfixes, including for usb (though also patches specific to those SDKs). -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v4 3/9] selftests: Introduce minimal shared logic for running tests
On 03/10/2015 10:05 PM, Michael Ellerman wrote: This adds a Make include file which most selftests can then include to get the run_tests logic. On its own this has the advantage of some reduction in repetition, and also means the pass/fail message is defined in fewer places. However the key advantage is it will allow us to implement install very simply in a subsequent patch. The default implementation just executes each program in $(TEST_PROGS). We use a variable to hold the default implementation of $(RUN_TESTS) because that gives us a clean way to override it if necessary, ie. using override. The mount, memory-hotplug and mqueue tests use that to provide a different implementation. Tests are not run via /bin/bash, so if they are scripts they must be executable, we add a+x to several. Signed-off-by: Michael Ellerman m...@ellerman.id.au This patch will be applied to next and queued for 4.1. -- Shuah -- Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) shua...@osg.samsung.com | (970) 217-8978 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC][PATCH 1/2] fs proc: make pagemap a privileged interface
Dave Hansen d...@sr71.net writes: On 03/12/2015 03:35 PM, Andrew Morton wrote: On Mon, 09 Mar 2015 13:43:21 -0700 Dave Hansen d...@sr71.net wrote: From: Dave Hansen dave.han...@linux.intel.com Physical addresses are sensitive information. There are existing, known exploits that are made easier if physical information is available. Here is one example: http://www.cs.columbia.edu/~vpk/papers/ret2dir.sec14.pdf Do we really need to disable pagemap entirely? What happens if we just obscure the addresses (ie: zero them)? I think we have 3 basic options: 1. Disable it entirely (-EPERM or whatever). Apps using it break quickly and fairly obviously (diagnosable with an strace) 2. Zero it, or return some nonsensical thing for the physical address portion, but maintain exporting the PTE flags. Apps only caring about PTE flags work, but anything trying to do lookups in /proc/kpageflags break. If we zero it, apps pay get confused thinking they have the _actual_ pfn=0. 3. Scramble it in some way obscuring the physical address. Unscramble it upon access to /proc/kpageflags. I think you're suggesting (2). Doesn't that risk silently breaking apps? I think 3 where the scramble is something like AES crypto is likely to scramble this well and still protect us from plain text attacks. pagemap is also the kind of feature that could be used to escalate privileged from root in to the kernel. It probably needs to be protected in the same way that /dev/mem or module loading is in cases where the kernel needs to be protected from root, thus the choice to use CAP_SYS_RAWIO. Confused. If you have root, you can do mount -o notparanoid. Good point. I guess it doesn't protect us much here unless we also restrict the ability to remount. And the ability to unmount... A write-once sysctl or a boot time only parameter is much more likely to be useful in the scenario where you are concerned about root. Eric -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/6] ARM: cpuidle: Remove duplicate header inclusion
On Tue, Mar 03, 2015 at 12:29:32PM +, Daniel Lezcano wrote: The cpu_do_idle() function is always used by the cpuidle drivers. That led to have each driver including cpuidle.h and proc-fns.h, they are always paired. That makes a lot of duplicate headers inclusion. Instead of including both in each .c file, move the proc-fns.h header inclusion in the cpuidle.h header file directly, so we can save some line of code. Signed-off-by: Daniel Lezcano daniel.lezc...@linaro.org Acked-by: Lorenzo Pieralisi lorenzo.pieral...@arm.com --- arch/arm/include/asm/cpuidle.h| 2 ++ arch/arm/kernel/cpuidle.c | 2 +- arch/arm/mach-davinci/cpuidle.c | 1 - arch/arm/mach-imx/cpuidle-imx6q.c | 1 - arch/arm/mach-imx/cpuidle-imx6sl.c| 1 - arch/arm/mach-imx/cpuidle-imx6sx.c| 1 - arch/arm/mach-omap2/cpuidle44xx.c | 1 - arch/arm/mach-tegra/cpuidle-tegra20.c | 1 - arch/arm/mach-tegra/cpuidle-tegra30.c | 1 - drivers/cpuidle/cpuidle-at91.c| 1 - drivers/cpuidle/cpuidle-exynos.c | 1 - drivers/cpuidle/cpuidle-kirkwood.c| 1 - drivers/cpuidle/cpuidle-ux500.c | 1 - drivers/cpuidle/cpuidle-zynq.c| 1 - 14 files changed, 3 insertions(+), 13 deletions(-) diff --git a/arch/arm/include/asm/cpuidle.h b/arch/arm/include/asm/cpuidle.h index af319ac..348dc81 100644 --- a/arch/arm/include/asm/cpuidle.h +++ b/arch/arm/include/asm/cpuidle.h @@ -1,6 +1,8 @@ #ifndef __ASM_ARM_CPUIDLE_H #define __ASM_ARM_CPUIDLE_H +#include asm/proc-fns.h + #ifdef CONFIG_CPU_IDLE extern int arm_cpuidle_simple_enter(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index); diff --git a/arch/arm/kernel/cpuidle.c b/arch/arm/kernel/cpuidle.c index 89545f6..45969f8 100644 --- a/arch/arm/kernel/cpuidle.c +++ b/arch/arm/kernel/cpuidle.c @@ -10,7 +10,7 @@ */ #include linux/cpuidle.h -#include asm/proc-fns.h +#include asm/cpuidle.h int arm_cpuidle_simple_enter(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index) diff --git a/arch/arm/mach-davinci/cpuidle.c b/arch/arm/mach-davinci/cpuidle.c index e365c1b..306ebc5 100644 --- a/arch/arm/mach-davinci/cpuidle.c +++ b/arch/arm/mach-davinci/cpuidle.c @@ -17,7 +17,6 @@ #include linux/cpuidle.h #include linux/io.h #include linux/export.h -#include asm/proc-fns.h #include asm/cpuidle.h #include mach/cpuidle.h diff --git a/arch/arm/mach-imx/cpuidle-imx6q.c b/arch/arm/mach-imx/cpuidle-imx6q.c index d76d086..8e21ccc 100644 --- a/arch/arm/mach-imx/cpuidle-imx6q.c +++ b/arch/arm/mach-imx/cpuidle-imx6q.c @@ -9,7 +9,6 @@ #include linux/cpuidle.h #include linux/module.h #include asm/cpuidle.h -#include asm/proc-fns.h #include common.h #include cpuidle.h diff --git a/arch/arm/mach-imx/cpuidle-imx6sl.c b/arch/arm/mach-imx/cpuidle-imx6sl.c index 7d92e65..5742a9f 100644 --- a/arch/arm/mach-imx/cpuidle-imx6sl.c +++ b/arch/arm/mach-imx/cpuidle-imx6sl.c @@ -9,7 +9,6 @@ #include linux/cpuidle.h #include linux/module.h #include asm/cpuidle.h -#include asm/proc-fns.h #include common.h #include cpuidle.h diff --git a/arch/arm/mach-imx/cpuidle-imx6sx.c b/arch/arm/mach-imx/cpuidle-imx6sx.c index 5a36722..2c9f1a8 100644 --- a/arch/arm/mach-imx/cpuidle-imx6sx.c +++ b/arch/arm/mach-imx/cpuidle-imx6sx.c @@ -10,7 +10,6 @@ #include linux/cpu_pm.h #include linux/module.h #include asm/cpuidle.h -#include asm/proc-fns.h #include asm/suspend.h #include common.h diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c index 01e398a..7622dbb 100644 --- a/arch/arm/mach-omap2/cpuidle44xx.c +++ b/arch/arm/mach-omap2/cpuidle44xx.c @@ -17,7 +17,6 @@ #include linux/clockchips.h #include asm/cpuidle.h -#include asm/proc-fns.h #include common.h #include pm.h diff --git a/arch/arm/mach-tegra/cpuidle-tegra20.c b/arch/arm/mach-tegra/cpuidle-tegra20.c index 4f25a7c..e22b0d9 100644 --- a/arch/arm/mach-tegra/cpuidle-tegra20.c +++ b/arch/arm/mach-tegra/cpuidle-tegra20.c @@ -27,7 +27,6 @@ #include linux/module.h #include asm/cpuidle.h -#include asm/proc-fns.h #include asm/smp_plat.h #include asm/suspend.h diff --git a/arch/arm/mach-tegra/cpuidle-tegra30.c b/arch/arm/mach-tegra/cpuidle-tegra30.c index f8815ed..a2400ab4 100644 --- a/arch/arm/mach-tegra/cpuidle-tegra30.c +++ b/arch/arm/mach-tegra/cpuidle-tegra30.c @@ -27,7 +27,6 @@ #include linux/module.h #include asm/cpuidle.h -#include asm/proc-fns.h #include asm/smp_plat.h #include asm/suspend.h diff --git a/drivers/cpuidle/cpuidle-at91.c b/drivers/cpuidle/cpuidle-at91.c index aae7bfc..f2446c7 100644 --- a/drivers/cpuidle/cpuidle-at91.c +++ b/drivers/cpuidle/cpuidle-at91.c @@ -19,7 +19,6 @@ #include linux/cpuidle.h #include linux/io.h #include linux/export.h -#include asm/proc-fns.h #include asm/cpuidle.h #define AT91_MAX_STATES 2 diff
[PATCH 07/12] clocksource: qcom: Remove dead code
This code is no longer used now that mach-msm has been removed. Delete it. Cc: Daniel Lezcano daniel.lezc...@linaro.org Cc: David Brown dav...@codeaurora.org Cc: Bryan Huntsman bry...@codeaurora.org Cc: Daniel Walker dwal...@fifo99.com Signed-off-by: Stephen Boyd sb...@codeaurora.org --- This can be acked and go through arm-soc or applied directly to clocksource tree. drivers/clocksource/qcom-timer.c | 59 1 file changed, 59 deletions(-) diff --git a/drivers/clocksource/qcom-timer.c b/drivers/clocksource/qcom-timer.c index 098c542e5c53..cba2d015564c 100644 --- a/drivers/clocksource/qcom-timer.c +++ b/drivers/clocksource/qcom-timer.c @@ -40,8 +40,6 @@ #define GPT_HZ 32768 -#define MSM_DGT_SHIFT 5 - static void __iomem *event_base; static void __iomem *sts_base; @@ -232,7 +230,6 @@ err: register_current_timer_delay(msm_delay_timer); } -#ifdef CONFIG_ARCH_QCOM static void __init msm_dt_timer_init(struct device_node *np) { u32 freq; @@ -285,59 +282,3 @@ static void __init msm_dt_timer_init(struct device_node *np) } CLOCKSOURCE_OF_DECLARE(kpss_timer, qcom,kpss-timer, msm_dt_timer_init); CLOCKSOURCE_OF_DECLARE(scss_timer, qcom,scss-timer, msm_dt_timer_init); -#else - -static int __init msm_timer_map(phys_addr_t addr, u32 event, u32 source, - u32 sts) -{ - void __iomem *base; - - base = ioremap(addr, SZ_256); - if (!base) { - pr_err(Failed to map timer base\n); - return -ENOMEM; - } - event_base = base + event; - source_base = base + source; - if (sts) - sts_base = base + sts; - - return 0; -} - -static notrace cycle_t msm_read_timer_count_shift(struct clocksource *cs) -{ - /* -* Shift timer count down by a constant due to unreliable lower bits -* on some targets. -*/ - return msm_read_timer_count(cs) MSM_DGT_SHIFT; -} - -void __init msm7x01_timer_init(void) -{ - struct clocksource *cs = msm_clocksource; - - if (msm_timer_map(0xc010, 0x0, 0x10, 0x0)) - return; - cs-read = msm_read_timer_count_shift; - cs-mask = CLOCKSOURCE_MASK((32 - MSM_DGT_SHIFT)); - /* 600 KHz */ - msm_timer_init(1920 MSM_DGT_SHIFT, 32 - MSM_DGT_SHIFT, 7, - false); -} - -void __init msm7x30_timer_init(void) -{ - if (msm_timer_map(0xc010, 0x4, 0x24, 0x80)) - return; - msm_timer_init(24576000 / 4, 32, 1, false); -} - -void __init qsd8x50_timer_init(void) -{ - if (msm_timer_map(0xAC10, 0x0, 0x10, 0x34)) - return; - msm_timer_init(1920 / 4, 32, 7, false); -} -#endif -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] net/9p: add a privport option for RDMA transport.
RDMA can use the same kind of weak security as TCP by checking the client can bind to a privileged port, which is better than nothing if TAUTH isn't implemented. Signed-off-by: Dominique Martinet dominique.marti...@cea.fr --- YES, this does not checkpatch, but I'm not changing all the old Opt_* names just to add a new one unless I'm explicitely asked to. net/9p/trans_rdma.c | 52 1 file changed, 44 insertions(+), 8 deletions(-) diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c index 14ad43b..3533d2a 100644 --- a/net/9p/trans_rdma.c +++ b/net/9p/trans_rdma.c @@ -139,6 +139,7 @@ struct p9_rdma_opts { int sq_depth; int rq_depth; long timeout; + int privport; }; /* @@ -146,7 +147,10 @@ struct p9_rdma_opts { */ enum { /* Options that take integer arguments */ - Opt_port, Opt_rq_depth, Opt_sq_depth, Opt_timeout, Opt_err, + Opt_port, Opt_rq_depth, Opt_sq_depth, Opt_timeout, + /* Options that take no argument */ + Opt_privport, + Opt_err, }; static match_table_t tokens = { @@ -154,6 +158,7 @@ static match_table_t tokens = { {Opt_sq_depth, sq=%u}, {Opt_rq_depth, rq=%u}, {Opt_timeout, timeout=%u}, + {Opt_privport, privport}, {Opt_err, NULL}, }; @@ -175,6 +180,7 @@ static int parse_opts(char *params, struct p9_rdma_opts *opts) opts-sq_depth = P9_RDMA_SQ_DEPTH; opts-rq_depth = P9_RDMA_RQ_DEPTH; opts-timeout = P9_RDMA_TIMEOUT; + opts-privport = 0; if (!params) return 0; @@ -193,13 +199,13 @@ static int parse_opts(char *params, struct p9_rdma_opts *opts) if (!*p) continue; token = match_token(p, tokens, args); - if (token == Opt_err) - continue; - r = match_int(args[0], option); - if (r 0) { - p9_debug(P9_DEBUG_ERROR, -integer field, but no integer?\n); - continue; + if ((token != Opt_err) (token != Opt_privport)) { + r = match_int(args[0], option); + if (r 0) { + p9_debug(P9_DEBUG_ERROR, +integer field, but no integer?\n); + continue; + } } switch (token) { case Opt_port: @@ -214,6 +220,9 @@ static int parse_opts(char *params, struct p9_rdma_opts *opts) case Opt_timeout: opts-timeout = option; break; + case Opt_privport: + opts-privport = 1; + break; default: continue; } @@ -607,6 +616,23 @@ static int rdma_cancelled(struct p9_client *client, struct p9_req_t *req) return 0; } +static int p9_rdma_bind_privport(struct p9_trans_rdma *rdma) +{ + struct sockaddr_in cl = { + .sin_family = AF_INET, + .sin_addr.s_addr = htonl(INADDR_ANY), + }; + int port, err = -EINVAL; + + for (port = P9_DEF_MAX_RESVPORT; port = P9_DEF_MIN_RESVPORT; port--) { + cl.sin_port = htons((ushort)port); + err = rdma_bind_addr(rdma-cm_id, (struct sockaddr *)cl); + if (err != -EADDRINUSE) + break; + } + return err; +} + /** * trans_create_rdma - Transport method for creating atransport instance * @client: client instance @@ -642,6 +668,16 @@ rdma_create_trans(struct p9_client *client, const char *addr, char *args) /* Associate the client with the transport */ client-trans = rdma; + /* Bind to a privileged port if we need to */ + if (opts.privport) { + err = p9_rdma_bind_privport(rdma); + if (err 0) { + pr_err(%s (%d): problem binding to privport: %d\n, + __func__, task_pid_nr(current), -err); + goto error; + } + } + /* Resolve the server's address */ rdma-addr.sin_family = AF_INET; rdma-addr.sin_addr.s_addr = in_aton(addr); -- 1.9.3 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 05/12] net: smc91x: Remove dead code
This config no longer exists now that mach-msm has been removed. Delete it and the associated code. Cc: David S. Miller da...@davemloft.net Cc: David Brown dav...@codeaurora.org Cc: Bryan Huntsman bry...@codeaurora.org Cc: Daniel Walker dwal...@fifo99.com Signed-off-by: Stephen Boyd sb...@codeaurora.org --- This can be acked and go through arm-soc or applied directly. drivers/net/ethernet/smsc/smc91x.h | 14 -- 1 file changed, 14 deletions(-) diff --git a/drivers/net/ethernet/smsc/smc91x.h b/drivers/net/ethernet/smsc/smc91x.h index be67baf5f677..6fd5643c4fba 100644 --- a/drivers/net/ethernet/smsc/smc91x.h +++ b/drivers/net/ethernet/smsc/smc91x.h @@ -237,20 +237,6 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg) #define RPC_LSA_DEFAULT RPC_LED_100_10 #define RPC_LSB_DEFAULT RPC_LED_TX_RX -#elif defined(CONFIG_ARCH_MSM) - -#define SMC_CAN_USE_8BIT 0 -#define SMC_CAN_USE_16BIT 1 -#define SMC_CAN_USE_32BIT 0 -#define SMC_NOWAIT 1 - -#define SMC_inw(a, r) readw((a) + (r)) -#define SMC_outw(v, a, r) writew(v, (a) + (r)) -#define SMC_insw(a, r, p, l) readsw((a) + (r), p, l) -#define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) - -#define SMC_IRQ_FLAGS IRQF_TRIGGER_HIGH - #elif defined(CONFIG_COLDFIRE) #define SMC_CAN_USE_8BIT 0 -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 01/32] do_fork(): Rename 'stack_size' argument to reflect actual use
On Fri 2015-03-13 20:04 +0200, Alex Dowad wrote: The 'stack_size' argument is never used to pass a stack size. It's only used when forking a kernel thread, in which case it is an argument which should be passed to the 'main' function which the kernel thread executes. Hence, rename it to 'kthread_arg'. Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- AFAICT this clean up looks OK and should improve readability. Thanks. -- Aaron Tomlin pgp4xNeaAV5NO.pgp Description: PGP signature
[PATCH 14/32] m32r: copy_thread(): rename 'arg' argument to 'kthread_arg'
The 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()). Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- arch/m32r/kernel/process.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c index e69221d..6d5edf2 100644 --- a/arch/m32r/kernel/process.c +++ b/arch/m32r/kernel/process.c @@ -128,21 +128,25 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu) return 0; /* Task didn't use the fpu at all. */ } +/* + * Copy architecture-specific thread state + */ int copy_thread(unsigned long clone_flags, unsigned long spu, - unsigned long arg, struct task_struct *tsk) + unsigned long kthread_arg, struct task_struct *tsk) { struct pt_regs *childregs = task_pt_regs(tsk); extern void ret_from_fork(void); extern void ret_from_kernel_thread(void); if (unlikely(tsk-flags PF_KTHREAD)) { + /* kernel thread */ memset(childregs, 0, sizeof(struct pt_regs)); childregs-psw = M32R_PSW_BIE; childregs-r1 = spu;/* fn */ - childregs-r0 = arg; + childregs-r0 = kthread_arg; tsk-thread.lr = (unsigned long)ret_from_kernel_thread; } else { - /* Copy registers */ + /* user thread: copy registers */ *childregs = *current_pt_regs(); if (spu) childregs-spu = spu; -- 2.0.0.GIT -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/6] ARM64: cpuidle: Rename cpu_init_idle to a common function name
On Tue, Mar 03, 2015 at 01:29:35PM +0100, Daniel Lezcano wrote: diff --git a/drivers/cpuidle/cpuidle-arm64.c b/drivers/cpuidle/cpuidle-arm64.c index 0cea244..6ef291c7 100644 --- a/drivers/cpuidle/cpuidle-arm64.c +++ b/drivers/cpuidle/cpuidle-arm64.c @@ -110,7 +110,7 @@ static int __init arm64_idle_init(void) * idle states suspend back-end specific data */ for_each_possible_cpu(cpu) { - ret = cpu_init_idle(cpu); + ret = arm_cpuidle_init(cpu); Same nitpick here about dropping the arm_ prefix (though here we already have a cpuidle_init). -- Catalin -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 07/12] clocksource: qcom: Remove dead code
On 03/13/15 11:14, Daniel Lezcano wrote: On 03/13/2015 07:09 PM, Stephen Boyd wrote: This code is no longer used now that mach-msm has been removed. Delete it. Cc: Daniel Lezcano daniel.lezc...@linaro.org Cc: David Brown dav...@codeaurora.org Cc: Bryan Huntsman bry...@codeaurora.org Cc: Daniel Walker dwal...@fifo99.com Signed-off-by: Stephen Boyd sb...@codeaurora.org --- This can be acked and go through arm-soc or applied directly to clocksource tree. drivers/clocksource/qcom-timer.c | 59 1 file changed, 59 deletions(-) Applied to my tree for 4.1. Ah sorry, this one has to go with patch 1 through arm-soc, because it deletes symbols that patch 1 is using. -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] ath10k: mac: match wait_for_completion_timeout return type
Return type of wait_for_completion_timeout is unsigned long not int. An appropriately named unsigned long is added, respectively 'ret' renamed, and the assignments fixed up. Signed-off-by: Nicholas Mc Guire hof...@osadl.org --- Patch was only compile tested with x86_64_defconfig + CONFIG_ATH_CARDS=m, CONFIG_ATH10K=m Patch is against 4.0-rc3 (localversion-next is -next-20150313) drivers/net/wireless/ath/ath10k/mac.c | 20 +++- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index e8cc19f..3fa11d8 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -99,6 +99,7 @@ static int ath10k_install_key(struct ath10k_vif *arvif, { struct ath10k *ar = arvif-ar; int ret; + unsigned long time_left; lockdep_assert_held(ar-conf_mutex); @@ -108,8 +109,8 @@ static int ath10k_install_key(struct ath10k_vif *arvif, if (ret) return ret; - ret = wait_for_completion_timeout(ar-install_key_done, 3*HZ); - if (ret == 0) + time_left = wait_for_completion_timeout(ar-install_key_done, 3 * HZ); + if (time_left == 0) return -ETIMEDOUT; return 0; @@ -561,16 +562,16 @@ static void ath10k_mac_vif_beacon_cleanup(struct ath10k_vif *arvif) static inline int ath10k_vdev_setup_sync(struct ath10k *ar) { - int ret; + unsigned long time_left; lockdep_assert_held(ar-conf_mutex); if (test_bit(ATH10K_FLAG_CRASH_FLUSH, ar-dev_flags)) return -ESHUTDOWN; - ret = wait_for_completion_timeout(ar-vdev_setup_done, - ATH10K_VDEV_SETUP_TIMEOUT_HZ); - if (ret == 0) + time_left = wait_for_completion_timeout(ar-vdev_setup_done, + ATH10K_VDEV_SETUP_TIMEOUT_HZ); + if (time_left == 0) return -ETIMEDOUT; return 0; @@ -2432,6 +2433,7 @@ void ath10k_offchan_tx_work(struct work_struct *work) const u8 *peer_addr; int vdev_id; int ret; + unsigned long time_left; /* FW requirement: We must create a peer before FW will send out * an offchannel frame. Otherwise the frame will be stuck and @@ -2477,9 +2479,9 @@ void ath10k_offchan_tx_work(struct work_struct *work) ath10k_tx_htt(ar, skb); - ret = wait_for_completion_timeout(ar-offchan_tx_completed, - 3 * HZ); - if (ret == 0) + time_left = + wait_for_completion_timeout(ar-offchan_tx_completed, 3 * HZ); + if (time_left == 0) ath10k_warn(ar, timed out waiting for offchannel skb %p\n, skb); -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 1/2] drm/msm: update generated headers
From: Beeresh Gopal gbeer...@codeaurora.org To avoid ambiguity rename FRAME_SIZE to SSTILE_FRAME_SIZE Signed-off-by: Beeresh Gopal gbeer...@codeaurora.org --- drivers/gpu/drm/msm/mdp/mdp4/mdp4.xml.h | 36 + 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4.xml.h b/drivers/gpu/drm/msm/mdp/mdp4/mdp4.xml.h index 1d39174..2d0029d 100644 --- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4.xml.h +++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4.xml.h @@ -8,19 +8,11 @@ http://github.com/freedreno/envytools/ git clone https://github.com/freedreno/envytools.git The rules-ng-ng source files this header was generated from are: -- /home/robclark/src/freedreno/envytools/rnndb/msm.xml ( 676 bytes, from 2014-12-05 15:34:49) -- /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1453 bytes, from 2013-03-31 16:51:27) -- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp4.xml( 20908 bytes, from 2014-12-08 16:13:00) -- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml ( 2357 bytes, from 2014-12-08 16:13:00) -- /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml( 27208 bytes, from 2015-01-13 23:56:11) -- /home/robclark/src/freedreno/envytools/rnndb/dsi/dsi.xml ( 11712 bytes, from 2013-08-17 17:13:43) -- /home/robclark/src/freedreno/envytools/rnndb/dsi/sfpb.xml( 344 bytes, from 2013-08-11 19:26:32) -- /home/robclark/src/freedreno/envytools/rnndb/dsi/mmss_cc.xml ( 1686 bytes, from 2014-10-31 16:48:57) -- /home/robclark/src/freedreno/envytools/rnndb/hdmi/qfprom.xml ( 600 bytes, from 2013-07-05 19:21:12) -- /home/robclark/src/freedreno/envytools/rnndb/hdmi/hdmi.xml ( 26848 bytes, from 2015-01-13 23:55:57) -- /home/robclark/src/freedreno/envytools/rnndb/edp/edp.xml ( 8253 bytes, from 2014-12-08 16:13:00) - -Copyright (C) 2013-2014 by the following authors: +- /local/mnt/workspace/sandbox/envytools/rnndb/mdp/mdp4.xml( 20915 bytes, from 2015-02-06 15:25:51) +- /local/mnt/workspace/sandbox/envytools/rnndb/freedreno_copyright.xml ( 1453 bytes, from 2015-02-06 15:25:09) +- /local/mnt/workspace/sandbox/envytools/rnndb/mdp/mdp_common.xml ( 2357 bytes, from 2015-02-06 15:25:09) + +Copyright (C) 2013-2015 by the following authors: - Rob Clark robdcl...@gmail.com (robclark) Permission is hereby granted, free of charge, to any person obtaining @@ -680,18 +672,18 @@ static inline uint32_t MDP4_PIPE_SRC_STRIDE_B_P3(uint32_t val) return ((val) MDP4_PIPE_SRC_STRIDE_B_P3__SHIFT) MDP4_PIPE_SRC_STRIDE_B_P3__MASK; } -static inline uint32_t REG_MDP4_PIPE_FRAME_SIZE(enum mdp4_pipe i0) { return 0x00020048 + 0x1*i0; } -#define MDP4_PIPE_FRAME_SIZE_HEIGHT__MASK 0x -#define MDP4_PIPE_FRAME_SIZE_HEIGHT__SHIFT 16 -static inline uint32_t MDP4_PIPE_FRAME_SIZE_HEIGHT(uint32_t val) +static inline uint32_t REG_MDP4_PIPE_SSTILE_FRAME_SIZE(enum mdp4_pipe i0) { return 0x00020048 + 0x1*i0; } +#define MDP4_PIPE_SSTILE_FRAME_SIZE_HEIGHT__MASK 0x +#define MDP4_PIPE_SSTILE_FRAME_SIZE_HEIGHT__SHIFT 16 +static inline uint32_t MDP4_PIPE_SSTILE_FRAME_SIZE_HEIGHT(uint32_t val) { - return ((val) MDP4_PIPE_FRAME_SIZE_HEIGHT__SHIFT) MDP4_PIPE_FRAME_SIZE_HEIGHT__MASK; + return ((val) MDP4_PIPE_SSTILE_FRAME_SIZE_HEIGHT__SHIFT) MDP4_PIPE_SSTILE_FRAME_SIZE_HEIGHT__MASK; } -#define MDP4_PIPE_FRAME_SIZE_WIDTH__MASK 0x -#define MDP4_PIPE_FRAME_SIZE_WIDTH__SHIFT 0 -static inline uint32_t MDP4_PIPE_FRAME_SIZE_WIDTH(uint32_t val) +#define MDP4_PIPE_SSTILE_FRAME_SIZE_WIDTH__MASK 0x +#define MDP4_PIPE_SSTILE_FRAME_SIZE_WIDTH__SHIFT 0 +static inline uint32_t MDP4_PIPE_SSTILE_FRAME_SIZE_WIDTH(uint32_t val) { - return ((val) MDP4_PIPE_FRAME_SIZE_WIDTH__SHIFT) MDP4_PIPE_FRAME_SIZE_WIDTH__MASK; + return ((val) MDP4_PIPE_SSTILE_FRAME_SIZE_WIDTH__SHIFT) MDP4_PIPE_SSTILE_FRAME_SIZE_WIDTH__MASK; } static inline uint32_t REG_MDP4_PIPE_SRC_FORMAT(enum mdp4_pipe i0) { return 0x00020050 + 0x1*i0; } -- Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] checkpatch: catch all world writable debugfs_create_file
Currently checkpatch will fuss if one uses world writable settings in debugfs files by passing S_IWUGO but not when passing S_IWOTH, S_IRWXUGO or S_IALLUGO. This patch extends the check to catches all cases exporting world writable files Signed-off-by: Nicholas Mc Guire hof...@osadl.org --- The patch was tested against a set of trivial test-cases: t_file = debugfs_create_file(id, S_IWOTH, t_dir, NULL, t_fops); t_file = debugfs_create_file(id, S_IWUGO, t_dir, NULL, t_fops); t_file = debugfs_create_file(id, S_IRWXUGO, t_dir, NULL, t_fops); t_file = debugfs_create_file(id, S_IALLUGO, t_dir, NULL, t_fops); and t_file = debugfs_create_file(id, S_IWOTH | S_IXOTH, t_dir, NULL, t_fops); Patch is against 4.0-rc3 (localversion-next is -next-20150313) scripts/checkpatch.pl | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 6b79beb..5def21c 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -5356,8 +5356,14 @@ sub process { } } - if ($line =~ /debugfs_create_file.*S_IWUGO/ || - $line =~ /DEVICE_ATTR.*S_IWUGO/ ) { + if ($line =~ /debugfs_create_file.*S_IWOTH/ || + $line =~ /debugfs_create_file.*S_IWUGO/ || + $line =~ /debugfs_create_file.*S_IRWXUGO/ || + $line =~ /debugfs_create_file.*S_IALLUGO/ || + $line =~ /DEVICE_ATTR.*S_IWOTH/ || + $line =~ /DEVICE_ATTR.*S_IWUGO/ || + $line =~ /DEVICE_ATTR.*S_IRWXUGO/ || + $line =~ /DEVICE_ATTR.*S_IALLUGO/ ) { WARN(EXPORTED_WORLD_WRITABLE, Exporting world writable files is usually an error. Consider more restrictive permissions.\n . $herecurr); } -- 1.7.10.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v10 16/21] irqchip: Add GICv2 specific ACPI boot support
Hanjun, Catalin, On Thu, Mar 12, 2015 at 03:31:57PM +0800, Hanjun Guo wrote: On 2015/3/12 13:12, Jason Cooper wrote: On Thu, Mar 12, 2015 at 09:46:39AM +0800, Hanjun Guo wrote: On 2015/3/12 7:11, Jason Cooper wrote: Hey Grant, On Wed, Mar 11, 2015 at 06:04:50PM +, Grant Likely wrote: On 11 Mar 2015 12:42, Hanjun Guo hanjun@linaro.org wrote: [...] diff --git a/drivers/irqchip/irqchip.c b/drivers/irqchip/irqchip.c index 0fe2f71..afd1af3 100644 --- a/drivers/irqchip/irqchip.c +++ b/drivers/irqchip/irqchip.c @@ -8,6 +8,7 @@ * warranty of any kind, whether express or implied. */ +#include linux/acpi_irq.h #include linux/init.h #include linux/of_irq.h #include linux/irqchip.h @@ -26,4 +27,6 @@ extern struct of_device_id __irqchip_of_table[]; void __init irqchip_init(void) { of_irq_init(__irqchip_of_table); + + acpi_irq_init(); } Is this in line with Olof's idea that providing a dtb would override ACPI? Yes, it will. Since ACPI is default OFF (disabled), if a dtb provided, and no acpi=force passed in the early command line, dtb will be used as system configuration for boot (dtb is always the prior one for now) [1]. In acpi_gic_init() which called by acpi_irq_init(), it will return immediately if acpi disabled, so it will not parse any ACPI table for device configuration. Ok, that matches my recollection. Thanks for refreshing my memory. I'll apply this on a topic branch for irqchip/gic when I return from travel. Most likely Friday or over the weekend. Thank you very much! But this patch can't be applied without previous ones in this patch set, how about you ack this patch and Catalin takes it via ARM64 tree? I'm not sure for this, it depends on your decision. Is this a build dependency or a boot dependency? I only received this patch in the series and I apologize, I'm a bit swamped atm. Catalin, would an immutable irqchip/gic topic branch with this in it work for you? thx, Jason. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 02/12] irqchip: nvic: support hierarchy irq domain
2015-03-13 0:36 GMT+01:00 Stefan Agner ste...@agner.ch: Add support for hierarchy irq domain. Use to support the interrupt router found in Vybrid SoC, which is between the NVIC and the peripherals. Signed-off-by: Stefan Agner ste...@agner.ch --- drivers/irqchip/irq-nvic.c | 28 +++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-nvic.c b/drivers/irqchip/irq-nvic.c index 4ff0805..5fac910 100644 --- a/drivers/irqchip/irq-nvic.c +++ b/drivers/irqchip/irq-nvic.c @@ -49,6 +49,31 @@ nvic_handle_irq(irq_hw_number_t hwirq, struct pt_regs *regs) handle_IRQ(irq, regs); } +static int nvic_irq_domain_alloc(struct irq_domain *domain, unsigned int virq, + unsigned int nr_irqs, void *arg) +{ + int i, ret; + irq_hw_number_t hwirq; + unsigned int type = IRQ_TYPE_NONE; + struct of_phandle_args *irq_data = arg; + + ret = irq_domain_xlate_onecell(domain, irq_data-np, irq_data-args, + irq_data-args_count, hwirq, type); + if (ret) + return ret; + + for (i = 0; i nr_irqs; i++) + irq_map_generic_chip(domain, virq + i, hwirq + i); + + return 0; +} + +static const struct irq_domain_ops nvic_irq_domain_ops = { + .xlate = irq_domain_xlate_onecell, + .alloc = nvic_irq_domain_alloc, .alloc is only available with CONFIG_IRQ_DOMAIN_HIERARCHY=y, and it is not selected by in the config ARM_NVIC entry. It breaks the build with my STM32 series. Once selected, the build is fine, and the board boots successfully. Best regards, Maxime -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[GIT PULL] xen: bug fixes for 4.0-rc3
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Linus, Please git pull the following tag: git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip.git stable/for-linus-4.0-rc3-tag xen: bug fixes for 4.0-rc3 - - Fix a PV regression in 3.19. - - Fix a dom0 crash on hosts with large numbers of PIRQs. - - Prevent pcifront from disabling memory or I/O port access, which may trigger host crashes. Thanks. David arch/x86/xen/p2m.c |2 +- drivers/xen/events/events_base.c| 18 +--- drivers/xen/xen-pciback/conf_space.c|2 +- drivers/xen/xen-pciback/conf_space.h|2 + drivers/xen/xen-pciback/conf_space_header.c | 61 +-- include/xen/xenbus.h|4 +- 6 files changed, 66 insertions(+), 23 deletions(-) Jan Beulich (1): xen-pciback: limit guest control of command register Juergen Gross (2): x86/xen: correct bug in p2m list initialization xen/events: avoid NULL pointer dereference in dom0 on large machines Yuval Shaia (1): xen: Remove trailing semicolon from xenbus_register_frontend() definition -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.12 (GNU/Linux) iQEcBAEBAgAGBQJVAx9zAAoJEFxbo/MsZsTRUqEH/jClHenIGLdeAf3IAklwu1Dp uXq6zceCW+PH26+F8Pp/TvdiWk8bzuG7Uci+lt/A9wzYOWR/8BeY9XV08MsaWeoh 5TBd+WjfMH8XEXBYyJeB6rjxJP7UHbEl+7+rzKcsNTDqx6Rf1GGad6Mi6jfQhVfr YREfMI5ao3/GGNhZb/hsMk2Q7bBYXED5NlD4ond64Ju7fTvYfRkS0aZ0OMiNBopA Js/li5xHy0rlRnL44xgW//m7hbpewRFXFBFq0K6yiNprVCaZPq47aQ0Iq1fOeazB xLrvKrT1oUutg66Tel1JdkYijNqq9Pqt3NpQ9LsXK7PxRIDahS9vGmlDW8R76Rw= =WKLc -END PGP SIGNATURE- -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] [RFC] firewire: nosy: simplify grabbing context pointer in open()
Signed-off-by: Martin Kepplinger mart...@posteo.de --- This is a question: What's the real difference between the two solutions? I'm not sure if they are equivalent :( drivers/firewire/nosy.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/firewire/nosy.c b/drivers/firewire/nosy.c index 76b2d39..f43619e 100644 --- a/drivers/firewire/nosy.c +++ b/drivers/firewire/nosy.c @@ -275,16 +275,12 @@ set_phy_reg(struct pcilynx *lynx, int addr, int val) static int nosy_open(struct inode *inode, struct file *file) { - int minor = iminor(inode); struct client *client; - struct pcilynx *tmp, *lynx = NULL; + struct pcilynx *lynx = NULL; mutex_lock(card_mutex); - list_for_each_entry(tmp, card_list, link) - if (tmp-misc.minor == minor) { - lynx = lynx_get(tmp); - break; - } + lynx = container_of(file-private_data, struct pcilynx, misc); + lynx = lynx_get(lynx); mutex_unlock(card_mutex); if (lynx == NULL) return -ENODEV; -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[GIT PULL] cpuidle: 4.0-rc3 fixes
Hi Rafael, this pull request contains a couple of fixes: - Fix the cpu_pm_enter/exit symmetry in the mvebu driver (Gregory Clement) - Fix the mvebu drivers latency/residency values to reach an acceptable tradeoff between perf / power (Sebastian Rannou) Thanks ! -- Daniel ps: I took the opportunity to double check the other drivers have their cpu_pm_entry/exit symmetry correct (everything ok). The following changes since commit 9eccca0843205f87c00404b663188b88eb248051: Linux 4.0-rc3 (2015-03-08 16:09:09 -0700) are available in the git repository at: http://git.linaro.org/people/daniel.lezcano/linux.git cpuidle/4.0-fixes for you to fetch changes up to ce6031c89a35cffd5a5992b08377b77f49a004b9: cpuidle: mvebu: Update cpuidle thresholds for Armada XP SOCs (2015-03-13 18:31:29 +0100) Gregory CLEMENT (1): cpuidle: mvebu: Fix the CPU PM notifier usage Sebastien Rannou (1): cpuidle: mvebu: Update cpuidle thresholds for Armada XP SOCs drivers/cpuidle/cpuidle-mvebu-v7.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) -- http://www.linaro.org/ Linaro.org │ Open source software for ARM SoCs Follow Linaro: http://www.facebook.com/pages/Linaro Facebook | http://twitter.com/#!/linaroorg Twitter | http://www.linaro.org/linaro-blog/ Blog -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 00/12] Increased clocksource validation and cleanups (v4)
On Fri, Mar 13, 2015 at 1:58 AM, Ingo Molnar mi...@kernel.org wrote: * John Stultz john.stu...@linaro.org wrote: On Thu, Mar 12, 2015 at 2:19 AM, Ingo Molnar mi...@kernel.org wrote: * John Stultz john.stu...@linaro.org wrote: New in v4: * Lots and lots of typo corrections and minor cleanups suggested by Ingo. * Dropped Remove clocksource_max_deferment() patch * Added Rename __clocksource_updatefreq_*... patch * I realized one of the patches (Improve clocksource watchdog reporting) didn't have a proper cc list, so while it was on lkml folks may not have reviewed it before. So I've applied them with some changes to tip:timers/core, please look at the commit notifications for details. Any outstanding review feedback can be addressed as delta patches on top of this I think, none of my observations were show-stoppers. Have you not yet pushed the changed out publicly? (I'm only seeing one change from Viresh in tip/timers/core) Yeah, yesterday I had some test failures (elsewhere) so they were held up. I pushed them out a minute ago, the commit notifications should appear shortly. Ok, just looked them over and your changes look good to me. Thanks for the improvements! I'll generate a few patches to address the other comments you made the last cycle and send those to you in a bit. thanks -john -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 5/6] dts: msm8974: Add blsp2_bam dma node
Signed-off-by: Sricharan R sricha...@codeaurora.org --- arch/arm/boot/dts/qcom-msm8974.dtsi | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-msm8974.dtsi index e265ec1..3f648ae 100644 --- a/arch/arm/boot/dts/qcom-msm8974.dtsi +++ b/arch/arm/boot/dts/qcom-msm8974.dtsi @@ -247,5 +247,15 @@ #address-cells = 1; #size-cells = 0; }; + + blsp2_dma: dma@f9944000 { + compatible = qcom,bam-v1.4.0; + reg = 0xf9944000 0x19000; + interrupts = 0 239 0; + clocks = gcc GCC_BLSP2_AHB_CLK; + clock-names = bam_clk; + #dma-cells = 1; + qcom,ee = 0; + }; }; }; -- 1.8.2.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] net/9p: Initialize opts-privport as it should be.
We're currently using an uninitialized value if option privport is not set, thus (almost) always using a privileged port. Signed-off-by: Dominique Martinet dominique.marti...@cea.fr --- net/9p/trans_fd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c index c73b894..154479d 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c @@ -734,6 +734,7 @@ static int parse_opts(char *params, struct p9_fd_opts *opts) opts-port = P9_PORT; opts-rfd = ~0; opts-wfd = ~0; + opts-privport = 0; if (!params) return 0; -- 1.9.3 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/1] x86/cpu: don't allocate fpu-state for swapper/0
Hello. This patch is out of order a bit, but since Borislav mentioned this during review... And I was going to send the 2nd one (below), but it turns out that __init_refok is not discarded? So is there any way to do void __init init_function(); void non_init_func() { if (can_only_be_true_before_free_initmem) init_function(); } and avoid the warning? Fenghua, could you please explain the SYSTEM_BOOTING check in __save_fpu? It was added by f41d830fa8900 x86/xsaves: Save xstate to task's xsave area in __save_fpu during booting time, the changelog says: __save_fpu() can be called during early booting time how? from where? Do we expect math_error()-unlazy_fpu() at boot time, or what? Oleg. --- a/arch/x86/kernel/xsave.c +++ b/arch/x86/kernel/xsave.c @@ -532,7 +532,7 @@ void setup_xstate_comp(void) /* * setup the xstate image representing the init state */ -static void __init setup_init_fpu_buf(void) +static noinline void __init_refok setup_init_fpu_buf(void) { /* * Setup init_xstate_buf to represent the init state of @@ -677,16 +677,8 @@ void xsave_init(void) this_func(); } -static inline void __init eager_fpu_init_bp(void) -{ - if (!init_xstate_buf) - setup_init_fpu_buf(); -} - void eager_fpu_init(void) { - static __refdata void (*boot_func)(void) = eager_fpu_init_bp; - WARN_ON(used_math()); current_thread_info()-status = 0; @@ -698,10 +690,8 @@ void eager_fpu_init(void) return; } - if (boot_func) { - boot_func(); - boot_func = NULL; - } + if (!init_xstate_buf) + setup_init_fpu_buf(); } /* -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/1] x86/cpu: don't allocate fpu-state for swapper/0
Now that kthreads do not use FPU until exec swpper/0 doesn't need to allocate fpu-state. Signed-off-by: Oleg Nesterov o...@redhat.com --- arch/x86/kernel/xsave.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c index dff0ec2..1cf5667 100644 --- a/arch/x86/kernel/xsave.c +++ b/arch/x86/kernel/xsave.c @@ -679,8 +679,6 @@ void xsave_init(void) static inline void __init eager_fpu_init_bp(void) { - current-thread.fpu.state = - alloc_bootmem_align(xstate_size, __alignof__(struct xsave_struct)); if (!init_xstate_buf) setup_init_fpu_buf(); } -- 1.5.5.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 0/6] ARM: cpuidle: Unify the ARM64/ARM DT approach
On Thu, Mar 12, 2015 at 03:25:34PM +0100, Daniel Lezcano wrote: do you agree with this patchset ? In principle yes, apart from some function naming and I'm waiting for Lorenzo's ack as well. Do you plan to upstream this directly via your tree? If yes, I'll look in more detail and give some acks. -- Catalin -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 9/9] tulip_core.c : out-of-bounds check.
Hello. On 03/13/2015 05:15 PM, Ameen Ali wrote: Array index 'j' is used before limits check. Suggest put limit check before index use. Signed-off-by : ameenali...@gmail.com --- drivers/net/ethernet/dec/tulip/tulip_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/dec/tulip/tulip_core.c b/drivers/net/ethernet/dec/tulip/tulip_core.c index 3b42556..ed41559 100644 --- a/drivers/net/ethernet/dec/tulip/tulip_core.c +++ b/drivers/net/ethernet/dec/tulip/tulip_core.c @@ -589,7 +589,7 @@ static void tulip_tx_timeout(struct net_device *dev) (unsigned int)tp-rx_ring[i].buffer1, (unsigned int)tp-rx_ring[i].buffer2, buf[0], buf[1], buf[2]); - for (j = 0; buf[j] != 0xee j 1600; j++) + for (j = 0; ((j 1600) buf[j] != 0xee); j++) No need for extra parens, either around or around . WBR, Sergei -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 net-next 1/2] bpf: allow extended BPF programs access skb fields
introduce user accessible mirror of in-kernel 'struct sk_buff': struct __sk_buff { __u32 len; __u32 pkt_type; __u32 mark; __u32 queue_mapping; }; bpf programs can do: int bpf_prog(struct __sk_buff *skb) { __u32 var = skb-pkt_type; which will be compiled to bpf assembler as: dst_reg = *(u32 *)(src_reg + 4) // 4 == offsetof(struct __sk_buff, pkt_type) bpf verifier will check validity of access and will convert it to: dst_reg = *(u8 *)(src_reg + offsetof(struct sk_buff, __pkt_type_offset)) dst_reg = 7 since skb-pkt_type is a bitfield. Signed-off-by: Alexei Starovoitov a...@plumgrid.com --- include/linux/bpf.h |5 +- include/uapi/linux/bpf.h | 10 +++ kernel/bpf/syscall.c |2 +- kernel/bpf/verifier.c| 152 +- net/core/filter.c| 100 -- 5 files changed, 234 insertions(+), 35 deletions(-) diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 80f2e0fc3d02..2c17ebdfb5ae 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -103,6 +103,9 @@ struct bpf_verifier_ops { * with 'type' (read or write) is allowed */ bool (*is_valid_access)(int off, int size, enum bpf_access_type type); + + u32 (*convert_ctx_access)(int dst_reg, int src_reg, int ctx_off, + struct bpf_insn *insn); }; struct bpf_prog_type_list { @@ -133,7 +136,7 @@ struct bpf_map *bpf_map_get(struct fd f); void bpf_map_put(struct bpf_map *map); /* verify correctness of eBPF program */ -int bpf_check(struct bpf_prog *fp, union bpf_attr *attr); +int bpf_check(struct bpf_prog **fp, union bpf_attr *attr); #else static inline void bpf_register_prog_type(struct bpf_prog_type_list *tl) { diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index 3fa1af8a58d7..936e9257da95 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -168,4 +168,14 @@ enum bpf_func_id { __BPF_FUNC_MAX_ID, }; +/* user accessible mirror of in-kernel sk_buff. + * new fields can only be added to the end of this structure + */ +struct __sk_buff { + __u32 len; + __u32 pkt_type; + __u32 mark; + __u32 queue_mapping; +}; + #endif /* _UAPI__LINUX_BPF_H__ */ diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 669719ccc9ee..ea75c654af1b 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -519,7 +519,7 @@ static int bpf_prog_load(union bpf_attr *attr) goto free_prog; /* run eBPF verifier */ - err = bpf_check(prog, attr); + err = bpf_check(prog, attr); if (err 0) goto free_used_maps; diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index e6b522496250..c22ebd36fa4b 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -1620,11 +1620,10 @@ static int do_check(struct verifier_env *env) return err; } else if (class == BPF_LDX) { - if (BPF_MODE(insn-code) != BPF_MEM || - insn-imm != 0) { - verbose(BPF_LDX uses reserved fields\n); - return -EINVAL; - } + enum bpf_reg_type src_reg_type; + + /* check for reserved fields is already done */ + /* check src operand */ err = check_reg_arg(regs, insn-src_reg, SRC_OP); if (err) @@ -1643,6 +1642,29 @@ static int do_check(struct verifier_env *env) if (err) return err; + src_reg_type = regs[insn-src_reg].type; + + if (insn-imm == 0 BPF_SIZE(insn-code) == BPF_W) { + /* saw a valid insn +* dst_reg = *(u32 *)(src_reg + off) +* use reserved 'imm' field to mark this insn +*/ + insn-imm = src_reg_type; + + } else if (src_reg_type != insn-imm + (src_reg_type == PTR_TO_CTX || + insn-imm == PTR_TO_CTX)) { + /* ABuser program is trying to use the same insn +* dst_reg = *(u32*) (src_reg + off) +* with different pointer types: +* src_reg == ctx in one branch and +* src_reg == stack|map in some other branch. +* Reject it. +*/ + verbose(same insn cannot be used with different pointers\n); + return -EINVAL; + } + } else if (class == BPF_STX) {
Re: [PATCH V5] Allow compaction of unevictable pages
On Fri, 13 Mar 2015, Rik van Riel wrote: On 03/13/2015 01:26 PM, Eric B Munson wrote: --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1046,6 +1046,8 @@ typedef enum { ISOLATE_SUCCESS,/* Pages isolated, migrate */ } isolate_migrate_t; +int sysctl_compact_unevictable; + /* * Isolate all pages that can be migrated from the first suitable block, * starting at the block pointed to by the migrate scanner pfn within I suspect that the use cases where users absolutely do not want unevictable pages migrated are special cases, and it may make sense to enable sysctl_compact_unevictable by default. Given that sysctl_compact_unevictable=0 is the way the kernel behaves now and the push back against always enabling compaction on unevictable pages, I left the default to be the behavior as it is today. I agree that this is likely the minority case, but I'd really like Peter Z or someone else from real time to say that they are okay with the default changing. signature.asc Description: Digital signature
[PATCH V5] Allow compaction of unevictable pages
Currently, pages which are marked as unevictable are protected from compaction, but not from other types of migration. The POSIX real time extension explicitly states that mlock() will prevent a major page fault, but the spirit of is is that mlock() should give a process the ability to control sources of latency, including minor page faults. However, the mlock manpage only explicitly says that a locked page will not be written to swap and this can cause some confusion. The compaction code today, does not give a developer who wants to avoid swap but wants to have large contiguous areas available any method to achieve this state. This patch introduces a sysctl for controlling compaction behavoir with respect to the unevictable lru. Users that demand no page faults after a page is present can set compact_unevictable to 0 and users who need the large contiguous areas can enable compaction on locked memory by setting it to 1. To illustrate this problem I wrote a quick test program that mmaps a large number of 1MB files filled with random data. These maps are created locked and read only. Then every other mmap is unmapped and I attempt to allocate huge pages to the static huge page pool. When the compact_unevictable sysctl is 0, I cannot allocate hugepages after fragmenting memory. When the value is set to 1, allocations succeed. Signed-off-by: Eric B Munson emun...@akamai.com Cc: Vlastimil Babka vba...@suse.cz Cc: Thomas Gleixner t...@linutronix.de Cc: Christoph Lameter c...@linux.com Cc: Peter Zijlstra pet...@infradead.org Cc: Mel Gorman mgor...@suse.de Cc: David Rientjes rient...@google.com Cc: Rik van Riel r...@redhat.com Cc: Michal Hocko mho...@suse.cz Cc: linux...@kvack.org Cc: linux-kernel@vger.kernel.org --- Changes from V3: * Updated changelog * Restrict valid input to 0 or 1 in sysctl * Add documentation to sysctl/vm.txt Documentation/sysctl/vm.txt | 11 +++ include/linux/compaction.h |1 + kernel/sysctl.c |9 + mm/compaction.c |3 +++ 4 files changed, 24 insertions(+) diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt index 902b457..812f0d4 100644 --- a/Documentation/sysctl/vm.txt +++ b/Documentation/sysctl/vm.txt @@ -21,6 +21,7 @@ Currently, these files are in /proc/sys/vm: - admin_reserve_kbytes - block_dump - compact_memory +- compact_unevictable - dirty_background_bytes - dirty_background_ratio - dirty_bytes @@ -106,6 +107,16 @@ huge pages although processes will also directly compact memory as required. == +compact_unevictable + +Available only when CONFIG_COMPACTION is set. When set to 1, compaction is +allowed to examine the unevictable lru (mlocked pages) for pages to compact. +This should be used on systems where stalls for minor page faults are an +acceptable trade for large contiguous free memory. Set to 0 to prevent +compaction from moving pages that are unevictable. + +== + dirty_background_bytes Contains the amount of dirty memory at which the background kernel diff --git a/include/linux/compaction.h b/include/linux/compaction.h index a014559..9dd7e7c 100644 --- a/include/linux/compaction.h +++ b/include/linux/compaction.h @@ -34,6 +34,7 @@ extern int sysctl_compaction_handler(struct ctl_table *table, int write, extern int sysctl_extfrag_threshold; extern int sysctl_extfrag_handler(struct ctl_table *table, int write, void __user *buffer, size_t *length, loff_t *ppos); +extern int sysctl_compact_unevictable; extern int fragmentation_index(struct zone *zone, unsigned int order); extern unsigned long try_to_compact_pages(gfp_t gfp_mask, unsigned int order, diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 88ea2d6..9272568 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -1313,6 +1313,15 @@ static struct ctl_table vm_table[] = { .extra1 = min_extfrag_threshold, .extra2 = max_extfrag_threshold, }, + { + .procname = compact_unevictable, + .data = sysctl_compact_unevictable, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec, + .extra1 = zero, + .extra2 = one, + }, #endif /* CONFIG_COMPACTION */ { diff --git a/mm/compaction.c b/mm/compaction.c index 8c0d945..342b221 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1046,6 +1046,8 @@ typedef enum { ISOLATE_SUCCESS,/* Pages isolated, migrate */ } isolate_migrate_t; +int sysctl_compact_unevictable; + /* * Isolate all pages that can be migrated from the first suitable block, * starting at the block pointed to by the migrate scanner pfn within @@ -1057,6 +1059,7 @@ static isolate_migrate_t
Re: [PATCH] ath10k: match wait_for_completion_timeout return type
On Fri, 13 Mar 2015, Kalle Valo wrote: Nicholas Mc Guire hof...@osadl.org writes: Return type of wait_for_completion_timeout is unsigned long not int. An appropriately named unsigned long is added and the assignments fixed up. Signed-off-by: Nicholas Mc Guire hof...@osadl.org Doesn't apply: Applying: ath10k: match wait_for_completion_timeout return type fatal: sha1 information is lacking or useless (drivers/net/wireless/ath/ath10k/mac.c). Repository lacks necessary blobs to fall back on 3-way merge. Cannot fall back to three-way merge. Patch failed at 0001 ath10k: match wait_for_completion_timeout return type sorry - no idea how I managed that - checking it. Will fix it up and repost. thx! hofrat -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] cpuidle: mvebu: Update cpuidle thresholds for Armada XP SOCs
From: Sebastien Rannou m...@sbrk.org Originally, the thresholds used in the cpuidle driver for Armada SOCs were temporarily chosen, leaving room for improvements. This commit updates the thresholds for the Armada XP SOCs with values that positively impact performances: without patch with patch vendor kernel - iperf localhost (gbit/sec) ~3.7 ~6.4 ~5.4 - ioping tmpfs (iops) ~163k ~206k~179k - ioping tmpfs (mib/s) ~636 ~805 ~699 The idle power consumption is negatively impacted (proportionally less than the performance gain), and we are still performing better than the vendor kernel here: without patch with patch vendor kernel - power consumption idle (W) ~2.4~3.2~4.4 - power consumption busy (W) ~8.6~8.3~8.6 There is still room for improvement regarding the value of these thresholds, they were chosen to mimic the vendor kernel. This patch only impacts Armada XP SOCs and was tested on Online Labs C1 boards. A similar approach can be taken to improve the performances of the Armada 370 and Armada 38x SOCs. Thanks a lot to Thomas Petazzoni, Gregory Clement and Willy Tarreau for the discussions and tips around this topic. Signed-off-by: Sebastien Rannou m...@sbrk.org Signed-off-by: Daniel Lezcano daniel.lezc...@linaro.org Acked-by: Gregory CLEMENT gregory.clem...@free-electrons.com --- drivers/cpuidle/cpuidle-mvebu-v7.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/cpuidle/cpuidle-mvebu-v7.c b/drivers/cpuidle/cpuidle-mvebu-v7.c index cefa074..980151f 100644 --- a/drivers/cpuidle/cpuidle-mvebu-v7.c +++ b/drivers/cpuidle/cpuidle-mvebu-v7.c @@ -50,17 +50,17 @@ static struct cpuidle_driver armadaxp_idle_driver = { .states[0] = ARM_CPUIDLE_WFI_STATE, .states[1] = { .enter = mvebu_v7_enter_idle, - .exit_latency = 10, + .exit_latency = 100, .power_usage= 50, - .target_residency = 100, + .target_residency = 1000, .name = MV CPU IDLE, .desc = CPU power down, }, .states[2] = { .enter = mvebu_v7_enter_idle, - .exit_latency = 100, + .exit_latency = 1000, .power_usage= 5, - .target_residency = 1000, + .target_residency = 1, .flags = MVEBU_V7_FLAG_DEEP_IDLE, .name = MV CPU DEEP IDLE, .desc = CPU and L2 Fabric power down, -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] cpuidle: mvebu: Fix the CPU PM notifier usage
From: Gregory CLEMENT gregory.clem...@free-electrons.com As stated in kernel/cpu_pm.c, Platform is responsible for ensuring that cpu_pm_enter is not called twice on the same CPU before cpu_pm_exit is called.. In the current code in case of failure when calling mvebu_v7_cpu_suspend, the function cpu_pm_exit() is never called whereas cpu_pm_enter() was called just before. This patch moves the cpu_pm_exit() in order to balance the cpu_pm_enter() calls. Cc: sta...@vger.kernel.org Reported-by: Fulvio Benini f...@libero.it Signed-off-by: Gregory CLEMENT gregory.clem...@free-electrons.com Signed-off-by: Daniel Lezcano daniel.lezc...@linaro.org --- drivers/cpuidle/cpuidle-mvebu-v7.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/cpuidle/cpuidle-mvebu-v7.c b/drivers/cpuidle/cpuidle-mvebu-v7.c index 38e6861..cefa074 100644 --- a/drivers/cpuidle/cpuidle-mvebu-v7.c +++ b/drivers/cpuidle/cpuidle-mvebu-v7.c @@ -37,11 +37,11 @@ static int mvebu_v7_enter_idle(struct cpuidle_device *dev, deepidle = true; ret = mvebu_v7_cpu_suspend(deepidle); + cpu_pm_exit(); + if (ret) return ret; - cpu_pm_exit(); - return index; } -- 1.9.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/6] i2c: qup: Add support for v2 tags and bam dma
QUP from version 2.1.1 onwards, supports a new format of i2c command tags. Tag codes instructs the controller to perform a operation like read/write. This new tagging version supports and is required for adding bam dma capabilities. v2 tags supports transfer of more than 256 bytes in a single i2c transaction. Also adding bam dma support facilitates transferring each i2c_msg in i2c_msgs without a 'stop' bit in between which is required for some of the clients. This series depends on the below bam dma bug fix https://lkml.org/lkml/2015/2/20/47 Tested this series on apq8074 dragon board eeprom client on i2c bus1 Andy Gross (1): i2c: qup: Add V2 tags support Sricharan R (5): i2c: qup: Change qup_wait_writeready function to use for all timeouts i2c: qup: Add bam dma capabilities i2c: qup: Transfer every i2c_msg in i2c_msgs without stop dts: msm8974: Add blsp2_bam dma node dts: msm8974: Add dma channels for blsp2_i2c1 node arch/arm/boot/dts/qcom-msm8974.dtsi | 12 + drivers/i2c/busses/i2c-qup.c| 783 +--- 2 files changed, 741 insertions(+), 54 deletions(-) -- 1.8.2.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/6] i2c: qup: Add V2 tags support
From: Andy Gross agr...@codeaurora.org QUP from version 2.1.1 onwards, supports a new format of i2c command tags. Tag codes instructs the controller to perform a operation like read/write. This new tagging version supports bam dma and transfers of more than 256 bytes without 'stop' in between. Adding the support for the same. For each block a data_write/read tag and data_len tag is added to the output fifo. For the final block of data write_stop/read_stop tag is used. Signed-off-by: Andy Gross agr...@codeaurora.org Signed-off-by: Sricharan R sricha...@codeaurora.org --- drivers/i2c/busses/i2c-qup.c | 342 ++- 1 file changed, 305 insertions(+), 37 deletions(-) diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c index 49c6cba..e4e223f 100644 --- a/drivers/i2c/busses/i2c-qup.c +++ b/drivers/i2c/busses/i2c-qup.c @@ -24,6 +24,7 @@ #include linux/of.h #include linux/platform_device.h #include linux/pm_runtime.h +#include linux/slab.h /* QUP Registers */ #define QUP_CONFIG 0x000 @@ -42,6 +43,7 @@ #define QUP_IN_FIFO_BASE 0x218 #define QUP_I2C_CLK_CTL0x400 #define QUP_I2C_STATUS 0x404 +#define QUP_I2C_MASTER_GEN 0x408 /* QUP States and reset values */ #define QUP_RESET_STATE0 @@ -69,6 +71,8 @@ #define QUP_CLOCK_AUTO_GATEBIT(13) #define I2C_MINI_CORE (2 8) #define I2C_N_VAL 15 +#define I2C_N_VAL_V2 7 + /* Most significant word offset in FIFO port */ #define QUP_MSW_SHIFT (I2C_N_VAL + 1) @@ -80,17 +84,31 @@ #define QUP_REPACK_EN (QUP_UNPACK_EN | QUP_PACK_EN) +#define QUP_V2_TAGS_EN 1 + #define QUP_OUTPUT_BLOCK_SIZE(x)(((x) 0) 0x03) #define QUP_OUTPUT_FIFO_SIZE(x)(((x) 2) 0x07) #define QUP_INPUT_BLOCK_SIZE(x)(((x) 5) 0x03) #define QUP_INPUT_FIFO_SIZE(x) (((x) 7) 0x07) -/* QUP tags */ +/* QUP V1 tags */ #define QUP_TAG_START (1 8) #define QUP_TAG_DATA (2 8) #define QUP_TAG_STOP (3 8) #define QUP_TAG_REC(4 8) +/* QUP v2 tags */ +#define QUP_TAG_V2_HS 0xff +#define QUP_TAG_V2_START 0x81 +#define QUP_TAG_V2_DATAWR 0x82 +#define QUP_TAG_V2_DATAWR_STOP 0x83 +#define QUP_TAG_V2_DATARD 0x85 +#define QUP_TAG_V2_DATARD_STOP 0x87 + +/* frequency definitions for high speed and max speed */ +#define I2C_QUP_CLK_FAST_FREQ 100 +#define I2C_QUP_CLK_MAX_FREQ 340 + /* Status, Error flags */ #define I2C_STATUS_WR_BUFFER_FULL BIT(0) #define I2C_STATUS_BUS_ACTIVE BIT(8) @@ -99,6 +117,11 @@ #define QUP_READ_LIMIT 256 +struct qup_i2c_config { + int tag_ver; + int max_freq; +}; + struct qup_i2c_dev { struct device *dev; void __iomem*base; @@ -112,9 +135,20 @@ struct qup_i2c_dev { int in_fifo_sz; int out_blk_sz; int in_blk_sz; - + int blocks; + u8 *block_tag_len; + int *block_data_len; + int block_pos; unsigned long one_byte_t; + int is_hs; + booluse_v2_tags; + + int tx_tag_len; + int rx_tag_len; + u8 *tags; + int tags_pos; + struct i2c_msg *msg; /* Current posion in user message buffer */ int pos; @@ -262,8 +296,13 @@ static int qup_i2c_wait_ready(struct qup_i2c_dev *qup, int op, bool val, static void qup_i2c_set_write_mode(struct qup_i2c_dev *qup, struct i2c_msg *msg) { - /* Number of entries to shift out, including the start */ - int total = msg-len + 1; + /* Total Number of entries to shift out, including the tags */ + int total; + + if (qup-use_v2_tags) + total = msg-len + qup-tx_tag_len; + else + total = msg-len + 1; /* plus start tag */ if (total qup-out_fifo_sz) { /* FIFO mode */ @@ -277,7 +316,7 @@ static void qup_i2c_set_write_mode(struct qup_i2c_dev *qup, struct i2c_msg *msg) } } -static void qup_i2c_issue_write(struct qup_i2c_dev *qup, struct i2c_msg *msg) +static void qup_i2c_issue_write_v1(struct qup_i2c_dev *qup, struct i2c_msg *msg) { u32 addr = msg-addr 1; u32 qup_tag; @@ -318,6 +357,136 @@ static void qup_i2c_issue_write(struct qup_i2c_dev *qup, struct i2c_msg *msg) } } +static void qup_i2c_create_tag_v2(struct qup_i2c_dev *qup, + struct i2c_msg *msg) +{ + u16 addr = (msg-addr 1) | ((msg-flags I2C_M_RD) == I2C_M_RD); + int len = 0, prev_len = 0; +
[PATCH 4/6] i2c: qup: Transfer every i2c_msg in i2c_msgs without stop
The definition of i2c_msg says that If this is the last message in a group, it is followed by a STOP. Otherwise it is followed by the next @i2c_msg transaction segment, beginning with a (repeated) START So the expectation is that there is no 'STOP' bit inbetween individual i2c_msg segments with repeated 'START'. The QUP i2c hardware has no way to inform that there should not be a 'STOP' at the end of transaction. The only way to implement this is to coalesce all the i2c_msg in i2c_msgs in to one transaction and transfer them. Adding the support for the same. This is required for some clients like touchscreen which keeps incrementing counts across individual transfers and 'STOP' bit inbetween resets the counter, which is not required. Signed-off-by: Sricharan R sricha...@codeaurora.org --- drivers/i2c/busses/i2c-qup.c | 192 ++- 1 file changed, 115 insertions(+), 77 deletions(-) diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c index 11ea6af..90a2b5e 100644 --- a/drivers/i2c/busses/i2c-qup.c +++ b/drivers/i2c/busses/i2c-qup.c @@ -846,75 +846,91 @@ void qup_sg_set_buf(struct scatterlist *sg, void *buf, struct tag *tg, sg_dma_address(sg) = tg-addr + ((u8 *) buf - tg-start); } -static int bam_do_xfer(struct qup_i2c_dev *qup, struct i2c_msg *msg) +static int bam_do_xfer(struct qup_i2c_dev *qup, struct i2c_msg *msg, int num) { struct dma_async_tx_descriptor *txd, *rxd = NULL; int ret = 0; dma_cookie_t cookie_rx, cookie_tx; - u32 rx_nents = 0, tx_nents = 0, len = 0; - /* QUP I2C read/write limit for single command is 256bytes max*/ - int blocks = (msg-len + QUP_READ_LIMIT) / QUP_READ_LIMIT; - int rem = msg-len % QUP_READ_LIMIT; - int tlen, i = 0, tx_len = 0; - - if (msg-flags I2C_M_RD) { - tx_nents = 1; - rx_nents = (blocks 1) + 1; - sg_init_table(qup-sg_rx, rx_nents); - - while (i blocks) { - /* transfer length set to '0' implies 256 bytes */ - tlen = (i == (blocks - 1)) ? rem : 0; - len += get_start_tag(qup-start_tag.start[len], - msg, !i, (i == (blocks-1)), - tlen); - - qup_sg_set_buf(qup-sg_rx[i 1], - qup-scratch_tag.start[0], - qup-scratch_tag, - 2, qup, 0, 0); - - qup_sg_set_buf(qup-sg_rx[(i 1) + 1], - msg-buf[QUP_READ_LIMIT * i], - NULL, tlen, qup, 1, - DMA_FROM_DEVICE); - - i++; - } - - sg_init_one(qup-sg_tx, qup-start_tag.start[0], len); - qup_sg_set_buf(qup-sg_tx, qup-start_tag.start[0], - qup-start_tag, len, qup, 0, 0); - qup_sg_set_buf(qup-sg_rx[i 1], - qup-scratch_tag.start[1], - qup-scratch_tag, 2, - qup, 0, 0); - } else { - qup-footer_tag.start[0] = QUP_BAM_FLUSH_STOP; - qup-footer_tag.start[1] = QUP_BAM_FLUSH_STOP; - - tx_nents = (blocks 1) + 1; - sg_init_table(qup-sg_tx, tx_nents); - - while (i blocks) { - tlen = (i == (blocks - 1)) ? rem : 0; - len = get_start_tag(qup-start_tag.start[tx_len], - msg, !i, (i == (blocks-1)), tlen); - - qup_sg_set_buf(qup-sg_tx[i 1], - qup-start_tag.start[tx_len], - qup-start_tag, - len, qup, 0, 0); - - tx_len += len; - qup_sg_set_buf(qup-sg_tx[(i 1) + 1], - msg-buf[QUP_READ_LIMIT * i], NULL, - tlen, qup, 1, DMA_TO_DEVICE); - i++; + u32 rx_nents = 0, tx_nents = 0, len, blocks, rem, last; + u32 cur_rx_nents, cur_tx_nents; + u32 tlen, i, tx_len, tx_buf = 0, rx_buf = 0, off = 0; + + while (num) { + blocks = (msg-len + QUP_READ_LIMIT) / QUP_READ_LIMIT; + rem = msg-len % QUP_READ_LIMIT; + i = 0, tx_len = 0, len = 0; + + if (msg-flags I2C_M_RD) { + cur_tx_nents = 1; + cur_rx_nents = (blocks 1) + 1; + rx_nents += cur_rx_nents; + tx_nents += cur_tx_nents; + + while (i blocks) { + /* transfer length set to '0'
Re: [RFC] capabilities: Ambient capabilities
On Mar 13, 2015 6:24 AM, Andrew G. Morgan mor...@kernel.org wrote: It's to preserve the invariant that pA is always a subset of pI. But since a user can always raise a bit in pI if it is present in pP, what does this invariant add to your model other than inconvenience? The useful part is that dropping a bit from pI also drops it from pA. To keep the model consistent, I also require that you add the bit to pI before adding it to pA. I'm also unclear how you can turn off this new 'feature' for a process tree? As it is, the code creates an exploit path for a capable (pP != 0) program with an exploitable flaw to create a privilege escalation for an arbitrary child program. Huh? If you exploit the parent, you already win. Yes, if a kiddie injects shellcode that does system(/bin/bash) into some pP != 0 program, they don't actually elevate their privileges. On the other hand, by the time an attacker injected shellcode for: prctl(PR_CAP_AMBIENT, PR_CAP_AMBIENT_RAISE, CAP_SYS_ADMIN); system(/bin/bash); Let's call the above two lines [a] and [b]. With this patch, you are encouraging folk to write programs that contain a line like [a] already. So, yes, I am saying that you are creating an exploitable path in these programs that says if someone can inject system(/bin/bash) into these programs they can get a new (because of this patch) privilege escalation. In the prevailing model, this kind of privilege escalation (resulting from naive inheritance) is designed out. I recognize that you want to add it back in, but I am concerned that you are not allowing for the possibility that some folk might still want to still be able to prevent it. If you have a program that deliberately uses PR_CAP_AMBIENT, then setting such a securebit will break the program, so it still doesn't buy you anything. into a target, they can already do whatever they want. While I understand that everyone 'knows what they are doing' in implementing this change, I'm convinced that folk that are up to no good also do... Why not provide a lockable secure bit to selectively disable this support? Show me a legitimate use case and I'll gladly implement a secure bit. Thanks. I was kind of hoping that you would add a lockable secure bit that defaults this support to off, but can be used to turn it on with or without a lock. That way, you can avoid disturbing the legacy defaults (no surprises). I think this thing needs to default on to be useful. In the mean time, I don't even believe that there's a legitimate use for any of the other secure bits (except keepcaps, and I don't know why that's a securebit in the first place). Those bits currently make it possible to run a subsystem with no [set]uid-0 support in its process tree. Not usefully, because even with all the securebits set to their non-legacy modes, caps don't inherit, so it doesn't work. I've tried. In the mean time, see CVE-2014-3215 for an example of why securebits are probably more trouble than they're worth. I think it is safe to say that naive privilege inheritance has a fair track record of being exploited orders of magnitude more frequently than this. After all, these are the reasons LD_PRELOAD and shell script setuid bits are suppressed. I don't know what you mean here by naive privilege inheritance. The examples you're taking about aren't inheritance at all; they're exploring privilege *grants* during execve. My patch deliberately leaves grants like that alone. --Andy Cheers Andrew -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] PM / Domains: If an OF node is found but no device probed yet, defer.
Geert Uytterhoeven ge...@linux-m68k.org writes: On Wed, Mar 11, 2015 at 11:08 PM, Rafael J. Wysocki r...@rjwysocki.net wrote: More CCes. On Wednesday, March 11, 2015 08:27:28 AM Eric Anholt wrote: If we've declared a power domain in the OF, and the OF node is found but the requested domain hasn't been registered on it yet, then we probably have just tried to probe before the power domain driver has. Defer our device's probe until it shows up. Signed-off-by: Eric Anholt e...@anholt.net Kevin, Ulf, any chance to have a look at this, please? --- I ran into this when turning my ad-hoc code for BCM2835 (Raspberry Pi) USB poweron support in the DWC2 controller to an OF-based power domain declaration. I guess you are initializing the PM domains from module_init()? I use core_initcall() in arch/arm/mach-shmobile/pm-rmobile.c to make sure it's initialized earlier, as e.g. the interrupt controller uses postcore_initcall(). Yeah, I think most existing users are initizling PM domains early, but IMO we should be working towards supporting PM domains that are created later as well (as this patch does.) drivers/base/power/domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index ba4abbe..2b93c98 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2064,7 +2064,7 @@ EXPORT_SYMBOL_GPL(of_genpd_del_provider); struct generic_pm_domain *of_genpd_get_from_provider( struct of_phandle_args *genpdspec) { - struct generic_pm_domain *genpd = ERR_PTR(-ENOENT); + struct generic_pm_domain *genpd = ERR_PTR(-EPROBE_DEFER); Currently platform_drv_probe() just continues if dev_pm_domain_attach() returns a different error than -EPROBE_DEFER, which is what you are seeing. Your change does have the side effect that a new DT with PM domains won't work on an older kernel that doesn't have the PM domain driver yet. Is that a real problem though? Using newer DTs on older kernels can cause many types of problems. Kevin -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 07/32] blackfin: copy_thread(): rename 'topstk' argument to 'kthread_arg'
'topstk' is a misnomer: it is not a pointer to the top of a stack. Rather, it is an argument passed to the main function executed by a new kernel thread. Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- arch/blackfin/kernel/process.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/blackfin/kernel/process.c b/arch/blackfin/kernel/process.c index 4aa5545..81cdd5f 100644 --- a/arch/blackfin/kernel/process.c +++ b/arch/blackfin/kernel/process.c @@ -109,9 +109,12 @@ asmlinkage int bfin_clone(unsigned long clone_flags, unsigned long newsp) return do_fork(clone_flags, newsp, 0, NULL, NULL); } +/* + * Copy architecture-specific thread state + */ int copy_thread(unsigned long clone_flags, - unsigned long usp, unsigned long topstk, + unsigned long usp, unsigned long kthread_arg, struct task_struct *p) { struct pt_regs *childregs; @@ -120,14 +123,16 @@ copy_thread(unsigned long clone_flags, childregs = (struct pt_regs *) (task_stack_page(p) + THREAD_SIZE) - 1; v = ((unsigned long *)childregs) - 2; if (unlikely(p-flags PF_KTHREAD)) { + /* kernel thread */ memset(childregs, 0, sizeof(struct pt_regs)); v[0] = usp; - v[1] = topstk; + v[1] = kthread_arg; childregs-orig_p0 = -1; childregs-ipend = 0x8000; __asm__ __volatile__(%0 = syscfg;:=da(childregs-syscfg):); p-thread.usp = 0; } else { + /* user thread */ *childregs = *current_pt_regs(); childregs-r0 = 0; p-thread.usp = usp ? : rdusp(); -- 2.0.0.GIT -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 10/32] cris/arch-v32: copy_thread(): rename 'arg' argument to 'kthread_arg'
The 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()). Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- arch/cris/arch-v32/kernel/process.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/cris/arch-v32/kernel/process.c b/arch/cris/arch-v32/kernel/process.c index cebd32e..dc55e6c 100644 --- a/arch/cris/arch-v32/kernel/process.c +++ b/arch/cris/arch-v32/kernel/process.c @@ -101,9 +101,12 @@ unsigned long thread_saved_pc(struct task_struct *t) extern asmlinkage void ret_from_fork(void); extern asmlinkage void ret_from_kernel_thread(void); +/* + * Copy architecture-specific thread state + */ int copy_thread(unsigned long clone_flags, unsigned long usp, - unsigned long arg, struct task_struct *p) + unsigned long kthread_arg, struct task_struct *p) { struct pt_regs *childregs = task_pt_regs(p); struct switch_stack *swstack = ((struct switch_stack *) childregs) - 1; @@ -114,10 +117,11 @@ copy_thread(unsigned long clone_flags, unsigned long usp, * task. */ if (unlikely(p-flags PF_KTHREAD)) { + /* kernel thread */ memset(swstack, 0, sizeof(struct switch_stack) + sizeof(struct pt_regs)); swstack-r1 = usp; - swstack-r2 = arg; + swstack-r2 = kthread_arg; childregs-ccs = 1 (I_CCS_BITNR + CCS_SHIFT); swstack-return_ip = (unsigned long) ret_from_kernel_thread; p-thread.ksp = (unsigned long) swstack; -- 2.0.0.GIT -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 17/32] microblaze: copy_thread(): rename 'arg' argument to 'kthread_arg'
The 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()). Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- arch/microblaze/kernel/process.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/microblaze/kernel/process.c b/arch/microblaze/kernel/process.c index b2dd371..d4ecb98 100644 --- a/arch/microblaze/kernel/process.c +++ b/arch/microblaze/kernel/process.c @@ -51,20 +51,22 @@ void flush_thread(void) { } +/* + * Copy architecture-specific thread state + */ int copy_thread(unsigned long clone_flags, unsigned long usp, - unsigned long arg, struct task_struct *p) + unsigned long kthread_arg, struct task_struct *p) { struct pt_regs *childregs = task_pt_regs(p); struct thread_info *ti = task_thread_info(p); if (unlikely(p-flags PF_KTHREAD)) { - /* if we're creating a new kernel thread then just zeroing all -* the registers. That's OK for a brand new thread.*/ + /* kernel thread: just zero all the registers */ memset(childregs, 0, sizeof(struct pt_regs)); memset(ti-cpu_context, 0, sizeof(struct cpu_context)); ti-cpu_context.r1 = (unsigned long)childregs; ti-cpu_context.r20 = (unsigned long)usp; /* fn */ - ti-cpu_context.r19 = (unsigned long)arg; + ti-cpu_context.r19 = kthread_arg; childregs-pt_mode = 1; local_save_flags(childregs-msr); #ifdef CONFIG_MMU @@ -73,6 +75,8 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, ti-cpu_context.r15 = (unsigned long)ret_from_kernel_thread - 8; return 0; } + + /* user thread */ *childregs = *current_pt_regs(); if (usp) childregs-r1 = usp; -- 2.0.0.GIT -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 21/32] openrisc: copy_thread(): rename 'arg' argument to 'kthread_arg'
The 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()). Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- arch/openrisc/kernel/process.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c index 386af25..59098c4 100644 --- a/arch/openrisc/kernel/process.c +++ b/arch/openrisc/kernel/process.c @@ -114,7 +114,7 @@ extern asmlinkage void ret_from_fork(void); * copy_thread * @clone_flags: flags * @usp: user stack pointer or fn for kernel thread - * @arg: arg to fn for kernel thread; always NULL for userspace thread + * @kthread_arg: arg to fn for kernel thread; always NULL for userspace thread * @p: the newly created task * @regs: CPU context to copy for userspace thread; always NULL for kthread * @@ -140,10 +140,9 @@ extern asmlinkage void ret_from_fork(void); * below); ret_from_fork will then continue its execution causing the * 'kernel thread' to return to userspace as a userspace thread. */ - int copy_thread(unsigned long clone_flags, unsigned long usp, - unsigned long arg, struct task_struct *p) + unsigned long kthread_arg, struct task_struct *p) { struct pt_regs *userregs; struct pt_regs *kregs; @@ -165,10 +164,12 @@ copy_thread(unsigned long clone_flags, unsigned long usp, kregs = (struct pt_regs *)sp; if (unlikely(p-flags PF_KTHREAD)) { + /* kernel thread */ memset(kregs, 0, sizeof(struct pt_regs)); kregs-gpr[20] = usp; /* fn, kernel thread */ - kregs-gpr[22] = arg; + kregs-gpr[22] = kthread_arg; } else { + /* user thread */ *userregs = *current_pt_regs(); if (usp) -- 2.0.0.GIT -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] perf/builtin-diff: remove unnecessary error output
This patch prevents duplicated error output. per_session__new function calls perf_data_file__open which will print error message if it can not open the file and we will get duplicated output of the error message: failed to open perf.data.old: No such file or directory Failed to open perf.data.old Signed-off-by: Alexander Kuleshov kuleshovm...@gmail.com --- tools/perf/builtin-diff.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 74aada5..a18bf98 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c @@ -742,7 +742,6 @@ static int __cmd_diff(void) data__for_each_file(i, d) { d-session = perf_session__new(d-file, false, tool); if (!d-session) { - pr_err(Failed to open %s\n, d-file.path); ret = -1; goto out_delete; } -- 2.3.1.291.g7a9409c -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 19/32] mn10300: copy_thread(): rename 'ustk_size' argument to 'kthread_arg'
'ustk_size' is misleading, since this argument is never used for a user stack size. Rather, it is an argument passed to the main function executed by a new kernel thread. Therefore, rename it to 'kthread_arg'. Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- arch/mn10300/kernel/process.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c index 3707da5..d08a9b1 100644 --- a/arch/mn10300/kernel/process.c +++ b/arch/mn10300/kernel/process.c @@ -137,11 +137,10 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) } /* - * set up the kernel stack for a new thread and copy arch-specific thread - * control information + * Copy architecture-specific thread state */ int copy_thread(unsigned long clone_flags, - unsigned long c_usp, unsigned long ustk_size, + unsigned long c_usp, unsigned long kthread_arg, struct task_struct *p) { struct thread_info *ti = task_thread_info(p); @@ -164,14 +163,17 @@ int copy_thread(unsigned long clone_flags, p-thread.usp = c_usp; if (unlikely(p-flags PF_KTHREAD)) { + /* kernel thread */ memset(c_regs, 0, sizeof(struct pt_regs)); c_regs-a0 = c_usp; /* function */ - c_regs-d0 = ustk_size; /* argument */ + c_regs-d0 = kthread_arg; local_save_flags(c_regs-epsw); c_regs-epsw |= EPSW_IE | EPSW_IM_7; p-thread.pc= (unsigned long) ret_from_kernel_thread; return 0; } + + /* user thread */ *c_regs = *current_pt_regs(); if (c_usp) c_regs-sp = c_usp; -- 2.0.0.GIT -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3/6] ARM64: cpuidle: Replace cpu_suspend by the common ARM/ARM64 function
On Tue, Mar 03, 2015 at 01:29:34PM +0100, Daniel Lezcano wrote: Call the common ARM/ARM64 'arm_cpuidle_suspend' instead of cpu_suspend function which is specific to ARM64. Signed-off-by: Daniel Lezcano daniel.lezc...@linaro.org --- drivers/cpuidle/cpuidle-arm64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpuidle/cpuidle-arm64.c b/drivers/cpuidle/cpuidle-arm64.c index 39a2c62..0cea244 100644 --- a/drivers/cpuidle/cpuidle-arm64.c +++ b/drivers/cpuidle/cpuidle-arm64.c @@ -49,7 +49,7 @@ static int arm64_enter_idle_state(struct cpuidle_device *dev, * call the CPU ops suspend protocol with idle index as a * parameter. */ - ret = cpu_suspend(idx); + arm_cpuidle_suspend(idx); Nitpick: why don't we just rename the arm one cpuidle_suspend()? -- Catalin -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH V5] Allow compaction of unevictable pages
On 03/13/2015 01:26 PM, Eric B Munson wrote: --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1046,6 +1046,8 @@ typedef enum { ISOLATE_SUCCESS,/* Pages isolated, migrate */ } isolate_migrate_t; +int sysctl_compact_unevictable; + /* * Isolate all pages that can be migrated from the first suitable block, * starting at the block pointed to by the migrate scanner pfn within I suspect that the use cases where users absolutely do not want unevictable pages migrated are special cases, and it may make sense to enable sysctl_compact_unevictable by default. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 net-next 2/2] samples: bpf: add skb-field examples and tests
- modify sockex1 example to count number of bytes in outgoing packets - modify sockex2 example to count number of bytes and packets per flow - add 4 stress tests that exercise 'skb-field' code path of verifier Signed-off-by: Alexei Starovoitov a...@plumgrid.com --- samples/bpf/sockex1_kern.c |8 +++-- samples/bpf/sockex1_user.c |2 +- samples/bpf/sockex2_kern.c | 26 +--- samples/bpf/sockex2_user.c | 11 +-- samples/bpf/test_verifier.c | 70 +++ 5 files changed, 101 insertions(+), 16 deletions(-) diff --git a/samples/bpf/sockex1_kern.c b/samples/bpf/sockex1_kern.c index 066892662915..ed18e9a4909c 100644 --- a/samples/bpf/sockex1_kern.c +++ b/samples/bpf/sockex1_kern.c @@ -1,5 +1,6 @@ #include uapi/linux/bpf.h #include uapi/linux/if_ether.h +#include uapi/linux/if_packet.h #include uapi/linux/ip.h #include bpf_helpers.h @@ -11,14 +12,17 @@ struct bpf_map_def SEC(maps) my_map = { }; SEC(socket1) -int bpf_prog1(struct sk_buff *skb) +int bpf_prog1(struct __sk_buff *skb) { int index = load_byte(skb, ETH_HLEN + offsetof(struct iphdr, protocol)); long *value; + if (skb-pkt_type != PACKET_OUTGOING) + return 0; + value = bpf_map_lookup_elem(my_map, index); if (value) - __sync_fetch_and_add(value, 1); + __sync_fetch_and_add(value, skb-len); return 0; } diff --git a/samples/bpf/sockex1_user.c b/samples/bpf/sockex1_user.c index 34a443ff3831..678ce4693551 100644 --- a/samples/bpf/sockex1_user.c +++ b/samples/bpf/sockex1_user.c @@ -40,7 +40,7 @@ int main(int ac, char **argv) key = IPPROTO_ICMP; assert(bpf_lookup_elem(map_fd[0], key, icmp_cnt) == 0); - printf(TCP %lld UDP %lld ICMP %lld packets\n, + printf(TCP %lld UDP %lld ICMP %lld bytes\n, tcp_cnt, udp_cnt, icmp_cnt); sleep(1); } diff --git a/samples/bpf/sockex2_kern.c b/samples/bpf/sockex2_kern.c index 6f0135f0f217..ba0e177ff561 100644 --- a/samples/bpf/sockex2_kern.c +++ b/samples/bpf/sockex2_kern.c @@ -42,13 +42,13 @@ static inline int proto_ports_offset(__u64 proto) } } -static inline int ip_is_fragment(struct sk_buff *ctx, __u64 nhoff) +static inline int ip_is_fragment(struct __sk_buff *ctx, __u64 nhoff) { return load_half(ctx, nhoff + offsetof(struct iphdr, frag_off)) (IP_MF | IP_OFFSET); } -static inline __u32 ipv6_addr_hash(struct sk_buff *ctx, __u64 off) +static inline __u32 ipv6_addr_hash(struct __sk_buff *ctx, __u64 off) { __u64 w0 = load_word(ctx, off); __u64 w1 = load_word(ctx, off + 4); @@ -58,7 +58,7 @@ static inline __u32 ipv6_addr_hash(struct sk_buff *ctx, __u64 off) return (__u32)(w0 ^ w1 ^ w2 ^ w3); } -static inline __u64 parse_ip(struct sk_buff *skb, __u64 nhoff, __u64 *ip_proto, +static inline __u64 parse_ip(struct __sk_buff *skb, __u64 nhoff, __u64 *ip_proto, struct flow_keys *flow) { __u64 verlen; @@ -82,7 +82,7 @@ static inline __u64 parse_ip(struct sk_buff *skb, __u64 nhoff, __u64 *ip_proto, return nhoff; } -static inline __u64 parse_ipv6(struct sk_buff *skb, __u64 nhoff, __u64 *ip_proto, +static inline __u64 parse_ipv6(struct __sk_buff *skb, __u64 nhoff, __u64 *ip_proto, struct flow_keys *flow) { *ip_proto = load_byte(skb, @@ -96,7 +96,7 @@ static inline __u64 parse_ipv6(struct sk_buff *skb, __u64 nhoff, __u64 *ip_proto return nhoff; } -static inline bool flow_dissector(struct sk_buff *skb, struct flow_keys *flow) +static inline bool flow_dissector(struct __sk_buff *skb, struct flow_keys *flow) { __u64 nhoff = ETH_HLEN; __u64 ip_proto; @@ -183,18 +183,23 @@ static inline bool flow_dissector(struct sk_buff *skb, struct flow_keys *flow) return true; } +struct pair { + long packets; + long bytes; +}; + struct bpf_map_def SEC(maps) hash_map = { .type = BPF_MAP_TYPE_HASH, .key_size = sizeof(__be32), - .value_size = sizeof(long), + .value_size = sizeof(struct pair), .max_entries = 1024, }; SEC(socket2) -int bpf_prog2(struct sk_buff *skb) +int bpf_prog2(struct __sk_buff *skb) { struct flow_keys flow; - long *value; + struct pair *value; u32 key; if (!flow_dissector(skb, flow)) @@ -203,9 +208,10 @@ int bpf_prog2(struct sk_buff *skb) key = flow.dst; value = bpf_map_lookup_elem(hash_map, key); if (value) { - __sync_fetch_and_add(value, 1); + __sync_fetch_and_add(value-packets, 1); + __sync_fetch_and_add(value-bytes, skb-len); } else { - long val = 1; + struct pair val = {1, skb-len}; bpf_map_update_elem(hash_map, key, val, BPF_ANY); } diff --git
[PATCH v2 net-next 0/2] bpf: allow eBPF access skb fields
Hi All, V1-V2: - refactored field access converter into common helper convert_skb_access() used in both classic and extended BPF - added missing build_bug_on for field 'len' - added comment to uapi/linux/bpf.h as suggested by Daniel - dropped exposing 'ifindex' field for now classic BPF has a way to access skb fields, whereas extended BPF didn't. This patch introduces this ability. Classic BPF can access fields via negative SKF_AD_OFF offset. Positive bpf_ld_abs N is treated as load from packet, whereas bpf_ld_abs -0x1000 + N is treated as skb fields access. Many offsets were hard coded over years: SKF_AD_PROTOCOL, SKF_AD_PKTTYPE, etc. The problem with this approach was that for every new field classic bpf assembler had to be tweaked. I've considered doing the same for extended, but for every new field LLVM compiler would have to be modifed. Since it would need to add a new intrinsic. It could be done with single intrinsic and magic offset or use of inline assembler, but neither are clean from compiler backend point of view, since they look like calls but shouldn't scratch caller-saved registers. Another approach was to introduce a new helper functions like bpf_get_pkt_type() for every field that we want to access, but that is equally ugly for kernel and slow, since helpers are calls and they are slower then just loads. In theory helper calls can be 'inlined' inside kernel into direct loads, but since they were calls for user space, compiler would have to spill registers around such calls anyway. Teaching compiler to treat such helpers differently is even uglier. They were few other ideas considered. At the end the best seems to be to introduce a user accessible mirror of in-kernel sk_buff structure: struct __sk_buff { __u32 len; __u32 pkt_type; __u32 mark; __u32 queue_mapping; }; bpf programs will do: int bpf_prog1(struct __sk_buff *skb) { __u32 var = skb-pkt_type; which will be compiled to bpf assembler as: dst_reg = *(u32 *)(src_reg + 4) // 4 == offsetof(struct __sk_buff, pkt_type) bpf verifier will check validity of access and will convert it to: dst_reg = *(u8 *)(src_reg + offsetof(struct sk_buff, __pkt_type_offset)) dst_reg = 7 since 'pkt_type' is a bitfield. No new instructions added. LLVM doesn't need to be modified. JITs don't change and verifier already knows when it accesses 'ctx' pointer. The only thing needed was to convert user visible offset within __sk_buff to kernel internal offset within sk_buff. For 'len' and other fields conversion is trivial. Converting 'pkt_type' takes 2 or 3 instructions depending on endianness. More fields can be exposed by adding to the end of the 'struct __sk_buff'. Like vlan_tci and others can be added later. When pkt_type field is moved around, goes into different structure, removed or its size changes, the function convert_skb_access() would need to updated and it will cover both classic and extended. Patch 2 updates examples to demonstrates how fields are accessed and adds new tests for verifier, since it needs to detect a corner case when attacker is using single bpf instruction in two branches with different register types. The 4 fields of __sk_buff are already exposed to user space via classic bpf and I believe they're useful in extended as well. Alexei Starovoitov (2): bpf: allow extended BPF programs access skb fields samples: bpf: add skb-field examples and tests include/linux/bpf.h |5 +- include/uapi/linux/bpf.h| 10 +++ kernel/bpf/syscall.c|2 +- kernel/bpf/verifier.c | 152 ++- net/core/filter.c | 100 +++- samples/bpf/sockex1_kern.c |8 ++- samples/bpf/sockex1_user.c |2 +- samples/bpf/sockex2_kern.c | 26 +--- samples/bpf/sockex2_user.c | 11 +++- samples/bpf/test_verifier.c | 70 10 files changed, 335 insertions(+), 51 deletions(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v4 4/9] selftests: Add install target
On 03/10/2015 10:06 PM, Michael Ellerman wrote: This adds make install support to selftests. The basic usage is: $ cd tools/testing/selftests $ make install That installs into tools/testing/selftests/install, which can then be copied where ever necessary. The install destination is also configurable using eg: $ INSTALL_PATH=/mnt/selftests make install The implementation uses two targets in the child makefiles. The first install is expected to install all files into $(INSTALL_PATH). The second, emit_tests, is expected to emit the test instructions (ie. bash script) on stdout. Separating this from install means the child makefiles need no knowledge of the location of the test script. Signed-off-by: Michael Ellerman m...@ellerman.id.au Thanks for doing the work. This patch will be applied to next and will be queued for 4.1 thanks, -- Shuah -- Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) shua...@osg.samsung.com | (970) 217-8978 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 05/32] arm64: copy_thread(): rename 'stk_sz' argument to 'kthread_arg'
'stk_sz' is a misnomer: it is never used for a stack size. Rather, it is an argument which is passed to the main function executed by a kernel thread, when forking a new kthread. The most appropriate name is 'kthread_arg'. Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- arch/arm64/kernel/process.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index fde9923..734e2b6 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -242,8 +242,11 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) asmlinkage void ret_from_fork(void) asm(ret_from_fork); +/* + * Copy architecture-specific thread state + */ int copy_thread(unsigned long clone_flags, unsigned long stack_start, - unsigned long stk_sz, struct task_struct *p) + unsigned long kthread_arg, struct task_struct *p) { struct pt_regs *childregs = task_pt_regs(p); unsigned long tls = p-thread.tp_value; @@ -251,6 +254,7 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start, memset(p-thread.cpu_context, 0, sizeof(struct cpu_context)); if (likely(!(p-flags PF_KTHREAD))) { + /* user thread */ *childregs = *current_pt_regs(); childregs-regs[0] = 0; if (is_compat_thread(task_thread_info(p))) { @@ -276,10 +280,11 @@ int copy_thread(unsigned long clone_flags, unsigned long stack_start, if (clone_flags CLONE_SETTLS) tls = childregs-regs[3]; } else { + /* kernel thread */ memset(childregs, 0, sizeof(struct pt_regs)); childregs-pstate = PSR_MODE_EL1h; p-thread.cpu_context.x19 = stack_start; - p-thread.cpu_context.x20 = stk_sz; + p-thread.cpu_context.x20 = kthread_arg; } p-thread.cpu_context.pc = (unsigned long)ret_from_fork; p-thread.cpu_context.sp = (unsigned long)childregs; -- 2.0.0.GIT -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 03/32] arc: copy_thread(): rename 'arg' argument to 'kthread_arg'
The 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()). Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- arch/arc/kernel/process.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/arc/kernel/process.c b/arch/arc/kernel/process.c index fdd8971..cf366bd 100644 --- a/arch/arc/kernel/process.c +++ b/arch/arc/kernel/process.c @@ -49,7 +49,9 @@ void arch_cpu_idle(void) asmlinkage void ret_from_fork(void); -/* Layout of Child kernel mode stack as setup at the end of this function is +/* Copy architecture-specific thread state + * + * Layout of Child kernel mode stack as setup at the end of this function is * * | ...| * | ...| @@ -81,7 +83,7 @@ asmlinkage void ret_from_fork(void); * -- = END of PAGE */ int copy_thread(unsigned long clone_flags, - unsigned long usp, unsigned long arg, + unsigned long usp, unsigned long kthread_arg, struct task_struct *p) { struct pt_regs *c_regs;/* child's pt_regs */ @@ -110,9 +112,10 @@ int copy_thread(unsigned long clone_flags, childksp[1] = (unsigned long)ret_from_fork; /* blink */ if (unlikely(p-flags PF_KTHREAD)) { + /* kernel thread */ memset(c_regs, 0, sizeof(struct pt_regs)); - c_callee-r13 = arg; /* argument to kernel thread */ + c_callee-r13 = kthread_arg; c_callee-r14 = usp; /* function */ return 0; -- 2.0.0.GIT -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 02/32] alpha: copy_thread(): rename 'arg' argument to 'kthread_arg'
The 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()). Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- arch/alpha/kernel/process.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c index 1941a07..84d1326 100644 --- a/arch/alpha/kernel/process.c +++ b/arch/alpha/kernel/process.c @@ -236,12 +236,11 @@ release_thread(struct task_struct *dead_task) } /* - * Copy an alpha thread.. + * Copy architecture-specific thread state */ - int copy_thread(unsigned long clone_flags, unsigned long usp, - unsigned long arg, + unsigned long kthread_arg, struct task_struct *p) { extern void ret_from_fork(void); @@ -262,7 +261,7 @@ copy_thread(unsigned long clone_flags, unsigned long usp, sizeof(struct switch_stack) + sizeof(struct pt_regs)); childstack-r26 = (unsigned long) ret_from_kernel_thread; childstack-r9 = usp; /* function */ - childstack-r10 = arg; + childstack-r10 = kthread_arg; childregs-hae = alpha_mv.hae_cache, childti-pcb.usp = 0; return 0; -- 2.0.0.GIT -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 04/12] tty: serial: msm_serial: Remove dead code
This config no longer exists now that mach-msm has been removed. Delete it and the associated code. Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: David Brown dav...@codeaurora.org Cc: Bryan Huntsman bry...@codeaurora.org Cc: Daniel Walker dwal...@fifo99.com Signed-off-by: Stephen Boyd sb...@codeaurora.org --- This can be acked and go through arm-soc or applied directly to serial tree. drivers/tty/serial/Kconfig | 2 +- drivers/tty/serial/msm_serial.h | 9 - 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index 965c80f9fc50..049b9eb2e3e3 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig @@ -1054,7 +1054,7 @@ config SERIAL_SGI_IOC3 config SERIAL_MSM bool MSM on-chip serial port support - depends on ARCH_MSM || ARCH_QCOM + depends on ARCH_QCOM select SERIAL_CORE config SERIAL_MSM_CONSOLE diff --git a/drivers/tty/serial/msm_serial.h b/drivers/tty/serial/msm_serial.h index 3e1c7138d8cd..737f69fe7113 100644 --- a/drivers/tty/serial/msm_serial.h +++ b/drivers/tty/serial/msm_serial.h @@ -170,15 +170,6 @@ void msm_serial_set_mnd_regs_from_uartclk(struct uart_port *port) msm_serial_set_mnd_regs_tcxoby4(port); } -/* - * TROUT has a specific defect that makes it report it's uartclk - * as 19.2Mhz (TCXO) when it's actually 4.8Mhz (TCXO/4). This special - * cases TROUT to use the right clock. - */ -#ifdef CONFIG_MACH_TROUT -#define msm_serial_set_mnd_regs msm_serial_set_mnd_regs_tcxoby4 -#else #define msm_serial_set_mnd_regs msm_serial_set_mnd_regs_from_uartclk -#endif #endif /* __DRIVERS_SERIAL_MSM_SERIAL_H */ -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 08/12] ehci-msm: Remove dead dependency
This dependency no longer exists now that mach-msm has been removed. Delete it. Cc: Greg Kroah-Hartman gre...@linuxfoundation.org Cc: Alan Stern st...@rowland.harvard.edu Cc: linux-...@vger.kernel.org Cc: David Brown dav...@codeaurora.org Cc: Bryan Huntsman bry...@codeaurora.org Cc: Daniel Walker dwal...@fifo99.com Signed-off-by: Stephen Boyd sb...@codeaurora.org --- This can be acked and go through arm-soc or applied directly to usb tree. drivers/usb/host/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 5ad60e46dc2b..197a6a3e613b 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -198,7 +198,7 @@ config USB_EHCI_HCD_AT91 config USB_EHCI_MSM tristate Support for Qualcomm QSD/MSM on-chip EHCI USB controller - depends on ARCH_MSM || ARCH_QCOM + depends on ARCH_QCOM select USB_EHCI_ROOT_HUB_TT ---help--- Enables support for the USB Host controller present on the -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH net-next 1/2] bpf: allow extended BPF programs access skb fields
On 3/13/15 9:43 AM, Daniel Borkmann wrote: On 03/13/2015 05:22 PM, Alexei Starovoitov wrote: On 3/13/15 2:57 AM, Daniel Borkmann wrote: On 03/13/2015 03:21 AM, Alexei Starovoitov wrote: introduce user accessible mirror of in-kernel 'struct sk_buff': For each member, I'd also add BUILD_BUG_ON()s similarly as we have in convert_bpf_extensions(). That way, people won't forget to adjust the code. I thought about it, but didn't add it, since we already have them in the same file several lines above this spot. I think one build error per .c file should be enough to attract attention. Though I'll add a comment to convert_bpf_extensions() that build_bug_on errors should be addressed in two places. My concern would be that in case the code gets changed, this spot could easily be overlooked by someone possibly unfamiliar with the code, since no build error triggers there. So I guess it wouldn't hurt or cost us much to also adding the BUILD_BUG_ON()s there instead of a comment. I think it's overkill, but fine, it's minor. Will add another set of build_bug_ons and see how it looks. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 10/12] phy: qcom-ufs: Switch dependency to ARCH_QCOM
This phy only exists on platforms under ARCH_QCOM, not ARCH_MSM. Cc: Yaniv Gardi yga...@codeaurora.org Cc: Dov Levenglick d...@codeaurora.org Cc: Christoph Hellwig h...@lst.de Cc: David Brown dav...@codeaurora.org Cc: Bryan Huntsman bry...@codeaurora.org Cc: Daniel Walker dwal...@fifo99.com Signed-off-by: Stephen Boyd sb...@codeaurora.org --- This can be acked and go through arm-soc or applied directly to phy tree. drivers/phy/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 2962de205ba7..9b1ff313bd51 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -286,7 +286,7 @@ config PHY_STIH41X_USB config PHY_QCOM_UFS tristate Qualcomm UFS PHY driver - depends on OF ARCH_MSM + depends on OF ARCH_QCOM select GENERIC_PHY help Support for UFS PHY on QCOM chipsets. -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 02/12] gpio: Remove gpio-msm-v1 driver
This driver is orphaned now that mach-msm has been removed. Delete it. Cc: David Brown dav...@codeaurora.org Cc: Bryan Huntsman bry...@codeaurora.org Cc: Daniel Walker dwal...@fifo99.com Cc: Linus Walleij linus.wall...@linaro.org Cc: Alexandre Courbot gnu...@gmail.com Signed-off-by: Stephen Boyd sb...@codeaurora.org --- This can be acked and go through arm-soc or applied directly to gpio tree. drivers/gpio/Kconfig | 8 - drivers/gpio/Makefile | 1 - drivers/gpio/gpio-msm-v1.c | 714 - 3 files changed, 723 deletions(-) delete mode 100644 drivers/gpio/gpio-msm-v1.c diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index c1e2ca3d9a51..02087e82e77d 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -223,14 +223,6 @@ config GPIO_MPC8XXX Say Y here if you're going to use hardware that connects to the MPC512x/831x/834x/837x/8572/8610 GPIOs. -config GPIO_MSM_V1 - tristate Qualcomm MSM GPIO v1 - depends on GPIOLIB ARCH_MSM (ARCH_MSM7X00A || ARCH_MSM7X30 || ARCH_QSD8X50) - help - Say yes here to support the GPIO interface on ARM v6 based - Qualcomm MSM chips. Most of the pins on the MSM can be - selected for GPIO, and are controlled by this driver. - config GPIO_MSM_V2 tristate Qualcomm MSM GPIO v2 depends on GPIOLIB OF ARCH_QCOM diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index bdda6a94d2cd..aa0f2eaa040b 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -58,7 +58,6 @@ obj-$(CONFIG_GPIO_MOXART) += gpio-moxart.o obj-$(CONFIG_GPIO_MPC5200) += gpio-mpc5200.o obj-$(CONFIG_GPIO_MPC8XXX) += gpio-mpc8xxx.o obj-$(CONFIG_GPIO_MSIC)+= gpio-msic.o -obj-$(CONFIG_GPIO_MSM_V1) += gpio-msm-v1.o obj-$(CONFIG_GPIO_MSM_V2) += gpio-msm-v2.o obj-$(CONFIG_GPIO_MVEBU)+= gpio-mvebu.o obj-$(CONFIG_GPIO_MXC) += gpio-mxc.o diff --git a/drivers/gpio/gpio-msm-v1.c b/drivers/gpio/gpio-msm-v1.c deleted file mode 100644 index edf285e26667.. --- a/drivers/gpio/gpio-msm-v1.c +++ /dev/null @@ -1,714 +0,0 @@ -/* - * Copyright (C) 2007 Google, Inc. - * Copyright (c) 2009-2012, The Linux Foundation. All rights reserved. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ - -#include linux/bitops.h -#include linux/gpio.h -#include linux/interrupt.h -#include linux/io.h -#include linux/irq.h -#include linux/module.h -#include linux/device.h -#include linux/platform_device.h -#include linux/err.h - -#include mach/msm_gpiomux.h - -/* see 80-VA736-2 Rev C pp 695-751 -** -** These are actually the *shadow* gpio registers, since the -** real ones (which allow full access) are only available to the -** ARM9 side of the world. -** -** Since the _BASE need to be page-aligned when we're mapping them -** to virtual addresses, adjust for the additional offset in these -** macros. -*/ - -#define MSM_GPIO1_REG(off) (off) -#define MSM_GPIO2_REG(off) (off) -#define MSM_GPIO1_SHADOW_REG(off) (off) -#define MSM_GPIO2_SHADOW_REG(off) (off) - -/* - * MSM7X00 registers - */ -/* output value */ -#define MSM7X00_GPIO_OUT_0 MSM_GPIO1_SHADOW_REG(0x00) /* gpio 15-0 */ -#define MSM7X00_GPIO_OUT_1 MSM_GPIO2_SHADOW_REG(0x00) /* gpio 42-16 */ -#define MSM7X00_GPIO_OUT_2 MSM_GPIO1_SHADOW_REG(0x04) /* gpio 67-43 */ -#define MSM7X00_GPIO_OUT_3 MSM_GPIO1_SHADOW_REG(0x08) /* gpio 94-68 */ -#define MSM7X00_GPIO_OUT_4 MSM_GPIO1_SHADOW_REG(0x0C) /* gpio 106-95 */ -#define MSM7X00_GPIO_OUT_5 MSM_GPIO1_SHADOW_REG(0x50) /* gpio 107-121 */ - -/* same pin map as above, output enable */ -#define MSM7X00_GPIO_OE_0 MSM_GPIO1_SHADOW_REG(0x10) -#define MSM7X00_GPIO_OE_1 MSM_GPIO2_SHADOW_REG(0x08) -#define MSM7X00_GPIO_OE_2 MSM_GPIO1_SHADOW_REG(0x14) -#define MSM7X00_GPIO_OE_3 MSM_GPIO1_SHADOW_REG(0x18) -#define MSM7X00_GPIO_OE_4 MSM_GPIO1_SHADOW_REG(0x1C) -#define MSM7X00_GPIO_OE_5 MSM_GPIO1_SHADOW_REG(0x54) - -/* same pin map as above, input read */ -#define MSM7X00_GPIO_IN_0 MSM_GPIO1_SHADOW_REG(0x34) -#define MSM7X00_GPIO_IN_1 MSM_GPIO2_SHADOW_REG(0x20) -#define MSM7X00_GPIO_IN_2 MSM_GPIO1_SHADOW_REG(0x38) -#define MSM7X00_GPIO_IN_3 MSM_GPIO1_SHADOW_REG(0x3C) -#define MSM7X00_GPIO_IN_4 MSM_GPIO1_SHADOW_REG(0x40) -#define MSM7X00_GPIO_IN_5 MSM_GPIO1_SHADOW_REG(0x44) - -/* same pin map as above, 1=edge 0=level interrup */ -#define MSM7X00_GPIO_INT_EDGE_0MSM_GPIO1_SHADOW_REG(0x60) -#define MSM7X00_GPIO_INT_EDGE_1
[PATCH 22/32] parisc: copy_thread(): rename 'arg' argument to 'kthread_arg'
The 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()). Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- arch/parisc/kernel/process.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c index 8a488c2..809905a 100644 --- a/arch/parisc/kernel/process.c +++ b/arch/parisc/kernel/process.c @@ -181,9 +181,12 @@ int dump_task_fpu (struct task_struct *tsk, elf_fpregset_t *r) return 1; } +/* + * Copy architecture-specific thread state + */ int copy_thread(unsigned long clone_flags, unsigned long usp, - unsigned long arg, struct task_struct *p) + unsigned long kthread_arg, struct task_struct *p) { struct pt_regs *cregs = (p-thread.regs); void *stack = task_stack_page(p); @@ -195,11 +198,10 @@ copy_thread(unsigned long clone_flags, unsigned long usp, extern void * const child_return; if (unlikely(p-flags PF_KTHREAD)) { + /* kernel thread */ memset(cregs, 0, sizeof(struct pt_regs)); if (!usp) /* idle thread */ return 0; - - /* kernel thread */ /* Must exit via ret_from_kernel_thread in order * to call schedule_tail() */ @@ -215,7 +217,7 @@ copy_thread(unsigned long clone_flags, unsigned long usp, #else cregs-gr[26] = usp; #endif - cregs-gr[25] = arg; + cregs-gr[25] = kthread_arg; } else { /* user thread */ /* usp must be word aligned. This also prevents users from -- 2.0.0.GIT -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 13/32] ia64: copy_thread(): rename 'user_stack_size' argument to 'kthread_arg'
'user_stack_size' is very misleading, since the argument is never used for the size of the user stack. Rather, it is an argument which is passed to the main function executed by a newly forked kernel thread. Hence, rename it to 'kthread_arg'. When forking a new user thread, the kernel thread arg was (uselessly) added to the new user stack pointer. This worked, since the kernel thread arg is always zero when forking a user thread, but it was obviously not intended. Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- arch/ia64/kernel/process.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c index b515149..d4a78da 100644 --- a/arch/ia64/kernel/process.c +++ b/arch/ia64/kernel/process.c @@ -300,7 +300,7 @@ ia64_load_extra (struct task_struct *task) } /* - * Copy the state of an ia-64 thread. + * Copy the architecture-specific state of an ia-64 thread. * * We get here through the following call chain: * @@ -332,7 +332,7 @@ ia64_load_extra (struct task_struct *task) */ int copy_thread(unsigned long clone_flags, -unsigned long user_stack_base, unsigned long user_stack_size, +unsigned long user_stack_base, unsigned long kthread_arg, struct task_struct *p) { extern char ia64_ret_from_clone; @@ -376,13 +376,14 @@ copy_thread(unsigned long clone_flags, ia64_drop_fpu(p); /* don't pick up stale state from a CPU's fph */ if (unlikely(p-flags PF_KTHREAD)) { + /* kernel thread */ if (unlikely(!user_stack_base)) { /* fork_idle() called us */ return 0; } memset(child_stack, 0, sizeof(*child_ptregs) + sizeof(*child_stack)); child_stack-r4 = user_stack_base; /* payload */ - child_stack-r5 = user_stack_size; /* argument */ + child_stack-r5 = kthread_arg; /* * Preserve PSR bits, except for bits 32-34 and 37-45, * which we can't read. @@ -406,6 +407,8 @@ copy_thread(unsigned long clone_flags, return 0; } + + /* user thread */ stack = ((struct switch_stack *) regs) - 1; /* copy parent's switch_stack pt_regs to child: */ memcpy(child_stack, stack, sizeof(*child_ptregs) + sizeof(*child_stack)); @@ -416,7 +419,7 @@ copy_thread(unsigned long clone_flags, if (clone_flags CLONE_SETTLS) child_ptregs-r13 = regs-r16; /* see sys_clone2() in entry.S */ if (user_stack_base) { - child_ptregs-r12 = user_stack_base + user_stack_size - 16; + child_ptregs-r12 = user_stack_base - 16; child_ptregs-ar_bspstore = user_stack_base; child_ptregs-ar_rnat = 0; child_ptregs-loadrs = 0; -- 2.0.0.GIT -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 12/32] hexagon: copy_thread(): rename 'arg' argument to 'kthread_arg'
The 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()). Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- arch/hexagon/kernel/process.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/hexagon/kernel/process.c b/arch/hexagon/kernel/process.c index 0a0dd5c..6f27358 100644 --- a/arch/hexagon/kernel/process.c +++ b/arch/hexagon/kernel/process.c @@ -71,7 +71,7 @@ unsigned long thread_saved_pc(struct task_struct *tsk) * Copy architecture-specific thread state */ int copy_thread(unsigned long clone_flags, unsigned long usp, - unsigned long arg, struct task_struct *p) + unsigned long kthread_arg, struct task_struct *p) { struct thread_info *ti = task_thread_info(p); struct hexagon_switch_stack *ss; @@ -94,10 +94,11 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, ss-lr = (unsigned long)ret_from_fork; p-thread.switch_sp = ss; if (unlikely(p-flags PF_KTHREAD)) { + /* kernel thread */ memset(childregs, 0, sizeof(struct pt_regs)); /* r24 - fn, r25 - arg */ ss-r24 = usp; - ss-r25 = arg; + ss-r25 = kthread_arg; pt_set_kmode(childregs); return 0; } -- 2.0.0.GIT -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 15/32] m68k: copy_thread(): rename 'arg' argument to 'kthread_arg'
The 'arg' argument to copy_thread() is only ever used when forking a new kernel thread. Hence, rename it to 'kthread_arg' for clarity (and consistency with do_fork() and other arch-specific implementations of copy_thread()). Signed-off-by: Alex Dowad alexinbeij...@gmail.com --- arch/m68k/kernel/process.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c index c55ff71..92bf7b4 100644 --- a/arch/m68k/kernel/process.c +++ b/arch/m68k/kernel/process.c @@ -129,8 +129,11 @@ asmlinkage int m68k_clone(struct pt_regs *regs) (int __user *)regs-d3, (int __user *)regs-d4); } +/* + * Copy architecture-specific thread state + */ int copy_thread(unsigned long clone_flags, unsigned long usp, -unsigned long arg, struct task_struct *p) +unsigned long kthread_arg, struct task_struct *p) { struct fork_frame { struct switch_stack sw; @@ -153,11 +156,13 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, memset(frame, 0, sizeof(struct fork_frame)); frame-regs.sr = PS_S; frame-sw.a3 = usp; /* function */ - frame-sw.d7 = arg; + frame-sw.d7 = kthread_arg; frame-sw.retpc = (unsigned long)ret_from_kernel_thread; p-thread.usp = 0; return 0; } + + /* user thread */ memcpy(frame, container_of(current_pt_regs(), struct fork_frame, regs), sizeof(struct fork_frame)); frame-regs.d0 = 0; -- 2.0.0.GIT -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/