[linux-yocto] [yocto-kernel-cache][yocto-4.12][PATCH] kdump: add config fragments
From: Jianchuan WangSigned-off-by: Jianchuan Wang --- features/kdump/kdump-enable.scc | 4 features/kdump/kdump.cfg| 1 + 2 files changed, 5 insertions(+) create mode 100644 features/kdump/kdump-enable.scc create mode 100644 features/kdump/kdump.cfg diff --git a/features/kdump/kdump-enable.scc b/features/kdump/kdump-enable.scc new file mode 100644 index 000..69a7dd3 --- /dev/null +++ b/features/kdump/kdump-enable.scc @@ -0,0 +1,4 @@ +define KFEATURE_DESCRIPTION "Enable Kdump - The kexec-based Crash Dumping Solution" +define KFEATURE_COMPATIBILITY optional + +kconf non-hardware kdump.cfg diff --git a/features/kdump/kdump.cfg b/features/kdump/kdump.cfg new file mode 100644 index 000..84bb04c --- /dev/null +++ b/features/kdump/kdump.cfg @@ -0,0 +1 @@ +CONFIG_CRASH_DUMP=y -- 2.7.4 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [yocto-kernel-cache][yocto-4.12][PATCH] kexec/kdump: Add config fragments
From: Jianchuan WangSigned-off-by: Jianchuan Wang --- features/kexec/kexec-enable.scc | 4 features/kexec/kexec.cfg| 1 + 2 files changed, 5 insertions(+) create mode 100644 features/kexec/kexec-enable.scc create mode 100644 features/kexec/kexec.cfg diff --git a/features/kexec/kexec-enable.scc b/features/kexec/kexec-enable.scc new file mode 100644 index 000..54181ab --- /dev/null +++ b/features/kexec/kexec-enable.scc @@ -0,0 +1,4 @@ +define KFEATURE_DESCRIPTION "Enable Kexec - live kernel execution" +define KFEATURE_COMPATIBILITY optional + +kconf non-hardware kexec.cfg diff --git a/features/kexec/kexec.cfg b/features/kexec/kexec.cfg new file mode 100644 index 000..b45488d --- /dev/null +++ b/features/kexec/kexec.cfg @@ -0,0 +1 @@ +CONFIG_KEXEC=y -- 2.7.4 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [yocto-kernel-cache][yocto-4.12][PATCH] sysrq: add sysrq kernel config
From: Jianchuan WangAdd basic meta data for sysrq Signed-off-by: Jianchuan Wang --- features/sysrq/sysrq.cfg | 2 ++ features/sysrq/sysrq.scc | 1 + 2 files changed, 3 insertions(+) create mode 100644 features/sysrq/sysrq.cfg create mode 100644 features/sysrq/sysrq.scc diff --git a/features/sysrq/sysrq.cfg b/features/sysrq/sysrq.cfg new file mode 100644 index 000..ebdced4 --- /dev/null +++ b/features/sysrq/sysrq.cfg @@ -0,0 +1,2 @@ +CONFIG_MAGIC_SYSRQ=y +CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=1 diff --git a/features/sysrq/sysrq.scc b/features/sysrq/sysrq.scc new file mode 100644 index 000..7ca0e45 --- /dev/null +++ b/features/sysrq/sysrq.scc @@ -0,0 +1 @@ +kconf non-hardware sysrq.cfg -- 2.7.4 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [yocto-kernel-cache][yocto-4.12][PATCH] bpf: add bpf kernel config
From: Jianchuan WangAdd basic meta data for bpf. Signed-off-by: Jianchuan Wang --- features/bpf/bpf.cfg | 4 features/bpf/bpf.scc | 4 2 files changed, 8 insertions(+) create mode 100644 features/bpf/bpf.cfg create mode 100644 features/bpf/bpf.scc diff --git a/features/bpf/bpf.cfg b/features/bpf/bpf.cfg new file mode 100644 index 000..0c4967c --- /dev/null +++ b/features/bpf/bpf.cfg @@ -0,0 +1,4 @@ +CONFIG_BPF=y +CONFIG_BPF_SYSCALL=y +CONFIG_BPF_JIT=y +CONFIG_BPF_EVENTS=y diff --git a/features/bpf/bpf.scc b/features/bpf/bpf.scc new file mode 100644 index 000..f2306f2 --- /dev/null +++ b/features/bpf/bpf.scc @@ -0,0 +1,4 @@ +define KFEATURE_DESCRIPTION "Enable Berkeley Packet Filter (BPF)" +define KFEATURE_COMPATIBILITY all + +kconf non-hardware bpf.cfg -- 2.7.4 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [kernel-cache][yocto-4.12][PATCH] bpf: add bpf kernel config
From: Jianchuan WangAdd basic meta data for bpf. Signed-off-by: Jianchuan Wang --- features/bpf/bpf.cfg | 4 features/bpf/bpf.scc | 4 2 files changed, 8 insertions(+) create mode 100644 features/bpf/bpf.cfg create mode 100644 features/bpf/bpf.scc diff --git a/features/bpf/bpf.cfg b/features/bpf/bpf.cfg new file mode 100644 index 000..0c4967c --- /dev/null +++ b/features/bpf/bpf.cfg @@ -0,0 +1,4 @@ +CONFIG_BPF=y +CONFIG_BPF_SYSCALL=y +CONFIG_BPF_JIT=y +CONFIG_BPF_EVENTS=y diff --git a/features/bpf/bpf.scc b/features/bpf/bpf.scc new file mode 100644 index 000..f2306f2 --- /dev/null +++ b/features/bpf/bpf.scc @@ -0,0 +1,4 @@ +define KFEATURE_DESCRIPTION "Enable Berkeley Packet Filter (BPF)" +define KFEATURE_COMPATIBILITY all + +kconf non-hardware bpf.cfg -- 2.7.4 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH 4/4] drm/vmwgfx: limit the number of mip levels in vmw_gb_surface_define_ioctl()
From: Vladis Dronovcommit: ee9c4e681ec4f58e42a83cb0c22a0289ade1aacf upstream The 'req->mip_levels' parameter in vmw_gb_surface_define_ioctl() is a user-controlled 'uint32_t' value which is used as a loop count limit. This can lead to a kernel lockup and DoS. Add check for 'req->mip_levels'. References: https://bugzilla.redhat.com/show_bug.cgi?id=1437431 Cc: Signed-off-by: Vladis Dronov Reviewed-by: Sinclair Yeh Signed-off-by: Jianchuan Wang --- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c index 05fa092..6fed5a8 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c @@ -1280,6 +1280,9 @@ int vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data, if (req->multisample_count != 0) return -EINVAL; + if (req->mip_levels > DRM_VMW_MAX_MIP_LEVELS) + return -EINVAL; + if (unlikely(vmw_user_surface_size == 0)) vmw_user_surface_size = ttm_round_pot(sizeof(*user_srf)) + 128; -- 2.8.1 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH 3/4] ACPICA: Namespace: fix operand cache leak
From: Seunghun Hancommit 3b2d69114fefa474fca542e51119036dceb4aa6f upstream ACPICA commit a23325b2e583556eae88ed3f764e457786bf4df6 I found some ACPI operand cache leaks in ACPI early abort cases. Boot log of ACPI operand cache leak is as follows: >[0.174332] ACPI: Added _OSI(Module Device) >[0.175504] ACPI: Added _OSI(Processor Device) >[0.176010] ACPI: Added _OSI(3.0 _SCP Extensions) >[0.177032] ACPI: Added _OSI(Processor Aggregator Device) >[0.178284] ACPI: SCI (IRQ16705) allocation failed >[0.179352] ACPI Exception: AE_NOT_ACQUIRED, Unable to install System Control Interrupt handler (20160930/evevent-131) >[0.180008] ACPI: Unable to start the ACPI Interpreter >[0.181125] ACPI Error: Could not remove SCI handler (20160930/evmisc-281) >[0.184068] kmem_cache_destroy Acpi-Operand: Slab cache still has objects >[0.185358] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.10.0-rc3 #2 >[0.186820] Hardware name: innotek gmb_h virtual_box/virtual_box, BIOS virtual_box 12/01/2006 >[0.188000] Call Trace: >[0.188000] ? dump_stack+0x5c/0x7d >[0.188000] ? kmem_cache_destroy+0x224/0x230 >[0.188000] ? acpi_sleep_proc_init+0x22/0x22 >[0.188000] ? acpi_os_delete_cache+0xa/0xd >[0.188000] ? acpi_ut_delete_caches+0x3f/0x7b >[0.188000] ? acpi_terminate+0x5/0xf >[0.188000] ? acpi_init+0x288/0x32e >[0.188000] ? __class_create+0x4c/0x80 >[0.188000] ? video_setup+0x7a/0x7a >[0.188000] ? do_one_initcall+0x4e/0x1b0 >[0.188000] ? kernel_init_freeable+0x194/0x21a >[0.188000] ? rest_init+0x80/0x80 >[0.188000] ? kernel_init+0xa/0x100 >[0.188000] ? ret_from_fork+0x25/0x30 When early abort is occurred due to invalid ACPI information, Linux kernel terminates ACPI by calling acpi_terminate() function. The function calls acpi_ns_terminate() function to delete namespace data and ACPI operand cache (acpi_gbl_module_code_list). But the deletion code in acpi_ns_terminate() function is wrapped in ACPI_EXEC_APP definition, therefore the code is only executed when the definition exists. If the define doesn't exist, ACPI operand cache (acpi_gbl_module_code_list) is leaked, and stack dump is shown in kernel log. This causes a security threat because the old kernel (<= 4.9) shows memory locations of kernel functions in stack dump, therefore kernel ASLR can be neutralized. To fix ACPI operand leak for enhancing security, I made a patch which removes the ACPI_EXEC_APP define in acpi_ns_terminate() function for executing the deletion code unconditionally. Link: https://github.com/acpica/acpica/commit/a23325b2 Signed-off-by: Seunghun Han Signed-off-by: Lv Zheng Signed-off-by: Bob Moore Signed-off-by: Rafael J. Wysocki Signed-off-by: Jianchuan Wang --- drivers/acpi/acpica/nsutils.c | 23 +-- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c index 691814d..943702d 100644 --- a/drivers/acpi/acpica/nsutils.c +++ b/drivers/acpi/acpica/nsutils.c @@ -594,25 +594,20 @@ struct acpi_namespace_node *acpi_ns_validate_handle(acpi_handle handle) void acpi_ns_terminate(void) { acpi_status status; + union acpi_operand_object *prev; + union acpi_operand_object *next; ACPI_FUNCTION_TRACE(ns_terminate); -#ifdef ACPI_EXEC_APP - { - union acpi_operand_object *prev; - union acpi_operand_object *next; + /* Delete any module-level code blocks */ - /* Delete any module-level code blocks */ - - next = acpi_gbl_module_code_list; - while (next) { - prev = next; - next = next->method.mutex; - prev->method.mutex = NULL; /* Clear the Mutex (cheated) field */ - acpi_ut_remove_reference(prev); - } + next = acpi_gbl_module_code_list; + while (next) { + prev = next; + next = next->method.mutex; + prev->method.mutex = NULL; /* Clear the Mutex (cheated) field */ + acpi_ut_remove_reference(prev); } -#endif /* * Free the entire namespace -- all nodes and all objects -- 2.8.1 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH 2/4] char: lp: fix possible integer overflow in lp_setup()
From: Willy Tarreaucommit 3e21f4af170bebf47c187c1ff8bf155583c9f3b1 upstream The lp_setup() code doesn't apply any bounds checking when passing "lp=none", and only in this case, resulting in an overflow of the parport_nr[] array. All versions in Git history are affected. Reported-By: Roee Hay Cc: Ben Hutchings Cc: sta...@vger.kernel.org Signed-off-by: Willy Tarreau Signed-off-by: Greg Kroah-Hartman Signed-off-by: Jianchuan Wang --- drivers/char/lp.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/char/lp.c b/drivers/char/lp.c index 5b67427..841fd59 100644 --- a/drivers/char/lp.c +++ b/drivers/char/lp.c @@ -859,7 +859,11 @@ static int __init lp_setup (char *str) } else if (!strcmp(str, "auto")) { parport_nr[0] = LP_PARPORT_AUTO; } else if (!strcmp(str, "none")) { - parport_nr[parport_ptr++] = LP_PARPORT_NONE; + if (parport_ptr < LP_NO) + parport_nr[parport_ptr++] = LP_PARPORT_NONE; + else + printk(KERN_INFO "lp: too many ports, %s ignored.\n", + str); } else if (!strcmp(str, "reset")) { reset = 1; } -- 2.8.1 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [linux-yocto-4.10][PATCH 0/4] For CVE-2017-8890, CVE-2017-1000363, CVE-2017-11472, CVE-2017-7346
This series of patches are for CVE, including CVE-2017-8890, CVE-2017-1000363,CVE-2017-11472,CVE-2017-7346 Eric Dumazet (1): dccp/tcp: do not inherit mc_list from parent Seunghun Han (1): ACPICA: Namespace: fix operand cache leak Vladis Dronov (1): drm/vmwgfx: limit the number of mip levels in vmw_gb_surface_define_ioctl() Willy Tarreau (1): char: lp: fix possible integer overflow in lp_setup() drivers/acpi/acpica/nsutils.c | 23 +-- drivers/char/lp.c | 6 +- drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 3 +++ net/ipv4/inet_connection_sock.c | 2 ++ 4 files changed, 19 insertions(+), 15 deletions(-) -- 2.8.1 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH 1/4] dccp/tcp: do not inherit mc_list from parent
From: Eric Dumazetcommit 657831ffc38e30092a2d5f03d385d710eb88b09a upstream syzkaller found a way to trigger double frees from ip_mc_drop_socket() It turns out that leave a copy of parent mc_list at accept() time, which is very bad. Very similar to commit 8b485ce69876 ("tcp: do not inherit fastopen_req from parent") Initial report from Pray3r, completed by Andrey one. Thanks a lot to them ! Signed-off-by: Eric Dumazet Reported-by: Pray3r Reported-by: Andrey Konovalov Tested-by: Andrey Konovalov Signed-off-by: David S. Miller Signed-off-by: Jianchuan Wang --- net/ipv4/inet_connection_sock.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 19ea045..d952cfa 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c @@ -669,6 +669,8 @@ struct sock *inet_csk_clone_lock(const struct sock *sk, /* listeners have SOCK_RCU_FREE, not the children */ sock_reset_flag(newsk, SOCK_RCU_FREE); + inet_sk(newsk)->mc_list = NULL; + newsk->sk_mark = inet_rsk(req)->ir_mark; atomic64_set(>sk_cookie, atomic64_read(_rsk(req)->ir_cookie)); -- 2.8.1 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH 4/4] nfsd: encoders mustn't use unitialized values in error cases
From: "J. Bruce Fields"commit: f961e3f2acae94b727380c0b74e2d3954d0edf79 upstream In error cases, lgp->lg_layout_type may be out of bounds; so we shouldn't be using it until after the check of nfserr. This was seen to crash nfsd threads when the server receives a LAYOUTGET request with a large layout type. GETDEVICEINFO has the same problem. Reported-by: Ari Kauppi Reviewed-by: Christoph Hellwig Cc: sta...@vger.kernel.org Signed-off-by: J. Bruce Fields Signed-off-by: Jianchuan Wang --- fs/nfsd/nfs4xdr.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 8fae53c..58b9d41 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -4112,8 +4112,7 @@ nfsd4_encode_getdeviceinfo(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_getdeviceinfo *gdev) { struct xdr_stream *xdr = >xdr; - const struct nfsd4_layout_ops *ops = - nfsd4_layout_ops[gdev->gd_layout_type]; + const struct nfsd4_layout_ops *ops; u32 starting_len = xdr->buf->len, needed_len; __be32 *p; @@ -4130,6 +4129,7 @@ nfsd4_encode_getdeviceinfo(struct nfsd4_compoundres *resp, __be32 nfserr, /* If maxcount is 0 then just update notifications */ if (gdev->gd_maxcount != 0) { + ops = nfsd4_layout_ops[gdev->gd_layout_type]; nfserr = ops->encode_getdeviceinfo(xdr, gdev); if (nfserr) { /* @@ -4182,8 +4182,7 @@ nfsd4_encode_layoutget(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_layoutget *lgp) { struct xdr_stream *xdr = >xdr; - const struct nfsd4_layout_ops *ops = - nfsd4_layout_ops[lgp->lg_layout_type]; + const struct nfsd4_layout_ops *ops; __be32 *p; dprintk("%s: err %d\n", __func__, nfserr); @@ -4206,6 +4205,7 @@ nfsd4_encode_layoutget(struct nfsd4_compoundres *resp, __be32 nfserr, *p++ = cpu_to_be32(lgp->lg_seg.iomode); *p++ = cpu_to_be32(lgp->lg_layout_type); + ops = nfsd4_layout_ops[lgp->lg_layout_type]; nfserr = ops->encode_layoutget(xdr, lgp); out: kfree(lgp->lg_content); -- 2.8.1 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH 3/4] nfsd: fix undefined behavior in nfsd4_layout_verify
From: Ari Kauppicommit: b550a32e60a4941994b437a8d662432a486235a5 upstream UBSAN: Undefined behaviour in fs/nfsd/nfs4proc.c:1262:34 shift exponent 128 is too large for 32-bit type 'int' Depending on compiler+architecture, this may cause the check for layout_type to succeed for overly large values (which seems to be the case with amd64). The large value will be later used in de-referencing nfsd4_layout_ops for function pointers. Reported-by: Jani Tuovila Signed-off-by: Ari Kauppi [colin.k...@canonical.com: use LAYOUT_TYPE_MAX instead of 32] Cc: sta...@vger.kernel.org Reviewed-by: Dan Carpenter Reviewed-by: Christoph Hellwig Signed-off-by: J. Bruce Fields Signed-off-by: Jianchuan Wang --- fs/nfsd/nfs4proc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 74a6e57..d76c944 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1255,7 +1255,8 @@ nfsd4_layout_verify(struct svc_export *exp, unsigned int layout_type) return NULL; } - if (!(exp->ex_layout_types & (1 << layout_type))) { + if (layout_type >= LAYOUT_TYPE_MAX || + !(exp->ex_layout_types & (1 << layout_type))) { dprintk("%s: layout type %d not supported\n", __func__, layout_type); return NULL; -- 2.8.1 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH 1/4] brcmfmac: fix possible buffer overflow in brcmf_cfg80211_mgmt_tx()
From: Arend van Sprielcommit 8f44c9a41386729fea410e688959ddaa9d51be7c upstream The lower level nl80211 code in cfg80211 ensures that "len" is between 25 and NL80211_ATTR_FRAME (2304). We subtract DOT11_MGMT_HDR_LEN (24) from "len" so thats's max of 2280. However, the action_frame->data[] buffer is only BRCMF_FIL_ACTION_FRAME_SIZE (1800) bytes long so this memcpy() can overflow. memcpy(action_frame->data, [DOT11_MGMT_HDR_LEN], le16_to_cpu(action_frame->len)); Cc: sta...@vger.kernel.org # 3.9.x Fixes: 18e2f61db3b70 ("brcmfmac: P2P action frame tx.") Reported-by: "freenerguo(郭大兴)" Signed-off-by: Arend van Spriel Signed-off-by: David S. Miller Signed-off-by: Jianchuan Wang --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index 7ffc4ab..baa12e9 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -4839,6 +4839,11 @@ brcmf_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, cfg80211_mgmt_tx_status(wdev, *cookie, buf, len, true, GFP_KERNEL); } else if (ieee80211_is_action(mgmt->frame_control)) { + if (len > BRCMF_FIL_ACTION_FRAME_SIZE + DOT11_MGMT_HDR_LEN) { + brcmf_err("invalid action frame length\n"); + err = -EINVAL; + goto exit; + } af_params = kzalloc(sizeof(*af_params), GFP_KERNEL); if (af_params == NULL) { brcmf_err("unable to allocate frame\n"); -- 2.8.1 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [linux-yocto-4.10][PATCH 0/4] For CVE-2017-1000380, CVE-2017-7541 and CVE-2017-10911
Hi, Bruce, This series of patches are for CVE, including CVE-2017-1000380, CVE-2017-7541 and CVE-2017-10911. Arend van Spriel (1): brcmfmac: fix possible buffer overflow in brcmf_cfg80211_mgmt_tx() Ari Kauppi (1): nfsd: fix undefined behavior in nfsd4_layout_verify J. Bruce Fields (1): nfsd: encoders mustn't use unitialized values in error cases Jan Beulich (1): xen-blkback: don't leak stack data via response ring drivers/block/xen-blkback/blkback.c| 23 ++-- drivers/block/xen-blkback/common.h | 25 +- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 5 + fs/nfsd/nfs4proc.c | 3 ++- fs/nfsd/nfs4xdr.c | 8 +++ 5 files changed, 28 insertions(+), 36 deletions(-) -- 2.8.1 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH 2/3] mm: fix new crash in unmapped_area_topdown()
From: Hugh Dickinscommit f4cb767d76cf7ee72f97dd76f6cfa6c76a5edc89 upstream Trinity gets kernel BUG at mm/mmap.c:1963! in about 3 minutes of mmap testing. That's the VM_BUG_ON(gap_end < gap_start) at the end of unmapped_area_topdown(). Linus points out how MAP_FIXED (which does not have to respect our stack guard gap intentions) could result in gap_end below gap_start there. Fix that, and the similar case in its alternative, unmapped_area(). Cc: sta...@vger.kernel.org Fixes: 1be7107fbe18 ("mm: larger stack guard gap, between vmas") Reported-by: Dave Jones Debugged-by: Linus Torvalds Signed-off-by: Hugh Dickins Acked-by: Michal Hocko Signed-off-by: Linus Torvalds Signed-off-by: Jianchuan Wang --- mm/mmap.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index 945ff3b..91581c6 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1814,7 +1814,8 @@ unsigned long unmapped_area(struct vm_unmapped_area_info *info) /* Check if current node has a suitable gap */ if (gap_start > high_limit) return -ENOMEM; - if (gap_end >= low_limit && gap_end - gap_start >= length) + if (gap_end >= low_limit && + gap_end > gap_start && gap_end - gap_start >= length) goto found; /* Visit right subtree if it looks promising */ @@ -1917,7 +1918,8 @@ unsigned long unmapped_area_topdown(struct vm_unmapped_area_info *info) gap_end = vm_start_gap(vma); if (gap_end < low_limit) return -ENOMEM; - if (gap_start <= high_limit && gap_end - gap_start >= length) + if (gap_start <= high_limit && + gap_end > gap_start && gap_end - gap_start >= length) goto found; /* Visit left subtree if it looks promising */ -- 2.8.1 -- ___ linux-yocto mailing list linux-yo...@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH 3/3] ipx: call ipxitf_put() in ioctl error path
From: Dan Carpenterupstream ee0d8d8482345ff97a75a7d747efc309f13b0d80 commit We should call ipxitf_put() if the copy_to_user() fails. Reported-by: 李强 Signed-off-by: Dan Carpenter Signed-off-by: David S. Miller Signed-off-by: Jianchuan Wang --- net/ipx/af_ipx.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index 8a9219f..fa31ef2 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c @@ -1168,11 +1168,10 @@ static int ipxitf_ioctl(unsigned int cmd, void __user *arg) sipx->sipx_network = ipxif->if_netnum; memcpy(sipx->sipx_node, ipxif->if_node, sizeof(sipx->sipx_node)); - rc = -EFAULT; + rc = 0; if (copy_to_user(arg, , sizeof(ifr))) - break; + rc = -EFAULT; ipxitf_put(ipxif); - rc = 0; break; } case SIOCAIPXITFCRT: -- 2.8.1 -- ___ linux-yocto mailing list linux-yo...@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH 1/3] mm: larger stack guard gap, between vmas
From: Hugh Dickinscommit 1be7107fbe18eed3e319a6c3e83c78254b693acb upstream. Stack guard page is a useful feature to reduce a risk of stack smashing into a different mapping. We have been using a single page gap which is sufficient to prevent having stack adjacent to a different mapping. But this seems to be insufficient in the light of the stack usage in userspace. E.g. glibc uses as large as 64kB alloca() in many commonly used functions. Others use constructs liks gid_t buffer[NGROUPS_MAX] which is 256kB or stack strings with MAX_ARG_STRLEN. This will become especially dangerous for suid binaries and the default no limit for the stack size limit because those applications can be tricked to consume a large portion of the stack and a single glibc call could jump over the guard page. These attacks are not theoretical, unfortunatelly. Make those attacks less probable by increasing the stack guard gap to 1MB (on systems with 4k pages; but make it depend on the page size because systems with larger base pages might cap stack allocations in the PAGE_SIZE units) which should cover larger alloca() and VLA stack allocations. It is obviously not a full fix because the problem is somehow inherent, but it should reduce attack space a lot. One could argue that the gap size should be configurable from userspace, but that can be done later when somebody finds that the new 1MB is wrong for some special case applications. For now, add a kernel command line option (stack_guard_gap) to specify the stack gap size (in page units). Implementation wise, first delete all the old code for stack guard page: because although we could get away with accounting one extra page in a stack vma, accounting a larger gap can break userspace - case in point, a program run with "ulimit -S -v 2" failed when the 1MB gap was counted for RLIMIT_AS; similar problems could come with RLIMIT_MLOCK and strict non-overcommit mode. Instead of keeping gap inside the stack vma, maintain the stack guard gap as a gap between vmas: using vm_start_gap() in place of vm_start (or vm_end_gap() in place of vm_end if VM_GROWSUP) in just those few places which need to respect the gap - mainly arch_get_unmapped_area(), and and the vma tree's subtree_gap support for that. Original-patch-by: Oleg Nesterov Original-patch-by: Michal Hocko Signed-off-by: Hugh Dickins Acked-by: Michal Hocko Tested-by: Helge Deller # parisc Signed-off-by: Linus Torvalds [wt: backport to 4.11: adjust context] [wt: backport to 4.9: adjust context ; kernel doc was not in admin-guide] Signed-off-by: Willy Tarreau Signed-off-by: Greg Kroah-Hartman Signed-off-by: Paul Gortmaker Signed-off-by: Jianchuan Wang --- arch/arc/mm/mmap.c | 2 +- arch/arm/mm/mmap.c | 4 +- arch/frv/mm/elf-fdpic.c | 2 +- arch/mips/mm/mmap.c | 2 +- arch/parisc/kernel/sys_parisc.c | 15 ++-- arch/powerpc/mm/hugetlbpage-radix.c | 2 +- arch/powerpc/mm/mmap.c | 4 +- arch/powerpc/mm/slice.c | 2 +- arch/s390/mm/mmap.c | 4 +- arch/sh/mm/mmap.c | 4 +- arch/sparc/kernel/sys_sparc_64.c| 4 +- arch/sparc/mm/hugetlbpage.c | 2 +- arch/tile/mm/hugetlbpage.c | 2 +- arch/x86/kernel/sys_x86_64.c| 4 +- arch/x86/mm/hugetlbpage.c | 2 +- arch/xtensa/kernel/syscall.c| 2 +- fs/hugetlbfs/inode.c| 2 +- fs/proc/task_mmu.c | 4 - include/linux/mm.h | 53 ++--- mm/gup.c| 5 -- mm/memory.c | 38 - mm/memory.c.rej | 10 --- mm/mmap.c | 148 ++-- 23 files changed, 145 insertions(+), 172 deletions(-) delete mode 100644 mm/memory.c.rej diff --git a/arch/arc/mm/mmap.c b/arch/arc/mm/mmap.c index 2e06d56..cf4ae69 100644 --- a/arch/arc/mm/mmap.c +++ b/arch/arc/mm/mmap.c @@ -64,7 +64,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, vma = find_vma(mm, addr); if (TASK_SIZE - len >= addr && - (!vma || addr + len <= vma->vm_start)) + (!vma || addr + len <= vm_start_gap(vma))) return addr; } diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c index 66353ca..641334e 100644 --- a/arch/arm/mm/mmap.c +++ b/arch/arm/mm/mmap.c @@ -89,7 +89,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, vma = find_vma(mm, addr); if (TASK_SIZE - len >= addr && - (!vma || addr + len <= vma->vm_start)) + (!vma ||
[linux-yocto] [PATCH] cryptodev: add Kbuild hooks
From: Jianchuan WangHook cryptodev-linux into the kernel build as a tristate option. Signed-off-by: Bruce Ashfield Signed-off-by: Jianchuan Wang --- crypto/Kconfig | 8 crypto/Makefile | 1 + 2 files changed, 9 insertions(+) diff --git a/crypto/Kconfig b/crypto/Kconfig index 362905e..3a1d0fa 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -21,6 +21,14 @@ if CRYPTO comment "Crypto core or helper" +config CRYPTODEV + tristate "cryptodev module support" +help + This is a /dev/crypto device driver, equivalent to those in OpenBSD or + FreeBSD. The main idea is to access of existing ciphers in kernel space + from userspace, thus enabling re-use of a hardware implementation of a + cipher. + config CRYPTO_FIPS bool "FIPS 200 compliance" depends on (CRYPTO_ANSI_CPRNG || CRYPTO_DRBG) && !CRYPTO_MANAGER_DISABLE_TESTS diff --git a/crypto/Makefile b/crypto/Makefile index 97b7d3a..a39ac416 100644 --- a/crypto/Makefile +++ b/crypto/Makefile @@ -110,3 +110,4 @@ obj-$(CONFIG_ASYNC_CORE) += async_tx/ obj-$(CONFIG_ASYMMETRIC_KEY_TYPE) += asymmetric_keys/ obj-$(CONFIG_CRYPTO_HASH_INFO) += hash_info.o obj-$(CONFIG_CRYPTO_ABLK_HELPER) += ablk_helper.o +obj-$(CONFIG_CRYPTODEV) += ../drivers/staging/crypto/cryptodev/ -- 1.9.1 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH] nf_tables: Add nf_tables feature
From: Jianchuan WangAdd a nf_tables feature that turns on the kernel options required to support nf_tables. Signed-off-by: Jianchuan Wang --- features/nf_tables/nf_tables.cfg | 24 features/nf_tables/nf_tables.scc | 8 2 files changed, 32 insertions(+) create mode 100644 features/nf_tables/nf_tables.cfg create mode 100644 features/nf_tables/nf_tables.scc diff --git a/features/nf_tables/nf_tables.cfg b/features/nf_tables/nf_tables.cfg new file mode 100644 index 000..5e085ce --- /dev/null +++ b/features/nf_tables/nf_tables.cfg @@ -0,0 +1,24 @@ +CONFIG_NF_TABLES=m +CONFIG_NF_TABLES_INET=m +CONFIG_NFT_EXTHDR=m +CONFIG_NFT_META=m +CONFIG_NFT_CT=m +CONFIG_NFT_RBTREE=m +CONFIG_NFT_HASH=m +CONFIG_NFT_COUNTER=m +CONFIG_NFT_LOG=m +CONFIG_NFT_LIMIT=m +CONFIG_NFT_NAT=m +CONFIG_NFT_QUEUE=m +CONFIG_NFT_REJECT=m +CONFIG_NFT_REJECT_INET=m +CONFIG_NFT_COMPAT=m +CONFIG_NF_TABLES_IPV4=m +CONFIG_NFT_CHAIN_ROUTE_IPV4=m +CONFIG_NFT_CHAIN_NAT_IPV4=m +CONFIG_NFT_REJECT_IPV4=m +CONFIG_NF_TABLES_ARP=m +CONFIG_NF_TABLES_IPV6=m +CONFIG_NFT_CHAIN_ROUTE_IPV6=m +CONFIG_NFT_REJECT_IPV6=m +CONFIG_NF_TABLES_BRIDGE=m diff --git a/features/nf_tables/nf_tables.scc b/features/nf_tables/nf_tables.scc new file mode 100644 index 000..b261acb --- /dev/null +++ b/features/nf_tables/nf_tables.scc @@ -0,0 +1,8 @@ +# +# Not directly sourced via a kernel type but via an external bb +# + +define KFEATURE_DESCRIPTION "netfilter nf_tables" +define KFEATURE_COMPATIBILITY all + +kconf non-hardware nf_tables.cfg -- 2.3.5 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH] BFQ: Support Budget Fair Queueing (BFQ) Storage-I/O Scheduler
From: Jianchuan Wang jianchuan.w...@windriver.com BFQ: Support Budget Fair Queueing (BFQ) Storage-I/O Scheduler Signed-off-by: Jianchuan Wang jianchuan.w...@windriver.com --- meta/cfg/kernel-cache/features/bfq/bfq-enable.scc | 1 + meta/cfg/kernel-cache/features/bfq/bfq.cfg| 2 ++ 2 files changed, 3 insertions(+) create mode 100644 meta/cfg/kernel-cache/features/bfq/bfq-enable.scc create mode 100644 meta/cfg/kernel-cache/features/bfq/bfq.cfg diff --git a/meta/cfg/kernel-cache/features/bfq/bfq-enable.scc b/meta/cfg/kernel-cache/features/bfq/bfq-enable.scc new file mode 100644 index 000..c75a014 --- /dev/null +++ b/meta/cfg/kernel-cache/features/bfq/bfq-enable.scc @@ -0,0 +1 @@ +kconf non-hardware bfq.cfg diff --git a/meta/cfg/kernel-cache/features/bfq/bfq.cfg b/meta/cfg/kernel-cache/features/bfq/bfq.cfg new file mode 100644 index 000..df82ebc --- /dev/null +++ b/meta/cfg/kernel-cache/features/bfq/bfq.cfg @@ -0,0 +1,2 @@ +CONFIG_IOSCHED_BFQ=y +CONFIG_CGROUP_BFQIO=y -- 1.9.1 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH 3/3] block, bfq: add Early Queue Merge (EQM) to BFQ-v7r5 for 3.14.0
From: Mauro Andreolini mauro.andreol...@unimore.it Original patch taken from: http://algo.ing.unimo.it/people/paolo/disk_sched/patches/3.14.0-v7r5 A set of processes may happen to perform interleaved reads, i.e.,requests whose union would give rise to a sequential read pattern. There are two typical cases: in the first case, processes read fixed-size chunks of data at a fixed distance from each other, while in the second case processes may read variable-size chunks at variable distances. The latter case occurs for example with QEMU, which splits the I/O generated by the guest into multiple chunks, and lets these chunks be served by a pool of cooperating processes, iteratively assigning the next chunk of I/O to the first available process. CFQ uses actual queue merging for the first type of rocesses, whereas it uses preemption to get a sequential read pattern out of the read requests performed by the second type of processes. In the end it uses two different mechanisms to achieve the same goal: boosting the throughput with interleaved I/O. This patch introduces Early Queue Merge (EQM), a unified mechanism to get a sequential read pattern with both types of processes. The main idea is checking newly arrived requests against the next request of the active queue both in case of actual request insert and in case of request merge. By doing so, both the types of processes can be handled by just merging their queues. EQM is then simpler and more compact than the pair of mechanisms used in CFQ. Finally, EQM also preserves the typical low-latency properties of BFQ, by properly restoring the weight-raising state of a queue when it gets back to a non-merged state. Signed-off-by: Mauro Andreolini mauro.andreol...@unimore.it Signed-off-by: Arianna Avanzini avanzini.aria...@gmail.com Signed-off-by: Paolo Valente paolo.vale...@unimore.it Signed-off-by: Jianchuan Wang jianchuan.w...@windriver.com --- block/bfq-iosched.c | 736 block/bfq-sched.c | 28 -- block/bfq.h | 46 +++- 3 files changed, 556 insertions(+), 254 deletions(-) diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 0cbb182..452f477 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -571,6 +571,57 @@ static inline unsigned int bfq_wr_duration(struct bfq_data *bfqd) return dur; } +static inline unsigned +bfq_bfqq_cooperations(struct bfq_queue *bfqq) +{ + return bfqq-bic ? bfqq-bic-cooperations : 0; +} + +static inline void +bfq_bfqq_resume_state(struct bfq_queue *bfqq, struct bfq_io_cq *bic) +{ + if (bic-saved_idle_window) + bfq_mark_bfqq_idle_window(bfqq); + else + bfq_clear_bfqq_idle_window(bfqq); + if (bic-saved_IO_bound) + bfq_mark_bfqq_IO_bound(bfqq); + else + bfq_clear_bfqq_IO_bound(bfqq); + if (bic-wr_time_left bfqq-bfqd-low_latency + bic-cooperations bfqq-bfqd-bfq_coop_thresh) { + /* +* Start a weight raising period with the duration given by +* the raising_time_left snapshot. +*/ + if (bfq_bfqq_busy(bfqq)) + bfqq-bfqd-wr_busy_queues++; + bfqq-wr_coeff = bfqq-bfqd-bfq_wr_coeff; + bfqq-wr_cur_max_time = bic-wr_time_left; + bfqq-last_wr_start_finish = jiffies; + bfqq-entity.ioprio_changed = 1; + } + /* +* Clear wr_time_left to prevent bfq_bfqq_save_state() from +* getting confused about the queue's need of a weight-raising +* period. +*/ + bic-wr_time_left = 0; +} + +/* + * Must be called with the queue_lock held. + */ +static int bfqq_process_refs(struct bfq_queue *bfqq) +{ + int process_refs, io_refs; + + io_refs = bfqq-allocated[READ] + bfqq-allocated[WRITE]; + process_refs = atomic_read(bfqq-ref) - io_refs - bfqq-entity.on_st; + BUG_ON(process_refs 0); + return process_refs; +} + static void bfq_add_request(struct request *rq) { struct bfq_queue *bfqq = RQ_BFQQ(rq); @@ -602,8 +653,11 @@ static void bfq_add_request(struct request *rq) if (!bfq_bfqq_busy(bfqq)) { int soft_rt = bfqd-bfq_wr_max_softrt_rate 0 + bfq_bfqq_cooperations(bfqq) bfqd-bfq_coop_thresh time_is_before_jiffies(bfqq-soft_rt_next_start); - idle_for_long_time = time_is_before_jiffies( + idle_for_long_time = bfq_bfqq_cooperations(bfqq) +bfqd-bfq_coop_thresh + time_is_before_jiffies( bfqq-budget_timeout + bfqd-bfq_wr_min_idle_time); entity-budget = max_t(unsigned long, bfqq-max_budget, @@ -624,11 +678,20 @@ static void bfq_add_request(struct request *rq)
[linux-yocto] [PATCH 1/3] block: cgroups, kconfig, build bits for BFQ-v7r5-3.14
From: Paolo Valente paolo.vale...@unimore.it Original patch taken from: http://algo.ing.unimo.it/people/paolo/disk_sched/patches/3.14.0-v7r5 Update Kconfig.iosched and do the related Makefile changes to include kernel configuration options for BFQ. Also add the bfqio controller to the cgroups subsystem. Signed-off-by: Paolo Valente paolo.vale...@unimore.it Signed-off-by: Arianna Avanzini avanzini.aria...@gmail.com Signed-off-by: Jianchuan Wang jianchuan.w...@windriver.com --- block/Kconfig.iosched | 32 block/Makefile| 1 + include/linux/cgroup_subsys.h | 4 3 files changed, 37 insertions(+) diff --git a/block/Kconfig.iosched b/block/Kconfig.iosched index 421bef9..0ee5f0f 100644 --- a/block/Kconfig.iosched +++ b/block/Kconfig.iosched @@ -39,6 +39,27 @@ config CFQ_GROUP_IOSCHED ---help--- Enable group IO scheduling in CFQ. +config IOSCHED_BFQ + tristate BFQ I/O scheduler + default n + ---help--- + The BFQ I/O scheduler tries to distribute bandwidth among + all processes according to their weights. + It aims at distributing the bandwidth as desired, independently of + the disk parameters and with any workload. It also tries to + guarantee low latency to interactive and soft real-time + applications. If compiled built-in (saying Y here), BFQ can + be configured to support hierarchical scheduling. + +config CGROUP_BFQIO + bool BFQ hierarchical scheduling support + depends on CGROUPS IOSCHED_BFQ=y + default n + ---help--- + Enable hierarchical scheduling in BFQ, using the cgroups + filesystem interface. The name of the subsystem will be + bfqio. + choice prompt Default I/O scheduler default DEFAULT_CFQ @@ -52,6 +73,16 @@ choice config DEFAULT_CFQ bool CFQ if IOSCHED_CFQ=y + config DEFAULT_BFQ + bool BFQ if IOSCHED_BFQ=y + help + Selects BFQ as the default I/O scheduler which will be + used by default for all block devices. + The BFQ I/O scheduler aims at distributing the bandwidth + as desired, independently of the disk parameters and with + any workload. It also tries to guarantee low latency to + interactive and soft real-time applications. + config DEFAULT_NOOP bool No-op @@ -61,6 +92,7 @@ config DEFAULT_IOSCHED string default deadline if DEFAULT_DEADLINE default cfq if DEFAULT_CFQ + default bfq if DEFAULT_BFQ default noop if DEFAULT_NOOP endmenu diff --git a/block/Makefile b/block/Makefile index 20645e8..cbd83fb 100644 --- a/block/Makefile +++ b/block/Makefile @@ -16,6 +16,7 @@ obj-$(CONFIG_BLK_DEV_THROTTLING) += blk-throttle.o obj-$(CONFIG_IOSCHED_NOOP) += noop-iosched.o obj-$(CONFIG_IOSCHED_DEADLINE) += deadline-iosched.o obj-$(CONFIG_IOSCHED_CFQ) += cfq-iosched.o +obj-$(CONFIG_IOSCHED_BFQ) += bfq-iosched.o obj-$(CONFIG_BLOCK_COMPAT) += compat_ioctl.o obj-$(CONFIG_BLK_DEV_INTEGRITY)+= blk-integrity.o diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h index 7b99d71..4e8c0ff 100644 --- a/include/linux/cgroup_subsys.h +++ b/include/linux/cgroup_subsys.h @@ -39,6 +39,10 @@ SUBSYS(net_cls) SUBSYS(blkio) #endif +#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_BFQIO) +SUBSYS(bfqio) +#endif + #if IS_SUBSYS_ENABLED(CONFIG_CGROUP_PERF) SUBSYS(perf) #endif -- 1.9.1 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH 1/5] gre: add x-netns support
From: Nicolas Dichtel nicolas.dich...@6wind.com commit b57708add31494175be741ed3fd24023b50c3423 upstream This patch allows to switch the netns when packet is encapsulated or decapsulated. In other word, the encapsulated packet is received in a netns, where the lookup is done to find the tunnel. Once the tunnel is found, the packet is decapsulated and injecting into the corresponding interface which stands to another netns. When one of the two netns is removed, the tunnel is destroyed. Signed-off-by: Nicolas Dichtel nicolas.dich...@6wind.com Signed-off-by: David S. Miller da...@davemloft.net Signed-off-by: Jianchuan Wang jianchuan.w...@windriver.com --- net/ipv4/ip_gre.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 94213c8..c5a557a 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -410,7 +410,7 @@ static int ipgre_open(struct net_device *dev) struct flowi4 fl4; struct rtable *rt; - rt = ip_route_output_gre(dev_net(dev), fl4, + rt = ip_route_output_gre(t-net, fl4, t-parms.iph.daddr, t-parms.iph.saddr, t-parms.o_key, @@ -434,7 +434,7 @@ static int ipgre_close(struct net_device *dev) if (ipv4_is_multicast(t-parms.iph.daddr) t-mlink) { struct in_device *in_dev; - in_dev = inetdev_by_index(dev_net(dev), t-mlink); + in_dev = inetdev_by_index(t-net, t-mlink); if (in_dev) ip_mc_dec_group(in_dev, t-parms.iph.daddr); } @@ -478,7 +478,7 @@ static void __gre_tunnel_init(struct net_device *dev) dev-needed_headroom= LL_MAX_HEADER + sizeof(struct iphdr) + 4; dev-mtu= ETH_DATA_LEN - sizeof(struct iphdr) - 4; - dev-features |= NETIF_F_NETNS_LOCAL | GRE_FEATURES; + dev-features |= GRE_FEATURES; dev-hw_features|= GRE_FEATURES; if (!(tunnel-parms.o_flags TUNNEL_SEQ)) { -- 1.9.1 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH] GRE: enable gre feature.
From: Jianchuan Wang jianchuan.w...@windriver.com Signed-off-by: Jianchuan Wang jianchuan.w...@windriver.com --- meta/cfg/kernel-cache/features/gre/gre-enable.scc | 1 + meta/cfg/kernel-cache/features/gre/gre.cfg| 6 ++ 2 files changed, 7 insertions(+) create mode 100644 meta/cfg/kernel-cache/features/gre/gre-enable.scc create mode 100644 meta/cfg/kernel-cache/features/gre/gre.cfg diff --git a/meta/cfg/kernel-cache/features/gre/gre-enable.scc b/meta/cfg/kernel-cache/features/gre/gre-enable.scc new file mode 100644 index 000..cd60fa1 --- /dev/null +++ b/meta/cfg/kernel-cache/features/gre/gre-enable.scc @@ -0,0 +1 @@ +kconf non-hardware gre.cfg diff --git a/meta/cfg/kernel-cache/features/gre/gre.cfg b/meta/cfg/kernel-cache/features/gre/gre.cfg new file mode 100644 index 000..3eff707 --- /dev/null +++ b/meta/cfg/kernel-cache/features/gre/gre.cfg @@ -0,0 +1,6 @@ +CONFIG_NET_IPGRE_DEMUX=m +CONFIG_NET_IPGRE=m +CONFIG_NET_IPGRE_BROADCAST=y +CONFIG_IPV6_GRE=m +CONFIG_OPENVSWITCH_GRE=y +# CONFIG_PPTP is not set -- 1.9.1 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH 4/5] net: Generalize checksum_init functions
From: Tom Herbert therb...@google.com commit 76ba0aae673075c77a8b775e9133c8e8b1a44563 upstream Create a general __skb_checksum_validate function (actually a macro) to subsume the various checksum_init functions. This function can either init the checksum, or do the full validation (logically checksum_init+skb_check_complete)-- a flag specifies if full vaidation is performed. Also, there is a flag to the function to indicate that zero checksums are allowed (to support optional UDP checksums). Added several stub functions for calling __skb_checksum_validate. Signed-off-by: Tom Herbert therb...@google.com Signed-off-by: David S. Miller da...@davemloft.net Signed-off-by: Jianchuan Wang jianchuan.w...@windriver.com --- include/linux/skbuff.h | 93 ++ 1 file changed, 93 insertions(+) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 15ede6a..1fba79c 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -2686,6 +2686,99 @@ static inline __sum16 skb_checksum_complete(struct sk_buff *skb) 0 : __skb_checksum_complete(skb); } +/* Check if we need to perform checksum complete validation. + * + * Returns true if checksum complete is needed, false otherwise + * (either checksum is unnecessary or zero checksum is allowed). + */ +static inline bool __skb_checksum_validate_needed(struct sk_buff *skb, + bool zero_okay, + __sum16 check) +{ + if (skb_csum_unnecessary(skb)) { + return false; + } else if (zero_okay !check) { + skb-ip_summed = CHECKSUM_UNNECESSARY; + return false; + } + + return true; +} + +/* For small packets = CHECKSUM_BREAK peform checksum complete directly + * in checksum_init. + */ +#define CHECKSUM_BREAK 76 + +/* Validate (init) checksum based on checksum complete. + * + * Return values: + * 0: checksum is validated or try to in skb_checksum_complete. In the latter + * case the ip_summed will not be CHECKSUM_UNNECESSARY and the pseudo + * checksum is stored in skb-csum for use in __skb_checksum_complete + * non-zero: value of invalid checksum + * + */ +static inline __sum16 __skb_checksum_validate_complete(struct sk_buff *skb, + bool complete, + __wsum psum) +{ + if (skb-ip_summed == CHECKSUM_COMPLETE) { + if (!csum_fold(csum_add(psum, skb-csum))) { + skb-ip_summed = CHECKSUM_UNNECESSARY; + return 0; + } + } + + skb-csum = psum; + + if (complete || skb-len = CHECKSUM_BREAK) + return __skb_checksum_complete(skb); + + return 0; +} + +static inline __wsum null_compute_pseudo(struct sk_buff *skb, int proto) +{ + return 0; +} + +/* Perform checksum validate (init). Note that this is a macro since we only + * want to calculate the pseudo header which is an input function if necessary. + * First we try to validate without any computation (checksum unnecessary) and + * then calculate based on checksum complete calling the function to compute + * pseudo header. + * + * Return values: + * 0: checksum is validated or try to in skb_checksum_complete + * non-zero: value of invalid checksum + */ +#define __skb_checksum_validate(skb, proto, complete, \ + zero_okay, check, compute_pseudo) \ +({ \ + __sum16 __ret = 0; \ + if (__skb_checksum_validate_needed(skb, zero_okay, check)) \ + __ret = __skb_checksum_validate_complete(skb, \ + complete, compute_pseudo(skb, proto)); \ + __ret; \ +}) + +#define skb_checksum_init(skb, proto, compute_pseudo) \ + __skb_checksum_validate(skb, proto, false, false, 0, compute_pseudo) + +#define skb_checksum_init_zero_check(skb, proto, check, compute_pseudo) \ + __skb_checksum_validate(skb, proto, false, true, check, compute_pseudo) + +#define skb_checksum_validate(skb, proto, compute_pseudo) \ + __skb_checksum_validate(skb, proto, true, false, 0, compute_pseudo) + +#define skb_checksum_validate_zero_check(skb, proto, check,\ +compute_pseudo)\ + __skb_checksum_validate_(skb, proto, true, true, check, compute_pseudo) + +#define skb_checksum_simple_validate(skb) \ + __skb_checksum_validate(skb, 0, true, false, 0, null_compute_pseudo) + #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) void
[linux-yocto] [PATCH 3/5] ip6gre: add x-netns support
From: Nicolas Dichtel nicolas.dich...@6wind.com commit 22f08069e8b415b827e910ad75ed55eeadc4a877 upstream This patch allows to switch the netns when packet is encapsulated or decapsulated. In other word, the encapsulated packet is received in a netns, where the lookup is done to find the tunnel. Once the tunnel is found, the packet is decapsulated and injecting into the corresponding interface which stands to another netns. When one of the two netns is removed, the tunnel is destroyed. Signed-off-by: Nicolas Dichtel nicolas.dich...@6wind.com Signed-off-by: David S. Miller da...@davemloft.net Signed-off-by: Jianchuan Wang jianchuan.w...@windriver.com --- net/ipv6/ip6_gre.c | 52 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index 2465d18..084bde3 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -72,6 +72,7 @@ struct ip6gre_net { }; static struct rtnl_link_ops ip6gre_link_ops __read_mostly; +static struct rtnl_link_ops ip6gre_tap_ops __read_mostly; static int ip6gre_tunnel_init(struct net_device *dev); static void ip6gre_tunnel_setup(struct net_device *dev); static void ip6gre_tunnel_link(struct ip6gre_net *ign, struct ip6_tnl *t); @@ -353,10 +354,10 @@ failed_free: static void ip6gre_tunnel_uninit(struct net_device *dev) { - struct net *net = dev_net(dev); - struct ip6gre_net *ign = net_generic(net, ip6gre_net_id); + struct ip6_tnl *t = netdev_priv(dev); + struct ip6gre_net *ign = net_generic(t-net, ip6gre_net_id); - ip6gre_tunnel_unlink(ign, netdev_priv(dev)); + ip6gre_tunnel_unlink(ign, t); dev_put(dev); } @@ -611,8 +612,8 @@ static netdev_tx_t ip6gre_xmit2(struct sk_buff *skb, int encap_limit, __u32 *pmtu) { - struct net *net = dev_net(dev); struct ip6_tnl *tunnel = netdev_priv(dev); + struct net *net = tunnel-net; struct net_device *tdev;/* Device to other host */ struct ipv6hdr *ipv6h; /* Our new IP header */ unsigned int max_headroom = 0; /* The extra header space needed */ @@ -979,7 +980,7 @@ static void ip6gre_tnl_link_config(struct ip6_tnl *t, int set_mtu) int strict = (ipv6_addr_type(p-raddr) (IPV6_ADDR_MULTICAST|IPV6_ADDR_LINKLOCAL)); - struct rt6_info *rt = rt6_lookup(dev_net(dev), + struct rt6_info *rt = rt6_lookup(t-net, p-raddr, p-laddr, p-link, strict); @@ -1063,13 +1064,12 @@ static int ip6gre_tunnel_ioctl(struct net_device *dev, int err = 0; struct ip6_tnl_parm2 p; struct __ip6_tnl_parm p1; - struct ip6_tnl *t; - struct net *net = dev_net(dev); + struct ip6_tnl *t = netdev_priv(dev); + struct net *net = t-net; struct ip6gre_net *ign = net_generic(net, ip6gre_net_id); switch (cmd) { case SIOCGETTUNNEL: - t = NULL; if (dev == ign-fb_tunnel_dev) { if (copy_from_user(p, ifr-ifr_ifru.ifru_data, sizeof(p))) { err = -EFAULT; @@ -1077,9 +1077,9 @@ static int ip6gre_tunnel_ioctl(struct net_device *dev, } ip6gre_tnl_parm_from_user(p1, p); t = ip6gre_tunnel_locate(net, p1, 0); + if (t == NULL) + t = netdev_priv(dev); } - if (t == NULL) - t = netdev_priv(dev); memset(p, 0, sizeof(p)); ip6gre_tnl_parm_to_user(p, t-parms); if (copy_to_user(ifr-ifr_ifru.ifru_data, p, sizeof(p))) @@ -1242,7 +1242,6 @@ static void ip6gre_tunnel_setup(struct net_device *dev) dev-flags |= IFF_NOARP; dev-iflink = 0; dev-addr_len = sizeof(struct in6_addr); - dev-features |= NETIF_F_NETNS_LOCAL; dev-priv_flags = ~IFF_XMIT_DST_RELEASE; } @@ -1297,11 +1296,17 @@ static struct inet6_protocol ip6gre_protocol __read_mostly = { .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, }; -static void ip6gre_destroy_tunnels(struct ip6gre_net *ign, - struct list_head *head) +static void ip6gre_destroy_tunnels(struct net *net, struct list_head *head) { + struct ip6gre_net *ign = net_generic(net, ip6gre_net_id); + struct net_device *dev, *aux; int prio; + for_each_netdev_safe(net, dev, aux) + if (dev-rtnl_link_ops == ip6gre_link_ops || + dev-rtnl_link_ops == ip6gre_tap_ops) + unregister_netdevice_queue(dev, head); + for (prio = 0; prio 4; prio++) { int h; for (h = 0; h HASH_SIZE; h++) { @@ -1310,7 +1315,12 @@ static void
[linux-yocto] [PATCH 4/4] vxlan: use dev-needed_headroom instead of dev-hard_header_len
From: Cong Wang cw...@twopensource.com commit 2853af6a2ea1a8ed09b09dd4fb578e7f435e8d34 upstream vxlan: use dev-needed_headroom instead of dev-hard_header_len When we mirror packets from a vxlan tunnel to other device, the mirror device should see the same packets (that is, without outer header). Because vxlan tunnel sets dev-hard_header_len, tcf_mirred() resets mac header back to outer mac, the mirror device actually sees packets with outer headers Vxlan tunnel should set dev-needed_headroom instead of dev-hard_header_len, like what other ip tunnels do. This fixes the above problem. Cc: David S. Miller da...@davemloft.net Cc: stephen hemminger step...@networkplumber.org Cc: Pravin B Shelar pshe...@nicira.com Signed-off-by: Cong Wang cw...@twopensource.com Signed-off-by: Cong Wang xiyou.wangc...@gmail.com Signed-off-by: David S. Miller da...@davemloft.net Signed-off-by: Jianchuan Wang jianchuan.w...@windriver.com --- drivers/net/vxlan.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 4a5c522..d63dfbf 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -2288,9 +2288,9 @@ static void vxlan_setup(struct net_device *dev) eth_hw_addr_random(dev); ether_setup(dev); if (vxlan-default_dst.remote_ip.sa.sa_family == AF_INET6) - dev-hard_header_len = ETH_HLEN + VXLAN6_HEADROOM; + dev-needed_headroom = ETH_HLEN + VXLAN6_HEADROOM; else - dev-hard_header_len = ETH_HLEN + VXLAN_HEADROOM; + dev-needed_headroom = ETH_HLEN + VXLAN_HEADROOM; dev-netdev_ops = vxlan_netdev_ops; dev-destructor = free_netdev; @@ -2674,8 +2674,7 @@ static int vxlan_newlink(struct net *net, struct net_device *dev, if (!tb[IFLA_MTU]) dev-mtu = lowerdev-mtu - (use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM); - /* update header length based on lower device */ - dev-hard_header_len = lowerdev-hard_header_len + + dev-needed_headroom = lowerdev-hard_header_len + (use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM); } else if (use_ipv6) vxlan-flags |= VXLAN_F_IPV6; -- 1.9.1 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH] vxlan: Enable vxlan support
From: Jianchuan Wang jianchuan.w...@windriver.com vxlan: Enable vxlan support Signed-off-by: Jianchuan Wang jianchuan.w...@windriver.com --- meta/cfg/kernel-cache/features/vxlan/vxlan-enable.scc | 4 meta/cfg/kernel-cache/features/vxlan/vxlan.cfg| 1 + 2 files changed, 5 insertions(+) create mode 100644 meta/cfg/kernel-cache/features/vxlan/vxlan-enable.scc create mode 100644 meta/cfg/kernel-cache/features/vxlan/vxlan.cfg diff --git a/meta/cfg/kernel-cache/features/vxlan/vxlan-enable.scc b/meta/cfg/kernel-cache/features/vxlan/vxlan-enable.scc new file mode 100644 index 000..b2f0c7d --- /dev/null +++ b/meta/cfg/kernel-cache/features/vxlan/vxlan-enable.scc @@ -0,0 +1,4 @@ +define KFEATURE_DESCRIPTION Enable vxlan support +define KFEATURE_COMPATIBILITY all + +kconf non-hardware vxlan.cfg diff --git a/meta/cfg/kernel-cache/features/vxlan/vxlan.cfg b/meta/cfg/kernel-cache/features/vxlan/vxlan.cfg new file mode 100644 index 000..2aa404d --- /dev/null +++ b/meta/cfg/kernel-cache/features/vxlan/vxlan.cfg @@ -0,0 +1 @@ +CONFIG_VXLAN=m -- 1.9.1 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH 3/4] vxlan: add x-netns support
From: Nicolas Dichtel nicolas.dich...@6wind.com commit f01ec1c017dead42092997a2b8684fcab4cbf126 upstream vxlan: add x-netns support This patch allows to switch the netns when packet is encapsulated or decapsulated. The vxlan socket is openned into the i/o netns, ie into the netns where encapsulated packets are received. The socket lookup is done into this netns to find the corresponding vxlan tunnel. After decapsulation, the packet is injecting into the corresponding interface which may stand to another netns. When one of the two netns is removed, the tunnel is destroyed. Configuration example: ip netns add netns1 ip netns exec netns1 ip link set lo up ip link add vxlan10 type vxlan id 10 group 239.0.0.10 dev eth0 dstport 0 ip link set vxlan10 netns netns1 ip netns exec netns1 ip addr add 192.168.0.249/24 broadcast 192.168.0.255 dev vxlan10 ip netns exec netns1 ip link set vxlan10 up Signed-off-by: Nicolas Dichtel nicolas.dich...@6wind.com Signed-off-by: David S. Miller da...@davemloft.net Signed-off-by: Jianchuan Wang jianchuan.w...@windriver.com --- drivers/net/vxlan.c | 63 --- include/net/vxlan.h | 2 +- net/openvswitch/vport-vxlan.c | 3 ++- 3 files changed, 50 insertions(+), 18 deletions(-) diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 806881a..4a5c522 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -127,6 +127,7 @@ struct vxlan_dev { struct list_head next; /* vxlan's per namespace list */ struct vxlan_sock *vn_sock; /* listening socket */ struct net_device *dev; + struct net*net; /* netns for packet i/o */ struct vxlan_rdst default_dst; /* default destination */ union vxlan_addr saddr;/* source address */ __be16dst_port; @@ -1203,6 +1204,7 @@ static void vxlan_rcv(struct vxlan_sock *vs, remote_ip = vxlan-default_dst.remote_ip; skb_reset_mac_header(skb); + skb_scrub_packet(skb, !net_eq(vxlan-net, dev_net(vxlan-dev))); skb-protocol = eth_type_trans(skb, vxlan-dev); /* Ignore packet loops (and multicast echo) */ @@ -1618,7 +1620,8 @@ static int vxlan6_xmit_skb(struct vxlan_sock *vs, struct dst_entry *dst, struct sk_buff *skb, struct net_device *dev, struct in6_addr *saddr, struct in6_addr *daddr, __u8 prio, __u8 ttl, - __be16 src_port, __be16 dst_port, __be32 vni) + __be16 src_port, __be16 dst_port, __be32 vni, + bool xnet) { struct ipv6hdr *ip6h; struct vxlanhdr *vxh; @@ -1631,7 +1634,7 @@ static int vxlan6_xmit_skb(struct vxlan_sock *vs, skb-encapsulation = 1; } - skb_scrub_packet(skb, false); + skb_scrub_packet(skb, xnet); min_headroom = LL_RESERVED_SPACE(dst-dev) + dst-header_len + VXLAN_HLEN + sizeof(struct ipv6hdr) @@ -1711,7 +1714,7 @@ static int vxlan6_xmit_skb(struct vxlan_sock *vs, int vxlan_xmit_skb(struct vxlan_sock *vs, struct rtable *rt, struct sk_buff *skb, __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df, - __be16 src_port, __be16 dst_port, __be32 vni) + __be16 src_port, __be16 dst_port, __be32 vni, bool xnet) { struct vxlanhdr *vxh; struct udphdr *uh; @@ -1760,7 +1763,7 @@ int vxlan_xmit_skb(struct vxlan_sock *vs, return err; return iptunnel_xmit(rt, skb, src, dst, IPPROTO_UDP, tos, ttl, df, -false); +xnet); } EXPORT_SYMBOL_GPL(vxlan_xmit_skb); @@ -1853,7 +1856,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, fl4.daddr = dst-sin.sin_addr.s_addr; fl4.saddr = vxlan-saddr.sin.sin_addr.s_addr; - rt = ip_route_output_key(dev_net(dev), fl4); + rt = ip_route_output_key(vxlan-net, fl4); if (IS_ERR(rt)) { netdev_dbg(dev, no route to %pI4\n, dst-sin.sin_addr.s_addr); @@ -1874,7 +1877,7 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, struct vxlan_dev *dst_vxlan; ip_rt_put(rt); - dst_vxlan = vxlan_find_vni(dev_net(dev), vni, dst_port); + dst_vxlan = vxlan_find_vni(vxlan-net, vni, dst_port); if (!dst_vxlan) goto tx_error; vxlan_encap_bypass(skb, vxlan, dst_vxlan); @@ -1887,7 +1890,8 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, err = vxlan_xmit_skb(vxlan-vn_sock, rt, skb, fl4.saddr,
[linux-yocto] [PATCH 1/4] vxlan: remove unused port variable in vxlan_udp_encap_recv()
From: Pablo Neira Ayuso pa...@gnumonks.org commit 86c3f0f8307ac18f3ad3109e1969c62b8fbed5df upstream vxlan: remove unused port variable in vxlan_udp_encap_recv() Signed-off-by: Pablo Neira Ayuso pa...@gnumonks.org Signed-off-by: David S. Miller da...@davemloft.net Signed-off-by: Jianchuan Wang jianchuan.w...@windriver.com --- drivers/net/vxlan.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index d091e52..6bab66a 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -1135,7 +1135,6 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb) { struct vxlan_sock *vs; struct vxlanhdr *vxh; - __be16 port; /* Need Vxlan and inner Ethernet header to be present */ if (!pskb_may_pull(skb, VXLAN_HLEN)) @@ -1153,8 +1152,6 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb) if (iptunnel_pull_header(skb, VXLAN_HLEN, htons(ETH_P_TEB))) goto drop; - port = inet_sk(sk)-inet_sport; - vs = rcu_dereference_sk_user_data(sk); if (!vs) goto drop; -- 1.9.1 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH 3/3] block, bfq: add Early Queue Merge (EQM) to BFQ-v7r5 for 3.14.0
From: Mauro Andreolini mauro.andreol...@unimore.it Original patch taken from: http://algo.ing.unimo.it/people/paolo/disk_sched/patches/3.14.0-v7r5 A set of processes may happen to perform interleaved reads, i.e.,requests whose union would give rise to a sequential read pattern. There are two typical cases: in the first case, processes read fixed-size chunks of data at a fixed distance from each other, while in the second case processes may read variable-size chunks at variable distances. The latter case occurs for example with QEMU, which splits the I/O generated by the guest into multiple chunks, and lets these chunks be served by a pool of cooperating processes, iteratively assigning the next chunk of I/O to the first available process. CFQ uses actual queue merging for the first type of rocesses, whereas it uses preemption to get a sequential read pattern out of the read requests performed by the second type of processes. In the end it uses two different mechanisms to achieve the same goal: boosting the throughput with interleaved I/O. This patch introduces Early Queue Merge (EQM), a unified mechanism to get a sequential read pattern with both types of processes. The main idea is checking newly arrived requests against the next request of the active queue both in case of actual request insert and in case of request merge. By doing so, both the types of processes can be handled by just merging their queues. EQM is then simpler and more compact than the pair of mechanisms used in CFQ. Finally, EQM also preserves the typical low-latency properties of BFQ, by properly restoring the weight-raising state of a queue when it gets back to a non-merged state. Signed-off-by: Mauro Andreolini mauro.andreol...@unimore.it Signed-off-by: Arianna Avanzini avanzini.aria...@gmail.com Signed-off-by: Paolo Valente paolo.vale...@unimore.it Signed-off-by: Jianchuan Wang jianchuan.w...@windriver.com --- block/bfq-iosched.c | 736 block/bfq-sched.c | 28 -- block/bfq.h | 46 +++- 3 files changed, 556 insertions(+), 254 deletions(-) diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 0cbb182..452f477 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -571,6 +571,57 @@ static inline unsigned int bfq_wr_duration(struct bfq_data *bfqd) return dur; } +static inline unsigned +bfq_bfqq_cooperations(struct bfq_queue *bfqq) +{ + return bfqq-bic ? bfqq-bic-cooperations : 0; +} + +static inline void +bfq_bfqq_resume_state(struct bfq_queue *bfqq, struct bfq_io_cq *bic) +{ + if (bic-saved_idle_window) + bfq_mark_bfqq_idle_window(bfqq); + else + bfq_clear_bfqq_idle_window(bfqq); + if (bic-saved_IO_bound) + bfq_mark_bfqq_IO_bound(bfqq); + else + bfq_clear_bfqq_IO_bound(bfqq); + if (bic-wr_time_left bfqq-bfqd-low_latency + bic-cooperations bfqq-bfqd-bfq_coop_thresh) { + /* +* Start a weight raising period with the duration given by +* the raising_time_left snapshot. +*/ + if (bfq_bfqq_busy(bfqq)) + bfqq-bfqd-wr_busy_queues++; + bfqq-wr_coeff = bfqq-bfqd-bfq_wr_coeff; + bfqq-wr_cur_max_time = bic-wr_time_left; + bfqq-last_wr_start_finish = jiffies; + bfqq-entity.ioprio_changed = 1; + } + /* +* Clear wr_time_left to prevent bfq_bfqq_save_state() from +* getting confused about the queue's need of a weight-raising +* period. +*/ + bic-wr_time_left = 0; +} + +/* + * Must be called with the queue_lock held. + */ +static int bfqq_process_refs(struct bfq_queue *bfqq) +{ + int process_refs, io_refs; + + io_refs = bfqq-allocated[READ] + bfqq-allocated[WRITE]; + process_refs = atomic_read(bfqq-ref) - io_refs - bfqq-entity.on_st; + BUG_ON(process_refs 0); + return process_refs; +} + static void bfq_add_request(struct request *rq) { struct bfq_queue *bfqq = RQ_BFQQ(rq); @@ -602,8 +653,11 @@ static void bfq_add_request(struct request *rq) if (!bfq_bfqq_busy(bfqq)) { int soft_rt = bfqd-bfq_wr_max_softrt_rate 0 + bfq_bfqq_cooperations(bfqq) bfqd-bfq_coop_thresh time_is_before_jiffies(bfqq-soft_rt_next_start); - idle_for_long_time = time_is_before_jiffies( + idle_for_long_time = bfq_bfqq_cooperations(bfqq) +bfqd-bfq_coop_thresh + time_is_before_jiffies( bfqq-budget_timeout + bfqd-bfq_wr_min_idle_time); entity-budget = max_t(unsigned long, bfqq-max_budget, @@ -624,11 +678,20 @@ static void bfq_add_request(struct request *rq)
[linux-yocto] [PATCH 1/3] block: cgroups, kconfig, build bits for BFQ-v7r5-3.14
From: Paolo Valente paolo.vale...@unimore.it Original patch taken from: http://algo.ing.unimo.it/people/paolo/disk_sched/patches/3.14.0-v7r5 Update Kconfig.iosched and do the related Makefile changes to include kernel configuration options for BFQ. Also add the bfqio controller to the cgroups subsystem. Signed-off-by: Paolo Valente paolo.vale...@unimore.it Signed-off-by: Arianna Avanzini avanzini.aria...@gmail.com Signed-off-by: Jianchuan Wang jianchuan.w...@windriver.com --- block/Kconfig.iosched | 32 block/Makefile| 1 + include/linux/cgroup_subsys.h | 4 3 files changed, 37 insertions(+) diff --git a/block/Kconfig.iosched b/block/Kconfig.iosched index 421bef9..0ee5f0f 100644 --- a/block/Kconfig.iosched +++ b/block/Kconfig.iosched @@ -39,6 +39,27 @@ config CFQ_GROUP_IOSCHED ---help--- Enable group IO scheduling in CFQ. +config IOSCHED_BFQ + tristate BFQ I/O scheduler + default n + ---help--- + The BFQ I/O scheduler tries to distribute bandwidth among + all processes according to their weights. + It aims at distributing the bandwidth as desired, independently of + the disk parameters and with any workload. It also tries to + guarantee low latency to interactive and soft real-time + applications. If compiled built-in (saying Y here), BFQ can + be configured to support hierarchical scheduling. + +config CGROUP_BFQIO + bool BFQ hierarchical scheduling support + depends on CGROUPS IOSCHED_BFQ=y + default n + ---help--- + Enable hierarchical scheduling in BFQ, using the cgroups + filesystem interface. The name of the subsystem will be + bfqio. + choice prompt Default I/O scheduler default DEFAULT_CFQ @@ -52,6 +73,16 @@ choice config DEFAULT_CFQ bool CFQ if IOSCHED_CFQ=y + config DEFAULT_BFQ + bool BFQ if IOSCHED_BFQ=y + help + Selects BFQ as the default I/O scheduler which will be + used by default for all block devices. + The BFQ I/O scheduler aims at distributing the bandwidth + as desired, independently of the disk parameters and with + any workload. It also tries to guarantee low latency to + interactive and soft real-time applications. + config DEFAULT_NOOP bool No-op @@ -61,6 +92,7 @@ config DEFAULT_IOSCHED string default deadline if DEFAULT_DEADLINE default cfq if DEFAULT_CFQ + default bfq if DEFAULT_BFQ default noop if DEFAULT_NOOP endmenu diff --git a/block/Makefile b/block/Makefile index 20645e8..cbd83fb 100644 --- a/block/Makefile +++ b/block/Makefile @@ -16,6 +16,7 @@ obj-$(CONFIG_BLK_DEV_THROTTLING) += blk-throttle.o obj-$(CONFIG_IOSCHED_NOOP) += noop-iosched.o obj-$(CONFIG_IOSCHED_DEADLINE) += deadline-iosched.o obj-$(CONFIG_IOSCHED_CFQ) += cfq-iosched.o +obj-$(CONFIG_IOSCHED_BFQ) += bfq-iosched.o obj-$(CONFIG_BLOCK_COMPAT) += compat_ioctl.o obj-$(CONFIG_BLK_DEV_INTEGRITY)+= blk-integrity.o diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h index 7b99d71..4e8c0ff 100644 --- a/include/linux/cgroup_subsys.h +++ b/include/linux/cgroup_subsys.h @@ -39,6 +39,10 @@ SUBSYS(net_cls) SUBSYS(blkio) #endif +#if IS_SUBSYS_ENABLED(CONFIG_CGROUP_BFQIO) +SUBSYS(bfqio) +#endif + #if IS_SUBSYS_ENABLED(CONFIG_CGROUP_PERF) SUBSYS(perf) #endif -- 1.9.1 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH] BFQ: Support Budget Fair Queueing (BFQ) Storage-I/O Scheduler
From: Jianchuan Wang jianchuan.w...@windriver.com BFQ: Support Budget Fair Queueing (BFQ) Storage-I/O Scheduler Signed-off-by: Jianchuan Wang jianchuan.w...@windriver.com --- meta/cfg/kernel-cache/features/bfq/bfq-enable.scc | 1 + meta/cfg/kernel-cache/features/bfq/bfq.cfg| 2 ++ 2 files changed, 3 insertions(+) create mode 100644 meta/cfg/kernel-cache/features/bfq/bfq-enable.scc create mode 100644 meta/cfg/kernel-cache/features/bfq/bfq.cfg diff --git a/meta/cfg/kernel-cache/features/bfq/bfq-enable.scc b/meta/cfg/kernel-cache/features/bfq/bfq-enable.scc new file mode 100644 index 000..c75a014 --- /dev/null +++ b/meta/cfg/kernel-cache/features/bfq/bfq-enable.scc @@ -0,0 +1 @@ +kconf non-hardware bfq.cfg diff --git a/meta/cfg/kernel-cache/features/bfq/bfq.cfg b/meta/cfg/kernel-cache/features/bfq/bfq.cfg new file mode 100644 index 000..df82ebc --- /dev/null +++ b/meta/cfg/kernel-cache/features/bfq/bfq.cfg @@ -0,0 +1,2 @@ +CONFIG_IOSCHED_BFQ=y +CONFIG_CGROUP_BFQIO=y -- 1.9.1 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH 07/13] x86, vdso: __vdso_clock_gettime() cleanup
From: Stefani Seibold stef...@seibold.net commit ce39c64028a075d14af32bfb8336bfe1370c0443 upstream This patch is a small code cleanup for the __vdso_clock_gettime() function. It removes the unneeded return values from do_monotonic_coarse() and do_realtime_coarse() and add a fallback label for doing the kernel gettimeofday() system call. Reviewed-by: Andy Lutomirski l...@amacapital.net Signed-off-by: Stefani Seibold stef...@seibold.net Link: http://lkml.kernel.org/r/1395094933-14252-5-git-send-email-stef...@seibold.net Signed-off-by: H. Peter Anvin h...@linux.intel.com Signed-off-by: Jianchuan Wang jianchuan.w...@windriver.com --- arch/x86/vdso/vclock_gettime.c | 27 ++- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c index bbc8065..fd074dd 100644 --- a/arch/x86/vdso/vclock_gettime.c +++ b/arch/x86/vdso/vclock_gettime.c @@ -209,7 +209,7 @@ notrace static int do_monotonic(struct timespec *ts) return mode; } -notrace static int do_realtime_coarse(struct timespec *ts) +notrace static void do_realtime_coarse(struct timespec *ts) { unsigned long seq; do { @@ -217,10 +217,9 @@ notrace static int do_realtime_coarse(struct timespec *ts) ts-tv_sec = gtod-wall_time_coarse.tv_sec; ts-tv_nsec = gtod-wall_time_coarse.tv_nsec; } while (unlikely(read_seqcount_retry(gtod-seq, seq))); - return 0; } -notrace static int do_monotonic_coarse(struct timespec *ts) +notrace static void do_monotonic_coarse(struct timespec *ts) { unsigned long seq; do { @@ -228,30 +227,32 @@ notrace static int do_monotonic_coarse(struct timespec *ts) ts-tv_sec = gtod-monotonic_time_coarse.tv_sec; ts-tv_nsec = gtod-monotonic_time_coarse.tv_nsec; } while (unlikely(read_seqcount_retry(gtod-seq, seq))); - - return 0; } notrace int __vdso_clock_gettime(clockid_t clock, struct timespec *ts) { - int ret = VCLOCK_NONE; - switch (clock) { case CLOCK_REALTIME: - ret = do_realtime(ts); + if (do_realtime(ts) == VCLOCK_NONE) + goto fallback; break; case CLOCK_MONOTONIC: - ret = do_monotonic(ts); + if (do_monotonic(ts) == VCLOCK_NONE) + goto fallback; break; case CLOCK_REALTIME_COARSE: - return do_realtime_coarse(ts); + do_realtime_coarse(ts); + break; case CLOCK_MONOTONIC_COARSE: - return do_monotonic_coarse(ts); + do_monotonic_coarse(ts); + break; + default: + goto fallback; } - if (ret == VCLOCK_NONE) - return vdso_fallback_gettime(clock, ts); return 0; +fallback: + return vdso_fallback_gettime(clock, ts); } int clock_gettime(clockid_t, struct timespec *) __attribute__((weak, alias(__vdso_clock_gettime))); -- 1.7.9.5 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH 01/13] x86, vdso: Remove compat vdso support
From: Andy Lutomirski l...@amacapital.net commit b0b49f2673f011cad7deeabf7a683b388c351278 upstream The compat vDSO is a complicated hack that's needed to maintain compatibility with a small range of glibc versions. This removes it and replaces it with a much simpler hack: a config option to disable the 32-bit vDSO by default. This also changes the default value of CONFIG_COMPAT_VDSO to n -- users configuring kernels from scratch almost certainly want that choice. Signed-off-by: Andy Lutomirski l...@amacapital.net Link: http://lkml.kernel.org/r/4bb4690899106eb11430b1186d5cc66ca9d1660c.1394751608.git.l...@amacapital.net Signed-off-by: H. Peter Anvin h...@linux.intel.com Signed-off-by: Jianchuan Wang jianchuan.w...@windriver.com --- Documentation/kernel-parameters.txt | 22 +++- arch/x86/Kconfig| 26 ++-- arch/x86/include/asm/elf.h |4 - arch/x86/include/asm/fixmap.h |8 -- arch/x86/include/asm/vdso.h |5 +- arch/x86/vdso/vdso-layout.lds.S |2 +- arch/x86/vdso/vdso32-setup.c| 232 --- arch/x86/vdso/vdso32/vdso32.lds.S |2 - 8 files changed, 58 insertions(+), 243 deletions(-) diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 7116fda..8601975 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -3409,14 +3409,24 @@ bytes respectively. Such letter suffixes can also be entirely omitted. of CONFIG_HIGHPTE. vdso= [X86,SH] - vdso=2: enable compat VDSO (default with COMPAT_VDSO) - vdso=1: enable VDSO (default) + On X86_32, this is an alias for vdso32=. Otherwise: + + vdso=1: enable VDSO (the default) vdso=0: disable VDSO mapping - vdso32= [X86] - vdso32=2: enable compat VDSO (default with COMPAT_VDSO) - vdso32=1: enable 32-bit VDSO (default) - vdso32=0: disable 32-bit VDSO mapping + vdso32= [X86] Control the 32-bit vDSO + vdso32=1: enable 32-bit VDSO + vdso32=0 or vdso32=2: disable 32-bit VDSO + + See the help text for CONFIG_COMPAT_VDSO for more + details. If CONFIG_COMPAT_VDSO is set, the default is + vdso32=0; otherwise, the default is vdso32=1. + + For compatibility with older kernels, vdso32=2 is an + alias for vdso32=0. + + Try vdso32=0 if you encounter an error that says: + dl_main: Assertion `(void *) ph-p_vaddr == _rtld_local._dl_sysinfo_dso' failed! vector= [IA-64,SMP] vector=percpu: enable percpu vector domain diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 0af5250..9122f6b 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -1836,17 +1836,29 @@ config DEBUG_HOTPLUG_CPU0 If unsure, say N. config COMPAT_VDSO - def_bool y - prompt Compat VDSO support + def_bool n + prompt Disable the 32-bit vDSO (needed for glibc 2.3.3) depends on X86_32 || IA32_EMULATION ---help--- - Map the 32-bit VDSO to the predictable old-style address too. + Certain buggy versions of glibc will crash if they are + presented with a 32-bit vDSO that is not mapped at the address + indicated in its segment table. - Say N here if you are running a sufficiently recent glibc - version (2.3.3 or later), to remove the high-mapped - VDSO mapping and to exclusively use the randomized VDSO. + The bug was introduced by f866314b89d56845f55e6f365e18b31ec978ec3a + and fixed by 3b3ddb4f7db98ec9e912ccdf54d35df4aa30e04a and + 49ad572a70b8aeb91e57483a11dd1b77e31c4468. Glibc 2.3.3 is + the only released version with the bug, but OpenSUSE 9 + contains a buggy glibc 2.3.2. - If unsure, say Y. + The symptom of the bug is that everything crashes on startup, saying: + dl_main: Assertion `(void *) ph-p_vaddr == _rtld_local._dl_sysinfo_dso' failed! + + Saying Y here changes the default value of the vdso32 boot + option from 1 to 0, which turns off the 32-bit vDSO entirely. + This works around the glibc bug but hurts performance. + + If unsure, say N: if you are compiling your own kernel, you + are unlikely to be using a buggy version of glibc. config CMDLINE_BOOL bool Built-in kernel command line diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h index 9c999c1..2c71182 100644 --- a/arch/x86/include/asm/elf.h +++ b/arch/x86/include/asm/elf.h @@ -281,16 +281,12 @@ do {
[linux-yocto] [PATCH 02/13] x86_32, mm: Remove user bit from identity map PDE
From: Andy Lutomirski l...@amacapital.net commit 7dda038756704b3562187b29c81f86de935148c6 upstream The only reason that the user bit was set was to support userspace access to the compat vDSO in the fixmap. The compat vDSO is gone, so the user bit can be removed. Signed-off-by: Andy Lutomirski l...@amacapital.net Link: http://lkml.kernel.org/r/e240a977f3c7cbd525a091fd6521499ec4b8e94f.1394751608.git.l...@amacapital.net Signed-off-by: H. Peter Anvin h...@linux.intel.com Signed-off-by: Jianchuan Wang jianchuan.w...@windriver.com --- arch/x86/include/asm/pgtable_types.h |7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h index 1aa9ccd..757f9c4 100644 --- a/arch/x86/include/asm/pgtable_types.h +++ b/arch/x86/include/asm/pgtable_types.h @@ -214,13 +214,8 @@ #ifdef CONFIG_X86_64 #define __PAGE_KERNEL_IDENT_LARGE_EXEC __PAGE_KERNEL_LARGE_EXEC #else -/* - * For PDE_IDENT_ATTR include USER bit. As the PDE and PTE protection - * bits are combined, this will alow user to access the high address mapped - * VDSO in the presence of CONFIG_COMPAT_VDSO - */ #define PTE_IDENT_ATTR 0x003 /* PRESENT+RW */ -#define PDE_IDENT_ATTR 0x067 /* PRESENT+RW+USER+DIRTY+ACCESSED */ +#define PDE_IDENT_ATTR 0x063 /* PRESENT+RW+DIRTY+ACCESSED */ #define PGD_IDENT_ATTR 0x001 /* PRESENT (no other attributes) */ #endif -- 1.7.9.5 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH 04/13] x86, vdso: Make vsyscall_gtod_data handling x86 generic
From: Stefani Seibold stef...@seibold.net commit d2312e3379d581d2c3603357a0181046448e1de3 upstream This patch move the vsyscall_gtod_data handling out of vsyscall_64.c into an additonal file vsyscall_gtod.c to make the functionality available for x86 32 bit kernel. It also adds a new vsyscall_32.c which setup the VVAR page. Reviewed-by: Andy Lutomirski l...@amacapital.net Signed-off-by: Stefani Seibold stef...@seibold.net Link: http://lkml.kernel.org/r/1395094933-14252-2-git-send-email-stef...@seibold.net Signed-off-by: H. Peter Anvin h...@linux.intel.com Signed-off-by: Jianchuan Wang jianchuan.w...@windriver.com --- arch/x86/Kconfig |4 +-- arch/x86/include/asm/clocksource.h |4 --- arch/x86/include/asm/vvar.h| 12 ++-- arch/x86/kernel/Makefile |2 +- arch/x86/kernel/hpet.c |2 -- arch/x86/kernel/tsc.c |2 -- arch/x86/kernel/vmlinux.lds.S |3 -- arch/x86/kernel/vsyscall_64.c | 45 --- arch/x86/kernel/vsyscall_gtod.c| 59 arch/x86/tools/relocs.c|2 +- 10 files changed, 72 insertions(+), 63 deletions(-) create mode 100644 arch/x86/kernel/vsyscall_gtod.c diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 9122f6b..ab3ebc8 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -107,9 +107,9 @@ config X86 select HAVE_ARCH_SOFT_DIRTY select CLOCKSOURCE_WATCHDOG select GENERIC_CLOCKEVENTS - select ARCH_CLOCKSOURCE_DATA if X86_64 + select ARCH_CLOCKSOURCE_DATA select GENERIC_CLOCKEVENTS_BROADCAST if X86_64 || (X86_32 X86_LOCAL_APIC) - select GENERIC_TIME_VSYSCALL if X86_64 + select GENERIC_TIME_VSYSCALL select KTIME_SCALAR if X86_32 select GENERIC_STRNCPY_FROM_USER select GENERIC_STRNLEN_USER diff --git a/arch/x86/include/asm/clocksource.h b/arch/x86/include/asm/clocksource.h index 16a57f4..eda81dc 100644 --- a/arch/x86/include/asm/clocksource.h +++ b/arch/x86/include/asm/clocksource.h @@ -3,8 +3,6 @@ #ifndef _ASM_X86_CLOCKSOURCE_H #define _ASM_X86_CLOCKSOURCE_H -#ifdef CONFIG_X86_64 - #define VCLOCK_NONE 0 /* No vDSO clock available. */ #define VCLOCK_TSC 1 /* vDSO should use vread_tsc. */ #define VCLOCK_HPET 2 /* vDSO should use vread_hpet. */ @@ -14,6 +12,4 @@ struct arch_clocksource_data { int vclock_mode; }; -#endif /* CONFIG_X86_64 */ - #endif /* _ASM_X86_CLOCKSOURCE_H */ diff --git a/arch/x86/include/asm/vvar.h b/arch/x86/include/asm/vvar.h index d76ac40..0a534ea 100644 --- a/arch/x86/include/asm/vvar.h +++ b/arch/x86/include/asm/vvar.h @@ -16,9 +16,6 @@ * you mess up, the linker will catch it.) */ -/* Base address of vvars. This is not ABI. */ -#define VVAR_ADDRESS (-10*1024*1024 - 4096) - #if defined(__VVAR_KERNEL_LDS) /* The kernel linker script defines its own magic to put vvars in the @@ -29,6 +26,15 @@ #else +extern char __vvar_page; + +/* Base address of vvars. This is not ABI. */ +#ifdef CONFIG_X86_64 +#define VVAR_ADDRESS (-10*1024*1024 - 4096) +#else +#define VVAR_ADDRESS (__vvar_page) +#endif + #define DECLARE_VVAR(offset, type, name) \ static type const * const vvaraddr_ ## name = \ (void *)(VVAR_ADDRESS + (offset)); diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index cb648c8..f4d9600 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile @@ -26,7 +26,7 @@ obj-$(CONFIG_IRQ_WORK) += irq_work.o obj-y += probe_roms.o obj-$(CONFIG_X86_32) += i386_ksyms_32.o obj-$(CONFIG_X86_64) += sys_x86_64.o x8664_ksyms_64.o -obj-y += syscall_$(BITS).o +obj-y += syscall_$(BITS).o vsyscall_gtod.o obj-$(CONFIG_X86_64) += vsyscall_64.o obj-$(CONFIG_X86_64) += vsyscall_emu_64.o obj-$(CONFIG_SYSFS)+= ksysfs.o diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index da85a8e..e4b86ab 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c @@ -752,9 +752,7 @@ static struct clocksource clocksource_hpet = { .mask = HPET_MASK, .flags = CLOCK_SOURCE_IS_CONTINUOUS, .resume = hpet_resume_counter, -#ifdef CONFIG_X86_64 .archdata = { .vclock_mode = VCLOCK_HPET }, -#endif }; static int hpet_clocksource_register(void) diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index cfbe99f..227dcfc 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c @@ -985,9 +985,7 @@ static struct clocksource clocksource_tsc = { .mask = CLOCKSOURCE_MASK(64), .flags = CLOCK_SOURCE_IS_CONTINUOUS | CLOCK_SOURCE_MUST_VERIFY, -#ifdef CONFIG_X86_64 .archdata = { .vclock_mode = VCLOCK_TSC }, -#endif }; void mark_tsc_unstable(char *reason) diff --git
[linux-yocto] [PATCH 09/13] x86, vdso: Cleanup __vdso_gettimeofday()
From: Stefani Seibold stef...@seibold.net commit 0df1ea2b7955d3cb311a549c44ed482452b859ff upstream This patch cleans up the __vdso_gettimeofday() function a little. It kicks out an unneeded ret local variable and makes the code faster if only the timezone is needed (an admittedly rare case.) Reviewed-by: Andy Lutomirski l...@amacapital.net Signed-off-by: Stefani Seibold stef...@seibold.net Link: http://lkml.kernel.org/r/1395094933-14252-7-git-send-email-stef...@seibold.net Signed-off-by: H. Peter Anvin h...@linux.intel.com Signed-off-by: Jianchuan Wang jianchuan.w...@windriver.com --- arch/x86/vdso/vclock_gettime.c |7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c index 743f277..09dae4a 100644 --- a/arch/x86/vdso/vclock_gettime.c +++ b/arch/x86/vdso/vclock_gettime.c @@ -259,13 +259,12 @@ int clock_gettime(clockid_t, struct timespec *) notrace int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz) { - long ret = VCLOCK_NONE; - if (likely(tv != NULL)) { BUILD_BUG_ON(offsetof(struct timeval, tv_usec) != offsetof(struct timespec, tv_nsec) || sizeof(*tv) != sizeof(struct timespec)); - ret = do_realtime((struct timespec *)tv); + if (unlikely(do_realtime((struct timespec *)tv) == VCLOCK_NONE)) + return vdso_fallback_gtod(tv, tz); tv-tv_usec /= 1000; } if (unlikely(tz != NULL)) { @@ -274,8 +273,6 @@ notrace int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz) tz-tz_dsttime = gtod-sys_tz.tz_dsttime; } - if (ret == VCLOCK_NONE) - return vdso_fallback_gtod(tv, tz); return 0; } int gettimeofday(struct timeval *, struct timezone *) -- 1.7.9.5 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH 08/13] x86, vdso: Replace VVAR(vsyscall_gtod_data) by gtod macro
From: Stefani Seibold stef...@seibold.net commit af8c93d8d9809c3cf71cae2c398069399e64efa3 upstream There a currently more than 30 users of the gtod macro, so replace the last VVAR(vsyscall_gtod_data) by gtod macro. Reviewed-by: Andy Lutomirski l...@amacapital.net Signed-off-by: Stefani Seibold stef...@seibold.net Link: http://lkml.kernel.org/r/1395094933-14252-6-git-send-email-stef...@seibold.net Signed-off-by: H. Peter Anvin h...@linux.intel.com Signed-off-by: Jianchuan Wang jianchuan.w...@windriver.com --- arch/x86/vdso/vclock_gettime.c |6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c index fd074dd..743f277 100644 --- a/arch/x86/vdso/vclock_gettime.c +++ b/arch/x86/vdso/vclock_gettime.c @@ -109,7 +109,7 @@ static notrace cycle_t vread_pvclock(int *mode) *mode = VCLOCK_NONE; /* refer to tsc.c read_tsc() comment for rationale */ - last = VVAR(vsyscall_gtod_data).clock.cycle_last; + last = gtod-clock.cycle_last; if (likely(ret = last)) return ret; @@ -133,7 +133,7 @@ notrace static cycle_t vread_tsc(void) rdtsc_barrier(); ret = (cycle_t)vget_cycles(); - last = VVAR(vsyscall_gtod_data).clock.cycle_last; + last = gtod-clock.cycle_last; if (likely(ret = last)) return ret; @@ -288,7 +288,7 @@ int gettimeofday(struct timeval *, struct timezone *) notrace time_t __vdso_time(time_t *t) { /* This is atomic on x86_64 so we don't need any locks. */ - time_t result = ACCESS_ONCE(VVAR(vsyscall_gtod_data).wall_time_sec); + time_t result = ACCESS_ONCE(gtod-wall_time_sec); if (t) *t = result; -- 1.7.9.5 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH] vdso: Delete CONFIG_COMPAT_VDSO after removing compat vdso
From: Jianchuan Wang jianchuan.w...@windriver.com --- meta/cfg/kernel-cache/features/vdso/vdso.cfg |1 + meta/cfg/kernel-cache/features/vdso/vdso.scc |1 + 2 files changed, 2 insertions(+) create mode 100644 meta/cfg/kernel-cache/features/vdso/vdso.cfg create mode 100644 meta/cfg/kernel-cache/features/vdso/vdso.scc diff --git a/meta/cfg/kernel-cache/features/vdso/vdso.cfg b/meta/cfg/kernel-cache/features/vdso/vdso.cfg new file mode 100644 index 000..a79844f --- /dev/null +++ b/meta/cfg/kernel-cache/features/vdso/vdso.cfg @@ -0,0 +1 @@ +# CONFIG_COMPAT_VDSO is not set diff --git a/meta/cfg/kernel-cache/features/vdso/vdso.scc b/meta/cfg/kernel-cache/features/vdso/vdso.scc new file mode 100644 index 000..ca32f71 --- /dev/null +++ b/meta/cfg/kernel-cache/features/vdso/vdso.scc @@ -0,0 +1 @@ +kconf non-hardware vdso.cfg -- 1.7.9.5 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH 10/13] x86, vdso: Introduce VVAR marco for vdso32
From: Stefani Seibold stef...@seibold.net commit ef721987aef0cc0abba08c88810f2155f76b0b1f upstream This patch revamps the vvar.h for introduce the VVAR macro for vdso32. Reviewed-by: Andy Lutomirski l...@amacapital.net Signed-off-by: Stefani Seibold stef...@seibold.net Link: http://lkml.kernel.org/r/1395094933-14252-8-git-send-email-stef...@seibold.net Signed-off-by: H. Peter Anvin h...@linux.intel.com Signed-off-by: Jianchuan Wang jianchuan.w...@windriver.com --- arch/x86/include/asm/vvar.h | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/vvar.h b/arch/x86/include/asm/vvar.h index 0a534ea..52c79ff 100644 --- a/arch/x86/include/asm/vvar.h +++ b/arch/x86/include/asm/vvar.h @@ -26,6 +26,15 @@ #else +#ifdef BUILD_VDSO32 + +#define DECLARE_VVAR(offset, type, name) \ + extern type vvar_ ## name __attribute__((visibility(hidden))); + +#define VVAR(name) (vvar_ ## name) + +#else + extern char __vvar_page; /* Base address of vvars. This is not ABI. */ @@ -39,12 +48,13 @@ extern char __vvar_page; static type const * const vvaraddr_ ## name = \ (void *)(VVAR_ADDRESS + (offset)); +#define VVAR(name) (*vvaraddr_ ## name) +#endif + #define DEFINE_VVAR(type, name) \ type name \ __attribute__((section(.vvar_ #name), aligned(16))) __visible -#define VVAR(name) (*vvaraddr_ ## name) - #endif /* DECLARE_VVAR(offset, type, name) */ -- 1.7.9.5 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH 06/13] x86, vdso: Revamp vclock_gettime.c
From: Stefani Seibold stef...@seibold.net commit 411f790cd7e91fac0db80d3cf789cb6deeac298e upstream This intermediate patch revamps the vclock_gettime.c by moving some functions around. It is only for spliting purpose, to make whole the 32 bit vdso timer patch easier to review. Reviewed-by: Andy Lutomirski l...@amacapital.net Signed-off-by: Stefani Seibold stef...@seibold.net Link: http://lkml.kernel.org/r/1395094933-14252-4-git-send-email-stef...@seibold.net Signed-off-by: H. Peter Anvin h...@linux.intel.com Signed-off-by: Jianchuan Wang jianchuan.w...@windriver.com --- arch/x86/vdso/vclock_gettime.c | 85 1 file changed, 42 insertions(+), 43 deletions(-) diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c index eb5d7a5..bbc8065 100644 --- a/arch/x86/vdso/vclock_gettime.c +++ b/arch/x86/vdso/vclock_gettime.c @@ -26,41 +26,26 @@ #define gtod (VVAR(vsyscall_gtod_data)) -notrace static cycle_t vread_tsc(void) +static notrace cycle_t vread_hpet(void) { - cycle_t ret; - u64 last; - - /* -* Empirically, a fence (of type that depends on the CPU) -* before rdtsc is enough to ensure that rdtsc is ordered -* with respect to loads. The various CPU manuals are unclear -* as to whether rdtsc can be reordered with later loads, -* but no one has ever seen it happen. -*/ - rdtsc_barrier(); - ret = (cycle_t)vget_cycles(); - - last = VVAR(vsyscall_gtod_data).clock.cycle_last; - - if (likely(ret = last)) - return ret; + return readl((const void __iomem *)fix_to_virt(VSYSCALL_HPET) + HPET_COUNTER); +} - /* -* GCC likes to generate cmov here, but this branch is extremely -* predictable (it's just a funciton of time and the likely is -* very likely) and there's a data dependence, so force GCC -* to generate a branch instead. I don't barrier() because -* we don't actually need a barrier, and if this function -* ever gets inlined it will generate worse code. -*/ - asm volatile (); - return last; +notrace static long vdso_fallback_gettime(long clock, struct timespec *ts) +{ + long ret; + asm(syscall : =a (ret) : + 0 (__NR_clock_gettime), D (clock), S (ts) : memory); + return ret; } -static notrace cycle_t vread_hpet(void) +notrace static long vdso_fallback_gtod(struct timeval *tv, struct timezone *tz) { - return readl((const void __iomem *)fix_to_virt(VSYSCALL_HPET) + HPET_COUNTER); + long ret; + + asm(syscall : =a (ret) : + 0 (__NR_gettimeofday), D (tv), S (tz) : memory); + return ret; } #ifdef CONFIG_PARAVIRT_CLOCK @@ -133,23 +118,37 @@ static notrace cycle_t vread_pvclock(int *mode) } #endif -notrace static long vdso_fallback_gettime(long clock, struct timespec *ts) +notrace static cycle_t vread_tsc(void) { - long ret; - asm(syscall : =a (ret) : - 0 (__NR_clock_gettime),D (clock), S (ts) : memory); - return ret; -} + cycle_t ret; + u64 last; -notrace static long vdso_fallback_gtod(struct timeval *tv, struct timezone *tz) -{ - long ret; + /* +* Empirically, a fence (of type that depends on the CPU) +* before rdtsc is enough to ensure that rdtsc is ordered +* with respect to loads. The various CPU manuals are unclear +* as to whether rdtsc can be reordered with later loads, +* but no one has ever seen it happen. +*/ + rdtsc_barrier(); + ret = (cycle_t)vget_cycles(); - asm(syscall : =a (ret) : - 0 (__NR_gettimeofday), D (tv), S (tz) : memory); - return ret; -} + last = VVAR(vsyscall_gtod_data).clock.cycle_last; + if (likely(ret = last)) + return ret; + + /* +* GCC likes to generate cmov here, but this branch is extremely +* predictable (it's just a funciton of time and the likely is +* very likely) and there's a data dependence, so force GCC +* to generate a branch instead. I don't barrier() because +* we don't actually need a barrier, and if this function +* ever gets inlined it will generate worse code. +*/ + asm volatile (); + return last; +} notrace static inline u64 vgetsns(int *mode) { -- 1.7.9.5 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH 03/13] x86, vdso, xen: Remove stray reference to FIX_VDSO
From: H. Peter Anvin h...@linux.intel.com commit 1f2cbcf648962cdcf511d234cb39745baa9f5d07 upstream Checkin b0b49f2673f0 x86, vdso: Remove compat vdso support ... removed the VDSO from the fixmap, and thus FIX_VDSO; remove a stray reference in Xen. Found by Fengguang Wu's test robot. Reported-by: Fengguang Wu fengguang...@intel.com Cc: Andy Lutomirski l...@amacapital.net Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com Cc: Boris Ostrovsky boris.ostrov...@oracle.com Cc: David Vrabel david.vra...@citrix.com Link: http://lkml.kernel.org/r/4bb4690899106eb11430b1186d5cc66ca9d1660c.1394751608.git.l...@amacapital.net Signed-off-by: H. Peter Anvin h...@linux.intel.com Signed-off-by: Jianchuan Wang jianchuan.w...@windriver.com --- arch/x86/xen/mmu.c |1 - 1 file changed, 1 deletion(-) diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index 256282e..21c6a42 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c @@ -2058,7 +2058,6 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot) case FIX_RO_IDT: #ifdef CONFIG_X86_32 case FIX_WP_TEST: - case FIX_VDSO: # ifdef CONFIG_HIGHMEM case FIX_KMAP_BEGIN ... FIX_KMAP_END: # endif -- 1.7.9.5 -- ___ linux-yocto mailing list linux-yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/linux-yocto
[linux-yocto] [PATCH 1/2] cpu: add generic support for CPU feature based module
From: Jianchuan Wang jianchuan.w...@windriver.com commit 67bad2fdb754dbef14596c0b5d28b3a12c8dfe84 upstream cpu: add generic support for CPU feature based module autoloading This patch adds support for advertising optional CPU features over udev using the modalias, and for declaring compatibility with/dependency upon such a feature in a module. The mapping between feature numbers and actual features should be provided by the architecture in a file called asm/cpufeature.h which exports the following functions/macros: - cpu_feature(FEAT), a preprocessor macro that maps token FEAT to a numeric index; - bool cpu_have_feature(n), returning whether this CPU has support for feature #n; - MAX_CPU_FEATURES, an upper bound for 'n' in the previous function. The feature can then be enabled by setting CONFIG_GENERIC_CPU_AUTOPROBE for the architecture. For instance, a module that registers its module init function using module_cpu_feature_match(FEAT_X, module_init_function) will be probed automatically when the CPU's support for the 'FEAT_X' feature is advertised over udev, and will only allow the module to be loaded by hand if the 'FEAT_X' feature is supported. Signed-off-by: Ard Biesheuvel ard.biesheu...@linaro.org Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org Signed-off-by: Jianchuan Wang jianchuan.w...@windriver.com --- drivers/base/Kconfig |8 + drivers/base/cpu.c| 49 ++--- include/linux/cpufeature.h| 61 + include/linux/mod_devicetable.h |9 ++ scripts/mod/devicetable-offsets.c |3 ++ scripts/mod/file2alias.c | 10 ++ 6 files changed, 135 insertions(+), 5 deletions(-) create mode 100644 include/linux/cpufeature.h diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index ec36e77..3f0d373 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig @@ -185,6 +185,14 @@ config GENERIC_CPU_DEVICES bool default n +config HAVE_CPU_AUTOPROBE + def_bool ARCH_HAS_CPU_AUTOPROBE + +config GENERIC_CPU_AUTOPROBE + bool + depends on !ARCH_HAS_CPU_AUTOPROBE + select HAVE_CPU_AUTOPROBE + config SOC_BUS bool diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index f48370d..860e6ff 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -285,6 +285,45 @@ static void cpu_device_release(struct device *dev) * on the linux-kernel list, you have been warned. */ } + +#ifdef CONFIG_HAVE_CPU_AUTOPROBE +#ifdef CONFIG_GENERIC_CPU_AUTOPROBE +static ssize_t print_cpu_modalias(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + ssize_t n; + u32 i; + + n = sprintf(buf, cpu:type: CPU_FEATURE_TYPEFMT :feature:, + CPU_FEATURE_TYPEVAL); + + for (i = 0; i MAX_CPU_FEATURES; i++) + if (cpu_have_feature(i)) { + if (PAGE_SIZE n + sizeof(,\n)) { + WARN(1, CPU features overflow page\n); + break; + } + n += sprintf(buf[n], ,%04X, i); + } + buf[n++] = '\n'; + return n; +} +#else +#define print_cpu_modalias arch_print_cpu_modalias +#endif + +static int cpu_uevent(struct device *dev, struct kobj_uevent_env *env) +{ + char *buf = kzalloc(PAGE_SIZE, GFP_KERNEL); + if (buf) { + print_cpu_modalias(NULL, NULL, buf); + add_uevent_var(env, MODALIAS=%s, buf); + kfree(buf); + } + return 0; +} +#endif /* * register_cpu - Setup a sysfs device for a CPU. @@ -306,8 +345,8 @@ int register_cpu(struct cpu *cpu, int num) cpu-dev.offline_disabled = !cpu-hotpluggable; cpu-dev.offline = !cpu_online(num); cpu-dev.of_node = of_get_cpu_node(num, NULL); -#ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE - cpu-dev.bus-uevent = arch_cpu_uevent; +#ifdef CONFIG_HAVE_CPU_AUTOPROBE + cpu-dev.bus-uevent = cpu_uevent; #endif cpu-dev.groups = common_cpu_attr_groups; if (cpu-hotpluggable) @@ -330,8 +369,8 @@ struct device *get_cpu_device(unsigned cpu) } EXPORT_SYMBOL_GPL(get_cpu_device); -#ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE -static DEVICE_ATTR(modalias, 0444, arch_print_cpu_modalias, NULL); +#ifdef CONFIG_HAVE_CPU_AUTOPROBE +static DEVICE_ATTR(modalias, 0444, print_cpu_modalias, NULL); #endif static struct attribute *cpu_root_attrs[] = { @@ -344,7 +383,7 @@ static struct attribute *cpu_root_attrs[] = { cpu_attrs[2].attr.attr, dev_attr_kernel_max.attr, dev_attr_offline.attr, -#ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE +#ifdef CONFIG_HAVE_CPU_AUTOPROBE dev_attr_modalias.attr, #endif NULL diff --git a/include/linux/cpufeature.h b/include/linux/cpufeature.h new file mode 100644 index
[linux-yocto] [PATCH 2/2] x86: align x86 arch with generic CPU modalias handling
From: Jianchuan Wang jianchuan.w...@windriver.com commit 2b9c1f03278ab7cd421f14ce24dee39091ecb064 upstream x86: align x86 arch with generic CPU modalias handling The x86 CPU feature modalias handling existed before it was reimplemented generically. This patch aligns the x86 handling so that it (a) reuses some more code that is now generic; (b) uses the generic format for the modalias module metadata entry, i.e., it now uses 'cpu:type:x86,venfammod:feature:,,' instead of the 'x86cpu:vendor::family::model::feature:,,' that was used before. Signed-off-by: Ard Biesheuvel ard.biesheu...@linaro.org Acked-by: H. Peter Anvin h...@linux.intel.com Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org Signed-off-by: Jianchuan Wang jianchuan.w...@windriver.com --- arch/x86/Kconfig |4 +--- arch/x86/include/asm/cpufeature.h |8 arch/x86/kernel/cpu/match.c | 41 - drivers/base/Kconfig |7 +-- drivers/base/cpu.c| 12 --- include/linux/cpu.h |7 --- scripts/mod/file2alias.c |8 7 files changed, 18 insertions(+), 69 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 0af5250..7fab7e0 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -127,6 +127,7 @@ config X86 select HAVE_DEBUG_STACKOVERFLOW select HAVE_IRQ_EXIT_ON_IRQ_STACK if X86_64 select HAVE_CC_STACKPROTECTOR + select GENERIC_CPU_AUTOPROBE config INSTRUCTION_DECODER def_bool y @@ -195,9 +196,6 @@ config ARCH_HAS_CPU_RELAX config ARCH_HAS_CACHE_LINE_SIZE def_bool y -config ARCH_HAS_CPU_AUTOPROBE - def_bool y - config HAVE_SETUP_PER_CPU_AREA def_bool y diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index e099f95..0b3ba18 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h @@ -541,6 +541,14 @@ static __always_inline __pure bool _static_cpu_has_safe(u16 bit) #define static_cpu_has_bug(bit)static_cpu_has((bit)) #define boot_cpu_has_bug(bit) cpu_has_bug(boot_cpu_data, (bit)) +#define MAX_CPU_FEATURES(NCAPINTS * 32) +#define cpu_have_featureboot_cpu_has +#define cpu_feature(x) ilog2(X86_FEATURE_ ## x) + +#define CPU_FEATURE_TYPEFMT x86,ven%04Xfam%04Xmod%04X +#define CPU_FEATURE_TYPEVAL boot_cpu_data.x86_vendor, boot_cpu_data.x86, \ + boot_cpu_data.x86_model + #endif /* defined(__KERNEL__) !defined(__ASSEMBLY__) */ #endif /* _ASM_X86_CPUFEATURE_H */ diff --git a/arch/x86/kernel/cpu/match.c b/arch/x86/kernel/cpu/match.c index 3656537..d21b27b 100644 --- a/arch/x86/kernel/cpu/match.c +++ b/arch/x86/kernel/cpu/match.c @@ -48,44 +48,3 @@ const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id *match) } EXPORT_SYMBOL(x86_match_cpu); -ssize_t arch_print_cpu_modalias(struct device *dev, - struct device_attribute *attr, - char *bufptr) -{ - int size = PAGE_SIZE; - int i, n; - char *buf = bufptr; - - n = snprintf(buf, size, x86cpu:vendor:%04X:family:%04X: -model:%04X:feature:, - boot_cpu_data.x86_vendor, - boot_cpu_data.x86, - boot_cpu_data.x86_model); - size -= n; - buf += n; - size -= 1; - for (i = 0; i NCAPINTS*32; i++) { - if (boot_cpu_has(i)) { - n = snprintf(buf, size, ,%04X, i); - if (n = size) { - WARN(1, x86 features overflow page\n); - break; - } - size -= n; - buf += n; - } - } - *buf++ = '\n'; - return buf - bufptr; -} - -int arch_cpu_uevent(struct device *dev, struct kobj_uevent_env *env) -{ - char *buf = kzalloc(PAGE_SIZE, GFP_KERNEL); - if (buf) { - arch_print_cpu_modalias(NULL, NULL, buf); - add_uevent_var(env, MODALIAS=%s, buf); - kfree(buf); - } - return 0; -} diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index 3f0d373..79f68a5 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig @@ -185,13 +185,8 @@ config GENERIC_CPU_DEVICES bool default n -config HAVE_CPU_AUTOPROBE - def_bool ARCH_HAS_CPU_AUTOPROBE - config GENERIC_CPU_AUTOPROBE - bool - depends on !ARCH_HAS_CPU_AUTOPROBE - select HAVE_CPU_AUTOPROBE +bool config SOC_BUS bool diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 860e6ff..e898afe 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -285,12 +285,11 @@ static void
[linux-yocto] [PATCH 1/2] cpu: add generic support for CPU feature based module autoloading
From: Jianchuan Wang jianchuan.w...@windriver.com commit 67bad2fdb754dbef14596c0b5d28b3a12c8dfe84 upstream cpu: add generic support for CPU feature based module autoloading This patch adds support for advertising optional CPU features over udev using the modalias, and for declaring compatibility with/dependency upon such a feature in a module. The mapping between feature numbers and actual features should be provided by the architecture in a file called asm/cpufeature.h which exports the following functions/macros: - cpu_feature(FEAT), a preprocessor macro that maps token FEAT to a numeric index; - bool cpu_have_feature(n), returning whether this CPU has support for feature #n; - MAX_CPU_FEATURES, an upper bound for 'n' in the previous function. The feature can then be enabled by setting CONFIG_GENERIC_CPU_AUTOPROBE for the architecture. For instance, a module that registers its module init function using module_cpu_feature_match(FEAT_X, module_init_function) will be probed automatically when the CPU's support for the 'FEAT_X' feature is advertised over udev, and will only allow the module to be loaded by hand if the 'FEAT_X' feature is supported. Signed-off-by: Ard Biesheuvel ard.biesheu...@linaro.org Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org Signed-off-by: Jianchuan Wang jianchuan.w...@windriver.com --- drivers/base/Kconfig |8 + drivers/base/cpu.c| 49 ++--- include/linux/cpufeature.h| 61 + include/linux/mod_devicetable.h |9 ++ scripts/mod/devicetable-offsets.c |3 ++ scripts/mod/file2alias.c | 10 ++ 6 files changed, 135 insertions(+), 5 deletions(-) create mode 100644 include/linux/cpufeature.h diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index ec36e77..3f0d373 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig @@ -185,6 +185,14 @@ config GENERIC_CPU_DEVICES bool default n +config HAVE_CPU_AUTOPROBE + def_bool ARCH_HAS_CPU_AUTOPROBE + +config GENERIC_CPU_AUTOPROBE + bool + depends on !ARCH_HAS_CPU_AUTOPROBE + select HAVE_CPU_AUTOPROBE + config SOC_BUS bool diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index f48370d..860e6ff 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -285,6 +285,45 @@ static void cpu_device_release(struct device *dev) * on the linux-kernel list, you have been warned. */ } + +#ifdef CONFIG_HAVE_CPU_AUTOPROBE +#ifdef CONFIG_GENERIC_CPU_AUTOPROBE +static ssize_t print_cpu_modalias(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + ssize_t n; + u32 i; + + n = sprintf(buf, cpu:type: CPU_FEATURE_TYPEFMT :feature:, + CPU_FEATURE_TYPEVAL); + + for (i = 0; i MAX_CPU_FEATURES; i++) + if (cpu_have_feature(i)) { + if (PAGE_SIZE n + sizeof(,\n)) { + WARN(1, CPU features overflow page\n); + break; + } + n += sprintf(buf[n], ,%04X, i); + } + buf[n++] = '\n'; + return n; +} +#else +#define print_cpu_modalias arch_print_cpu_modalias +#endif + +static int cpu_uevent(struct device *dev, struct kobj_uevent_env *env) +{ + char *buf = kzalloc(PAGE_SIZE, GFP_KERNEL); + if (buf) { + print_cpu_modalias(NULL, NULL, buf); + add_uevent_var(env, MODALIAS=%s, buf); + kfree(buf); + } + return 0; +} +#endif /* * register_cpu - Setup a sysfs device for a CPU. @@ -306,8 +345,8 @@ int register_cpu(struct cpu *cpu, int num) cpu-dev.offline_disabled = !cpu-hotpluggable; cpu-dev.offline = !cpu_online(num); cpu-dev.of_node = of_get_cpu_node(num, NULL); -#ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE - cpu-dev.bus-uevent = arch_cpu_uevent; +#ifdef CONFIG_HAVE_CPU_AUTOPROBE + cpu-dev.bus-uevent = cpu_uevent; #endif cpu-dev.groups = common_cpu_attr_groups; if (cpu-hotpluggable) @@ -330,8 +369,8 @@ struct device *get_cpu_device(unsigned cpu) } EXPORT_SYMBOL_GPL(get_cpu_device); -#ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE -static DEVICE_ATTR(modalias, 0444, arch_print_cpu_modalias, NULL); +#ifdef CONFIG_HAVE_CPU_AUTOPROBE +static DEVICE_ATTR(modalias, 0444, print_cpu_modalias, NULL); #endif static struct attribute *cpu_root_attrs[] = { @@ -344,7 +383,7 @@ static struct attribute *cpu_root_attrs[] = { cpu_attrs[2].attr.attr, dev_attr_kernel_max.attr, dev_attr_offline.attr, -#ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE +#ifdef CONFIG_HAVE_CPU_AUTOPROBE dev_attr_modalias.attr, #endif NULL diff --git
[linux-yocto] [PATCH 2/2] x86: align x86 arch with generic CPU modalias handling
From: Jianchuan Wang jianchuan.w...@windriver.com commit 2b9c1f03278ab7cd421f14ce24dee39091ecb064 upstream x86: align x86 arch with generic CPU modalias handling The x86 CPU feature modalias handling existed before it was reimplemented generically. This patch aligns the x86 handling so that it (a) reuses some more code that is now generic; (b) uses the generic format for the modalias module metadata entry, i.e., it now uses 'cpu:type:x86,venfammod:feature:,,' instead of the 'x86cpu:vendor::family::model::feature:,,' that was used before. Signed-off-by: Ard Biesheuvel ard.biesheu...@linaro.org Acked-by: H. Peter Anvin h...@linux.intel.com Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org Signed-off-by: Jianchuan Wang jianchuan.w...@windriver.com --- arch/x86/Kconfig |4 +--- arch/x86/include/asm/cpufeature.h |8 arch/x86/kernel/cpu/match.c | 41 - drivers/base/Kconfig |7 +-- drivers/base/cpu.c| 12 --- include/linux/cpu.h |7 --- scripts/mod/file2alias.c |8 7 files changed, 18 insertions(+), 69 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 0af5250..7fab7e0 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -127,6 +127,7 @@ config X86 select HAVE_DEBUG_STACKOVERFLOW select HAVE_IRQ_EXIT_ON_IRQ_STACK if X86_64 select HAVE_CC_STACKPROTECTOR + select GENERIC_CPU_AUTOPROBE config INSTRUCTION_DECODER def_bool y @@ -195,9 +196,6 @@ config ARCH_HAS_CPU_RELAX config ARCH_HAS_CACHE_LINE_SIZE def_bool y -config ARCH_HAS_CPU_AUTOPROBE - def_bool y - config HAVE_SETUP_PER_CPU_AREA def_bool y diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index e099f95..0b3ba18 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h @@ -541,6 +541,14 @@ static __always_inline __pure bool _static_cpu_has_safe(u16 bit) #define static_cpu_has_bug(bit)static_cpu_has((bit)) #define boot_cpu_has_bug(bit) cpu_has_bug(boot_cpu_data, (bit)) +#define MAX_CPU_FEATURES(NCAPINTS * 32) +#define cpu_have_featureboot_cpu_has +#define cpu_feature(x) ilog2(X86_FEATURE_ ## x) + +#define CPU_FEATURE_TYPEFMT x86,ven%04Xfam%04Xmod%04X +#define CPU_FEATURE_TYPEVAL boot_cpu_data.x86_vendor, boot_cpu_data.x86, \ + boot_cpu_data.x86_model + #endif /* defined(__KERNEL__) !defined(__ASSEMBLY__) */ #endif /* _ASM_X86_CPUFEATURE_H */ diff --git a/arch/x86/kernel/cpu/match.c b/arch/x86/kernel/cpu/match.c index 3656537..d21b27b 100644 --- a/arch/x86/kernel/cpu/match.c +++ b/arch/x86/kernel/cpu/match.c @@ -48,44 +48,3 @@ const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id *match) } EXPORT_SYMBOL(x86_match_cpu); -ssize_t arch_print_cpu_modalias(struct device *dev, - struct device_attribute *attr, - char *bufptr) -{ - int size = PAGE_SIZE; - int i, n; - char *buf = bufptr; - - n = snprintf(buf, size, x86cpu:vendor:%04X:family:%04X: -model:%04X:feature:, - boot_cpu_data.x86_vendor, - boot_cpu_data.x86, - boot_cpu_data.x86_model); - size -= n; - buf += n; - size -= 1; - for (i = 0; i NCAPINTS*32; i++) { - if (boot_cpu_has(i)) { - n = snprintf(buf, size, ,%04X, i); - if (n = size) { - WARN(1, x86 features overflow page\n); - break; - } - size -= n; - buf += n; - } - } - *buf++ = '\n'; - return buf - bufptr; -} - -int arch_cpu_uevent(struct device *dev, struct kobj_uevent_env *env) -{ - char *buf = kzalloc(PAGE_SIZE, GFP_KERNEL); - if (buf) { - arch_print_cpu_modalias(NULL, NULL, buf); - add_uevent_var(env, MODALIAS=%s, buf); - kfree(buf); - } - return 0; -} diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index 3f0d373..79f68a5 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig @@ -185,13 +185,8 @@ config GENERIC_CPU_DEVICES bool default n -config HAVE_CPU_AUTOPROBE - def_bool ARCH_HAS_CPU_AUTOPROBE - config GENERIC_CPU_AUTOPROBE - bool - depends on !ARCH_HAS_CPU_AUTOPROBE - select HAVE_CPU_AUTOPROBE +bool config SOC_BUS bool diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 860e6ff..e898afe 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -285,12 +285,11 @@ static void cpu_device_release(struct device *dev) * on the