Two easy cases of overlapping changes.
Unified · Split
| @@ -20,6 +20,8 @@ Required properties: · 19 unmodified lines | |||
| 20 | Optional properties: | 20 | Optional properties: |
| 21 | - phy-handle: See ethernet.txt file in the same directory. | 21 | - phy-handle: See ethernet.txt file in the same directory. |
| 22 | If absent, davinci_emac driver defaults to 100/FULL. | 22 | If absent, davinci_emac driver defaults to 100/FULL. |
| 23 | - nvmem-cells: phandle, reference to an nvmem node for the MAC address | ||
| 24 | - nvmem-cell-names: string, should be "mac-address" if nvmem is to be used | ||
| 23 | - ti,davinci-rmii-en: 1 byte, 1 means use RMII | 25 | - ti,davinci-rmii-en: 1 byte, 1 means use RMII |
| 24 | - ti,davinci-no-bd-ram: boolean, does EMAC have BD RAM? | 26 | - ti,davinci-no-bd-ram: boolean, does EMAC have BD RAM? |
| 25 | 27 | ||
| @@ -10,15 +10,14 @@ Documentation/devicetree/bindings/phy/phy-bindings.txt. · 9 unmodified lines | |||
| 10 | the boot program; should be used in cases where the MAC address assigned to | 10 | the boot program; should be used in cases where the MAC address assigned to |
| 11 | the device by the boot program is different from the "local-mac-address" | 11 | the device by the boot program is different from the "local-mac-address" |
| 12 | property; | 12 | property; |
| 13 | - nvmem-cells: phandle, reference to an nvmem node for the MAC address; | ||
| 14 | - nvmem-cell-names: string, should be "mac-address" if nvmem is to be used; | ||
| 15 | - max-speed: number, specifies maximum speed in Mbit/s supported by the device; | 13 | - max-speed: number, specifies maximum speed in Mbit/s supported by the device; |
| 16 | - max-frame-size: number, maximum transfer unit (IEEE defined MTU), rather than | 14 | - max-frame-size: number, maximum transfer unit (IEEE defined MTU), rather than |
| 17 | the maximum frame size (there's contradiction in the Devicetree | 15 | the maximum frame size (there's contradiction in the Devicetree |
| 18 | Specification). | 16 | Specification). |
| 19 | - phy-mode: string, operation mode of the PHY interface. This is now a de-facto | 17 | - phy-mode: string, operation mode of the PHY interface. This is now a de-facto |
| 20 | standard property; supported values are: | 18 | standard property; supported values are: |
| 21 | * "internal" | 19 | * "internal" (Internal means there is not a standard bus between the MAC and |
| 20 | the PHY, something proprietary is being used to embed the PHY in the MAC.) | ||
| 22 | * "mii" | 21 | * "mii" |
| 23 | * "gmii" | 22 | * "gmii" |
| 24 | * "sgmii" | 23 | * "sgmii" |
| @@ -26,6 +26,10 @@ Required properties: · 25 unmodified lines | |||
| 26 | Optional elements: 'tsu_clk' | 26 | Optional elements: 'tsu_clk' |
| 27 | - clocks: Phandles to input clocks. | 27 | - clocks: Phandles to input clocks. |
| 28 | 28 | ||
| 29 | Optional properties: | ||
| 30 | - nvmem-cells: phandle, reference to an nvmem node for the MAC address | ||
| 31 | - nvmem-cell-names: string, should be "mac-address" if nvmem is to be used | ||
| 32 | |||
| 29 | Optional properties for PHY child node: | 33 | Optional properties for PHY child node: |
| 30 | - reset-gpios : Should specify the gpio for phy reset | 34 | - reset-gpios : Should specify the gpio for phy reset |
| 31 | - magic-packet : If present, indicates that the hardware supports waking | 35 | - magic-packet : If present, indicates that the hardware supports waking |
| @@ -623,7 +623,7 @@ the remote via /dev/input/event devices. · 622 unmodified lines | |||
| 623 | 623 | ||
| 624 | - .. row 78 | 624 | - .. row 78 |
| 625 | 625 | ||
| 626 | - ``KEY_SCREEN`` | 626 | - ``KEY_ASPECT_RATIO`` |
| 627 | 627 | ||
| 628 | - Select screen aspect ratio | 628 | - Select screen aspect ratio |
| 629 | 629 | ||
| @@ -631,7 +631,7 @@ the remote via /dev/input/event devices. · 1 unmodified line | |||
| 631 | 631 | ||
| 632 | - .. row 79 | 632 | - .. row 79 |
| 633 | 633 | ||
| 634 | - ``KEY_ZOOM`` | 634 | - ``KEY_FULL_SCREEN`` |
| 635 | 635 | ||
| 636 | - Put device into zoom/full screen mode | 636 | - Put device into zoom/full screen mode |
| 637 | 637 | ||
| @@ -22,8 +22,6 @@ you'll need the following options as well... · 21 unmodified lines | |||
| 22 | CONFIG_DECNET_ROUTER (to be able to add/delete routes) | 22 | CONFIG_DECNET_ROUTER (to be able to add/delete routes) |
| 23 | CONFIG_NETFILTER (will be required for the DECnet routing daemon) | 23 | CONFIG_NETFILTER (will be required for the DECnet routing daemon) |
| 24 | 24 | ||
| 25 | CONFIG_DECNET_ROUTE_FWMARK is optional | ||
| 26 | |||
| 27 | Don't turn on SIOCGIFCONF support for DECnet unless you are really sure | 25 | Don't turn on SIOCGIFCONF support for DECnet unless you are really sure |
| 28 | that you need it, in general you won't and it can cause ifconfig to | 26 | that you need it, in general you won't and it can cause ifconfig to |
| 29 | malfunction. | 27 | malfunction. |
| @@ -427,6 +427,7 @@ tcp_min_rtt_wlen - INTEGER · 426 unmodified lines | |||
| 427 | minimum RTT when it is moved to a longer path (e.g., due to traffic | 427 | minimum RTT when it is moved to a longer path (e.g., due to traffic |
| 428 | engineering). A longer window makes the filter more resistant to RTT | 428 | engineering). A longer window makes the filter more resistant to RTT |
| 429 | inflations such as transient congestion. The unit is seconds. | 429 | inflations such as transient congestion. The unit is seconds. |
| 430 | Possible values: 0 - 86400 (1 day) | ||
| 430 | Default: 300 | 431 | Default: 300 |
| 431 | 432 | ||
| 432 | tcp_moderate_rcvbuf - BOOLEAN | 433 | tcp_moderate_rcvbuf - BOOLEAN |
| @@ -3124,6 +3124,7 @@ F: drivers/cpufreq/bmips-cpufreq.c · 3123 unmodified lines | |||
| 3124 | BROADCOM BMIPS MIPS ARCHITECTURE | 3124 | BROADCOM BMIPS MIPS ARCHITECTURE |
| 3125 | M: Kevin Cernekee <cernekee@gmail.com> | 3125 | M: Kevin Cernekee <cernekee@gmail.com> |
| 3126 | M: Florian Fainelli <f.fainelli@gmail.com> | 3126 | M: Florian Fainelli <f.fainelli@gmail.com> |
| 3127 | L: bcm-kernel-feedback-list@broadcom.com | ||
| 3127 | L: linux-mips@vger.kernel.org | 3128 | L: linux-mips@vger.kernel.org |
| 3128 | T: git git://github.com/broadcom/stblinux.git | 3129 | T: git git://github.com/broadcom/stblinux.git |
| 3129 | S: Maintained | 3130 | S: Maintained |
| @@ -7336,7 +7337,6 @@ F: Documentation/devicetree/bindings/i3c/ · 4206 unmodified lines | |||
| 7336 | F: Documentation/driver-api/i3c | 7337 | F: Documentation/driver-api/i3c |
| 7337 | F: drivers/i3c/ | 7338 | F: drivers/i3c/ |
| 7338 | F: include/linux/i3c/ | 7339 | F: include/linux/i3c/ |
| 7339 | F: include/dt-bindings/i3c/ | ||
| 7340 | 7340 | ||
| 7341 | I3C DRIVER FOR SYNOPSYS DESIGNWARE | 7341 | I3C DRIVER FOR SYNOPSYS DESIGNWARE |
| 7342 | M: Vitor Soares <vitor.soares@synopsys.com> | 7342 | M: Vitor Soares <vitor.soares@synopsys.com> |
| @@ -8711,6 +8711,7 @@ F: scripts/leaking_addresses.pl · 1368 unmodified lines | |||
| 8711 | LED SUBSYSTEM | 8711 | LED SUBSYSTEM |
| 8712 | M: Jacek Anaszewski <jacek.anaszewski@gmail.com> | 8712 | M: Jacek Anaszewski <jacek.anaszewski@gmail.com> |
| 8713 | M: Pavel Machek <pavel@ucw.cz> | 8713 | M: Pavel Machek <pavel@ucw.cz> |
| 8714 | R: Dan Murphy <dmurphy@ti.com> | ||
| 8714 | L: linux-leds@vger.kernel.org | 8715 | L: linux-leds@vger.kernel.org |
| 8715 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds.git | 8716 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds.git |
| 8716 | S: Maintained | 8717 | S: Maintained |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | VERSION = 5 | 2 | VERSION = 5 |
| 3 | PATCHLEVEL = 1 | 3 | PATCHLEVEL = 1 |
| 4 | SUBLEVEL = 0 | 4 | SUBLEVEL = 0 |
| 5 | EXTRAVERSION = -rc5 | 5 | EXTRAVERSION = -rc6 |
| 6 | NAME = Shy Crocodile | 6 | NAME = Shy Crocodile |
| 7 | 7 | ||
| 8 | # *DOCUMENTATION* | 8 | # *DOCUMENTATION* |
| @@ -463,3 +463,7 @@ · 462 unmodified lines | |||
| 463 | 532 common getppid sys_getppid | 463 | 532 common getppid sys_getppid |
| 464 | # all other architectures have common numbers for new syscall, alpha | 464 | # all other architectures have common numbers for new syscall, alpha |
| 465 | # is the exception. | 465 | # is the exception. |
| 466 | 534 common pidfd_send_signal sys_pidfd_send_signal | ||
| 467 | 535 common io_uring_setup sys_io_uring_setup | ||
| 468 | 536 common io_uring_enter sys_io_uring_enter | ||
| 469 | 537 common io_uring_register sys_io_uring_register | ||
| @@ -437,3 +437,7 @@ · 436 unmodified lines | |||
| 437 | 421 common rt_sigtimedwait_time64 sys_rt_sigtimedwait | 437 | 421 common rt_sigtimedwait_time64 sys_rt_sigtimedwait |
| 438 | 422 common futex_time64 sys_futex | 438 | 422 common futex_time64 sys_futex |
| 439 | 423 common sched_rr_get_interval_time64 sys_sched_rr_get_interval | 439 | 423 common sched_rr_get_interval_time64 sys_sched_rr_get_interval |
| 440 | 424 common pidfd_send_signal sys_pidfd_send_signal | ||
| 441 | 425 common io_uring_setup sys_io_uring_setup | ||
| 442 | 426 common io_uring_enter sys_io_uring_enter | ||
| 443 | 427 common io_uring_register sys_io_uring_register | ||
| @@ -50,7 +50,7 @@ do { \ · 49 unmodified lines | |||
| 50 | static inline int | 50 | static inline int |
| 51 | arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *_uaddr) | 51 | arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *_uaddr) |
| 52 | { | 52 | { |
| 53 | int oldval, ret, tmp; | 53 | int oldval = 0, ret, tmp; |
| 54 | u32 __user *uaddr = __uaccess_mask_ptr(_uaddr); | 54 | u32 __user *uaddr = __uaccess_mask_ptr(_uaddr); |
| 55 | 55 | ||
| 56 | pagefault_disable(); | 56 | pagefault_disable(); |
| @@ -44,7 +44,7 @@ · 43 unmodified lines | |||
| 44 | #define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE + 5) | 44 | #define __ARM_NR_compat_set_tls (__ARM_NR_COMPAT_BASE + 5) |
| 45 | #define __ARM_NR_COMPAT_END (__ARM_NR_COMPAT_BASE + 0x800) | 45 | #define __ARM_NR_COMPAT_END (__ARM_NR_COMPAT_BASE + 0x800) |
| 46 | 46 | ||
| 47 | #define __NR_compat_syscalls 424 | 47 | #define __NR_compat_syscalls 428 |
| 48 | #endif | 48 | #endif |
| 49 | 49 | ||
| 50 | #define __ARCH_WANT_SYS_CLONE | 50 | #define __ARCH_WANT_SYS_CLONE |
| @@ -866,6 +866,14 @@ __SYSCALL(__NR_rt_sigtimedwait_time64, compat_sys_rt_sigtimedwait_time64) · 865 unmodified lines | |||
| 866 | __SYSCALL(__NR_futex_time64, sys_futex) | 866 | __SYSCALL(__NR_futex_time64, sys_futex) |
| 867 | #define __NR_sched_rr_get_interval_time64 423 | 867 | #define __NR_sched_rr_get_interval_time64 423 |
| 868 | __SYSCALL(__NR_sched_rr_get_interval_time64, sys_sched_rr_get_interval) | 868 | __SYSCALL(__NR_sched_rr_get_interval_time64, sys_sched_rr_get_interval) |
| 869 | #define __NR_pidfd_send_signal 424 | ||
| 870 | __SYSCALL(__NR_pidfd_send_signal, sys_pidfd_send_signal) | ||
| 871 | #define __NR_io_uring_setup 425 | ||
| 872 | __SYSCALL(__NR_io_uring_setup, sys_io_uring_setup) | ||
| 873 | #define __NR_io_uring_enter 426 | ||
| 874 | __SYSCALL(__NR_io_uring_enter, sys_io_uring_enter) | ||
| 875 | #define __NR_io_uring_register 427 | ||
| 876 | __SYSCALL(__NR_io_uring_register, sys_io_uring_register) | ||
| 869 | 877 | ||
| 870 | /* | 878 | /* |
| 871 | * Please add new compat syscalls above this comment and update | 879 | * Please add new compat syscalls above this comment and update |
| @@ -344,3 +344,7 @@ · 343 unmodified lines | |||
| 344 | 332 common pkey_free sys_pkey_free | 344 | 332 common pkey_free sys_pkey_free |
| 345 | 333 common rseq sys_rseq | 345 | 333 common rseq sys_rseq |
| 346 | # 334 through 423 are reserved to sync up with other architectures | 346 | # 334 through 423 are reserved to sync up with other architectures |
| 347 | 424 common pidfd_send_signal sys_pidfd_send_signal | ||
| 348 | 425 common io_uring_setup sys_io_uring_setup | ||
| 349 | 426 common io_uring_enter sys_io_uring_enter | ||
| 350 | 427 common io_uring_register sys_io_uring_register | ||
| @@ -423,3 +423,7 @@ · 422 unmodified lines | |||
| 423 | 421 common rt_sigtimedwait_time64 sys_rt_sigtimedwait | 423 | 421 common rt_sigtimedwait_time64 sys_rt_sigtimedwait |
| 424 | 422 common futex_time64 sys_futex | 424 | 422 common futex_time64 sys_futex |
| 425 | 423 common sched_rr_get_interval_time64 sys_sched_rr_get_interval | 425 | 423 common sched_rr_get_interval_time64 sys_sched_rr_get_interval |
| 426 | 424 common pidfd_send_signal sys_pidfd_send_signal | ||
| 427 | 425 common io_uring_setup sys_io_uring_setup | ||
| 428 | 426 common io_uring_enter sys_io_uring_enter | ||
| 429 | 427 common io_uring_register sys_io_uring_register | ||
| @@ -429,3 +429,7 @@ · 428 unmodified lines | |||
| 429 | 421 common rt_sigtimedwait_time64 sys_rt_sigtimedwait | 429 | 421 common rt_sigtimedwait_time64 sys_rt_sigtimedwait |
| 430 | 422 common futex_time64 sys_futex | 430 | 422 common futex_time64 sys_futex |
| 431 | 423 common sched_rr_get_interval_time64 sys_sched_rr_get_interval | 431 | 423 common sched_rr_get_interval_time64 sys_sched_rr_get_interval |
| 432 | 424 common pidfd_send_signal sys_pidfd_send_signal | ||
| 433 | 425 common io_uring_setup sys_io_uring_setup | ||
| 434 | 426 common io_uring_enter sys_io_uring_enter | ||
| 435 | 427 common io_uring_register sys_io_uring_register | ||
| @@ -210,12 +210,6 @@ const char *get_system_type(void) · 209 unmodified lines | |||
| 210 | return ath79_sys_type; | 210 | return ath79_sys_type; |
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | int get_c0_perfcount_int(void) | ||
| 214 | { | ||
| 215 | return ATH79_MISC_IRQ(5); | ||
| 216 | } | ||
| 217 | EXPORT_SYMBOL_GPL(get_c0_perfcount_int); | ||
| 218 | |||
| 219 | unsigned int get_c0_compare_int(void) | 213 | unsigned int get_c0_compare_int(void) |
| 220 | { | 214 | { |
| 221 | return CP0_LEGACY_COMPARE_IRQ; | 215 | return CP0_LEGACY_COMPARE_IRQ; |
| @@ -125,7 +125,7 @@ trace_a_syscall: · 124 unmodified lines | |||
| 125 | subu t1, v0, __NR_O32_Linux | 125 | subu t1, v0, __NR_O32_Linux |
| 126 | move a1, v0 | 126 | move a1, v0 |
| 127 | bnez t1, 1f /* __NR_syscall at offset 0 */ | 127 | bnez t1, 1f /* __NR_syscall at offset 0 */ |
| 128 | lw a1, PT_R4(sp) /* Arg1 for __NR_syscall case */ | 128 | ld a1, PT_R4(sp) /* Arg1 for __NR_syscall case */ |
| 129 | .set pop | 129 | .set pop |
| 130 | 130 | ||
| 131 | 1: jal syscall_trace_enter | 131 | 1: jal syscall_trace_enter |
| @@ -362,3 +362,7 @@ · 361 unmodified lines | |||
| 362 | 421 n32 rt_sigtimedwait_time64 compat_sys_rt_sigtimedwait_time64 | 362 | 421 n32 rt_sigtimedwait_time64 compat_sys_rt_sigtimedwait_time64 |
| 363 | 422 n32 futex_time64 sys_futex | 363 | 422 n32 futex_time64 sys_futex |
| 364 | 423 n32 sched_rr_get_interval_time64 sys_sched_rr_get_interval | 364 | 423 n32 sched_rr_get_interval_time64 sys_sched_rr_get_interval |
| 365 | 424 n32 pidfd_send_signal sys_pidfd_send_signal | ||
| 366 | 425 n32 io_uring_setup sys_io_uring_setup | ||
| 367 | 426 n32 io_uring_enter sys_io_uring_enter | ||
| 368 | 427 n32 io_uring_register sys_io_uring_register | ||
| @@ -338,3 +338,7 @@ · 337 unmodified lines | |||
| 338 | 327 n64 rseq sys_rseq | 338 | 327 n64 rseq sys_rseq |
| 339 | 328 n64 io_pgetevents sys_io_pgetevents | 339 | 328 n64 io_pgetevents sys_io_pgetevents |
| 340 | # 329 through 423 are reserved to sync up with other architectures | 340 | # 329 through 423 are reserved to sync up with other architectures |
| 341 | 424 n64 pidfd_send_signal sys_pidfd_send_signal | ||
| 342 | 425 n64 io_uring_setup sys_io_uring_setup | ||
| 343 | 426 n64 io_uring_enter sys_io_uring_enter | ||
| 344 | 427 n64 io_uring_register sys_io_uring_register | ||
| @@ -411,3 +411,7 @@ · 410 unmodified lines | |||
| 411 | 421 o32 rt_sigtimedwait_time64 sys_rt_sigtimedwait compat_sys_rt_sigtimedwait_time64 | 411 | 421 o32 rt_sigtimedwait_time64 sys_rt_sigtimedwait compat_sys_rt_sigtimedwait_time64 |
| 412 | 422 o32 futex_time64 sys_futex sys_futex | 412 | 422 o32 futex_time64 sys_futex sys_futex |
| 413 | 423 o32 sched_rr_get_interval_time64 sys_sched_rr_get_interval sys_sched_rr_get_interval | 413 | 423 o32 sched_rr_get_interval_time64 sys_sched_rr_get_interval sys_sched_rr_get_interval |
| 414 | 424 o32 pidfd_send_signal sys_pidfd_send_signal | ||
| 415 | 425 o32 io_uring_setup sys_io_uring_setup | ||
| 416 | 426 o32 io_uring_enter sys_io_uring_enter | ||
| 417 | 427 o32 io_uring_register sys_io_uring_register | ||
| @@ -420,3 +420,7 @@ · 419 unmodified lines | |||
| 420 | 421 32 rt_sigtimedwait_time64 sys_rt_sigtimedwait compat_sys_rt_sigtimedwait_time64 | 420 | 421 32 rt_sigtimedwait_time64 sys_rt_sigtimedwait compat_sys_rt_sigtimedwait_time64 |
| 421 | 422 32 futex_time64 sys_futex sys_futex | 421 | 422 32 futex_time64 sys_futex sys_futex |
| 422 | 423 32 sched_rr_get_interval_time64 sys_sched_rr_get_interval sys_sched_rr_get_interval | 422 | 423 32 sched_rr_get_interval_time64 sys_sched_rr_get_interval sys_sched_rr_get_interval |
| 423 | 424 common pidfd_send_signal sys_pidfd_send_signal | ||
| 424 | 425 common io_uring_setup sys_io_uring_setup | ||
| 425 | 426 common io_uring_enter sys_io_uring_enter | ||
| 426 | 427 common io_uring_register sys_io_uring_register | ||
| @@ -505,3 +505,7 @@ · 504 unmodified lines | |||
| 505 | 421 32 rt_sigtimedwait_time64 sys_rt_sigtimedwait compat_sys_rt_sigtimedwait_time64 | 505 | 421 32 rt_sigtimedwait_time64 sys_rt_sigtimedwait compat_sys_rt_sigtimedwait_time64 |
| 506 | 422 32 futex_time64 sys_futex sys_futex | 506 | 422 32 futex_time64 sys_futex sys_futex |
| 507 | 423 32 sched_rr_get_interval_time64 sys_sched_rr_get_interval sys_sched_rr_get_interval | 507 | 423 32 sched_rr_get_interval_time64 sys_sched_rr_get_interval sys_sched_rr_get_interval |
| 508 | 424 common pidfd_send_signal sys_pidfd_send_signal | ||
| 509 | 425 common io_uring_setup sys_io_uring_setup | ||
| 510 | 426 common io_uring_enter sys_io_uring_enter | ||
| 511 | 427 common io_uring_register sys_io_uring_register | ||
| @@ -25,7 +25,7 @@ static void *mem_detect_alloc_extended(void) · 24 unmodified lines | |||
| 25 | { | 25 | { |
| 26 | unsigned long offset = ALIGN(mem_safe_offset(), sizeof(u64)); | 26 | unsigned long offset = ALIGN(mem_safe_offset(), sizeof(u64)); |
| 27 | 27 | ||
| 28 | if (IS_ENABLED(BLK_DEV_INITRD) && INITRD_START && INITRD_SIZE && | 28 | if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && INITRD_START && INITRD_SIZE && |
| 29 | INITRD_START < offset + ENTRIES_EXTENDED_MAX) | 29 | INITRD_START < offset + ENTRIES_EXTENDED_MAX) |
| 30 | offset = ALIGN(INITRD_START + INITRD_SIZE, sizeof(u64)); | 30 | offset = ALIGN(INITRD_START + INITRD_SIZE, sizeof(u64)); |
| 31 | 31 | ||
| @@ -23,7 +23,7 @@ void __kernel_fpu_begin(struct kernel_fpu *state, u32 flags) · 22 unmodified lines | |||
| 23 | 23 | ||
| 24 | if (flags & KERNEL_FPC) | 24 | if (flags & KERNEL_FPC) |
| 25 | /* Save floating point control */ | 25 | /* Save floating point control */ |
| 26 | asm volatile("stfpc %0" : "=m" (state->fpc)); | 26 | asm volatile("stfpc %0" : "=Q" (state->fpc)); |
| 27 | 27 | ||
| 28 | if (!MACHINE_HAS_VX) { | 28 | if (!MACHINE_HAS_VX) { |
| 29 | if (flags & KERNEL_VXR_V0V7) { | 29 | if (flags & KERNEL_VXR_V0V7) { |
| @@ -426,3 +426,7 @@ · 425 unmodified lines | |||
| 426 | 421 32 rt_sigtimedwait_time64 - compat_sys_rt_sigtimedwait_time64 | 426 | 421 32 rt_sigtimedwait_time64 - compat_sys_rt_sigtimedwait_time64 |
| 427 | 422 32 futex_time64 - sys_futex | 427 | 422 32 futex_time64 - sys_futex |
| 428 | 423 32 sched_rr_get_interval_time64 - sys_sched_rr_get_interval | 428 | 423 32 sched_rr_get_interval_time64 - sys_sched_rr_get_interval |
| 429 | 424 common pidfd_send_signal sys_pidfd_send_signal sys_pidfd_send_signal | ||
| 430 | 425 common io_uring_setup sys_io_uring_setup sys_io_uring_setup | ||
| 431 | 426 common io_uring_enter sys_io_uring_enter sys_io_uring_enter | ||
| 432 | 427 common io_uring_register sys_io_uring_register sys_io_uring_register | ||
| @@ -37,7 +37,7 @@ static inline u64 get_vtimer(void) · 36 unmodified lines | |||
| 37 | { | 37 | { |
| 38 | u64 timer; | 38 | u64 timer; |
| 39 | 39 | ||
| 40 | asm volatile("stpt %0" : "=m" (timer)); | 40 | asm volatile("stpt %0" : "=Q" (timer)); |
| 41 | return timer; | 41 | return timer; |
| 42 | } | 42 | } |
| 43 | 43 | ||
| @@ -48,7 +48,7 @@ static inline void set_vtimer(u64 expires) · 4 unmodified lines | |||
| 48 | asm volatile( | 48 | asm volatile( |
| 49 | " stpt %0\n" /* Store current cpu timer value */ | 49 | " stpt %0\n" /* Store current cpu timer value */ |
| 50 | " spt %1" /* Set new value imm. afterwards */ | 50 | " spt %1" /* Set new value imm. afterwards */ |
| 51 | : "=m" (timer) : "m" (expires)); | 51 | : "=Q" (timer) : "Q" (expires)); |
| 52 | S390_lowcore.system_timer += S390_lowcore.last_update_timer - timer; | 52 | S390_lowcore.system_timer += S390_lowcore.last_update_timer - timer; |
| 53 | S390_lowcore.last_update_timer = expires; | 53 | S390_lowcore.last_update_timer = expires; |
| 54 | } | 54 | } |
| @@ -135,8 +135,8 @@ static int do_account_vtime(struct task_struct *tsk) · 80 unmodified lines | |||
| 135 | #else | 135 | #else |
| 136 | " stck %1" /* Store current tod clock value */ | 136 | " stck %1" /* Store current tod clock value */ |
| 137 | #endif | 137 | #endif |
| 138 | : "=m" (S390_lowcore.last_update_timer), | 138 | : "=Q" (S390_lowcore.last_update_timer), |
| 139 | "=m" (S390_lowcore.last_update_clock)); | 139 | "=Q" (S390_lowcore.last_update_clock)); |
| 140 | clock = S390_lowcore.last_update_clock - clock; | 140 | clock = S390_lowcore.last_update_clock - clock; |
| 141 | timer -= S390_lowcore.last_update_timer; | 141 | timer -= S390_lowcore.last_update_timer; |
| 142 | 142 | ||
| @@ -426,3 +426,7 @@ · 425 unmodified lines | |||
| 426 | 421 common rt_sigtimedwait_time64 sys_rt_sigtimedwait | 426 | 421 common rt_sigtimedwait_time64 sys_rt_sigtimedwait |
| 427 | 422 common futex_time64 sys_futex | 427 | 422 common futex_time64 sys_futex |
| 428 | 423 common sched_rr_get_interval_time64 sys_sched_rr_get_interval | 428 | 423 common sched_rr_get_interval_time64 sys_sched_rr_get_interval |
| 429 | 424 common pidfd_send_signal sys_pidfd_send_signal | ||
| 430 | 425 common io_uring_setup sys_io_uring_setup | ||
| 431 | 426 common io_uring_enter sys_io_uring_enter | ||
| 432 | 427 common io_uring_register sys_io_uring_register | ||
| @@ -469,3 +469,7 @@ · 468 unmodified lines | |||
| 469 | 421 32 rt_sigtimedwait_time64 sys_rt_sigtimedwait compat_sys_rt_sigtimedwait_time64 | 469 | 421 32 rt_sigtimedwait_time64 sys_rt_sigtimedwait compat_sys_rt_sigtimedwait_time64 |
| 470 | 422 32 futex_time64 sys_futex sys_futex | 470 | 422 32 futex_time64 sys_futex sys_futex |
| 471 | 423 32 sched_rr_get_interval_time64 sys_sched_rr_get_interval sys_sched_rr_get_interval | 471 | 423 32 sched_rr_get_interval_time64 sys_sched_rr_get_interval sys_sched_rr_get_interval |
| 472 | 424 common pidfd_send_signal sys_pidfd_send_signal | ||
| 473 | 425 common io_uring_setup sys_io_uring_setup | ||
| 474 | 426 common io_uring_enter sys_io_uring_enter | ||
| 475 | 427 common io_uring_register sys_io_uring_register | ||
| @@ -1499,7 +1499,7 @@ config X86_CPA_STATISTICS · 1498 unmodified lines | |||
| 1499 | depends on DEBUG_FS | 1499 | depends on DEBUG_FS |
| 1500 | ---help--- | 1500 | ---help--- |
| 1501 | Expose statistics about the Change Page Attribute mechanims, which | 1501 | Expose statistics about the Change Page Attribute mechanims, which |
| 1502 | helps to determine the effectivness of preserving large and huge | 1502 | helps to determine the effectiveness of preserving large and huge |
| 1503 | page mappings when mapping protections are changed. | 1503 | page mappings when mapping protections are changed. |
| 1504 | 1504 | ||
| 1505 | config ARCH_HAS_MEM_ENCRYPT | 1505 | config ARCH_HAS_MEM_ENCRYPT |
| @@ -323,6 +323,12 @@ ENTRY(poly1305_4block_avx2) · 322 unmodified lines | |||
| 323 | vpaddq t2,t1,t1 | 323 | vpaddq t2,t1,t1 |
| 324 | vmovq t1x,d4 | 324 | vmovq t1x,d4 |
| 325 | 325 | ||
| 326 | # Now do a partial reduction mod (2^130)-5, carrying h0 -> h1 -> h2 -> | ||
| 327 | # h3 -> h4 -> h0 -> h1 to get h0,h2,h3,h4 < 2^26 and h1 < 2^26 + a small | ||
| 328 | # amount. Careful: we must not assume the carry bits 'd0 >> 26', | ||
| 329 | # 'd1 >> 26', 'd2 >> 26', 'd3 >> 26', and '(d4 >> 26) * 5' fit in 32-bit | ||
| 330 | # integers. It's true in a single-block implementation, but not here. | ||
| 331 | |||
| 326 | # d1 += d0 >> 26 | 332 | # d1 += d0 >> 26 |
| 327 | mov d0,%rax | 333 | mov d0,%rax |
| 328 | shr $26,%rax | 334 | shr $26,%rax |
| @@ -361,16 +367,16 @@ ENTRY(poly1305_4block_avx2) · 32 unmodified lines | |||
| 361 | # h0 += (d4 >> 26) * 5 | 367 | # h0 += (d4 >> 26) * 5 |
| 362 | mov d4,%rax | 368 | mov d4,%rax |
| 363 | shr $26,%rax | 369 | shr $26,%rax |
| 364 | lea (%eax,%eax,4),%eax | 370 | lea (%rax,%rax,4),%rax |
| 365 | add %eax,%ebx | 371 | add %rax,%rbx |
| 366 | # h4 = d4 & 0x3ffffff | 372 | # h4 = d4 & 0x3ffffff |
| 367 | mov d4,%rax | 373 | mov d4,%rax |
| 368 | and $0x3ffffff,%eax | 374 | and $0x3ffffff,%eax |
| 369 | mov %eax,h4 | 375 | mov %eax,h4 |
| 370 | 376 | ||
| 371 | # h1 += h0 >> 26 | 377 | # h1 += h0 >> 26 |
| 372 | mov %ebx,%eax | 378 | mov %rbx,%rax |
| 373 | shr $26,%eax | 379 | shr $26,%rax |
| 374 | add %eax,h1 | 380 | add %eax,h1 |
| 375 | # h0 = h0 & 0x3ffffff | 381 | # h0 = h0 & 0x3ffffff |
| 376 | andl $0x3ffffff,%ebx | 382 | andl $0x3ffffff,%ebx |
| @@ -253,16 +253,16 @@ ENTRY(poly1305_block_sse2) · 252 unmodified lines | |||
| 253 | # h0 += (d4 >> 26) * 5 | 253 | # h0 += (d4 >> 26) * 5 |
| 254 | mov d4,%rax | 254 | mov d4,%rax |
| 255 | shr $26,%rax | 255 | shr $26,%rax |
| 256 | lea (%eax,%eax,4),%eax | 256 | lea (%rax,%rax,4),%rax |
| 257 | add %eax,%ebx | 257 | add %rax,%rbx |
| 258 | # h4 = d4 & 0x3ffffff | 258 | # h4 = d4 & 0x3ffffff |
| 259 | mov d4,%rax | 259 | mov d4,%rax |
| 260 | and $0x3ffffff,%eax | 260 | and $0x3ffffff,%eax |
| 261 | mov %eax,h4 | 261 | mov %eax,h4 |
| 262 | 262 | ||
| 263 | # h1 += h0 >> 26 | 263 | # h1 += h0 >> 26 |
| 264 | mov %ebx,%eax | 264 | mov %rbx,%rax |
| 265 | shr $26,%eax | 265 | shr $26,%rax |
| 266 | add %eax,h1 | 266 | add %eax,h1 |
| 267 | # h0 = h0 & 0x3ffffff | 267 | # h0 = h0 & 0x3ffffff |
| 268 | andl $0x3ffffff,%ebx | 268 | andl $0x3ffffff,%ebx |
| @@ -524,6 +524,12 @@ ENTRY(poly1305_2block_sse2) · 255 unmodified lines | |||
| 524 | paddq t2,t1 | 524 | paddq t2,t1 |
| 525 | movq t1,d4 | 525 | movq t1,d4 |
| 526 | 526 | ||
| 527 | # Now do a partial reduction mod (2^130)-5, carrying h0 -> h1 -> h2 -> | ||
| 528 | # h3 -> h4 -> h0 -> h1 to get h0,h2,h3,h4 < 2^26 and h1 < 2^26 + a small | ||
| 529 | # amount. Careful: we must not assume the carry bits 'd0 >> 26', | ||
| 530 | # 'd1 >> 26', 'd2 >> 26', 'd3 >> 26', and '(d4 >> 26) * 5' fit in 32-bit | ||
| 531 | # integers. It's true in a single-block implementation, but not here. | ||
| 532 | |||
| 527 | # d1 += d0 >> 26 | 533 | # d1 += d0 >> 26 |
| 528 | mov d0,%rax | 534 | mov d0,%rax |
| 529 | shr $26,%rax | 535 | shr $26,%rax |
| @@ -562,16 +568,16 @@ ENTRY(poly1305_2block_sse2) · 32 unmodified lines | |||
| 562 | # h0 += (d4 >> 26) * 5 | 568 | # h0 += (d4 >> 26) * 5 |
| 563 | mov d4,%rax | 569 | mov d4,%rax |
| 564 | shr $26,%rax | 570 | shr $26,%rax |
| 565 | lea (%eax,%eax,4),%eax | 571 | lea (%rax,%rax,4),%rax |
| 566 | add %eax,%ebx | 572 | add %rax,%rbx |
| 567 | # h4 = d4 & 0x3ffffff | 573 | # h4 = d4 & 0x3ffffff |
| 568 | mov d4,%rax | 574 | mov d4,%rax |
| 569 | and $0x3ffffff,%eax | 575 | and $0x3ffffff,%eax |
| 570 | mov %eax,h4 | 576 | mov %eax,h4 |
| 571 | 577 | ||
| 572 | # h1 += h0 >> 26 | 578 | # h1 += h0 >> 26 |
| 573 | mov %ebx,%eax | 579 | mov %rbx,%rax |
| 574 | shr $26,%eax | 580 | shr $26,%rax |
| 575 | add %eax,h1 | 581 | add %eax,h1 |
| 576 | # h0 = h0 & 0x3ffffff | 582 | # h0 = h0 & 0x3ffffff |
| 577 | andl $0x3ffffff,%ebx | 583 | andl $0x3ffffff,%ebx |
| @@ -117,22 +117,39 @@ static __initconst const u64 amd_hw_cache_event_ids · 116 unmodified lines | |||
| 117 | }; | 117 | }; |
| 118 | 118 | ||
| 119 | /* | 119 | /* |
| 120 | * AMD Performance Monitor K7 and later. | 120 | * AMD Performance Monitor K7 and later, up to and including Family 16h: |
| 121 | */ | 121 | */ |
| 122 | static const u64 amd_perfmon_event_map[PERF_COUNT_HW_MAX] = | 122 | static const u64 amd_perfmon_event_map[PERF_COUNT_HW_MAX] = |
| 123 | { | 123 | { |
| 124 | [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, | 124 | [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, |
| 125 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, | 125 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, |
| 126 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0x077d, | 126 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0x077d, |
| 127 | [PERF_COUNT_HW_CACHE_MISSES] = 0x077e, | 127 | [PERF_COUNT_HW_CACHE_MISSES] = 0x077e, |
| 128 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2, | 128 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2, |
| 129 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3, | 129 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3, |
| 130 | [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x00d0, /* "Decoder empty" event */ | 130 | [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x00d0, /* "Decoder empty" event */ |
| 131 | [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = 0x00d1, /* "Dispatch stalls" event */ | 131 | [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = 0x00d1, /* "Dispatch stalls" event */ |
| 132 | }; | ||
| 133 | |||
| 134 | /* | ||
| 135 | * AMD Performance Monitor Family 17h and later: | ||
| 136 | */ | ||
| 137 | static const u64 amd_f17h_perfmon_event_map[PERF_COUNT_HW_MAX] = | ||
| 138 | { | ||
| 139 | [PERF_COUNT_HW_CPU_CYCLES] = 0x0076, | ||
| 140 | [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, | ||
| 141 | [PERF_COUNT_HW_CACHE_REFERENCES] = 0xff60, | ||
| 142 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2, | ||
| 143 | [PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3, | ||
| 144 | [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x0287, | ||
| 145 | [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = 0x0187, | ||
| 132 | }; | 146 | }; |
| 133 | 147 | ||
| 134 | static u64 amd_pmu_event_map(int hw_event) | 148 | static u64 amd_pmu_event_map(int hw_event) |
| 135 | { | 149 | { |
| 150 | if (boot_cpu_data.x86 >= 0x17) | ||
| 151 | return amd_f17h_perfmon_event_map[hw_event]; | ||
| 152 | |||
| 136 | return amd_perfmon_event_map[hw_event]; | 153 | return amd_perfmon_event_map[hw_event]; |
| 137 | } | 154 | } |
| 138 | 155 | ||
| @@ -3131,7 +3131,7 @@ static unsigned long intel_pmu_large_pebs_flags(struct perf_event *event) · 3130 unmodified lines | |||
| 3131 | flags &= ~PERF_SAMPLE_TIME; | 3131 | flags &= ~PERF_SAMPLE_TIME; |
| 3132 | if (!event->attr.exclude_kernel) | 3132 | if (!event->attr.exclude_kernel) |
| 3133 | flags &= ~PERF_SAMPLE_REGS_USER; | 3133 | flags &= ~PERF_SAMPLE_REGS_USER; |
| 3134 | if (event->attr.sample_regs_user & ~PEBS_REGS) | 3134 | if (event->attr.sample_regs_user & ~PEBS_GP_REGS) |
| 3135 | flags &= ~(PERF_SAMPLE_REGS_USER | PERF_SAMPLE_REGS_INTR); | 3135 | flags &= ~(PERF_SAMPLE_REGS_USER | PERF_SAMPLE_REGS_INTR); |
| 3136 | return flags; | 3136 | return flags; |
| 3137 | } | 3137 | } |
| @@ -96,25 +96,25 @@ struct amd_nb { · 95 unmodified lines | |||
| 96 | PERF_SAMPLE_REGS_INTR | PERF_SAMPLE_REGS_USER | \ | 96 | PERF_SAMPLE_REGS_INTR | PERF_SAMPLE_REGS_USER | \ |
| 97 | PERF_SAMPLE_PERIOD) | 97 | PERF_SAMPLE_PERIOD) |
| 98 | 98 | ||
| 99 | #define PEBS_REGS \ | 99 | #define PEBS_GP_REGS \ |
| 100 | (PERF_REG_X86_AX | \ | 100 | ((1ULL << PERF_REG_X86_AX) | \ |
| 101 | PERF_REG_X86_BX | \ | 101 | (1ULL << PERF_REG_X86_BX) | \ |
| 102 | PERF_REG_X86_CX | \ | 102 | (1ULL << PERF_REG_X86_CX) | \ |
| 103 | PERF_REG_X86_DX | \ | 103 | (1ULL << PERF_REG_X86_DX) | \ |
| 104 | PERF_REG_X86_DI | \ | 104 | (1ULL << PERF_REG_X86_DI) | \ |
| 105 | PERF_REG_X86_SI | \ | 105 | (1ULL << PERF_REG_X86_SI) | \ |
| 106 | PERF_REG_X86_SP | \ | 106 | (1ULL << PERF_REG_X86_SP) | \ |
| 107 | PERF_REG_X86_BP | \ | 107 | (1ULL << PERF_REG_X86_BP) | \ |
| 108 | PERF_REG_X86_IP | \ | 108 | (1ULL << PERF_REG_X86_IP) | \ |
| 109 | PERF_REG_X86_FLAGS | \ | 109 | (1ULL << PERF_REG_X86_FLAGS) | \ |
| 110 | PERF_REG_X86_R8 | \ | 110 | (1ULL << PERF_REG_X86_R8) | \ |
| 111 | PERF_REG_X86_R9 | \ | 111 | (1ULL << PERF_REG_X86_R9) | \ |
| 112 | PERF_REG_X86_R10 | \ | 112 | (1ULL << PERF_REG_X86_R10) | \ |
| 113 | PERF_REG_X86_R11 | \ | 113 | (1ULL << PERF_REG_X86_R11) | \ |
| 114 | PERF_REG_X86_R12 | \ | 114 | (1ULL << PERF_REG_X86_R12) | \ |
| 115 | PERF_REG_X86_R13 | \ | 115 | (1ULL << PERF_REG_X86_R13) | \ |
| 116 | PERF_REG_X86_R14 | \ | 116 | (1ULL << PERF_REG_X86_R14) | \ |
| 117 | PERF_REG_X86_R15) | 117 | (1ULL << PERF_REG_X86_R15)) |
| 118 | 118 | ||
| 119 | /* | 119 | /* |
| 120 | * Per register state. | 120 | * Per register state. |
| @@ -275,7 +275,7 @@ static const struct { · 274 unmodified lines | |||
| 275 | const char *option; | 275 | const char *option; |
| 276 | enum spectre_v2_user_cmd cmd; | 276 | enum spectre_v2_user_cmd cmd; |
| 277 | bool secure; | 277 | bool secure; |
| 278 | } v2_user_options[] __initdata = { | 278 | } v2_user_options[] __initconst = { |
| 279 | { "auto", SPECTRE_V2_USER_CMD_AUTO, false }, | 279 | { "auto", SPECTRE_V2_USER_CMD_AUTO, false }, |
| 280 | { "off", SPECTRE_V2_USER_CMD_NONE, false }, | 280 | { "off", SPECTRE_V2_USER_CMD_NONE, false }, |
| 281 | { "on", SPECTRE_V2_USER_CMD_FORCE, true }, | 281 | { "on", SPECTRE_V2_USER_CMD_FORCE, true }, |
| @@ -419,7 +419,7 @@ static const struct { · 137 unmodified lines | |||
| 419 | const char *option; | 419 | const char *option; |
| 420 | enum spectre_v2_mitigation_cmd cmd; | 420 | enum spectre_v2_mitigation_cmd cmd; |
| 421 | bool secure; | 421 | bool secure; |
| 422 | } mitigation_options[] __initdata = { | 422 | } mitigation_options[] __initconst = { |
| 423 | { "off", SPECTRE_V2_CMD_NONE, false }, | 423 | { "off", SPECTRE_V2_CMD_NONE, false }, |
| 424 | { "on", SPECTRE_V2_CMD_FORCE, true }, | 424 | { "on", SPECTRE_V2_CMD_FORCE, true }, |
| 425 | { "retpoline", SPECTRE_V2_CMD_RETPOLINE, false }, | 425 | { "retpoline", SPECTRE_V2_CMD_RETPOLINE, false }, |
| @@ -658,7 +658,7 @@ static const char * const ssb_strings[] = { · 232 unmodified lines | |||
| 658 | static const struct { | 658 | static const struct { |
| 659 | const char *option; | 659 | const char *option; |
| 660 | enum ssb_mitigation_cmd cmd; | 660 | enum ssb_mitigation_cmd cmd; |
| 661 | } ssb_mitigation_options[] __initdata = { | 661 | } ssb_mitigation_options[] __initconst = { |
| 662 | { "auto", SPEC_STORE_BYPASS_CMD_AUTO }, /* Platform decides */ | 662 | { "auto", SPEC_STORE_BYPASS_CMD_AUTO }, /* Platform decides */ |
| 663 | { "on", SPEC_STORE_BYPASS_CMD_ON }, /* Disable Speculative Store Bypass */ | 663 | { "on", SPEC_STORE_BYPASS_CMD_ON }, /* Disable Speculative Store Bypass */ |
| 664 | { "off", SPEC_STORE_BYPASS_CMD_NONE }, /* Don't touch Speculative Store Bypass */ | 664 | { "off", SPEC_STORE_BYPASS_CMD_NONE }, /* Don't touch Speculative Store Bypass */ |
| @@ -611,8 +611,8 @@ static void init_intel_energy_perf(struct cpuinfo_x86 *c) · 610 unmodified lines | |||
| 611 | if ((epb & 0xF) != ENERGY_PERF_BIAS_PERFORMANCE) | 611 | if ((epb & 0xF) != ENERGY_PERF_BIAS_PERFORMANCE) |
| 612 | return; | 612 | return; |
| 613 | 613 | ||
| 614 | pr_warn_once("ENERGY_PERF_BIAS: Set to 'normal', was 'performance'\n"); | 614 | pr_info_once("ENERGY_PERF_BIAS: Set to 'normal', was 'performance'\n"); |
| 615 | pr_warn_once("ENERGY_PERF_BIAS: View and update with x86_energy_perf_policy(8)\n"); | 615 | pr_info_once("ENERGY_PERF_BIAS: View and update with x86_energy_perf_policy(8)\n"); |
| 616 | epb = (epb & ~0xF) | ENERGY_PERF_BIAS_NORMAL; | 616 | epb = (epb & ~0xF) | ENERGY_PERF_BIAS_NORMAL; |
| 617 | wrmsrl(MSR_IA32_ENERGY_PERF_BIAS, epb); | 617 | wrmsrl(MSR_IA32_ENERGY_PERF_BIAS, epb); |
| 618 | } | 618 | } |
| @@ -2610,9 +2610,10 @@ static int rdtgroup_init_alloc(struct rdtgroup *rdtgrp) · 2609 unmodified lines | |||
| 2610 | rdt_last_cmd_puts("Failed to initialize allocations\n"); | 2610 | rdt_last_cmd_puts("Failed to initialize allocations\n"); |
| 2611 | return ret; | 2611 | return ret; |
| 2612 | } | 2612 | } |
| 2613 | rdtgrp->mode = RDT_MODE_SHAREABLE; | ||
| 2614 | } | 2613 | } |
| 2615 | 2614 | ||
| 2615 | rdtgrp->mode = RDT_MODE_SHAREABLE; | ||
| 2616 | |||
| 2616 | return 0; | 2617 | return 0; |
| 2617 | } | 2618 | } |
| 2618 | 2619 | ||
| @@ -569,6 +569,7 @@ void arch_prepare_kretprobe(struct kretprobe_instance *ri, struct pt_regs *regs) · 568 unmodified lines | |||
| 569 | unsigned long *sara = stack_addr(regs); | 569 | unsigned long *sara = stack_addr(regs); |
| 570 | 570 | ||
| 571 | ri->ret_addr = (kprobe_opcode_t *) *sara; | 571 | ri->ret_addr = (kprobe_opcode_t *) *sara; |
| 572 | ri->fp = sara; | ||
| 572 | 573 | ||
| 573 | /* Replace the return addr with trampoline addr */ | 574 | /* Replace the return addr with trampoline addr */ |
| 574 | *sara = (unsigned long) &kretprobe_trampoline; | 575 | *sara = (unsigned long) &kretprobe_trampoline; |
| @@ -748,26 +749,48 @@ asm( · 173 unmodified lines | |||
| 748 | NOKPROBE_SYMBOL(kretprobe_trampoline); | 749 | NOKPROBE_SYMBOL(kretprobe_trampoline); |
| 749 | STACK_FRAME_NON_STANDARD(kretprobe_trampoline); | 750 | STACK_FRAME_NON_STANDARD(kretprobe_trampoline); |
| 750 | 751 | ||
| 752 | static struct kprobe kretprobe_kprobe = { | ||
| 753 | .addr = (void *)kretprobe_trampoline, | ||
| 754 | }; | ||
| 755 | |||
| 751 | /* | 756 | /* |
| 752 | * Called from kretprobe_trampoline | 757 | * Called from kretprobe_trampoline |
| 753 | */ | 758 | */ |
| 754 | static __used void *trampoline_handler(struct pt_regs *regs) | 759 | static __used void *trampoline_handler(struct pt_regs *regs) |
| 755 | { | 760 | { |
| 761 | struct kprobe_ctlblk *kcb; | ||
| 756 | struct kretprobe_instance *ri = NULL; | 762 | struct kretprobe_instance *ri = NULL; |
| 757 | struct hlist_head *head, empty_rp; | 763 | struct hlist_head *head, empty_rp; |
| 758 | struct hlist_node *tmp; | 764 | struct hlist_node *tmp; |
| 759 | unsigned long flags, orig_ret_address = 0; | 765 | unsigned long flags, orig_ret_address = 0; |
| 760 | unsigned long trampoline_address = (unsigned long)&kretprobe_trampoline; | 766 | unsigned long trampoline_address = (unsigned long)&kretprobe_trampoline; |
| 761 | kprobe_opcode_t *correct_ret_addr = NULL; | 767 | kprobe_opcode_t *correct_ret_addr = NULL; |
| 768 | void *frame_pointer; | ||
| 769 | bool skipped = false; | ||
| 770 | |||
| 771 | preempt_disable(); | ||
| 772 | |||
| 773 | /* | ||
| 774 | * Set a dummy kprobe for avoiding kretprobe recursion. | ||
| 775 | * Since kretprobe never run in kprobe handler, kprobe must not | ||
| 776 | * be running at this point. | ||
| 777 | */ | ||
| 778 | kcb = get_kprobe_ctlblk(); | ||
| 779 | __this_cpu_write(current_kprobe, &kretprobe_kprobe); | ||
| 780 | kcb->kprobe_status = KPROBE_HIT_ACTIVE; | ||
| 762 | 781 | ||
| 763 | INIT_HLIST_HEAD(&empty_rp); | 782 | INIT_HLIST_HEAD(&empty_rp); |
| 764 | kretprobe_hash_lock(current, &head, &flags); | 783 | kretprobe_hash_lock(current, &head, &flags); |
| 765 | /* fixup registers */ | 784 | /* fixup registers */ |
| 766 | #ifdef CONFIG_X86_64 | 785 | #ifdef CONFIG_X86_64 |
| 767 | regs->cs = __KERNEL_CS; | 786 | regs->cs = __KERNEL_CS; |
| 787 | /* On x86-64, we use pt_regs->sp for return address holder. */ | ||
| 788 | frame_pointer = ®s->sp; | ||
| 768 | #else | 789 | #else |
| 769 | regs->cs = __KERNEL_CS | get_kernel_rpl(); | 790 | regs->cs = __KERNEL_CS | get_kernel_rpl(); |
| 770 | regs->gs = 0; | 791 | regs->gs = 0; |
| 792 | /* On x86-32, we use pt_regs->flags for return address holder. */ | ||
| 793 | frame_pointer = ®s->flags; | ||
| 771 | #endif | 794 | #endif |
| 772 | regs->ip = trampoline_address; | 795 | regs->ip = trampoline_address; |
| 773 | regs->orig_ax = ~0UL; | 796 | regs->orig_ax = ~0UL; |
| @@ -789,8 +812,25 @@ static __used void *trampoline_handler(struct pt_regs *regs) · 15 unmodified lines | |||
| 789 | if (ri->task != current) | 812 | if (ri->task != current) |
| 790 | /* another task is sharing our hash bucket */ | 813 | /* another task is sharing our hash bucket */ |
| 791 | continue; | 814 | continue; |
| 815 | /* | ||
| 816 | * Return probes must be pushed on this hash list correct | ||
| 817 | * order (same as return order) so that it can be poped | ||
| 818 | * correctly. However, if we find it is pushed it incorrect | ||
| 819 | * order, this means we find a function which should not be | ||
| 820 | * probed, because the wrong order entry is pushed on the | ||
| 821 | * path of processing other kretprobe itself. | ||
| 822 | */ | ||
| 823 | if (ri->fp != frame_pointer) { | ||
| 824 | if (!skipped) | ||
| 825 | pr_warn("kretprobe is stacked incorrectly. Trying to fixup.\n"); | ||
| 826 | skipped = true; | ||
| 827 | continue; | ||
| 828 | } | ||
| 792 | 829 | ||
| 793 | orig_ret_address = (unsigned long)ri->ret_addr; | 830 | orig_ret_address = (unsigned long)ri->ret_addr; |
| 831 | if (skipped) | ||
| 832 | pr_warn("%ps must be blacklisted because of incorrect kretprobe order\n", | ||
| 833 | ri->rp->kp.addr); | ||
| 794 | 834 | ||
| 795 | if (orig_ret_address != trampoline_address) | 835 | if (orig_ret_address != trampoline_address) |
| 796 | /* | 836 | /* |
| @@ -808,14 +848,15 @@ static __used void *trampoline_handler(struct pt_regs *regs) · 11 unmodified lines | |||
| 808 | if (ri->task != current) | 848 | if (ri->task != current) |
| 809 | /* another task is sharing our hash bucket */ | 849 | /* another task is sharing our hash bucket */ |
| 810 | continue; | 850 | continue; |
| 851 | if (ri->fp != frame_pointer) | ||
| 852 | continue; | ||
| 811 | 853 | ||
| 812 | orig_ret_address = (unsigned long)ri->ret_addr; | 854 | orig_ret_address = (unsigned long)ri->ret_addr; |
| 813 | if (ri->rp && ri->rp->handler) { | 855 | if (ri->rp && ri->rp->handler) { |
| 814 | __this_cpu_write(current_kprobe, &ri->rp->kp); | 856 | __this_cpu_write(current_kprobe, &ri->rp->kp); |
| 815 | get_kprobe_ctlblk()->kprobe_status = KPROBE_HIT_ACTIVE; | ||
| 816 | ri->ret_addr = correct_ret_addr; | 857 | ri->ret_addr = correct_ret_addr; |
| 817 | ri->rp->handler(ri, regs); | 858 | ri->rp->handler(ri, regs); |
| 818 | __this_cpu_write(current_kprobe, NULL); | 859 | __this_cpu_write(current_kprobe, &kretprobe_kprobe); |
| 819 | } | 860 | } |
| 820 | 861 | ||
| 821 | recycle_rp_inst(ri, &empty_rp); | 862 | recycle_rp_inst(ri, &empty_rp); |
| @@ -831,6 +872,9 @@ static __used void *trampoline_handler(struct pt_regs *regs) · 9 unmodified lines | |||
| 831 | 872 | ||
| 832 | kretprobe_hash_unlock(current, &flags); | 873 | kretprobe_hash_unlock(current, &flags); |
| 833 | 874 | ||
| 875 | __this_cpu_write(current_kprobe, NULL); | ||
| 876 | preempt_enable(); | ||
| 877 | |||
| 834 | hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) { | 878 | hlist_for_each_entry_safe(ri, tmp, &empty_rp, hlist) { |
| 835 | hlist_del(&ri->hlist); | 879 | hlist_del(&ri->hlist); |
| 836 | kfree(ri); | 880 | kfree(ri); |
| @@ -426,6 +426,8 @@ static __always_inline void __speculation_ctrl_update(unsigned long tifp, · 425 unmodified lines | |||
| 426 | u64 msr = x86_spec_ctrl_base; | 426 | u64 msr = x86_spec_ctrl_base; |
| 427 | bool updmsr = false; | 427 | bool updmsr = false; |
| 428 | 428 | ||
| 429 | lockdep_assert_irqs_disabled(); | ||
| 430 | |||
| 429 | /* | 431 | /* |
| 430 | * If TIF_SSBD is different, select the proper mitigation | 432 | * If TIF_SSBD is different, select the proper mitigation |
| 431 | * method. Note that if SSBD mitigation is disabled or permanentely | 433 | * method. Note that if SSBD mitigation is disabled or permanentely |
| @@ -477,10 +479,12 @@ static unsigned long speculation_ctrl_update_tif(struct task_struct *tsk) · 45 unmodified lines | |||
| 477 | 479 | ||
| 478 | void speculation_ctrl_update(unsigned long tif) | 480 | void speculation_ctrl_update(unsigned long tif) |
| 479 | { | 481 | { |
| 482 | unsigned long flags; | ||
| 483 | |||
| 480 | /* Forced update. Make sure all relevant TIF flags are different */ | 484 | /* Forced update. Make sure all relevant TIF flags are different */ |
| 481 | preempt_disable(); | 485 | local_irq_save(flags); |
| 482 | __speculation_ctrl_update(~tif, tif); | 486 | __speculation_ctrl_update(~tif, tif); |
| 483 | preempt_enable(); | 487 | local_irq_restore(flags); |
| 484 | } | 488 | } |
| 485 | 489 | ||
| 486 | /* Called from seccomp/prctl update */ | 490 | /* Called from seccomp/prctl update */ |
| @@ -81,6 +81,19 @@ static int __init set_bios_reboot(const struct dmi_system_id *d) · 80 unmodified lines | |||
| 81 | return 0; | 81 | return 0; |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | /* | ||
| 85 | * Some machines don't handle the default ACPI reboot method and | ||
| 86 | * require the EFI reboot method: | ||
| 87 | */ | ||
| 88 | static int __init set_efi_reboot(const struct dmi_system_id *d) | ||
| 89 | { | ||
| 90 | if (reboot_type != BOOT_EFI && !efi_runtime_disabled()) { | ||
| 91 | reboot_type = BOOT_EFI; | ||
| 92 | pr_info("%s series board detected. Selecting EFI-method for reboot.\n", d->ident); | ||
| 93 | } | ||
| 94 | return 0; | ||
| 95 | } | ||
| 96 | |||
| 84 | void __noreturn machine_real_restart(unsigned int type) | 97 | void __noreturn machine_real_restart(unsigned int type) |
| 85 | { | 98 | { |
| 86 | local_irq_disable(); | 99 | local_irq_disable(); |
| @@ -166,6 +179,14 @@ static const struct dmi_system_id reboot_dmi_table[] __initconst = { · 79 unmodified lines | |||
| 166 | DMI_MATCH(DMI_PRODUCT_NAME, "AOA110"), | 179 | DMI_MATCH(DMI_PRODUCT_NAME, "AOA110"), |
| 167 | }, | 180 | }, |
| 168 | }, | 181 | }, |
| 182 | { /* Handle reboot issue on Acer TravelMate X514-51T */ | ||
| 183 | .callback = set_efi_reboot, | ||
| 184 | .ident = "Acer TravelMate X514-51T", | ||
| 185 | .matches = { | ||
| 186 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
| 187 | DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate X514-51T"), | ||
| 188 | }, | ||
| 189 | }, | ||
| 169 | 190 | ||
| 170 | /* Apple */ | 191 | /* Apple */ |
| 171 | { /* Handle problems with rebooting on Apple MacBook5 */ | 192 | { /* Handle problems with rebooting on Apple MacBook5 */ |
| @@ -362,7 +362,7 @@ SECTIONS · 361 unmodified lines | |||
| 362 | .bss : AT(ADDR(.bss) - LOAD_OFFSET) { | 362 | .bss : AT(ADDR(.bss) - LOAD_OFFSET) { |
| 363 | __bss_start = .; | 363 | __bss_start = .; |
| 364 | *(.bss..page_aligned) | 364 | *(.bss..page_aligned) |
| 365 | *(.bss) | 365 | *(BSS_MAIN) |
| 366 | BSS_DECRYPTED | 366 | BSS_DECRYPTED |
| 367 | . = ALIGN(PAGE_SIZE); | 367 | . = ALIGN(PAGE_SIZE); |
| 368 | __bss_stop = .; | 368 | __bss_stop = .; |
| @@ -259,7 +259,8 @@ static void note_wx(struct pg_state *st) · 258 unmodified lines | |||
| 259 | #endif | 259 | #endif |
| 260 | /* Account the WX pages */ | 260 | /* Account the WX pages */ |
| 261 | st->wx_pages += npages; | 261 | st->wx_pages += npages; |
| 262 | WARN_ONCE(1, "x86/mm: Found insecure W+X mapping at address %pS\n", | 262 | WARN_ONCE(__supported_pte_mask & _PAGE_NX, |
| 263 | "x86/mm: Found insecure W+X mapping at address %pS\n", | ||
| 263 | (void *)st->start_address); | 264 | (void *)st->start_address); |
| 264 | } | 265 | } |
| 265 | 266 | ||
| @@ -825,7 +825,7 @@ void __init __early_set_fixmap(enum fixed_addresses idx, · 824 unmodified lines | |||
| 825 | pte = early_ioremap_pte(addr); | 825 | pte = early_ioremap_pte(addr); |
| 826 | 826 | ||
| 827 | /* Sanitize 'prot' against any unsupported bits: */ | 827 | /* Sanitize 'prot' against any unsupported bits: */ |
| 828 | pgprot_val(flags) &= __default_kernel_pte_mask; | 828 | pgprot_val(flags) &= __supported_pte_mask; |
| 829 | 829 | ||
| 830 | if (pgprot_val(flags)) | 830 | if (pgprot_val(flags)) |
| 831 | set_pte(pte, pfn_pte(phys >> PAGE_SHIFT, flags)); | 831 | set_pte(pte, pfn_pte(phys >> PAGE_SHIFT, flags)); |
| @@ -94,7 +94,7 @@ void __init kernel_randomize_memory(void) · 93 unmodified lines | |||
| 94 | if (!kaslr_memory_enabled()) | 94 | if (!kaslr_memory_enabled()) |
| 95 | return; | 95 | return; |
| 96 | 96 | ||
| 97 | kaslr_regions[0].size_tb = 1 << (__PHYSICAL_MASK_SHIFT - TB_SHIFT); | 97 | kaslr_regions[0].size_tb = 1 << (MAX_PHYSMEM_BITS - TB_SHIFT); |
| 98 | kaslr_regions[1].size_tb = VMALLOC_SIZE_TB; | 98 | kaslr_regions[1].size_tb = VMALLOC_SIZE_TB; |
| 99 | 99 | ||
| 100 | /* | 100 | /* |
| @@ -728,7 +728,7 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start, · 727 unmodified lines | |||
| 728 | { | 728 | { |
| 729 | int cpu; | 729 | int cpu; |
| 730 | 730 | ||
| 731 | struct flush_tlb_info info __aligned(SMP_CACHE_BYTES) = { | 731 | struct flush_tlb_info info = { |
| 732 | .mm = mm, | 732 | .mm = mm, |
| 733 | .stride_shift = stride_shift, | 733 | .stride_shift = stride_shift, |
| 734 | .freed_tables = freed_tables, | 734 | .freed_tables = freed_tables, |
| @@ -394,3 +394,7 @@ · 393 unmodified lines | |||
| 394 | 421 common rt_sigtimedwait_time64 sys_rt_sigtimedwait | 394 | 421 common rt_sigtimedwait_time64 sys_rt_sigtimedwait |
| 395 | 422 common futex_time64 sys_futex | 395 | 422 common futex_time64 sys_futex |
| 396 | 423 common sched_rr_get_interval_time64 sys_sched_rr_get_interval | 396 | 423 common sched_rr_get_interval_time64 sys_sched_rr_get_interval |
| 397 | 424 common pidfd_send_signal sys_pidfd_send_signal | ||
| 398 | 425 common io_uring_setup sys_io_uring_setup | ||
| 399 | 426 common io_uring_enter sys_io_uring_enter | ||
| 400 | 427 common io_uring_register sys_io_uring_register | ||
| @@ -5396,7 +5396,7 @@ static unsigned int bfq_update_depths(struct bfq_data *bfqd, · 5395 unmodified lines | |||
| 5396 | return min_shallow; | 5396 | return min_shallow; |
| 5397 | } | 5397 | } |
| 5398 | 5398 | ||
| 5399 | static int bfq_init_hctx(struct blk_mq_hw_ctx *hctx, unsigned int index) | 5399 | static void bfq_depth_updated(struct blk_mq_hw_ctx *hctx) |
| 5400 | { | 5400 | { |
| 5401 | struct bfq_data *bfqd = hctx->queue->elevator->elevator_data; | 5401 | struct bfq_data *bfqd = hctx->queue->elevator->elevator_data; |
| 5402 | struct blk_mq_tags *tags = hctx->sched_tags; | 5402 | struct blk_mq_tags *tags = hctx->sched_tags; |
| @@ -5404,6 +5404,11 @@ static int bfq_init_hctx(struct blk_mq_hw_ctx *hctx, unsigned int index) · 1 unmodified line | |||
| 5404 | 5404 | ||
| 5405 | min_shallow = bfq_update_depths(bfqd, &tags->bitmap_tags); | 5405 | min_shallow = bfq_update_depths(bfqd, &tags->bitmap_tags); |
| 5406 | sbitmap_queue_min_shallow_depth(&tags->bitmap_tags, min_shallow); | 5406 | sbitmap_queue_min_shallow_depth(&tags->bitmap_tags, min_shallow); |
| 5407 | } | ||
| 5408 | |||
| 5409 | static int bfq_init_hctx(struct blk_mq_hw_ctx *hctx, unsigned int index) | ||
| 5410 | { | ||
| 5411 | bfq_depth_updated(hctx); | ||
| 5407 | return 0; | 5412 | return 0; |
| 5408 | } | 5413 | } |
| 5409 | 5414 | ||
| @@ -5826,6 +5831,7 @@ static struct elevator_type iosched_bfq_mq = { · 416 unmodified lines | |||
| 5826 | .requests_merged = bfq_requests_merged, | 5831 | .requests_merged = bfq_requests_merged, |
| 5827 | .request_merged = bfq_request_merged, | 5832 | .request_merged = bfq_request_merged, |
| 5828 | .has_work = bfq_has_work, | 5833 | .has_work = bfq_has_work, |
| 5834 | .depth_updated = bfq_depth_updated, | ||
| 5829 | .init_hctx = bfq_init_hctx, | 5835 | .init_hctx = bfq_init_hctx, |
| 5830 | .init_sched = bfq_init_queue, | 5836 | .init_sched = bfq_init_queue, |
| 5831 | .exit_sched = bfq_exit_queue, | 5837 | .exit_sched = bfq_exit_queue, |
| @@ -3135,6 +3135,8 @@ int blk_mq_update_nr_requests(struct request_queue *q, unsigned int nr) · 3134 unmodified lines | |||
| 3135 | } | 3135 | } |
| 3136 | if (ret) | 3136 | if (ret) |
| 3137 | break; | 3137 | break; |
| 3138 | if (q->elevator && q->elevator->type->ops.depth_updated) | ||
| 3139 | q->elevator->type->ops.depth_updated(hctx); | ||
| 3138 | } | 3140 | } |
| 3139 | 3141 | ||
| 3140 | if (!ret) | 3142 | if (!ret) |
| @@ -5634,7 +5634,49 @@ static const struct hash_testvec poly1305_tv_template[] = { · 5633 unmodified lines | |||
| 5634 | .psize = 80, | 5634 | .psize = 80, |
| 5635 | .digest = "\x13\x00\x00\x00\x00\x00\x00\x00" | 5635 | .digest = "\x13\x00\x00\x00\x00\x00\x00\x00" |
| 5636 | "\x00\x00\x00\x00\x00\x00\x00\x00", | 5636 | "\x00\x00\x00\x00\x00\x00\x00\x00", |
| 5637 | }, | 5637 | }, { /* Regression test for overflow in AVX2 implementation */ |
| 5638 | .plaintext = "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5639 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5640 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5641 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5642 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5643 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5644 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5645 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5646 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5647 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5648 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5649 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5650 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5651 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5652 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5653 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5654 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5655 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5656 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5657 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5658 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5659 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5660 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5661 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5662 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5663 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5664 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5665 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5666 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5667 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5668 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5669 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5670 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5671 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5672 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5673 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5674 | "\xff\xff\xff\xff\xff\xff\xff\xff" | ||
| 5675 | "\xff\xff\xff\xff", | ||
| 5676 | .psize = 300, | ||
| 5677 | .digest = "\xfb\x5e\x96\xd8\x61\xd5\xc7\xc8" | ||
| 5678 | "\x78\xe5\x87\xcc\x2d\x5a\x22\xe1", | ||
| 5679 | } | ||
| 5638 | }; | 5680 | }; |
| 5639 | 5681 | ||
| 5640 | /* NHPoly1305 test vectors from https://github.com/google/adiantum */ | 5682 | /* NHPoly1305 test vectors from https://github.com/google/adiantum */ |
| @@ -1646,7 +1646,7 @@ static irqreturn_t fs_irq (int irq, void *dev_id) · 1645 unmodified lines | |||
| 1646 | } | 1646 | } |
| 1647 | 1647 | ||
| 1648 | if (status & ISR_TBRQ_W) { | 1648 | if (status & ISR_TBRQ_W) { |
| 1649 | fs_dprintk (FS_DEBUG_IRQ, "Data tramsitted!\n"); | 1649 | fs_dprintk (FS_DEBUG_IRQ, "Data transmitted!\n"); |
| 1650 | process_txdone_queue (dev, &dev->tx_relq); | 1650 | process_txdone_queue (dev, &dev->tx_relq); |
| 1651 | } | 1651 | } |
| 1652 | 1652 | ||
| @@ -506,7 +506,7 @@ static ssize_t probe_store(struct device *dev, struct device_attribute *attr, · 505 unmodified lines | |||
| 506 | 506 | ||
| 507 | ret = lock_device_hotplug_sysfs(); | 507 | ret = lock_device_hotplug_sysfs(); |
| 508 | if (ret) | 508 | if (ret) |
| 509 | goto out; | 509 | return ret; |
| 510 | 510 | ||
| 511 | nid = memory_add_physaddr_to_nid(phys_addr); | 511 | nid = memory_add_physaddr_to_nid(phys_addr); |
| 512 | ret = __add_memory(nid, phys_addr, | 512 | ret = __add_memory(nid, phys_addr, |
| @@ -145,6 +145,7 @@ config VT8500_TIMER · 144 unmodified lines | |||
| 145 | config NPCM7XX_TIMER | 145 | config NPCM7XX_TIMER |
| 146 | bool "NPCM7xx timer driver" if COMPILE_TEST | 146 | bool "NPCM7xx timer driver" if COMPILE_TEST |
| 147 | depends on HAS_IOMEM | 147 | depends on HAS_IOMEM |
| 148 | select TIMER_OF | ||
| 148 | select CLKSRC_MMIO | 149 | select CLKSRC_MMIO |
| 149 | help | 150 | help |
| 150 | Enable 24-bit TIMER0 and TIMER1 counters in the NPCM7xx architecture, | 151 | Enable 24-bit TIMER0 and TIMER1 counters in the NPCM7xx architecture, |
| @@ -9,7 +9,7 @@ · 8 unmodified lines | |||
| 9 | * published by the Free Software Foundation. | 9 | * published by the Free Software Foundation. |
| 10 | */ | 10 | */ |
| 11 | 11 | ||
| 12 | #define pr_fmt(fmt) "arm_arch_timer: " fmt | 12 | #define pr_fmt(fmt) "arch_timer: " fmt |
| 13 | 13 | ||
| 14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
| 15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
| @@ -33,9 +33,6 @@ · 17 unmodified lines | |||
| 33 | 33 | ||
| 34 | #include <clocksource/arm_arch_timer.h> | 34 | #include <clocksource/arm_arch_timer.h> |
| 35 | 35 | ||
| 36 | #undef pr_fmt | ||
| 37 | #define pr_fmt(fmt) "arch_timer: " fmt | ||
| 38 | |||
| 39 | #define CNTTIDR 0x08 | 36 | #define CNTTIDR 0x08 |
| 40 | #define CNTTIDR_VIRT(n) (BIT(1) << ((n) * 4)) | 37 | #define CNTTIDR_VIRT(n) (BIT(1) << ((n) * 4)) |
| 41 | 38 | ||
| @@ -296,4 +296,4 @@ err_alloc: · 295 unmodified lines | |||
| 296 | TIMER_OF_DECLARE(ox810se_rps, | 296 | TIMER_OF_DECLARE(ox810se_rps, |
| 297 | "oxsemi,ox810se-rps-timer", oxnas_rps_timer_init); | 297 | "oxsemi,ox810se-rps-timer", oxnas_rps_timer_init); |
| 298 | TIMER_OF_DECLARE(ox820_rps, | 298 | TIMER_OF_DECLARE(ox820_rps, |
| 299 | "oxsemi,ox820se-rps-timer", oxnas_rps_timer_init); | 299 | "oxsemi,ox820-rps-timer", oxnas_rps_timer_init); |
| @@ -585,34 +585,6 @@ static int omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload, · 584 unmodified lines | |||
| 585 | return 0; | 585 | return 0; |
| 586 | } | 586 | } |
| 587 | 587 | ||
| 588 | /* Optimized set_load which removes costly spin wait in timer_start */ | ||
| 589 | static int omap_dm_timer_set_load_start(struct omap_dm_timer *timer, | ||
| 590 | int autoreload, unsigned int load) | ||
| 591 | { | ||
| 592 | u32 l; | ||
| 593 | |||
| 594 | if (unlikely(!timer)) | ||
| 595 | return -EINVAL; | ||
| 596 | |||
| 597 | omap_dm_timer_enable(timer); | ||
| 598 | |||
| 599 | l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG); | ||
| 600 | if (autoreload) { | ||
| 601 | l |= OMAP_TIMER_CTRL_AR; | ||
| 602 | omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load); | ||
| 603 | } else { | ||
| 604 | l &= ~OMAP_TIMER_CTRL_AR; | ||
| 605 | } | ||
| 606 | l |= OMAP_TIMER_CTRL_ST; | ||
| 607 | |||
| 608 | __omap_dm_timer_load_start(timer, l, load, timer->posted); | ||
| 609 | |||
| 610 | /* Save the context */ | ||
| 611 | timer->context.tclr = l; | ||
| 612 | timer->context.tldr = load; | ||
| 613 | timer->context.tcrr = load; | ||
| 614 | return 0; | ||
| 615 | } | ||
| 616 | static int omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable, | 588 | static int omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable, |
| 617 | unsigned int match) | 589 | unsigned int match) |
| 618 | { | 590 | { |
| @@ -116,7 +116,7 @@ config EXTCON_PALMAS · 115 unmodified lines | |||
| 116 | 116 | ||
| 117 | config EXTCON_PTN5150 | 117 | config EXTCON_PTN5150 |
| 118 | tristate "NXP PTN5150 CC LOGIC USB EXTCON support" | 118 | tristate "NXP PTN5150 CC LOGIC USB EXTCON support" |
| 119 | depends on I2C && GPIOLIB || COMPILE_TEST | 119 | depends on I2C && (GPIOLIB || COMPILE_TEST) |
| 120 | select REGMAP_I2C | 120 | select REGMAP_I2C |
| 121 | help | 121 | help |
| 122 | Say Y here to enable support for USB peripheral and USB host | 122 | Say Y here to enable support for USB peripheral and USB host |
| @@ -3165,6 +3165,7 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev) · 3164 unmodified lines | |||
| 3165 | 3165 | ||
| 3166 | /* No need to recover an evicted BO */ | 3166 | /* No need to recover an evicted BO */ |
| 3167 | if (shadow->tbo.mem.mem_type != TTM_PL_TT || | 3167 | if (shadow->tbo.mem.mem_type != TTM_PL_TT || |
| 3168 | shadow->tbo.mem.start == AMDGPU_BO_INVALID_OFFSET || | ||
| 3168 | shadow->parent->tbo.mem.mem_type != TTM_PL_VRAM) | 3169 | shadow->parent->tbo.mem.mem_type != TTM_PL_VRAM) |
| 3169 | continue; | 3170 | continue; |
| 3170 | 3171 | ||
| @@ -182,6 +182,7 @@ static void mmhub_v1_0_init_cache_regs(struct amdgpu_device *adev) · 181 unmodified lines | |||
| 182 | tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, | 182 | tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, |
| 183 | L2_CACHE_BIGK_FRAGMENT_SIZE, 6); | 183 | L2_CACHE_BIGK_FRAGMENT_SIZE, 6); |
| 184 | } | 184 | } |
| 185 | WREG32_SOC15(MMHUB, 0, mmVM_L2_CNTL3, tmp); | ||
| 185 | 186 | ||
| 186 | tmp = mmVM_L2_CNTL4_DEFAULT; | 187 | tmp = mmVM_L2_CNTL4_DEFAULT; |
| 187 | tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PDE_REQUEST_PHYSICAL, 0); | 188 | tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PDE_REQUEST_PHYSICAL, 0); |
| @@ -1377,6 +1377,11 @@ static enum surface_update_type det_surface_update(const struct dc *dc, · 1376 unmodified lines | |||
| 1377 | return UPDATE_TYPE_FULL; | 1377 | return UPDATE_TYPE_FULL; |
| 1378 | } | 1378 | } |
| 1379 | 1379 | ||
| 1380 | if (u->surface->force_full_update) { | ||
| 1381 | update_flags->bits.full_update = 1; | ||
| 1382 | return UPDATE_TYPE_FULL; | ||
| 1383 | } | ||
| 1384 | |||
| 1380 | type = get_plane_info_update_type(u); | 1385 | type = get_plane_info_update_type(u); |
| 1381 | elevate_update_type(&overall_type, type); | 1386 | elevate_update_type(&overall_type, type); |
| 1382 | 1387 | ||
| @@ -1802,6 +1807,14 @@ void dc_commit_updates_for_stream(struct dc *dc, · 419 unmodified lines | |||
| 1802 | } | 1807 | } |
| 1803 | 1808 | ||
| 1804 | dc_resource_state_copy_construct(state, context); | 1809 | dc_resource_state_copy_construct(state, context); |
| 1810 | |||
| 1811 | for (i = 0; i < dc->res_pool->pipe_count; i++) { | ||
| 1812 | struct pipe_ctx *new_pipe = &context->res_ctx.pipe_ctx[i]; | ||
| 1813 | struct pipe_ctx *old_pipe = &dc->current_state->res_ctx.pipe_ctx[i]; | ||
| 1814 | |||
| 1815 | if (new_pipe->plane_state && new_pipe->plane_state != old_pipe->plane_state) | ||
| 1816 | new_pipe->plane_state->force_full_update = true; | ||
| 1817 | } | ||
| 1805 | } | 1818 | } |
| 1806 | 1819 | ||
| 1807 | 1820 | ||
| @@ -1838,6 +1851,12 @@ void dc_commit_updates_for_stream(struct dc *dc, · 30 unmodified lines | |||
| 1838 | dc->current_state = context; | 1851 | dc->current_state = context; |
| 1839 | dc_release_state(old); | 1852 | dc_release_state(old); |
| 1840 | 1853 | ||
| 1854 | for (i = 0; i < dc->res_pool->pipe_count; i++) { | ||
| 1855 | struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i]; | ||
| 1856 | |||
| 1857 | if (pipe_ctx->plane_state && pipe_ctx->stream == stream) | ||
| 1858 | pipe_ctx->plane_state->force_full_update = false; | ||
| 1859 | } | ||
| 1841 | } | 1860 | } |
| 1842 | /*let's use current_state to update watermark etc*/ | 1861 | /*let's use current_state to update watermark etc*/ |
| 1843 | if (update_type >= UPDATE_TYPE_FULL) | 1862 | if (update_type >= UPDATE_TYPE_FULL) |
| @@ -503,6 +503,9 @@ struct dc_plane_state { · 502 unmodified lines | |||
| 503 | struct dc_plane_status status; | 503 | struct dc_plane_status status; |
| 504 | struct dc_context *ctx; | 504 | struct dc_context *ctx; |
| 505 | 505 | ||
| 506 | /* HACK: Workaround for forcing full reprogramming under some conditions */ | ||
| 507 | bool force_full_update; | ||
| 508 | |||
| 506 | /* private to dc_surface.c */ | 509 | /* private to dc_surface.c */ |
| 507 | enum dc_irq_source irq_source; | 510 | enum dc_irq_source irq_source; |
| 508 | struct kref refcount; | 511 | struct kref refcount; |
| @@ -190,6 +190,12 @@ static void submit_channel_request( · 189 unmodified lines | |||
| 190 | 1, | 190 | 1, |
| 191 | 0); | 191 | 0); |
| 192 | } | 192 | } |
| 193 | |||
| 194 | REG_UPDATE(AUX_INTERRUPT_CONTROL, AUX_SW_DONE_ACK, 1); | ||
| 195 | |||
| 196 | REG_WAIT(AUX_SW_STATUS, AUX_SW_DONE, 0, | ||
| 197 | 10, aux110->timeout_period/10); | ||
| 198 | |||
| 193 | /* set the delay and the number of bytes to write */ | 199 | /* set the delay and the number of bytes to write */ |
| 194 | 200 | ||
| 195 | /* The length include | 201 | /* The length include |
| @@ -242,9 +248,6 @@ static void submit_channel_request( · 46 unmodified lines | |||
| 242 | } | 248 | } |
| 243 | } | 249 | } |
| 244 | 250 | ||
| 245 | REG_UPDATE(AUX_INTERRUPT_CONTROL, AUX_SW_DONE_ACK, 1); | ||
| 246 | REG_WAIT(AUX_SW_STATUS, AUX_SW_DONE, 0, | ||
| 247 | 10, aux110->timeout_period/10); | ||
| 248 | REG_UPDATE(AUX_SW_CONTROL, AUX_SW_GO, 1); | 251 | REG_UPDATE(AUX_SW_CONTROL, AUX_SW_GO, 1); |
| 249 | } | 252 | } |
| 250 | 253 | ||
| @@ -71,11 +71,11 @@ enum { /* This is the timeout as defined in DP 1.2a, · 70 unmodified lines | |||
| 71 | * at most within ~240usec. That means, | 71 | * at most within ~240usec. That means, |
| 72 | * increasing this timeout will not affect normal operation, | 72 | * increasing this timeout will not affect normal operation, |
| 73 | * and we'll timeout after | 73 | * and we'll timeout after |
| 74 | * SW_AUX_TIMEOUT_PERIOD_MULTIPLIER * AUX_TIMEOUT_PERIOD = 1600usec. | 74 | * SW_AUX_TIMEOUT_PERIOD_MULTIPLIER * AUX_TIMEOUT_PERIOD = 2400usec. |
| 75 | * This timeout is especially important for | 75 | * This timeout is especially important for |
| 76 | * resume from S3 and CTS. | 76 | * converters, resume from S3, and CTS. |
| 77 | */ | 77 | */ |
| 78 | SW_AUX_TIMEOUT_PERIOD_MULTIPLIER = 4 | 78 | SW_AUX_TIMEOUT_PERIOD_MULTIPLIER = 6 |
| 79 | }; | 79 | }; |
| 80 | 80 | ||
| 81 | struct dce_aux { | 81 | struct dce_aux { |
| @@ -338,8 +338,8 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper, · 337 unmodified lines | |||
| 338 | bool *enabled, int width, int height) | 338 | bool *enabled, int width, int height) |
| 339 | { | 339 | { |
| 340 | struct drm_i915_private *dev_priv = to_i915(fb_helper->dev); | 340 | struct drm_i915_private *dev_priv = to_i915(fb_helper->dev); |
| 341 | unsigned long conn_configured, conn_seq, mask; | ||
| 341 | unsigned int count = min(fb_helper->connector_count, BITS_PER_LONG); | 342 | unsigned int count = min(fb_helper->connector_count, BITS_PER_LONG); |
| 342 | unsigned long conn_configured, conn_seq; | ||
| 343 | int i, j; | 343 | int i, j; |
| 344 | bool *save_enabled; | 344 | bool *save_enabled; |
| 345 | bool fallback = true, ret = true; | 345 | bool fallback = true, ret = true; |
| @@ -357,9 +357,10 @@ static bool intel_fb_initial_config(struct drm_fb_helper *fb_helper, · 11 unmodified lines | |||
| 357 | drm_modeset_backoff(&ctx); | 357 | drm_modeset_backoff(&ctx); |
| 358 | 358 | ||
| 359 | memcpy(save_enabled, enabled, count); | 359 | memcpy(save_enabled, enabled, count); |
| 360 | conn_seq = GENMASK(count - 1, 0); | 360 | mask = GENMASK(count - 1, 0); |
| 361 | conn_configured = 0; | 361 | conn_configured = 0; |
| 362 | retry: | 362 | retry: |
| 363 | conn_seq = conn_configured; | ||
| 363 | for (i = 0; i < count; i++) { | 364 | for (i = 0; i < count; i++) { |
| 364 | struct drm_fb_helper_connector *fb_conn; | 365 | struct drm_fb_helper_connector *fb_conn; |
| 365 | struct drm_connector *connector; | 366 | struct drm_connector *connector; |
| @@ -372,8 +373,7 @@ retry: · 6 unmodified lines | |||
| 372 | if (conn_configured & BIT(i)) | 373 | if (conn_configured & BIT(i)) |
| 373 | continue; | 374 | continue; |
| 374 | 375 | ||
| 375 | /* First pass, only consider tiled connectors */ | 376 | if (conn_seq == 0 && !connector->has_tile) |
| 376 | if (conn_seq == GENMASK(count - 1, 0) && !connector->has_tile) | ||
| 377 | continue; | 377 | continue; |
| 378 | 378 | ||
| 379 | if (connector->status == connector_status_connected) | 379 | if (connector->status == connector_status_connected) |
| @@ -477,10 +477,8 @@ retry: · 97 unmodified lines | |||
| 477 | conn_configured |= BIT(i); | 477 | conn_configured |= BIT(i); |
| 478 | } | 478 | } |
| 479 | 479 | ||
| 480 | if (conn_configured != conn_seq) { /* repeat until no more are found */ | 480 | if ((conn_configured & mask) != mask && conn_configured != conn_seq) |
| 481 | conn_seq = conn_configured; | ||
| 482 | goto retry; | 481 | goto retry; |
| 483 | } | ||
| 484 | 482 | ||
| 485 | /* | 483 | /* |
| 486 | * If the BIOS didn't enable everything it could, fall back to have the | 484 | * If the BIOS didn't enable everything it could, fall back to have the |
| @@ -1260,9 +1260,15 @@ static void tegra_hdmi_encoder_enable(struct drm_encoder *encoder) · 1259 unmodified lines | |||
| 1260 | 1260 | ||
| 1261 | hdmi->dvi = !tegra_output_is_hdmi(output); | 1261 | hdmi->dvi = !tegra_output_is_hdmi(output); |
| 1262 | if (!hdmi->dvi) { | 1262 | if (!hdmi->dvi) { |
| 1263 | err = tegra_hdmi_setup_audio(hdmi); | 1263 | /* |
| 1264 | if (err < 0) | 1264 | * Make sure that the audio format has been configured before |
| 1265 | hdmi->dvi = true; | 1265 | * enabling audio, otherwise we may try to divide by zero. |
| 1266 | */ | ||
| 1267 | if (hdmi->format.sample_rate > 0) { | ||
| 1268 | err = tegra_hdmi_setup_audio(hdmi); | ||
| 1269 | if (err < 0) | ||
| 1270 | hdmi->dvi = true; | ||
| 1271 | } | ||
| 1266 | } | 1272 | } |
| 1267 | 1273 | ||
| 1268 | if (hdmi->config->has_hda) | 1274 | if (hdmi->config->has_hda) |
| @@ -876,8 +876,10 @@ static int ttm_bo_add_move_fence(struct ttm_buffer_object *bo, · 875 unmodified lines | |||
| 876 | reservation_object_add_shared_fence(bo->resv, fence); | 876 | reservation_object_add_shared_fence(bo->resv, fence); |
| 877 | 877 | ||
| 878 | ret = reservation_object_reserve_shared(bo->resv, 1); | 878 | ret = reservation_object_reserve_shared(bo->resv, 1); |
| 879 | if (unlikely(ret)) | 879 | if (unlikely(ret)) { |
| 880 | dma_fence_put(fence); | ||
| 880 | return ret; | 881 | return ret; |
| 882 | } | ||
| 881 | 883 | ||
| 882 | dma_fence_put(bo->moving); | 884 | dma_fence_put(bo->moving); |
| 883 | bo->moving = fence; | 885 | bo->moving = fence; |
| @@ -730,9 +730,10 @@ static void ttm_put_pages(struct page **pages, unsigned npages, int flags, · 729 unmodified lines | |||
| 730 | } | 730 | } |
| 731 | 731 | ||
| 732 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | 732 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE |
| 733 | if (!(flags & TTM_PAGE_FLAG_DMA32)) { | 733 | if (!(flags & TTM_PAGE_FLAG_DMA32) && |
| 734 | for (j = 0; j < HPAGE_PMD_NR; ++j) | 734 | (npages - i) >= HPAGE_PMD_NR) { |
| 735 | if (p++ != pages[i + j]) | 735 | for (j = 1; j < HPAGE_PMD_NR; ++j) |
| 736 | if (++p != pages[i + j]) | ||
| 736 | break; | 737 | break; |
| 737 | 738 | ||
| 738 | if (j == HPAGE_PMD_NR) | 739 | if (j == HPAGE_PMD_NR) |
| @@ -759,15 +760,15 @@ static void ttm_put_pages(struct page **pages, unsigned npages, int flags, · 20 unmodified lines | |||
| 759 | unsigned max_size, n2free; | 760 | unsigned max_size, n2free; |
| 760 | 761 | ||
| 761 | spin_lock_irqsave(&huge->lock, irq_flags); | 762 | spin_lock_irqsave(&huge->lock, irq_flags); |
| 762 | while (i < npages) { | 763 | while ((npages - i) >= HPAGE_PMD_NR) { |
| 763 | struct page *p = pages[i]; | 764 | struct page *p = pages[i]; |
| 764 | unsigned j; | 765 | unsigned j; |
| 765 | 766 | ||
| 766 | if (!p) | 767 | if (!p) |
| 767 | break; | 768 | break; |
| 768 | 769 | ||
| 769 | for (j = 0; j < HPAGE_PMD_NR; ++j) | 770 | for (j = 1; j < HPAGE_PMD_NR; ++j) |
| 770 | if (p++ != pages[i + j]) | 771 | if (++p != pages[i + j]) |
| 771 | break; | 772 | break; |
| 772 | 773 | ||
| 773 | if (j != HPAGE_PMD_NR) | 774 | if (j != HPAGE_PMD_NR) |
| @@ -205,10 +205,14 @@ static struct drm_driver driver = { · 204 unmodified lines | |||
| 205 | #if defined(CONFIG_DEBUG_FS) | 205 | #if defined(CONFIG_DEBUG_FS) |
| 206 | .debugfs_init = virtio_gpu_debugfs_init, | 206 | .debugfs_init = virtio_gpu_debugfs_init, |
| 207 | #endif | 207 | #endif |
| 208 | .prime_handle_to_fd = drm_gem_prime_handle_to_fd, | ||
| 209 | .prime_fd_to_handle = drm_gem_prime_fd_to_handle, | ||
| 208 | .gem_prime_export = drm_gem_prime_export, | 210 | .gem_prime_export = drm_gem_prime_export, |
| 209 | .gem_prime_import = drm_gem_prime_import, | 211 | .gem_prime_import = drm_gem_prime_import, |
| 210 | .gem_prime_pin = virtgpu_gem_prime_pin, | 212 | .gem_prime_pin = virtgpu_gem_prime_pin, |
| 211 | .gem_prime_unpin = virtgpu_gem_prime_unpin, | 213 | .gem_prime_unpin = virtgpu_gem_prime_unpin, |
| 214 | .gem_prime_get_sg_table = virtgpu_gem_prime_get_sg_table, | ||
| 215 | .gem_prime_import_sg_table = virtgpu_gem_prime_import_sg_table, | ||
| 212 | .gem_prime_vmap = virtgpu_gem_prime_vmap, | 216 | .gem_prime_vmap = virtgpu_gem_prime_vmap, |
| 213 | .gem_prime_vunmap = virtgpu_gem_prime_vunmap, | 217 | .gem_prime_vunmap = virtgpu_gem_prime_vunmap, |
| 214 | .gem_prime_mmap = virtgpu_gem_prime_mmap, | 218 | .gem_prime_mmap = virtgpu_gem_prime_mmap, |
| @@ -354,6 +354,10 @@ int virtio_gpu_object_wait(struct virtio_gpu_object *bo, bool no_wait); · 353 unmodified lines | |||
| 354 | /* virtgpu_prime.c */ | 354 | /* virtgpu_prime.c */ |
| 355 | int virtgpu_gem_prime_pin(struct drm_gem_object *obj); | 355 | int virtgpu_gem_prime_pin(struct drm_gem_object *obj); |
| 356 | void virtgpu_gem_prime_unpin(struct drm_gem_object *obj); | 356 | void virtgpu_gem_prime_unpin(struct drm_gem_object *obj); |
| 357 | struct sg_table *virtgpu_gem_prime_get_sg_table(struct drm_gem_object *obj); | ||
| 358 | struct drm_gem_object *virtgpu_gem_prime_import_sg_table( | ||
| 359 | struct drm_device *dev, struct dma_buf_attachment *attach, | ||
| 360 | struct sg_table *sgt); | ||
| 357 | void *virtgpu_gem_prime_vmap(struct drm_gem_object *obj); | 361 | void *virtgpu_gem_prime_vmap(struct drm_gem_object *obj); |
| 358 | void virtgpu_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr); | 362 | void virtgpu_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr); |
| 359 | int virtgpu_gem_prime_mmap(struct drm_gem_object *obj, | 363 | int virtgpu_gem_prime_mmap(struct drm_gem_object *obj, |
| @@ -39,6 +39,18 @@ void virtgpu_gem_prime_unpin(struct drm_gem_object *obj) · 38 unmodified lines | |||
| 39 | WARN_ONCE(1, "not implemented"); | 39 | WARN_ONCE(1, "not implemented"); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | struct sg_table *virtgpu_gem_prime_get_sg_table(struct drm_gem_object *obj) | ||
| 43 | { | ||
| 44 | return ERR_PTR(-ENODEV); | ||
| 45 | } | ||
| 46 | |||
| 47 | struct drm_gem_object *virtgpu_gem_prime_import_sg_table( | ||
| 48 | struct drm_device *dev, struct dma_buf_attachment *attach, | ||
| 49 | struct sg_table *table) | ||
| 50 | { | ||
| 51 | return ERR_PTR(-ENODEV); | ||
| 52 | } | ||
| 53 | |||
| 42 | void *virtgpu_gem_prime_vmap(struct drm_gem_object *obj) | 54 | void *virtgpu_gem_prime_vmap(struct drm_gem_object *obj) |
| 43 | { | 55 | { |
| 44 | struct virtio_gpu_object *bo = gem_to_virtio_gpu_obj(obj); | 56 | struct virtio_gpu_object *bo = gem_to_virtio_gpu_obj(obj); |
| @@ -114,9 +114,13 @@ static inline void synchronize_syncpt_base(struct host1x_job *job) · 113 unmodified lines | |||
| 114 | 114 | ||
| 115 | static void host1x_channel_set_streamid(struct host1x_channel *channel) | 115 | static void host1x_channel_set_streamid(struct host1x_channel *channel) |
| 116 | { | 116 | { |
| 117 | #if IS_ENABLED(CONFIG_IOMMU_API) && HOST1X_HW >= 6 | 117 | #if HOST1X_HW >= 6 |
| 118 | u32 sid = 0x7f; | ||
| 119 | #ifdef CONFIG_IOMMU_API | ||
| 118 | struct iommu_fwspec *spec = dev_iommu_fwspec_get(channel->dev->parent); | 120 | struct iommu_fwspec *spec = dev_iommu_fwspec_get(channel->dev->parent); |
| 119 | u32 sid = spec ? spec->ids[0] & 0xffff : 0x7f; | 121 | if (spec) |
| 122 | sid = spec->ids[0] & 0xffff; | ||
| 123 | #endif | ||
| 120 | 124 | ||
| 121 | host1x_ch_writel(channel, sid, HOST1X_CHANNEL_SMMU_STREAMID); | 125 | host1x_ch_writel(channel, sid, HOST1X_CHANNEL_SMMU_STREAMID); |
| 122 | #endif | 126 | #endif |
| @@ -680,6 +680,14 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel · 679 unmodified lines | |||
| 680 | break; | 680 | break; |
| 681 | } | 681 | } |
| 682 | 682 | ||
| 683 | if ((usage->hid & 0xf0) == 0xb0) { /* SC - Display */ | ||
| 684 | switch (usage->hid & 0xf) { | ||
| 685 | case 0x05: map_key_clear(KEY_SWITCHVIDEOMODE); break; | ||
| 686 | default: goto ignore; | ||
| 687 | } | ||
| 688 | break; | ||
| 689 | } | ||
| 690 | |||
| 683 | /* | 691 | /* |
| 684 | * Some lazy vendors declare 255 usages for System Control, | 692 | * Some lazy vendors declare 255 usages for System Control, |
| 685 | * leading to the creation of ABS_X|Y axis and too many others. | 693 | * leading to the creation of ABS_X|Y axis and too many others. |
| @@ -902,7 +910,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel · 216 unmodified lines | |||
| 902 | case 0x06a: map_key_clear(KEY_GREEN); break; | 910 | case 0x06a: map_key_clear(KEY_GREEN); break; |
| 903 | case 0x06b: map_key_clear(KEY_BLUE); break; | 911 | case 0x06b: map_key_clear(KEY_BLUE); break; |
| 904 | case 0x06c: map_key_clear(KEY_YELLOW); break; | 912 | case 0x06c: map_key_clear(KEY_YELLOW); break; |
| 905 | case 0x06d: map_key_clear(KEY_ZOOM); break; | 913 | case 0x06d: map_key_clear(KEY_ASPECT_RATIO); break; |
| 906 | 914 | ||
| 907 | case 0x06f: map_key_clear(KEY_BRIGHTNESSUP); break; | 915 | case 0x06f: map_key_clear(KEY_BRIGHTNESSUP); break; |
| 908 | case 0x070: map_key_clear(KEY_BRIGHTNESSDOWN); break; | 916 | case 0x070: map_key_clear(KEY_BRIGHTNESSDOWN); break; |
| @@ -911,6 +919,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel · 2 unmodified lines | |||
| 911 | case 0x074: map_key_clear(KEY_BRIGHTNESS_MAX); break; | 919 | case 0x074: map_key_clear(KEY_BRIGHTNESS_MAX); break; |
| 912 | case 0x075: map_key_clear(KEY_BRIGHTNESS_AUTO); break; | 920 | case 0x075: map_key_clear(KEY_BRIGHTNESS_AUTO); break; |
| 913 | 921 | ||
| 922 | case 0x079: map_key_clear(KEY_KBDILLUMUP); break; | ||
| 923 | case 0x07a: map_key_clear(KEY_KBDILLUMDOWN); break; | ||
| 924 | case 0x07c: map_key_clear(KEY_KBDILLUMTOGGLE); break; | ||
| 925 | |||
| 914 | case 0x082: map_key_clear(KEY_VIDEO_NEXT); break; | 926 | case 0x082: map_key_clear(KEY_VIDEO_NEXT); break; |
| 915 | case 0x083: map_key_clear(KEY_LAST); break; | 927 | case 0x083: map_key_clear(KEY_LAST); break; |
| 916 | case 0x084: map_key_clear(KEY_ENTER); break; | 928 | case 0x084: map_key_clear(KEY_ENTER); break; |
| @@ -1022,6 +1034,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel · 105 unmodified lines | |||
| 1022 | case 0x22d: map_key_clear(KEY_ZOOMIN); break; | 1034 | case 0x22d: map_key_clear(KEY_ZOOMIN); break; |
| 1023 | case 0x22e: map_key_clear(KEY_ZOOMOUT); break; | 1035 | case 0x22e: map_key_clear(KEY_ZOOMOUT); break; |
| 1024 | case 0x22f: map_key_clear(KEY_ZOOMRESET); break; | 1036 | case 0x22f: map_key_clear(KEY_ZOOMRESET); break; |
| 1037 | case 0x232: map_key_clear(KEY_FULL_SCREEN); break; | ||
| 1025 | case 0x233: map_key_clear(KEY_SCROLLUP); break; | 1038 | case 0x233: map_key_clear(KEY_SCROLLUP); break; |
| 1026 | case 0x234: map_key_clear(KEY_SCROLLDOWN); break; | 1039 | case 0x234: map_key_clear(KEY_SCROLLDOWN); break; |
| 1027 | case 0x238: /* AC Pan */ | 1040 | case 0x238: /* AC Pan */ |
| @@ -1045,6 +1058,8 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel · 17 unmodified lines | |||
| 1045 | case 0x2cb: map_key_clear(KEY_KBDINPUTASSIST_ACCEPT); break; | 1058 | case 0x2cb: map_key_clear(KEY_KBDINPUTASSIST_ACCEPT); break; |
| 1046 | case 0x2cc: map_key_clear(KEY_KBDINPUTASSIST_CANCEL); break; | 1059 | case 0x2cc: map_key_clear(KEY_KBDINPUTASSIST_CANCEL); break; |
| 1047 | 1060 | ||
| 1061 | case 0x29f: map_key_clear(KEY_SCALE); break; | ||
| 1062 | |||
| 1048 | default: map_key_clear(KEY_UNKNOWN); | 1063 | default: map_key_clear(KEY_UNKNOWN); |
| 1049 | } | 1064 | } |
| 1050 | break; | 1065 | break; |
| @@ -1980,7 +1980,6 @@ of_i3c_master_add_i3c_boardinfo(struct i3c_master_controller *master, · 1979 unmodified lines | |||
| 1980 | { | 1980 | { |
| 1981 | struct i3c_dev_boardinfo *boardinfo; | 1981 | struct i3c_dev_boardinfo *boardinfo; |
| 1982 | struct device *dev = &master->dev; | 1982 | struct device *dev = &master->dev; |
| 1983 | struct i3c_device_info info = { }; | ||
| 1984 | enum i3c_addr_slot_status addrstatus; | 1983 | enum i3c_addr_slot_status addrstatus; |
| 1985 | u32 init_dyn_addr = 0; | 1984 | u32 init_dyn_addr = 0; |
| 1986 | 1985 | ||
| @@ -2012,8 +2011,8 @@ of_i3c_master_add_i3c_boardinfo(struct i3c_master_controller *master, · 25 unmodified lines | |||
| 2012 | 2011 | ||
| 2013 | boardinfo->pid = ((u64)reg[1] << 32) | reg[2]; | 2012 | boardinfo->pid = ((u64)reg[1] << 32) | reg[2]; |
| 2014 | 2013 | ||
| 2015 | if ((info.pid & GENMASK_ULL(63, 48)) || | 2014 | if ((boardinfo->pid & GENMASK_ULL(63, 48)) || |
| 2016 | I3C_PID_RND_LOWER_32BITS(info.pid)) | 2015 | I3C_PID_RND_LOWER_32BITS(boardinfo->pid)) |
| 2017 | return -EINVAL; | 2016 | return -EINVAL; |
| 2018 | 2017 | ||
| 2019 | boardinfo->init_dyn_addr = init_dyn_addr; | 2018 | boardinfo->init_dyn_addr = init_dyn_addr; |
| @@ -300,7 +300,7 @@ to_dw_i3c_master(struct i3c_master_controller *master) · 299 unmodified lines | |||
| 300 | 300 | ||
| 301 | static void dw_i3c_master_disable(struct dw_i3c_master *master) | 301 | static void dw_i3c_master_disable(struct dw_i3c_master *master) |
| 302 | { | 302 | { |
| 303 | writel(readl(master->regs + DEVICE_CTRL) & DEV_CTRL_ENABLE, | 303 | writel(readl(master->regs + DEVICE_CTRL) & ~DEV_CTRL_ENABLE, |
| 304 | master->regs + DEVICE_CTRL); | 304 | master->regs + DEVICE_CTRL); |
| 305 | } | 305 | } |
| 306 | 306 | ||
| @@ -1437,6 +1437,8 @@ static int kxcjk1013_resume(struct device *dev) · 1436 unmodified lines | |||
| 1437 | 1437 | ||
| 1438 | mutex_lock(&data->mutex); | 1438 | mutex_lock(&data->mutex); |
| 1439 | ret = kxcjk1013_set_mode(data, OPERATION); | 1439 | ret = kxcjk1013_set_mode(data, OPERATION); |
| 1440 | if (ret == 0) | ||
| 1441 | ret = kxcjk1013_set_range(data, data->range); | ||
| 1440 | mutex_unlock(&data->mutex); | 1442 | mutex_unlock(&data->mutex); |
| 1441 | 1443 | ||
| 1442 | return ret; | 1444 | return ret; |
| @@ -121,6 +121,7 @@ static int ad_sd_read_reg_raw(struct ad_sigma_delta *sigma_delta, · 120 unmodified lines | |||
| 121 | if (sigma_delta->info->has_registers) { | 121 | if (sigma_delta->info->has_registers) { |
| 122 | data[0] = reg << sigma_delta->info->addr_shift; | 122 | data[0] = reg << sigma_delta->info->addr_shift; |
| 123 | data[0] |= sigma_delta->info->read_mask; | 123 | data[0] |= sigma_delta->info->read_mask; |
| 124 | data[0] |= sigma_delta->comm; | ||
| 124 | spi_message_add_tail(&t[0], &m); | 125 | spi_message_add_tail(&t[0], &m); |
| 125 | } | 126 | } |
| 126 | spi_message_add_tail(&t[1], &m); | 127 | spi_message_add_tail(&t[1], &m); |
| @@ -704,23 +704,29 @@ static int at91_adc_read_raw(struct iio_dev *idev, · 703 unmodified lines | |||
| 704 | ret = wait_event_interruptible_timeout(st->wq_data_avail, | 704 | ret = wait_event_interruptible_timeout(st->wq_data_avail, |
| 705 | st->done, | 705 | st->done, |
| 706 | msecs_to_jiffies(1000)); | 706 | msecs_to_jiffies(1000)); |
| 707 | if (ret == 0) | ||
| 708 | ret = -ETIMEDOUT; | ||
| 709 | if (ret < 0) { | ||
| 710 | mutex_unlock(&st->lock); | ||
| 711 | return ret; | ||
| 712 | } | ||
| 713 | |||
| 714 | *val = st->last_value; | ||
| 715 | 707 | ||
| 708 | /* Disable interrupts, regardless if adc conversion was | ||
| 709 | * successful or not | ||
| 710 | */ | ||
| 716 | at91_adc_writel(st, AT91_ADC_CHDR, | 711 | at91_adc_writel(st, AT91_ADC_CHDR, |
| 717 | AT91_ADC_CH(chan->channel)); | 712 | AT91_ADC_CH(chan->channel)); |
| 718 | at91_adc_writel(st, AT91_ADC_IDR, BIT(chan->channel)); | 713 | at91_adc_writel(st, AT91_ADC_IDR, BIT(chan->channel)); |
| 719 | 714 | ||
| 720 | st->last_value = 0; | 715 | if (ret > 0) { |
| 721 | st->done = false; | 716 | /* a valid conversion took place */ |
| 717 | *val = st->last_value; | ||
| 718 | st->last_value = 0; | ||
| 719 | st->done = false; | ||
| 720 | ret = IIO_VAL_INT; | ||
| 721 | } else if (ret == 0) { | ||
| 722 | /* conversion timeout */ | ||
| 723 | dev_err(&idev->dev, "ADC Channel %d timeout.\n", | ||
| 724 | chan->channel); | ||
| 725 | ret = -ETIMEDOUT; | ||
| 726 | } | ||
| 727 | |||
| 722 | mutex_unlock(&st->lock); | 728 | mutex_unlock(&st->lock); |
| 723 | return IIO_VAL_INT; | 729 | return ret; |
| 724 | 730 | ||
| 725 | case IIO_CHAN_INFO_SCALE: | 731 | case IIO_CHAN_INFO_SCALE: |
| 726 | *val = st->vref_mv; | 732 | *val = st->vref_mv; |
| @@ -1292,6 +1292,7 @@ static int xadc_probe(struct platform_device *pdev) · 1291 unmodified lines | |||
| 1292 | 1292 | ||
| 1293 | err_free_irq: | 1293 | err_free_irq: |
| 1294 | free_irq(xadc->irq, indio_dev); | 1294 | free_irq(xadc->irq, indio_dev); |
| 1295 | cancel_delayed_work_sync(&xadc->zynq_unmask_work); | ||
| 1295 | err_clk_disable_unprepare: | 1296 | err_clk_disable_unprepare: |
| 1296 | clk_disable_unprepare(xadc->clk); | 1297 | clk_disable_unprepare(xadc->clk); |
| 1297 | err_free_samplerate_trigger: | 1298 | err_free_samplerate_trigger: |
| @@ -1321,8 +1322,8 @@ static int xadc_remove(struct platform_device *pdev) · 23 unmodified lines | |||
| 1321 | iio_triggered_buffer_cleanup(indio_dev); | 1322 | iio_triggered_buffer_cleanup(indio_dev); |
| 1322 | } | 1323 | } |
| 1323 | free_irq(xadc->irq, indio_dev); | 1324 | free_irq(xadc->irq, indio_dev); |
| 1325 | cancel_delayed_work_sync(&xadc->zynq_unmask_work); | ||
| 1324 | clk_disable_unprepare(xadc->clk); | 1326 | clk_disable_unprepare(xadc->clk); |
| 1325 | cancel_delayed_work(&xadc->zynq_unmask_work); | ||
| 1326 | kfree(xadc->data); | 1327 | kfree(xadc->data); |
| 1327 | kfree(indio_dev->channels); | 1328 | kfree(indio_dev->channels); |
| 1328 | 1329 | ||
| @@ -64,6 +64,7 @@ config IAQCORE · 63 unmodified lines | |||
| 64 | config PMS7003 | 64 | config PMS7003 |
| 65 | tristate "Plantower PMS7003 particulate matter sensor" | 65 | tristate "Plantower PMS7003 particulate matter sensor" |
| 66 | depends on SERIAL_DEV_BUS | 66 | depends on SERIAL_DEV_BUS |
| 67 | select IIO_TRIGGERED_BUFFER | ||
| 67 | help | 68 | help |
| 68 | Say Y here to build support for the Plantower PMS7003 particulate | 69 | Say Y here to build support for the Plantower PMS7003 particulate |
| 69 | matter sensor. | 70 | matter sensor. |
| @@ -71,6 +72,19 @@ config PMS7003 · 1 unmodified line | |||
| 71 | To compile this driver as a module, choose M here: the module will | 72 | To compile this driver as a module, choose M here: the module will |
| 72 | be called pms7003. | 73 | be called pms7003. |
| 73 | 74 | ||
| 75 | config SENSIRION_SGP30 | ||
| 76 | tristate "Sensirion SGPxx gas sensors" | ||
| 77 | depends on I2C | ||
| 78 | select CRC8 | ||
| 79 | help | ||
| 80 | Say Y here to build I2C interface support for the following | ||
| 81 | Sensirion SGP gas sensors: | ||
| 82 | * SGP30 gas sensor | ||
| 83 | * SGPC3 low power gas sensor | ||
| 84 | |||
| 85 | To compile this driver as module, choose M here: the | ||
| 86 | module will be called sgp30. | ||
| 87 | |||
| 74 | config SPS30 | 88 | config SPS30 |
| 75 | tristate "SPS30 particulate matter sensor" | 89 | tristate "SPS30 particulate matter sensor" |
| 76 | depends on I2C | 90 | depends on I2C |
| @@ -2,11 +2,9 @@ · 1 unmodified line | |||
| 2 | #ifndef BME680_H_ | 2 | #ifndef BME680_H_ |
| 3 | #define BME680_H_ | 3 | #define BME680_H_ |
| 4 | 4 | ||
| 5 | #define BME680_REG_CHIP_I2C_ID 0xD0 | 5 | #define BME680_REG_CHIP_ID 0xD0 |
| 6 | #define BME680_REG_CHIP_SPI_ID 0x50 | ||
| 7 | #define BME680_CHIP_ID_VAL 0x61 | 6 | #define BME680_CHIP_ID_VAL 0x61 |
| 8 | #define BME680_REG_SOFT_RESET_I2C 0xE0 | 7 | #define BME680_REG_SOFT_RESET 0xE0 |
| 9 | #define BME680_REG_SOFT_RESET_SPI 0x60 | ||
| 10 | #define BME680_CMD_SOFTRESET 0xB6 | 8 | #define BME680_CMD_SOFTRESET 0xB6 |
| 11 | #define BME680_REG_STATUS 0x73 | 9 | #define BME680_REG_STATUS 0x73 |
| 12 | #define BME680_SPI_MEM_PAGE_BIT BIT(4) | 10 | #define BME680_SPI_MEM_PAGE_BIT BIT(4) |
| @@ -63,9 +63,23 @@ struct bme680_data { · 62 unmodified lines | |||
| 63 | s32 t_fine; | 63 | s32 t_fine; |
| 64 | }; | 64 | }; |
| 65 | 65 | ||
| 66 | static const struct regmap_range bme680_volatile_ranges[] = { | ||
| 67 | regmap_reg_range(BME680_REG_MEAS_STAT_0, BME680_REG_GAS_R_LSB), | ||
| 68 | regmap_reg_range(BME680_REG_STATUS, BME680_REG_STATUS), | ||
| 69 | regmap_reg_range(BME680_T2_LSB_REG, BME680_GH3_REG), | ||
| 70 | }; | ||
| 71 | |||
| 72 | static const struct regmap_access_table bme680_volatile_table = { | ||
| 73 | .yes_ranges = bme680_volatile_ranges, | ||
| 74 | .n_yes_ranges = ARRAY_SIZE(bme680_volatile_ranges), | ||
| 75 | }; | ||
| 76 | |||
| 66 | const struct regmap_config bme680_regmap_config = { | 77 | const struct regmap_config bme680_regmap_config = { |
| 67 | .reg_bits = 8, | 78 | .reg_bits = 8, |
| 68 | .val_bits = 8, | 79 | .val_bits = 8, |
| 80 | .max_register = 0xef, | ||
| 81 | .volatile_table = &bme680_volatile_table, | ||
| 82 | .cache_type = REGCACHE_RBTREE, | ||
| 69 | }; | 83 | }; |
| 70 | EXPORT_SYMBOL(bme680_regmap_config); | 84 | EXPORT_SYMBOL(bme680_regmap_config); |
| 71 | 85 | ||
| @@ -316,6 +330,10 @@ static s16 bme680_compensate_temp(struct bme680_data *data, · 244 unmodified lines | |||
| 316 | s64 var1, var2, var3; | 330 | s64 var1, var2, var3; |
| 317 | s16 calc_temp; | 331 | s16 calc_temp; |
| 318 | 332 | ||
| 333 | /* If the calibration is invalid, attempt to reload it */ | ||
| 334 | if (!calib->par_t2) | ||
| 335 | bme680_read_calib(data, calib); | ||
| 336 | |||
| 319 | var1 = (adc_temp >> 3) - (calib->par_t1 << 1); | 337 | var1 = (adc_temp >> 3) - (calib->par_t1 << 1); |
| 320 | var2 = (var1 * calib->par_t2) >> 11; | 338 | var2 = (var1 * calib->par_t2) >> 11; |
| 321 | var3 = ((var1 >> 1) * (var1 >> 1)) >> 12; | 339 | var3 = ((var1 >> 1) * (var1 >> 1)) >> 12; |
| @@ -583,8 +601,7 @@ static int bme680_gas_config(struct bme680_data *data) · 261 unmodified lines | |||
| 583 | return ret; | 601 | return ret; |
| 584 | } | 602 | } |
| 585 | 603 | ||
| 586 | static int bme680_read_temp(struct bme680_data *data, | 604 | static int bme680_read_temp(struct bme680_data *data, int *val) |
| 587 | int *val, int *val2) | ||
| 588 | { | 605 | { |
| 589 | struct device *dev = regmap_get_device(data->regmap); | 606 | struct device *dev = regmap_get_device(data->regmap); |
| 590 | int ret; | 607 | int ret; |
| @@ -617,10 +634,9 @@ static int bme680_read_temp(struct bme680_data *data, · 26 unmodified lines | |||
| 617 | * compensate_press/compensate_humid to get compensated | 634 | * compensate_press/compensate_humid to get compensated |
| 618 | * pressure/humidity readings. | 635 | * pressure/humidity readings. |
| 619 | */ | 636 | */ |
| 620 | if (val && val2) { | 637 | if (val) { |
| 621 | *val = comp_temp; | 638 | *val = comp_temp * 10; /* Centidegrees to millidegrees */ |
| 622 | *val2 = 100; | 639 | return IIO_VAL_INT; |
| 623 | return IIO_VAL_FRACTIONAL; | ||
| 624 | } | 640 | } |
| 625 | 641 | ||
| 626 | return ret; | 642 | return ret; |
| @@ -635,7 +651,7 @@ static int bme680_read_press(struct bme680_data *data, · 8 unmodified lines | |||
| 635 | s32 adc_press; | 651 | s32 adc_press; |
| 636 | 652 | ||
| 637 | /* Read and compensate temperature to get a reading of t_fine */ | 653 | /* Read and compensate temperature to get a reading of t_fine */ |
| 638 | ret = bme680_read_temp(data, NULL, NULL); | 654 | ret = bme680_read_temp(data, NULL); |
| 639 | if (ret < 0) | 655 | if (ret < 0) |
| 640 | return ret; | 656 | return ret; |
| 641 | 657 | ||
| @@ -668,7 +684,7 @@ static int bme680_read_humid(struct bme680_data *data, · 26 unmodified lines | |||
| 668 | u32 comp_humidity; | 684 | u32 comp_humidity; |
| 669 | 685 | ||
| 670 | /* Read and compensate temperature to get a reading of t_fine */ | 686 | /* Read and compensate temperature to get a reading of t_fine */ |
| 671 | ret = bme680_read_temp(data, NULL, NULL); | 687 | ret = bme680_read_temp(data, NULL); |
| 672 | if (ret < 0) | 688 | if (ret < 0) |
| 673 | return ret; | 689 | return ret; |
| 674 | 690 | ||
| @@ -761,7 +777,7 @@ static int bme680_read_raw(struct iio_dev *indio_dev, · 86 unmodified lines | |||
| 761 | case IIO_CHAN_INFO_PROCESSED: | 777 | case IIO_CHAN_INFO_PROCESSED: |
| 762 | switch (chan->type) { | 778 | switch (chan->type) { |
| 763 | case IIO_TEMP: | 779 | case IIO_TEMP: |
| 764 | return bme680_read_temp(data, val, val2); | 780 | return bme680_read_temp(data, val); |
| 765 | case IIO_PRESSURE: | 781 | case IIO_PRESSURE: |
| 766 | return bme680_read_press(data, val, val2); | 782 | return bme680_read_press(data, val, val2); |
| 767 | case IIO_HUMIDITYRELATIVE: | 783 | case IIO_HUMIDITYRELATIVE: |
| @@ -867,8 +883,28 @@ int bme680_core_probe(struct device *dev, struct regmap *regmap, · 99 unmodified lines | |||
| 867 | { | 883 | { |
| 868 | struct iio_dev *indio_dev; | 884 | struct iio_dev *indio_dev; |
| 869 | struct bme680_data *data; | 885 | struct bme680_data *data; |
| 886 | unsigned int val; | ||
| 870 | int ret; | 887 | int ret; |
| 871 | 888 | ||
| 889 | ret = regmap_write(regmap, BME680_REG_SOFT_RESET, | ||
| 890 | BME680_CMD_SOFTRESET); | ||
| 891 | if (ret < 0) { | ||
| 892 | dev_err(dev, "Failed to reset chip\n"); | ||
| 893 | return ret; | ||
| 894 | } | ||
| 895 | |||
| 896 | ret = regmap_read(regmap, BME680_REG_CHIP_ID, &val); | ||
| 897 | if (ret < 0) { | ||
| 898 | dev_err(dev, "Error reading chip ID\n"); | ||
| 899 | return ret; | ||
| 900 | } | ||
| 901 | |||
| 902 | if (val != BME680_CHIP_ID_VAL) { | ||
| 903 | dev_err(dev, "Wrong chip ID, got %x expected %x\n", | ||
| 904 | val, BME680_CHIP_ID_VAL); | ||
| 905 | return -ENODEV; | ||
| 906 | } | ||
| 907 | |||
| 872 | indio_dev = devm_iio_device_alloc(dev, sizeof(*data)); | 908 | indio_dev = devm_iio_device_alloc(dev, sizeof(*data)); |
| 873 | if (!indio_dev) | 909 | if (!indio_dev) |
| 874 | return -ENOMEM; | 910 | return -ENOMEM; |
| @@ -23,8 +23,6 @@ static int bme680_i2c_probe(struct i2c_client *client, · 22 unmodified lines | |||
| 23 | { | 23 | { |
| 24 | struct regmap *regmap; | 24 | struct regmap *regmap; |
| 25 | const char *name = NULL; | 25 | const char *name = NULL; |
| 26 | unsigned int val; | ||
| 27 | int ret; | ||
| 28 | 26 | ||
| 29 | regmap = devm_regmap_init_i2c(client, &bme680_regmap_config); | 27 | regmap = devm_regmap_init_i2c(client, &bme680_regmap_config); |
| 30 | if (IS_ERR(regmap)) { | 28 | if (IS_ERR(regmap)) { |
| @@ -33,25 +31,6 @@ static int bme680_i2c_probe(struct i2c_client *client, · 2 unmodified lines | |||
| 33 | return PTR_ERR(regmap); | 31 | return PTR_ERR(regmap); |
| 34 | } | 32 | } |
| 35 | 33 | ||
| 36 | ret = regmap_write(regmap, BME680_REG_SOFT_RESET_I2C, | ||
| 37 | BME680_CMD_SOFTRESET); | ||
| 38 | if (ret < 0) { | ||
| 39 | dev_err(&client->dev, "Failed to reset chip\n"); | ||
| 40 | return ret; | ||
| 41 | } | ||
| 42 | |||
| 43 | ret = regmap_read(regmap, BME680_REG_CHIP_I2C_ID, &val); | ||
| 44 | if (ret < 0) { | ||
| 45 | dev_err(&client->dev, "Error reading I2C chip ID\n"); | ||
| 46 | return ret; | ||
| 47 | } | ||
| 48 | |||
| 49 | if (val != BME680_CHIP_ID_VAL) { | ||
| 50 | dev_err(&client->dev, "Wrong chip ID, got %x expected %x\n", | ||
| 51 | val, BME680_CHIP_ID_VAL); | ||
| 52 | return -ENODEV; | ||
| 53 | } | ||
| 54 | |||
| 55 | if (id) | 34 | if (id) |
| 56 | name = id->name; | 35 | name = id->name; |
| 57 | 36 | ||
| @@ -12,28 +12,93 @@ · 11 unmodified lines | |||
| 12 | 12 | ||
| 13 | #include "bme680.h" | 13 | #include "bme680.h" |
| 14 | 14 | ||
| 15 | struct bme680_spi_bus_context { | ||
| 16 | struct spi_device *spi; | ||
| 17 | u8 current_page; | ||
| 18 | }; | ||
| 19 | |||
| 20 | /* | ||
| 21 | * In SPI mode there are only 7 address bits, a "page" register determines | ||
| 22 | * which part of the 8-bit range is active. This function looks at the address | ||
| 23 | * and writes the page selection bit if needed | ||
| 24 | */ | ||
| 25 | static int bme680_regmap_spi_select_page( | ||
| 26 | struct bme680_spi_bus_context *ctx, u8 reg) | ||
| 27 | { | ||
| 28 | struct spi_device *spi = ctx->spi; | ||
| 29 | int ret; | ||
| 30 | u8 buf[2]; | ||
| 31 | u8 page = (reg & 0x80) ? 0 : 1; /* Page "1" is low range */ | ||
| 32 | |||
| 33 | if (page == ctx->current_page) | ||
| 34 | return 0; | ||
| 35 | |||
| 36 | /* | ||
| 37 | * Data sheet claims we're only allowed to change bit 4, so we must do | ||
| 38 | * a read-modify-write on each and every page select | ||
| 39 | */ | ||
| 40 | buf[0] = BME680_REG_STATUS; | ||
| 41 | ret = spi_write_then_read(spi, buf, 1, buf + 1, 1); | ||
| 42 | if (ret < 0) { | ||
| 43 | dev_err(&spi->dev, "failed to set page %u\n", page); | ||
| 44 | return ret; | ||
| 45 | } | ||
| 46 | |||
| 47 | buf[0] = BME680_REG_STATUS; | ||
| 48 | if (page) | ||
| 49 | buf[1] |= BME680_SPI_MEM_PAGE_BIT; | ||
| 50 | else | ||
| 51 | buf[1] &= ~BME680_SPI_MEM_PAGE_BIT; | ||
| 52 | |||
| 53 | ret = spi_write(spi, buf, 2); | ||
| 54 | if (ret < 0) { | ||
| 55 | dev_err(&spi->dev, "failed to set page %u\n", page); | ||
| 56 | return ret; | ||
| 57 | } | ||
| 58 | |||
| 59 | ctx->current_page = page; | ||
| 60 | |||
| 61 | return 0; | ||
| 62 | } | ||
| 63 | |||
| 15 | static int bme680_regmap_spi_write(void *context, const void *data, | 64 | static int bme680_regmap_spi_write(void *context, const void *data, |
| 16 | size_t count) | 65 | size_t count) |
| 17 | { | 66 | { |
| 18 | struct spi_device *spi = context; | 67 | struct bme680_spi_bus_context *ctx = context; |
| 68 | struct spi_device *spi = ctx->spi; | ||
| 69 | int ret; | ||
| 19 | u8 buf[2]; | 70 | u8 buf[2]; |
| 20 | 71 | ||
| 21 | memcpy(buf, data, 2); | 72 | memcpy(buf, data, 2); |
| 73 | |||
| 74 | ret = bme680_regmap_spi_select_page(ctx, buf[0]); | ||
| 75 | if (ret) | ||
| 76 | return ret; | ||
| 77 | |||
| 22 | /* | 78 | /* |
| 23 | * The SPI register address (= full register address without bit 7) | 79 | * The SPI register address (= full register address without bit 7) |
| 24 | * and the write command (bit7 = RW = '0') | 80 | * and the write command (bit7 = RW = '0') |
| 25 | */ | 81 | */ |
| 26 | buf[0] &= ~0x80; | 82 | buf[0] &= ~0x80; |
| 27 | 83 | ||
| 28 | return spi_write_then_read(spi, buf, 2, NULL, 0); | 84 | return spi_write(spi, buf, 2); |
| 29 | } | 85 | } |
| 30 | 86 | ||
| 31 | static int bme680_regmap_spi_read(void *context, const void *reg, | 87 | static int bme680_regmap_spi_read(void *context, const void *reg, |
| 32 | size_t reg_size, void *val, size_t val_size) | 88 | size_t reg_size, void *val, size_t val_size) |
| 33 | { | 89 | { |
| 34 | struct spi_device *spi = context; | 90 | struct bme680_spi_bus_context *ctx = context; |
| 91 | struct spi_device *spi = ctx->spi; | ||
| 92 | int ret; | ||
| 93 | u8 addr = *(const u8 *)reg; | ||
| 94 | |||
| 95 | ret = bme680_regmap_spi_select_page(ctx, addr); | ||
| 96 | if (ret) | ||
| 97 | return ret; | ||
| 35 | 98 | ||
| 36 | return spi_write_then_read(spi, reg, reg_size, val, val_size); | 99 | addr |= 0x80; /* bit7 = RW = '1' */ |
| 100 | |||
| 101 | return spi_write_then_read(spi, &addr, 1, val, val_size); | ||
| 37 | } | 102 | } |
| 38 | 103 | ||
| 39 | static struct regmap_bus bme680_regmap_bus = { | 104 | static struct regmap_bus bme680_regmap_bus = { |
| @@ -46,8 +111,8 @@ static struct regmap_bus bme680_regmap_bus = { · 6 unmodified lines | |||
| 46 | static int bme680_spi_probe(struct spi_device *spi) | 111 | static int bme680_spi_probe(struct spi_device *spi) |
| 47 | { | 112 | { |
| 48 | const struct spi_device_id *id = spi_get_device_id(spi); | 113 | const struct spi_device_id *id = spi_get_device_id(spi); |
| 114 | struct bme680_spi_bus_context *bus_context; | ||
| 49 | struct regmap *regmap; | 115 | struct regmap *regmap; |
| 50 | unsigned int val; | ||
| 51 | int ret; | 116 | int ret; |
| 52 | 117 | ||
| 53 | spi->bits_per_word = 8; | 118 | spi->bits_per_word = 8; |
| @@ -57,45 +122,21 @@ static int bme680_spi_probe(struct spi_device *spi) · 3 unmodified lines | |||
| 57 | return ret; | 122 | return ret; |
| 58 | } | 123 | } |
| 59 | 124 | ||
| 125 | bus_context = devm_kzalloc(&spi->dev, sizeof(*bus_context), GFP_KERNEL); | ||
| 126 | if (!bus_context) | ||
| 127 | return -ENOMEM; | ||
| 128 | |||
| 129 | bus_context->spi = spi; | ||
| 130 | bus_context->current_page = 0xff; /* Undefined on warm boot */ | ||
| 131 | |||
| 60 | regmap = devm_regmap_init(&spi->dev, &bme680_regmap_bus, | 132 | regmap = devm_regmap_init(&spi->dev, &bme680_regmap_bus, |
| 61 | &spi->dev, &bme680_regmap_config); | 133 | bus_context, &bme680_regmap_config); |
| 62 | if (IS_ERR(regmap)) { | 134 | if (IS_ERR(regmap)) { |
| 63 | dev_err(&spi->dev, "Failed to register spi regmap %d\n", | 135 | dev_err(&spi->dev, "Failed to register spi regmap %d\n", |
| 64 | (int)PTR_ERR(regmap)); | 136 | (int)PTR_ERR(regmap)); |
| 65 | return PTR_ERR(regmap); | 137 | return PTR_ERR(regmap); |
| 66 | } | 138 | } |
| 67 | 139 | ||
| 68 | ret = regmap_write(regmap, BME680_REG_SOFT_RESET_SPI, | ||
| 69 | BME680_CMD_SOFTRESET); | ||
| 70 | if (ret < 0) { | ||
| 71 | dev_err(&spi->dev, "Failed to reset chip\n"); | ||
| 72 | return ret; | ||
| 73 | } | ||
| 74 | |||
| 75 | /* after power-on reset, Page 0(0x80-0xFF) of spi_mem_page is active */ | ||
| 76 | ret = regmap_read(regmap, BME680_REG_CHIP_SPI_ID, &val); | ||
| 77 | if (ret < 0) { | ||
| 78 | dev_err(&spi->dev, "Error reading SPI chip ID\n"); | ||
| 79 | return ret; | ||
| 80 | } | ||
| 81 | |||
| 82 | if (val != BME680_CHIP_ID_VAL) { | ||
| 83 | dev_err(&spi->dev, "Wrong chip ID, got %x expected %x\n", | ||
| 84 | val, BME680_CHIP_ID_VAL); | ||
| 85 | return -ENODEV; | ||
| 86 | } | ||
| 87 | /* | ||
| 88 | * select Page 1 of spi_mem_page to enable access to | ||
| 89 | * to registers from address 0x00 to 0x7F. | ||
| 90 | */ | ||
| 91 | ret = regmap_write_bits(regmap, BME680_REG_STATUS, | ||
| 92 | BME680_SPI_MEM_PAGE_BIT, | ||
| 93 | BME680_SPI_MEM_PAGE_1_VAL); | ||
| 94 | if (ret < 0) { | ||
| 95 | dev_err(&spi->dev, "failed to set page 1 of spi_mem_page\n"); | ||
| 96 | return ret; | ||
| 97 | } | ||
| 98 | |||
| 99 | return bme680_core_probe(&spi->dev, regmap, id->name); | 140 | return bme680_core_probe(&spi->dev, regmap, id->name); |
| 100 | } | 141 | } |
| 101 | 142 | ||
| @@ -103,9 +103,10 @@ static int cros_ec_sensors_read(struct iio_dev *indio_dev, · 102 unmodified lines | |||
| 103 | * Do not use IIO_DEGREE_TO_RAD to avoid precision | 103 | * Do not use IIO_DEGREE_TO_RAD to avoid precision |
| 104 | * loss. Round to the nearest integer. | 104 | * loss. Round to the nearest integer. |
| 105 | */ | 105 | */ |
| 106 | *val = div_s64(val64 * 314159 + 9000000ULL, 1000); | 106 | *val = 0; |
| 107 | *val2 = 18000 << (CROS_EC_SENSOR_BITS - 1); | 107 | *val2 = div_s64(val64 * 3141592653ULL, |
| 108 | ret = IIO_VAL_FRACTIONAL; | 108 | 180 << (CROS_EC_SENSOR_BITS - 1)); |
| 109 | ret = IIO_VAL_INT_PLUS_NANO; | ||
| 109 | break; | 110 | break; |
| 110 | case MOTIONSENSE_TYPE_MAG: | 111 | case MOTIONSENSE_TYPE_MAG: |
| 111 | /* | 112 | /* |
| @@ -92,6 +92,7 @@ static ssize_t mcp4725_store_eeprom(struct device *dev, · 91 unmodified lines | |||
| 92 | 92 | ||
| 93 | inoutbuf[0] = 0x60; /* write EEPROM */ | 93 | inoutbuf[0] = 0x60; /* write EEPROM */ |
| 94 | inoutbuf[0] |= data->ref_mode << 3; | 94 | inoutbuf[0] |= data->ref_mode << 3; |
| 95 | inoutbuf[0] |= data->powerdown ? ((data->powerdown_mode + 1) << 1) : 0; | ||
| 95 | inoutbuf[1] = data->dac_value >> 4; | 96 | inoutbuf[1] = data->dac_value >> 4; |
| 96 | inoutbuf[2] = (data->dac_value & 0xf) << 4; | 97 | inoutbuf[2] = (data->dac_value & 0xf) << 4; |
| 97 | 98 | ||
| @@ -582,11 +582,10 @@ static int bmg160_read_raw(struct iio_dev *indio_dev, · 581 unmodified lines | |||
| 582 | case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY: | 582 | case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY: |
| 583 | return bmg160_get_filter(data, val); | 583 | return bmg160_get_filter(data, val); |
| 584 | case IIO_CHAN_INFO_SCALE: | 584 | case IIO_CHAN_INFO_SCALE: |
| 585 | *val = 0; | ||
| 586 | switch (chan->type) { | 585 | switch (chan->type) { |
| 587 | case IIO_TEMP: | 586 | case IIO_TEMP: |
| 588 | *val2 = 500000; | 587 | *val = 500; |
| 589 | return IIO_VAL_INT_PLUS_MICRO; | 588 | return IIO_VAL_INT; |
| 590 | case IIO_ANGL_VEL: | 589 | case IIO_ANGL_VEL: |
| 591 | { | 590 | { |
| 592 | int i; | 591 | int i; |
| @@ -594,6 +593,7 @@ static int bmg160_read_raw(struct iio_dev *indio_dev, · 1 unmodified line | |||
| 594 | for (i = 0; i < ARRAY_SIZE(bmg160_scale_table); ++i) { | 593 | for (i = 0; i < ARRAY_SIZE(bmg160_scale_table); ++i) { |
| 595 | if (bmg160_scale_table[i].dps_range == | 594 | if (bmg160_scale_table[i].dps_range == |
| 596 | data->dps_range) { | 595 | data->dps_range) { |
| 596 | *val = 0; | ||
| 597 | *val2 = bmg160_scale_table[i].scale; | 597 | *val2 = bmg160_scale_table[i].scale; |
| 598 | return IIO_VAL_INT_PLUS_MICRO; | 598 | return IIO_VAL_INT_PLUS_MICRO; |
| 599 | } | 599 | } |
| @@ -29,7 +29,8 @@ · 28 unmodified lines | |||
| 29 | 29 | ||
| 30 | #include "mpu3050.h" | 30 | #include "mpu3050.h" |
| 31 | 31 | ||
| 32 | #define MPU3050_CHIP_ID 0x69 | 32 | #define MPU3050_CHIP_ID 0x68 |
| 33 | #define MPU3050_CHIP_ID_MASK 0x7E | ||
| 33 | 34 | ||
| 34 | /* | 35 | /* |
| 35 | * Register map: anything suffixed *_H is a big-endian high byte and always | 36 | * Register map: anything suffixed *_H is a big-endian high byte and always |
| @@ -1176,8 +1177,9 @@ int mpu3050_common_probe(struct device *dev, · 1140 unmodified lines | |||
| 1176 | goto err_power_down; | 1177 | goto err_power_down; |
| 1177 | } | 1178 | } |
| 1178 | 1179 | ||
| 1179 | if (val != MPU3050_CHIP_ID) { | 1180 | if ((val & MPU3050_CHIP_ID_MASK) != MPU3050_CHIP_ID) { |
| 1180 | dev_err(dev, "unsupported chip id %02x\n", (u8)val); | 1181 | dev_err(dev, "unsupported chip id %02x\n", |
| 1182 | (u8)(val & MPU3050_CHIP_ID_MASK)); | ||
| 1181 | ret = -ENODEV; | 1183 | ret = -ENODEV; |
| 1182 | goto err_power_down; | 1184 | goto err_power_down; |
| 1183 | } | 1185 | } |
| @@ -320,9 +320,8 @@ static int iio_scan_mask_set(struct iio_dev *indio_dev, · 319 unmodified lines | |||
| 320 | const unsigned long *mask; | 320 | const unsigned long *mask; |
| 321 | unsigned long *trialmask; | 321 | unsigned long *trialmask; |
| 322 | 322 | ||
| 323 | trialmask = kmalloc_array(BITS_TO_LONGS(indio_dev->masklength), | 323 | trialmask = kcalloc(BITS_TO_LONGS(indio_dev->masklength), |
| 324 | sizeof(*trialmask), | 324 | sizeof(*trialmask), GFP_KERNEL); |
| 325 | GFP_KERNEL); | ||
| 326 | if (trialmask == NULL) | 325 | if (trialmask == NULL) |
| 327 | return -ENOMEM; | 326 | return -ENOMEM; |
| 328 | if (!indio_dev->masklength) { | 327 | if (!indio_dev->masklength) { |
| @@ -1743,10 +1743,10 @@ EXPORT_SYMBOL(__iio_device_register); · 1742 unmodified lines | |||
| 1743 | **/ | 1743 | **/ |
| 1744 | void iio_device_unregister(struct iio_dev *indio_dev) | 1744 | void iio_device_unregister(struct iio_dev *indio_dev) |
| 1745 | { | 1745 | { |
| 1746 | mutex_lock(&indio_dev->info_exist_lock); | ||
| 1747 | |||
| 1748 | cdev_device_del(&indio_dev->chrdev, &indio_dev->dev); | 1746 | cdev_device_del(&indio_dev->chrdev, &indio_dev->dev); |
| 1749 | 1747 | ||
| 1748 | mutex_lock(&indio_dev->info_exist_lock); | ||
| 1749 | |||
| 1750 | iio_device_unregister_debugfs(indio_dev); | 1750 | iio_device_unregister_debugfs(indio_dev); |
| 1751 | 1751 | ||
| 1752 | iio_disable_all_buffers(indio_dev); | 1752 | iio_disable_all_buffers(indio_dev); |
| @@ -993,6 +993,8 @@ void uverbs_user_mmap_disassociate(struct ib_uverbs_file *ufile) · 992 unmodified lines | |||
| 993 | * will only be one mm, so no big deal. | 993 | * will only be one mm, so no big deal. |
| 994 | */ | 994 | */ |
| 995 | down_write(&mm->mmap_sem); | 995 | down_write(&mm->mmap_sem); |
| 996 | if (!mmget_still_valid(mm)) | ||
| 997 | goto skip_mm; | ||
| 996 | mutex_lock(&ufile->umap_lock); | 998 | mutex_lock(&ufile->umap_lock); |
| 997 | list_for_each_entry_safe (priv, next_priv, &ufile->umaps, | 999 | list_for_each_entry_safe (priv, next_priv, &ufile->umaps, |
| 998 | list) { | 1000 | list) { |
| @@ -1007,6 +1009,7 @@ void uverbs_user_mmap_disassociate(struct ib_uverbs_file *ufile) · 8 unmodified lines | |||
| 1007 | vma->vm_flags &= ~(VM_SHARED | VM_MAYSHARE); | 1009 | vma->vm_flags &= ~(VM_SHARED | VM_MAYSHARE); |
| 1008 | } | 1010 | } |
| 1009 | mutex_unlock(&ufile->umap_lock); | 1011 | mutex_unlock(&ufile->umap_lock); |
| 1012 | skip_mm: | ||
| 1010 | up_write(&mm->mmap_sem); | 1013 | up_write(&mm->mmap_sem); |
| 1011 | mmput(mm); | 1014 | mmput(mm); |
| 1012 | } | 1015 | } |
| @@ -148,6 +148,9 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev) · 147 unmodified lines | |||
| 148 | return error; | 148 | return error; |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | pdata->input = input; | ||
| 152 | platform_set_drvdata(pdev, pdata); | ||
| 153 | |||
| 151 | error = devm_request_irq(&pdev->dev, pdata->irq, | 154 | error = devm_request_irq(&pdev->dev, pdata->irq, |
| 152 | imx_snvs_pwrkey_interrupt, | 155 | imx_snvs_pwrkey_interrupt, |
| 153 | 0, pdev->name, pdev); | 156 | 0, pdev->name, pdev); |
| @@ -163,9 +166,6 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev) · 9 unmodified lines | |||
| 163 | return error; | 166 | return error; |
| 164 | } | 167 | } |
| 165 | 168 | ||
| 166 | pdata->input = input; | ||
| 167 | platform_set_drvdata(pdev, pdata); | ||
| 168 | |||
| 169 | device_init_wakeup(&pdev->dev, pdata->wakeup); | 169 | device_init_wakeup(&pdev->dev, pdata->wakeup); |
| 170 | 170 | ||
| 171 | return 0; | 171 | return 0; |
| @@ -1339,21 +1339,46 @@ static const struct acpi_device_id elan_acpi_id[] = { · 1338 unmodified lines | |||
| 1339 | { "ELAN0600", 0 }, | 1339 | { "ELAN0600", 0 }, |
| 1340 | { "ELAN0601", 0 }, | 1340 | { "ELAN0601", 0 }, |
| 1341 | { "ELAN0602", 0 }, | 1341 | { "ELAN0602", 0 }, |
| 1342 | { "ELAN0603", 0 }, | ||
| 1343 | { "ELAN0604", 0 }, | ||
| 1342 | { "ELAN0605", 0 }, | 1344 | { "ELAN0605", 0 }, |
| 1345 | { "ELAN0606", 0 }, | ||
| 1346 | { "ELAN0607", 0 }, | ||
| 1343 | { "ELAN0608", 0 }, | 1347 | { "ELAN0608", 0 }, |
| 1344 | { "ELAN0609", 0 }, | 1348 | { "ELAN0609", 0 }, |
| 1345 | { "ELAN060B", 0 }, | 1349 | { "ELAN060B", 0 }, |
| 1346 | { "ELAN060C", 0 }, | 1350 | { "ELAN060C", 0 }, |
| 1351 | { "ELAN060F", 0 }, | ||
| 1352 | { "ELAN0610", 0 }, | ||
| 1347 | { "ELAN0611", 0 }, | 1353 | { "ELAN0611", 0 }, |
| 1348 | { "ELAN0612", 0 }, | 1354 | { "ELAN0612", 0 }, |
| 1355 | { "ELAN0615", 0 }, | ||
| 1356 | { "ELAN0616", 0 }, | ||
| 1349 | { "ELAN0617", 0 }, | 1357 | { "ELAN0617", 0 }, |
| 1350 | { "ELAN0618", 0 }, | 1358 | { "ELAN0618", 0 }, |
| 1359 | { "ELAN0619", 0 }, | ||
| 1360 | { "ELAN061A", 0 }, | ||
| 1361 | { "ELAN061B", 0 }, | ||
| 1351 | { "ELAN061C", 0 }, | 1362 | { "ELAN061C", 0 }, |
| 1352 | { "ELAN061D", 0 }, | 1363 | { "ELAN061D", 0 }, |
| 1353 | { "ELAN061E", 0 }, | 1364 | { "ELAN061E", 0 }, |
| 1365 | { "ELAN061F", 0 }, | ||
| 1354 | { "ELAN0620", 0 }, | 1366 | { "ELAN0620", 0 }, |
| 1355 | { "ELAN0621", 0 }, | 1367 | { "ELAN0621", 0 }, |
| 1356 | { "ELAN0622", 0 }, | 1368 | { "ELAN0622", 0 }, |
| 1369 | { "ELAN0623", 0 }, | ||
| 1370 | { "ELAN0624", 0 }, | ||
| 1371 | { "ELAN0625", 0 }, | ||
| 1372 | { "ELAN0626", 0 }, | ||
| 1373 | { "ELAN0627", 0 }, | ||
| 1374 | { "ELAN0628", 0 }, | ||
| 1375 | { "ELAN0629", 0 }, | ||
| 1376 | { "ELAN062A", 0 }, | ||
| 1377 | { "ELAN062B", 0 }, | ||
| 1378 | { "ELAN062C", 0 }, | ||
| 1379 | { "ELAN062D", 0 }, | ||
| 1380 | { "ELAN0631", 0 }, | ||
| 1381 | { "ELAN0632", 0 }, | ||
| 1357 | { "ELAN1000", 0 }, | 1382 | { "ELAN1000", 0 }, |
| 1358 | { } | 1383 | { } |
| 1359 | }; | 1384 | }; |
| @@ -22,6 +22,15 @@ · 21 unmodified lines | |||
| 22 | #define AR71XX_RESET_REG_MISC_INT_ENABLE 4 | 22 | #define AR71XX_RESET_REG_MISC_INT_ENABLE 4 |
| 23 | 23 | ||
| 24 | #define ATH79_MISC_IRQ_COUNT 32 | 24 | #define ATH79_MISC_IRQ_COUNT 32 |
| 25 | #define ATH79_MISC_PERF_IRQ 5 | ||
| 26 | |||
| 27 | static int ath79_perfcount_irq; | ||
| 28 | |||
| 29 | int get_c0_perfcount_int(void) | ||
| 30 | { | ||
| 31 | return ath79_perfcount_irq; | ||
| 32 | } | ||
| 33 | EXPORT_SYMBOL_GPL(get_c0_perfcount_int); | ||
| 25 | 34 | ||
| 26 | static void ath79_misc_irq_handler(struct irq_desc *desc) | 35 | static void ath79_misc_irq_handler(struct irq_desc *desc) |
| 27 | { | 36 | { |
| @@ -113,6 +122,8 @@ static void __init ath79_misc_intc_domain_init( · 85 unmodified lines | |||
| 113 | { | 122 | { |
| 114 | void __iomem *base = domain->host_data; | 123 | void __iomem *base = domain->host_data; |
| 115 | 124 | ||
| 125 | ath79_perfcount_irq = irq_create_mapping(domain, ATH79_MISC_PERF_IRQ); | ||
| 126 | |||
| 116 | /* Disable and clear all interrupts */ | 127 | /* Disable and clear all interrupts */ |
| 117 | __raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_ENABLE); | 128 | __raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_ENABLE); |
| 118 | __raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_STATUS); | 129 | __raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_STATUS); |
| @@ -1184,6 +1184,7 @@ static int fastrpc_cb_probe(struct platform_device *pdev) · 1183 unmodified lines | |||
| 1184 | struct fastrpc_session_ctx *sess; | 1184 | struct fastrpc_session_ctx *sess; |
| 1185 | struct device *dev = &pdev->dev; | 1185 | struct device *dev = &pdev->dev; |
| 1186 | int i, sessions = 0; | 1186 | int i, sessions = 0; |
| 1187 | int rc; | ||
| 1187 | 1188 | ||
| 1188 | cctx = dev_get_drvdata(dev->parent); | 1189 | cctx = dev_get_drvdata(dev->parent); |
| 1189 | if (!cctx) | 1190 | if (!cctx) |
| @@ -1213,7 +1214,11 @@ static int fastrpc_cb_probe(struct platform_device *pdev) · 23 unmodified lines | |||
| 1213 | } | 1214 | } |
| 1214 | cctx->sesscount++; | 1215 | cctx->sesscount++; |
| 1215 | spin_unlock(&cctx->lock); | 1216 | spin_unlock(&cctx->lock); |
| 1216 | dma_set_mask(dev, DMA_BIT_MASK(32)); | 1217 | rc = dma_set_mask(dev, DMA_BIT_MASK(32)); |
| 1218 | if (rc) { | ||
| 1219 | dev_err(dev, "32-bit DMA enable failed\n"); | ||
| 1220 | return rc; | ||
| 1221 | } | ||
| 1217 | 1222 | ||
| 1218 | return 0; | 1223 | return 0; |
| 1219 | } | 1224 | } |
| @@ -1688,12 +1688,11 @@ static void goya_init_golden_registers(struct hl_device *hdev) · 1687 unmodified lines | |||
| 1688 | 1688 | ||
| 1689 | /* | 1689 | /* |
| 1690 | * Workaround for H2 #HW-23 bug | 1690 | * Workaround for H2 #HW-23 bug |
| 1691 | * Set DMA max outstanding read requests to 240 on DMA CH 1. Set it | 1691 | * Set DMA max outstanding read requests to 240 on DMA CH 1. |
| 1692 | * to 16 on KMD DMA | 1692 | * This limitation is still large enough to not affect Gen4 bandwidth. |
| 1693 | * We need to limit only these DMAs because the user can only read | 1693 | * We need to only limit that DMA channel because the user can only read |
| 1694 | * from Host using DMA CH 1 | 1694 | * from Host using DMA CH 1 |
| 1695 | */ | 1695 | */ |
| 1696 | WREG32(mmDMA_CH_0_CFG0, 0x0fff0010); | ||
| 1697 | WREG32(mmDMA_CH_1_CFG0, 0x0fff00F0); | 1696 | WREG32(mmDMA_CH_1_CFG0, 0x0fff00F0); |
| 1698 | 1697 | ||
| 1699 | goya->hw_cap_initialized |= HW_CAP_GOLDEN; | 1698 | goya->hw_cap_initialized |= HW_CAP_GOLDEN; |
| @@ -3693,7 +3692,7 @@ static int goya_validate_dma_pkt_mmu(struct hl_device *hdev, · 1993 unmodified lines | |||
| 3693 | * WA for HW-23. | 3692 | * WA for HW-23. |
| 3694 | * We can't allow user to read from Host using QMANs other than 1. | 3693 | * We can't allow user to read from Host using QMANs other than 1. |
| 3695 | */ | 3694 | */ |
| 3696 | if (parser->hw_queue_id > GOYA_QUEUE_ID_DMA_1 && | 3695 | if (parser->hw_queue_id != GOYA_QUEUE_ID_DMA_1 && |
| 3697 | hl_mem_area_inside_range(le64_to_cpu(user_dma_pkt->src_addr), | 3696 | hl_mem_area_inside_range(le64_to_cpu(user_dma_pkt->src_addr), |
| 3698 | le32_to_cpu(user_dma_pkt->tsize), | 3697 | le32_to_cpu(user_dma_pkt->tsize), |
| 3699 | hdev->asic_prop.va_space_host_start_address, | 3698 | hdev->asic_prop.va_space_host_start_address, |
| @@ -1721,7 +1721,7 @@ static void atl1_inc_smb(struct atl1_adapter *adapter) · 1720 unmodified lines | |||
| 1721 | adapter->soft_stats.scc += smb->tx_1_col; | 1721 | adapter->soft_stats.scc += smb->tx_1_col; |
| 1722 | adapter->soft_stats.mcc += smb->tx_2_col; | 1722 | adapter->soft_stats.mcc += smb->tx_2_col; |
| 1723 | adapter->soft_stats.latecol += smb->tx_late_col; | 1723 | adapter->soft_stats.latecol += smb->tx_late_col; |
| 1724 | adapter->soft_stats.tx_underun += smb->tx_underrun; | 1724 | adapter->soft_stats.tx_underrun += smb->tx_underrun; |
| 1725 | adapter->soft_stats.tx_trunc += smb->tx_trunc; | 1725 | adapter->soft_stats.tx_trunc += smb->tx_trunc; |
| 1726 | adapter->soft_stats.tx_pause += smb->tx_pause; | 1726 | adapter->soft_stats.tx_pause += smb->tx_pause; |
| 1727 | 1727 | ||
| @@ -3179,7 +3179,7 @@ static struct atl1_stats atl1_gstrings_stats[] = { · 1451 unmodified lines | |||
| 3179 | {"tx_deferred_ok", ATL1_STAT(soft_stats.deffer)}, | 3179 | {"tx_deferred_ok", ATL1_STAT(soft_stats.deffer)}, |
| 3180 | {"tx_single_coll_ok", ATL1_STAT(soft_stats.scc)}, | 3180 | {"tx_single_coll_ok", ATL1_STAT(soft_stats.scc)}, |
| 3181 | {"tx_multi_coll_ok", ATL1_STAT(soft_stats.mcc)}, | 3181 | {"tx_multi_coll_ok", ATL1_STAT(soft_stats.mcc)}, |
| 3182 | {"tx_underun", ATL1_STAT(soft_stats.tx_underun)}, | 3182 | {"tx_underrun", ATL1_STAT(soft_stats.tx_underrun)}, |
| 3183 | {"tx_trunc", ATL1_STAT(soft_stats.tx_trunc)}, | 3183 | {"tx_trunc", ATL1_STAT(soft_stats.tx_trunc)}, |
| 3184 | {"tx_pause", ATL1_STAT(soft_stats.tx_pause)}, | 3184 | {"tx_pause", ATL1_STAT(soft_stats.tx_pause)}, |
| 3185 | {"rx_pause", ATL1_STAT(soft_stats.rx_pause)}, | 3185 | {"rx_pause", ATL1_STAT(soft_stats.rx_pause)}, |
| @@ -681,7 +681,7 @@ struct atl1_sft_stats { · 680 unmodified lines | |||
| 681 | u64 scc; /* packets TX after a single collision */ | 681 | u64 scc; /* packets TX after a single collision */ |
| 682 | u64 mcc; /* packets TX after multiple collisions */ | 682 | u64 mcc; /* packets TX after multiple collisions */ |
| 683 | u64 latecol; /* TX packets w/ late collisions */ | 683 | u64 latecol; /* TX packets w/ late collisions */ |
| 684 | u64 tx_underun; /* TX packets aborted due to TX FIFO underrun | 684 | u64 tx_underrun; /* TX packets aborted due to TX FIFO underrun |
| 685 | * or TRD FIFO underrun */ | 685 | * or TRD FIFO underrun */ |
| 686 | u64 tx_trunc; /* TX packets truncated due to size > MTU */ | 686 | u64 tx_trunc; /* TX packets truncated due to size > MTU */ |
| 687 | u64 rx_pause; /* num Pause packets received. */ | 687 | u64 rx_pause; /* num Pause packets received. */ |
| @@ -553,7 +553,7 @@ static void atl2_intr_tx(struct atl2_adapter *adapter) · 552 unmodified lines | |||
| 553 | netdev->stats.tx_aborted_errors++; | 553 | netdev->stats.tx_aborted_errors++; |
| 554 | if (txs->late_col) | 554 | if (txs->late_col) |
| 555 | netdev->stats.tx_window_errors++; | 555 | netdev->stats.tx_window_errors++; |
| 556 | if (txs->underun) | 556 | if (txs->underrun) |
| 557 | netdev->stats.tx_fifo_errors++; | 557 | netdev->stats.tx_fifo_errors++; |
| 558 | } while (1); | 558 | } while (1); |
| 559 | 559 | ||
| @@ -260,7 +260,7 @@ struct tx_pkt_status { · 259 unmodified lines | |||
| 260 | unsigned multi_col:1; | 260 | unsigned multi_col:1; |
| 261 | unsigned late_col:1; | 261 | unsigned late_col:1; |
| 262 | unsigned abort_col:1; | 262 | unsigned abort_col:1; |
| 263 | unsigned underun:1; /* current packet is aborted | 263 | unsigned underrun:1; /* current packet is aborted |
| 264 | * due to txram underrun */ | 264 | * due to txram underrun */ |
| 265 | unsigned:3; /* reserved */ | 265 | unsigned:3; /* reserved */ |
| 266 | unsigned update:1; /* always 1'b1 in tx_status_buf */ | 266 | unsigned update:1; /* always 1'b1 in tx_status_buf */ |
| @@ -33,6 +33,26 @@ · 32 unmodified lines | |||
| 33 | #include <linux/bpf_trace.h> | 33 | #include <linux/bpf_trace.h> |
| 34 | #include "en/xdp.h" | 34 | #include "en/xdp.h" |
| 35 | 35 | ||
| 36 | int mlx5e_xdp_max_mtu(struct mlx5e_params *params) | ||
| 37 | { | ||
| 38 | int hr = NET_IP_ALIGN + XDP_PACKET_HEADROOM; | ||
| 39 | |||
| 40 | /* Let S := SKB_DATA_ALIGN(sizeof(struct skb_shared_info)). | ||
| 41 | * The condition checked in mlx5e_rx_is_linear_skb is: | ||
| 42 | * SKB_DATA_ALIGN(sw_mtu + hard_mtu + hr) + S <= PAGE_SIZE (1) | ||
| 43 | * (Note that hw_mtu == sw_mtu + hard_mtu.) | ||
| 44 | * What is returned from this function is: | ||
| 45 | * max_mtu = PAGE_SIZE - S - hr - hard_mtu (2) | ||
| 46 | * After assigning sw_mtu := max_mtu, the left side of (1) turns to | ||
| 47 | * SKB_DATA_ALIGN(PAGE_SIZE - S) + S, which is equal to PAGE_SIZE, | ||
| 48 | * because both PAGE_SIZE and S are already aligned. Any number greater | ||
| 49 | * than max_mtu would make the left side of (1) greater than PAGE_SIZE, | ||
| 50 | * so max_mtu is the maximum MTU allowed. | ||
| 51 | */ | ||
| 52 | |||
| 53 | return MLX5E_HW2SW_MTU(params, SKB_MAX_HEAD(hr)); | ||
| 54 | } | ||
| 55 | |||
| 36 | static inline bool | 56 | static inline bool |
| 37 | mlx5e_xmit_xdp_buff(struct mlx5e_xdpsq *sq, struct mlx5e_dma_info *di, | 57 | mlx5e_xmit_xdp_buff(struct mlx5e_xdpsq *sq, struct mlx5e_dma_info *di, |
| 38 | struct xdp_buff *xdp) | 58 | struct xdp_buff *xdp) |
| @@ -310,9 +330,9 @@ bool mlx5e_poll_xdpsq_cq(struct mlx5e_cq *cq, struct mlx5e_rq *rq) · 271 unmodified lines | |||
| 310 | mlx5e_xdpi_fifo_pop(xdpi_fifo); | 330 | mlx5e_xdpi_fifo_pop(xdpi_fifo); |
| 311 | 331 | ||
| 312 | if (is_redirect) { | 332 | if (is_redirect) { |
| 313 | xdp_return_frame(xdpi.xdpf); | ||
| 314 | dma_unmap_single(sq->pdev, xdpi.dma_addr, | 333 | dma_unmap_single(sq->pdev, xdpi.dma_addr, |
| 315 | xdpi.xdpf->len, DMA_TO_DEVICE); | 334 | xdpi.xdpf->len, DMA_TO_DEVICE); |
| 335 | xdp_return_frame(xdpi.xdpf); | ||
| 316 | } else { | 336 | } else { |
| 317 | /* Recycle RX page */ | 337 | /* Recycle RX page */ |
| 318 | mlx5e_page_release(rq, &xdpi.di, true); | 338 | mlx5e_page_release(rq, &xdpi.di, true); |
| @@ -351,9 +371,9 @@ void mlx5e_free_xdpsq_descs(struct mlx5e_xdpsq *sq, struct mlx5e_rq *rq) · 32 unmodified lines | |||
| 351 | mlx5e_xdpi_fifo_pop(xdpi_fifo); | 371 | mlx5e_xdpi_fifo_pop(xdpi_fifo); |
| 352 | 372 | ||
| 353 | if (is_redirect) { | 373 | if (is_redirect) { |
| 354 | xdp_return_frame(xdpi.xdpf); | ||
| 355 | dma_unmap_single(sq->pdev, xdpi.dma_addr, | 374 | dma_unmap_single(sq->pdev, xdpi.dma_addr, |
| 356 | xdpi.xdpf->len, DMA_TO_DEVICE); | 375 | xdpi.xdpf->len, DMA_TO_DEVICE); |
| 376 | xdp_return_frame(xdpi.xdpf); | ||
| 357 | } else { | 377 | } else { |
| 358 | /* Recycle RX page */ | 378 | /* Recycle RX page */ |
| 359 | mlx5e_page_release(rq, &xdpi.di, false); | 379 | mlx5e_page_release(rq, &xdpi.di, false); |
| @@ -34,13 +34,12 @@ · 33 unmodified lines | |||
| 34 | 34 | ||
| 35 | #include "en.h" | 35 | #include "en.h" |
| 36 | 36 | ||
| 37 | #define MLX5E_XDP_MAX_MTU ((int)(PAGE_SIZE - \ | ||
| 38 | MLX5_SKB_FRAG_SZ(XDP_PACKET_HEADROOM))) | ||
| 39 | #define MLX5E_XDP_MIN_INLINE (ETH_HLEN + VLAN_HLEN) | 37 | #define MLX5E_XDP_MIN_INLINE (ETH_HLEN + VLAN_HLEN) |
| 40 | #define MLX5E_XDP_TX_EMPTY_DS_COUNT \ | 38 | #define MLX5E_XDP_TX_EMPTY_DS_COUNT \ |
| 41 | (sizeof(struct mlx5e_tx_wqe) / MLX5_SEND_WQE_DS) | 39 | (sizeof(struct mlx5e_tx_wqe) / MLX5_SEND_WQE_DS) |
| 42 | #define MLX5E_XDP_TX_DS_COUNT (MLX5E_XDP_TX_EMPTY_DS_COUNT + 1 /* SG DS */) | 40 | #define MLX5E_XDP_TX_DS_COUNT (MLX5E_XDP_TX_EMPTY_DS_COUNT + 1 /* SG DS */) |
| 43 | 41 | ||
| 42 | int mlx5e_xdp_max_mtu(struct mlx5e_params *params); | ||
| 44 | bool mlx5e_xdp_handle(struct mlx5e_rq *rq, struct mlx5e_dma_info *di, | 43 | bool mlx5e_xdp_handle(struct mlx5e_rq *rq, struct mlx5e_dma_info *di, |
| 45 | void *va, u16 *rx_headroom, u32 *len); | 44 | void *va, u16 *rx_headroom, u32 *len); |
| 46 | bool mlx5e_poll_xdpsq_cq(struct mlx5e_cq *cq, struct mlx5e_rq *rq); | 45 | bool mlx5e_poll_xdpsq_cq(struct mlx5e_cq *cq, struct mlx5e_rq *rq); |
| @@ -1586,7 +1586,7 @@ static int mlx5e_get_module_info(struct net_device *netdev, · 1585 unmodified lines | |||
| 1586 | break; | 1586 | break; |
| 1587 | case MLX5_MODULE_ID_SFP: | 1587 | case MLX5_MODULE_ID_SFP: |
| 1588 | modinfo->type = ETH_MODULE_SFF_8472; | 1588 | modinfo->type = ETH_MODULE_SFF_8472; |
| 1589 | modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN; | 1589 | modinfo->eeprom_len = MLX5_EEPROM_PAGE_LENGTH; |
| 1590 | break; | 1590 | break; |
| 1591 | default: | 1591 | default: |
| 1592 | netdev_err(priv->netdev, "%s: cable type not recognized:0x%x\n", | 1592 | netdev_err(priv->netdev, "%s: cable type not recognized:0x%x\n", |
| @@ -3720,7 +3720,7 @@ int mlx5e_change_mtu(struct net_device *netdev, int new_mtu, · 3719 unmodified lines | |||
| 3720 | if (params->xdp_prog && | 3720 | if (params->xdp_prog && |
| 3721 | !mlx5e_rx_is_linear_skb(&new_channels.params)) { | 3721 | !mlx5e_rx_is_linear_skb(&new_channels.params)) { |
| 3722 | netdev_err(netdev, "MTU(%d) > %d is not allowed while XDP enabled\n", | 3722 | netdev_err(netdev, "MTU(%d) > %d is not allowed while XDP enabled\n", |
| 3723 | new_mtu, MLX5E_XDP_MAX_MTU); | 3723 | new_mtu, mlx5e_xdp_max_mtu(params)); |
| 3724 | err = -EINVAL; | 3724 | err = -EINVAL; |
| 3725 | goto out; | 3725 | goto out; |
| 3726 | } | 3726 | } |
| @@ -4161,7 +4161,8 @@ static int mlx5e_xdp_allowed(struct mlx5e_priv *priv, struct bpf_prog *prog) · 434 unmodified lines | |||
| 4161 | 4161 | ||
| 4162 | if (!mlx5e_rx_is_linear_skb(&new_channels.params)) { | 4162 | if (!mlx5e_rx_is_linear_skb(&new_channels.params)) { |
| 4163 | netdev_warn(netdev, "XDP is not allowed with MTU(%d) > %d\n", | 4163 | netdev_warn(netdev, "XDP is not allowed with MTU(%d) > %d\n", |
| 4164 | new_channels.params.sw_mtu, MLX5E_XDP_MAX_MTU); | 4164 | new_channels.params.sw_mtu, |
| 4165 | mlx5e_xdp_max_mtu(&new_channels.params)); | ||
| 4165 | return -EINVAL; | 4166 | return -EINVAL; |
| 4166 | } | 4167 | } |
| 4167 | 4168 | ||
| @@ -317,10 +317,6 @@ int mlx5_query_module_eeprom(struct mlx5_core_dev *dev, · 316 unmodified lines | |||
| 317 | size -= offset + size - MLX5_EEPROM_PAGE_LENGTH; | 317 | size -= offset + size - MLX5_EEPROM_PAGE_LENGTH; |
| 318 | 318 | ||
| 319 | i2c_addr = MLX5_I2C_ADDR_LOW; | 319 | i2c_addr = MLX5_I2C_ADDR_LOW; |
| 320 | if (offset >= MLX5_EEPROM_PAGE_LENGTH) { | ||
| 321 | i2c_addr = MLX5_I2C_ADDR_HIGH; | ||
| 322 | offset -= MLX5_EEPROM_PAGE_LENGTH; | ||
| 323 | } | ||
| 324 | 320 | ||
| 325 | MLX5_SET(mcia_reg, in, l, 0); | 321 | MLX5_SET(mcia_reg, in, l, 0); |
| 326 | MLX5_SET(mcia_reg, in, module, module_num); | 322 | MLX5_SET(mcia_reg, in, module, module_num); |
| @@ -27,7 +27,7 @@ · 26 unmodified lines | |||
| 27 | 27 | ||
| 28 | #define MLXSW_PCI_SW_RESET 0xF0010 | 28 | #define MLXSW_PCI_SW_RESET 0xF0010 |
| 29 | #define MLXSW_PCI_SW_RESET_RST_BIT BIT(0) | 29 | #define MLXSW_PCI_SW_RESET_RST_BIT BIT(0) |
| 30 | #define MLXSW_PCI_SW_RESET_TIMEOUT_MSECS 13000 | 30 | #define MLXSW_PCI_SW_RESET_TIMEOUT_MSECS 20000 |
| 31 | #define MLXSW_PCI_SW_RESET_WAIT_MSECS 100 | 31 | #define MLXSW_PCI_SW_RESET_WAIT_MSECS 100 |
| 32 | #define MLXSW_PCI_FW_READY 0xA1844 | 32 | #define MLXSW_PCI_FW_READY 0xA1844 |
| 33 | #define MLXSW_PCI_FW_READY_MASK 0xFFFF | 33 | #define MLXSW_PCI_FW_READY_MASK 0xFFFF |
| @@ -3113,11 +3113,11 @@ mlxsw_sp_port_set_link_ksettings(struct net_device *dev, · 3112 unmodified lines | |||
| 3113 | if (err) | 3113 | if (err) |
| 3114 | return err; | 3114 | return err; |
| 3115 | 3115 | ||
| 3116 | mlxsw_sp_port->link.autoneg = autoneg; | ||
| 3117 | |||
| 3116 | if (!netif_running(dev)) | 3118 | if (!netif_running(dev)) |
| 3117 | return 0; | 3119 | return 0; |
| 3118 | 3120 | ||
| 3119 | mlxsw_sp_port->link.autoneg = autoneg; | ||
| 3120 | |||
| 3121 | mlxsw_sp_port_admin_status_set(mlxsw_sp_port, false); | 3121 | mlxsw_sp_port_admin_status_set(mlxsw_sp_port, false); |
| 3122 | mlxsw_sp_port_admin_status_set(mlxsw_sp_port, true); | 3122 | mlxsw_sp_port_admin_status_set(mlxsw_sp_port, true); |
| 3123 | 3123 | ||
| @@ -3303,7 +3303,7 @@ static int mlxsw_sp_port_ets_init(struct mlxsw_sp_port *mlxsw_sp_port) · 179 unmodified lines | |||
| 3303 | err = mlxsw_sp_port_ets_set(mlxsw_sp_port, | 3303 | err = mlxsw_sp_port_ets_set(mlxsw_sp_port, |
| 3304 | MLXSW_REG_QEEC_HIERARCY_TC, | 3304 | MLXSW_REG_QEEC_HIERARCY_TC, |
| 3305 | i + 8, i, | 3305 | i + 8, i, |
| 3306 | false, 0); | 3306 | true, 100); |
| 3307 | if (err) | 3307 | if (err) |
| 3308 | return err; | 3308 | return err; |
| 3309 | } | 3309 | } |
| @@ -39,7 +39,7 @@ nfp_abm_u32_check_knode(struct nfp_abm *abm, struct tc_cls_u32_knode *knode, · 38 unmodified lines | |||
| 39 | } | 39 | } |
| 40 | if (knode->sel->off || knode->sel->offshift || knode->sel->offmask || | 40 | if (knode->sel->off || knode->sel->offshift || knode->sel->offmask || |
| 41 | knode->sel->offoff || knode->fshift) { | 41 | knode->sel->offoff || knode->fshift) { |
| 42 | NL_SET_ERR_MSG_MOD(extack, "variable offseting not supported"); | 42 | NL_SET_ERR_MSG_MOD(extack, "variable offsetting not supported"); |
| 43 | return false; | 43 | return false; |
| 44 | } | 44 | } |
| 45 | if (knode->sel->hoff || knode->sel->hmask) { | 45 | if (knode->sel->hoff || knode->sel->hmask) { |
| @@ -78,7 +78,7 @@ nfp_abm_u32_check_knode(struct nfp_abm *abm, struct tc_cls_u32_knode *knode, · 32 unmodified lines | |||
| 78 | 78 | ||
| 79 | k = &knode->sel->keys[0]; | 79 | k = &knode->sel->keys[0]; |
| 80 | if (k->offmask) { | 80 | if (k->offmask) { |
| 81 | NL_SET_ERR_MSG_MOD(extack, "offset mask - variable offseting not supported"); | 81 | NL_SET_ERR_MSG_MOD(extack, "offset mask - variable offsetting not supported"); |
| 82 | return false; | 82 | return false; |
| 83 | } | 83 | } |
| 84 | if (k->off) { | 84 | if (k->off) { |
| @@ -673,7 +673,8 @@ static void netsec_process_tx(struct netsec_priv *priv) · 672 unmodified lines | |||
| 673 | } | 673 | } |
| 674 | 674 | ||
| 675 | static void *netsec_alloc_rx_data(struct netsec_priv *priv, | 675 | static void *netsec_alloc_rx_data(struct netsec_priv *priv, |
| 676 | dma_addr_t *dma_handle, u16 *desc_len) | 676 | dma_addr_t *dma_handle, u16 *desc_len, |
| 677 | bool napi) | ||
| 677 | { | 678 | { |
| 678 | size_t total_len = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); | 679 | size_t total_len = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); |
| 679 | size_t payload_len = NETSEC_RX_BUF_SZ; | 680 | size_t payload_len = NETSEC_RX_BUF_SZ; |
| @@ -682,7 +683,7 @@ static void *netsec_alloc_rx_data(struct netsec_priv *priv, · 2 unmodified lines | |||
| 682 | 683 | ||
| 683 | total_len += SKB_DATA_ALIGN(payload_len + NETSEC_SKB_PAD); | 684 | total_len += SKB_DATA_ALIGN(payload_len + NETSEC_SKB_PAD); |
| 684 | 685 | ||
| 685 | buf = napi_alloc_frag(total_len); | 686 | buf = napi ? napi_alloc_frag(total_len) : netdev_alloc_frag(total_len); |
| 686 | if (!buf) | 687 | if (!buf) |
| 687 | return NULL; | 688 | return NULL; |
| 688 | 689 | ||
| @@ -765,7 +766,8 @@ static int netsec_process_rx(struct netsec_priv *priv, int budget) · 76 unmodified lines | |||
| 765 | /* allocate a fresh buffer and map it to the hardware. | 766 | /* allocate a fresh buffer and map it to the hardware. |
| 766 | * This will eventually replace the old buffer in the hardware | 767 | * This will eventually replace the old buffer in the hardware |
| 767 | */ | 768 | */ |
| 768 | buf_addr = netsec_alloc_rx_data(priv, &dma_handle, &desc_len); | 769 | buf_addr = netsec_alloc_rx_data(priv, &dma_handle, &desc_len, |
| 770 | true); | ||
| 769 | if (unlikely(!buf_addr)) | 771 | if (unlikely(!buf_addr)) |
| 770 | break; | 772 | break; |
| 771 | 773 | ||
| @@ -1069,7 +1071,8 @@ static int netsec_setup_rx_dring(struct netsec_priv *priv) · 297 unmodified lines | |||
| 1069 | void *buf; | 1071 | void *buf; |
| 1070 | u16 len; | 1072 | u16 len; |
| 1071 | 1073 | ||
| 1072 | buf = netsec_alloc_rx_data(priv, &dma_handle, &len); | 1074 | buf = netsec_alloc_rx_data(priv, &dma_handle, &len, |
| 1075 | false); | ||
| 1073 | if (!buf) { | 1076 | if (!buf) { |
| 1074 | netsec_uninit_pkt_dring(priv, NETSEC_RING_RX); | 1077 | netsec_uninit_pkt_dring(priv, NETSEC_RING_RX); |
| 1075 | goto err_out; | 1078 | goto err_out; |
| @@ -140,7 +140,7 @@ static void ndesc_init_rx_desc(struct dma_desc *p, int disable_rx_ic, int mode, · 139 unmodified lines | |||
| 140 | p->des0 |= cpu_to_le32(RDES0_OWN); | 140 | p->des0 |= cpu_to_le32(RDES0_OWN); |
| 141 | 141 | ||
| 142 | bfsize1 = min(bfsize, BUF_SIZE_2KiB - 1); | 142 | bfsize1 = min(bfsize, BUF_SIZE_2KiB - 1); |
| 143 | p->des1 |= cpu_to_le32(bfsize & RDES1_BUFFER1_SIZE_MASK); | 143 | p->des1 |= cpu_to_le32(bfsize1 & RDES1_BUFFER1_SIZE_MASK); |
| 144 | 144 | ||
| 145 | if (mode == STMMAC_CHAIN_MODE) | 145 | if (mode == STMMAC_CHAIN_MODE) |
| 146 | ndesc_rx_set_on_chain(p, end); | 146 | ndesc_rx_set_on_chain(p, end); |
| @@ -2616,8 +2616,6 @@ static int stmmac_open(struct net_device *dev) · 2615 unmodified lines | |||
| 2616 | u32 chan; | 2616 | u32 chan; |
| 2617 | int ret; | 2617 | int ret; |
| 2618 | 2618 | ||
| 2619 | stmmac_check_ether_addr(priv); | ||
| 2620 | |||
| 2621 | if (priv->hw->pcs != STMMAC_PCS_RGMII && | 2619 | if (priv->hw->pcs != STMMAC_PCS_RGMII && |
| 2622 | priv->hw->pcs != STMMAC_PCS_TBI && | 2620 | priv->hw->pcs != STMMAC_PCS_TBI && |
| 2623 | priv->hw->pcs != STMMAC_PCS_RTBI) { | 2621 | priv->hw->pcs != STMMAC_PCS_RTBI) { |
| @@ -4303,6 +4301,8 @@ int stmmac_dvr_probe(struct device *device, · 1679 unmodified lines | |||
| 4303 | if (ret) | 4301 | if (ret) |
| 4304 | goto error_hw_init; | 4302 | goto error_hw_init; |
| 4305 | 4303 | ||
| 4304 | stmmac_check_ether_addr(priv); | ||
| 4305 | |||
| 4306 | /* Configure real RX and TX queues */ | 4306 | /* Configure real RX and TX queues */ |
| 4307 | netif_set_real_num_rx_queues(ndev, priv->plat->rx_queues_to_use); | 4307 | netif_set_real_num_rx_queues(ndev, priv->plat->rx_queues_to_use); |
| 4308 | netif_set_real_num_tx_queues(ndev, priv->plat->tx_queues_to_use); | 4308 | netif_set_real_num_tx_queues(ndev, priv->plat->tx_queues_to_use); |
| @@ -159,6 +159,12 @@ static const struct dmi_system_id quark_pci_dmi[] = { · 158 unmodified lines | |||
| 159 | }, | 159 | }, |
| 160 | .driver_data = (void *)&galileo_stmmac_dmi_data, | 160 | .driver_data = (void *)&galileo_stmmac_dmi_data, |
| 161 | }, | 161 | }, |
| 162 | /* | ||
| 163 | * There are 2 types of SIMATIC IOT2000: IOT20202 and IOT2040. | ||
| 164 | * The asset tag "6ES7647-0AA00-0YA2" is only for IOT2020 which | ||
| 165 | * has only one pci network device while other asset tags are | ||
| 166 | * for IOT2040 which has two. | ||
| 167 | */ | ||
| 162 | { | 168 | { |
| 163 | .matches = { | 169 | .matches = { |
| 164 | DMI_EXACT_MATCH(DMI_BOARD_NAME, "SIMATIC IOT2000"), | 170 | DMI_EXACT_MATCH(DMI_BOARD_NAME, "SIMATIC IOT2000"), |
| @@ -170,8 +176,6 @@ static const struct dmi_system_id quark_pci_dmi[] = { · 5 unmodified lines | |||
| 170 | { | 176 | { |
| 171 | .matches = { | 177 | .matches = { |
| 172 | DMI_EXACT_MATCH(DMI_BOARD_NAME, "SIMATIC IOT2000"), | 178 | DMI_EXACT_MATCH(DMI_BOARD_NAME, "SIMATIC IOT2000"), |
| 173 | DMI_EXACT_MATCH(DMI_BOARD_ASSET_TAG, | ||
| 174 | "6ES7647-0AA00-1YA2"), | ||
| 175 | }, | 179 | }, |
| 176 | .driver_data = (void *)&iot2040_stmmac_dmi_data, | 180 | .driver_data = (void *)&iot2040_stmmac_dmi_data, |
| 177 | }, | 181 | }, |
| @@ -159,6 +159,14 @@ static const struct spi_device_id ks8995_id[] = { · 158 unmodified lines | |||
| 159 | }; | 159 | }; |
| 160 | MODULE_DEVICE_TABLE(spi, ks8995_id); | 160 | MODULE_DEVICE_TABLE(spi, ks8995_id); |
| 161 | 161 | ||
| 162 | static const struct of_device_id ks8895_spi_of_match[] = { | ||
| 163 | { .compatible = "micrel,ks8995" }, | ||
| 164 | { .compatible = "micrel,ksz8864" }, | ||
| 165 | { .compatible = "micrel,ksz8795" }, | ||
| 166 | { }, | ||
| 167 | }; | ||
| 168 | MODULE_DEVICE_TABLE(of, ks8895_spi_of_match); | ||
| 169 | |||
| 162 | static inline u8 get_chip_id(u8 val) | 170 | static inline u8 get_chip_id(u8 val) |
| 163 | { | 171 | { |
| 164 | return (val >> ID1_CHIPID_S) & ID1_CHIPID_M; | 172 | return (val >> ID1_CHIPID_S) & ID1_CHIPID_M; |
| @@ -526,6 +534,7 @@ static int ks8995_remove(struct spi_device *spi) · 361 unmodified lines | |||
| 526 | static struct spi_driver ks8995_driver = { | 534 | static struct spi_driver ks8995_driver = { |
| 527 | .driver = { | 535 | .driver = { |
| 528 | .name = "spi-ks8995", | 536 | .name = "spi-ks8995", |
| 537 | .of_match_table = of_match_ptr(ks8895_spi_of_match), | ||
| 529 | }, | 538 | }, |
| 530 | .probe = ks8995_probe, | 539 | .probe = ks8995_probe, |
| 531 | .remove = ks8995_remove, | 540 | .remove = ks8995_remove, |
| @@ -1154,6 +1154,13 @@ static int team_port_add(struct team *team, struct net_device *port_dev, · 1153 unmodified lines | |||
| 1154 | return -EINVAL; | 1154 | return -EINVAL; |
| 1155 | } | 1155 | } |
| 1156 | 1156 | ||
| 1157 | if (netdev_has_upper_dev(dev, port_dev)) { | ||
| 1158 | NL_SET_ERR_MSG(extack, "Device is already an upper device of the team interface"); | ||
| 1159 | netdev_err(dev, "Device %s is already an upper device of the team interface\n", | ||
| 1160 | portname); | ||
| 1161 | return -EBUSY; | ||
| 1162 | } | ||
| 1163 | |||
| 1157 | if (port_dev->features & NETIF_F_VLAN_CHALLENGED && | 1164 | if (port_dev->features & NETIF_F_VLAN_CHALLENGED && |
| 1158 | vlan_uses_dev(dev)) { | 1165 | vlan_uses_dev(dev)) { |
| 1159 | NL_SET_ERR_MSG(extack, "Device is VLAN challenged and team device has VLAN set up"); | 1166 | NL_SET_ERR_MSG(extack, "Device is VLAN challenged and team device has VLAN set up"); |
| @@ -873,6 +873,7 @@ static const struct net_device_ops vrf_netdev_ops = { · 872 unmodified lines | |||
| 873 | .ndo_init = vrf_dev_init, | 873 | .ndo_init = vrf_dev_init, |
| 874 | .ndo_uninit = vrf_dev_uninit, | 874 | .ndo_uninit = vrf_dev_uninit, |
| 875 | .ndo_start_xmit = vrf_xmit, | 875 | .ndo_start_xmit = vrf_xmit, |
| 876 | .ndo_set_mac_address = eth_mac_addr, | ||
| 876 | .ndo_get_stats64 = vrf_get_stats64, | 877 | .ndo_get_stats64 = vrf_get_stats64, |
| 877 | .ndo_add_slave = vrf_add_slave, | 878 | .ndo_add_slave = vrf_add_slave, |
| 878 | .ndo_del_slave = vrf_del_slave, | 879 | .ndo_del_slave = vrf_del_slave, |
| @@ -1272,6 +1273,7 @@ static void vrf_setup(struct net_device *dev) · 393 unmodified lines | |||
| 1272 | /* default to no qdisc; user can add if desired */ | 1273 | /* default to no qdisc; user can add if desired */ |
| 1273 | dev->priv_flags |= IFF_NO_QUEUE; | 1274 | dev->priv_flags |= IFF_NO_QUEUE; |
| 1274 | dev->priv_flags |= IFF_NO_RX_HANDLER; | 1275 | dev->priv_flags |= IFF_NO_RX_HANDLER; |
| 1276 | dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; | ||
| 1275 | 1277 | ||
| 1276 | /* VRF devices do not care about MTU, but if the MTU is set | 1278 | /* VRF devices do not care about MTU, but if the MTU is set |
| 1277 | * too low then the ipv4 and ipv6 protocols are disabled | 1279 | * too low then the ipv4 and ipv6 protocols are disabled |
| @@ -1074,6 +1074,12 @@ static const struct spi_device_id st95hf_id[] = { · 1073 unmodified lines | |||
| 1074 | }; | 1074 | }; |
| 1075 | MODULE_DEVICE_TABLE(spi, st95hf_id); | 1075 | MODULE_DEVICE_TABLE(spi, st95hf_id); |
| 1076 | 1076 | ||
| 1077 | static const struct of_device_id st95hf_spi_of_match[] = { | ||
| 1078 | { .compatible = "st,st95hf" }, | ||
| 1079 | { }, | ||
| 1080 | }; | ||
| 1081 | MODULE_DEVICE_TABLE(of, st95hf_spi_of_match); | ||
| 1082 | |||
| 1077 | static int st95hf_probe(struct spi_device *nfc_spi_dev) | 1083 | static int st95hf_probe(struct spi_device *nfc_spi_dev) |
| 1078 | { | 1084 | { |
| 1079 | int ret; | 1085 | int ret; |
| @@ -1260,6 +1266,7 @@ static struct spi_driver st95hf_driver = { · 180 unmodified lines | |||
| 1260 | .driver = { | 1266 | .driver = { |
| 1261 | .name = "st95hf", | 1267 | .name = "st95hf", |
| 1262 | .owner = THIS_MODULE, | 1268 | .owner = THIS_MODULE, |
| 1269 | .of_match_table = of_match_ptr(st95hf_spi_of_match), | ||
| 1263 | }, | 1270 | }, |
| 1264 | .id_table = st95hf_id, | 1271 | .id_table = st95hf_id, |
| 1265 | .probe = st95hf_probe, | 1272 | .probe = st95hf_probe, |
| @@ -7,7 +7,6 @@ · 6 unmodified lines | |||
| 7 | */ | 7 | */ |
| 8 | #include <linux/etherdevice.h> | 8 | #include <linux/etherdevice.h> |
| 9 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
| 10 | #include <linux/nvmem-consumer.h> | ||
| 11 | #include <linux/of_net.h> | 10 | #include <linux/of_net.h> |
| 12 | #include <linux/phy.h> | 11 | #include <linux/phy.h> |
| 13 | #include <linux/export.h> | 12 | #include <linux/export.h> |
| @@ -1,4 +1,4 @@ | |||
| 1 | // SPDX-License-Identifier: GPL | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | /* | 2 | /* |
| 3 | * Power supply driver for the goldfish emulator | 3 | * Power supply driver for the goldfish emulator |
| 4 | * | 4 | * |
| @@ -2004,14 +2004,14 @@ static int dasd_eckd_end_analysis(struct dasd_block *block) · 2003 unmodified lines | |||
| 2004 | blk_per_trk = recs_per_track(&private->rdc_data, 0, block->bp_block); | 2004 | blk_per_trk = recs_per_track(&private->rdc_data, 0, block->bp_block); |
| 2005 | 2005 | ||
| 2006 | raw: | 2006 | raw: |
| 2007 | block->blocks = (private->real_cyl * | 2007 | block->blocks = ((unsigned long) private->real_cyl * |
| 2008 | private->rdc_data.trk_per_cyl * | 2008 | private->rdc_data.trk_per_cyl * |
| 2009 | blk_per_trk); | 2009 | blk_per_trk); |
| 2010 | 2010 | ||
| 2011 | dev_info(&device->cdev->dev, | 2011 | dev_info(&device->cdev->dev, |
| 2012 | "DASD with %d KB/block, %d KB total size, %d KB/track, " | 2012 | "DASD with %u KB/block, %lu KB total size, %u KB/track, " |
| 2013 | "%s\n", (block->bp_block >> 10), | 2013 | "%s\n", (block->bp_block >> 10), |
| 2014 | ((private->real_cyl * | 2014 | (((unsigned long) private->real_cyl * |
| 2015 | private->rdc_data.trk_per_cyl * | 2015 | private->rdc_data.trk_per_cyl * |
| 2016 | blk_per_trk * (block->bp_block >> 9)) >> 1), | 2016 | blk_per_trk * (block->bp_block >> 9)) >> 1), |
| 2017 | ((blk_per_trk * block->bp_block) >> 10), | 2017 | ((blk_per_trk * block->bp_block) >> 10), |
| @@ -629,7 +629,7 @@ con3270_init(void) · 628 unmodified lines | |||
| 629 | (void (*)(unsigned long)) con3270_read_tasklet, | 629 | (void (*)(unsigned long)) con3270_read_tasklet, |
| 630 | (unsigned long) condev->read); | 630 | (unsigned long) condev->read); |
| 631 | 631 | ||
| 632 | raw3270_add_view(&condev->view, &con3270_fn, 1); | 632 | raw3270_add_view(&condev->view, &con3270_fn, 1, RAW3270_VIEW_LOCK_IRQ); |
| 633 | 633 | ||
| 634 | INIT_LIST_HEAD(&condev->freemem); | 634 | INIT_LIST_HEAD(&condev->freemem); |
| 635 | for (i = 0; i < CON3270_STRING_PAGES; i++) { | 635 | for (i = 0; i < CON3270_STRING_PAGES; i++) { |
| @@ -463,7 +463,8 @@ fs3270_open(struct inode *inode, struct file *filp) · 462 unmodified lines | |||
| 463 | 463 | ||
| 464 | init_waitqueue_head(&fp->wait); | 464 | init_waitqueue_head(&fp->wait); |
| 465 | fp->fs_pid = get_pid(task_pid(current)); | 465 | fp->fs_pid = get_pid(task_pid(current)); |
| 466 | rc = raw3270_add_view(&fp->view, &fs3270_fn, minor); | 466 | rc = raw3270_add_view(&fp->view, &fs3270_fn, minor, |
| 467 | RAW3270_VIEW_LOCK_BH); | ||
| 467 | if (rc) { | 468 | if (rc) { |
| 468 | fs3270_free_view(&fp->view); | 469 | fs3270_free_view(&fp->view); |
| 469 | goto out; | 470 | goto out; |
| @@ -920,7 +920,7 @@ raw3270_deactivate_view(struct raw3270_view *view) · 919 unmodified lines | |||
| 920 | * Add view to device with minor "minor". | 920 | * Add view to device with minor "minor". |
| 921 | */ | 921 | */ |
| 922 | int | 922 | int |
| 923 | raw3270_add_view(struct raw3270_view *view, struct raw3270_fn *fn, int minor) | 923 | raw3270_add_view(struct raw3270_view *view, struct raw3270_fn *fn, int minor, int subclass) |
| 924 | { | 924 | { |
| 925 | unsigned long flags; | 925 | unsigned long flags; |
| 926 | struct raw3270 *rp; | 926 | struct raw3270 *rp; |
| @@ -942,6 +942,7 @@ raw3270_add_view(struct raw3270_view *view, struct raw3270_fn *fn, int minor) · 15 unmodified lines | |||
| 942 | view->cols = rp->cols; | 942 | view->cols = rp->cols; |
| 943 | view->ascebc = rp->ascebc; | 943 | view->ascebc = rp->ascebc; |
| 944 | spin_lock_init(&view->lock); | 944 | spin_lock_init(&view->lock); |
| 945 | lockdep_set_subclass(&view->lock, subclass); | ||
| 945 | list_add(&view->list, &rp->view_list); | 946 | list_add(&view->list, &rp->view_list); |
| 946 | rc = 0; | 947 | rc = 0; |
| 947 | spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags); | 948 | spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags); |
| @@ -150,6 +150,8 @@ struct raw3270_fn { · 149 unmodified lines | |||
| 150 | struct raw3270_view { | 150 | struct raw3270_view { |
| 151 | struct list_head list; | 151 | struct list_head list; |
| 152 | spinlock_t lock; | 152 | spinlock_t lock; |
| 153 | #define RAW3270_VIEW_LOCK_IRQ 0 | ||
| 154 | #define RAW3270_VIEW_LOCK_BH 1 | ||
| 153 | atomic_t ref_count; | 155 | atomic_t ref_count; |
| 154 | struct raw3270 *dev; | 156 | struct raw3270 *dev; |
| 155 | struct raw3270_fn *fn; | 157 | struct raw3270_fn *fn; |
| @@ -158,7 +160,7 @@ struct raw3270_view { · 2 unmodified lines | |||
| 158 | unsigned char *ascebc; /* ascii -> ebcdic table */ | 160 | unsigned char *ascebc; /* ascii -> ebcdic table */ |
| 159 | }; | 161 | }; |
| 160 | 162 | ||
| 161 | int raw3270_add_view(struct raw3270_view *, struct raw3270_fn *, int); | 163 | int raw3270_add_view(struct raw3270_view *, struct raw3270_fn *, int, int); |
| 162 | int raw3270_activate_view(struct raw3270_view *); | 164 | int raw3270_activate_view(struct raw3270_view *); |
| 163 | void raw3270_del_view(struct raw3270_view *); | 165 | void raw3270_del_view(struct raw3270_view *); |
| 164 | void raw3270_deactivate_view(struct raw3270_view *); | 166 | void raw3270_deactivate_view(struct raw3270_view *); |
| @@ -980,7 +980,8 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty) · 979 unmodified lines | |||
| 980 | return PTR_ERR(tp); | 980 | return PTR_ERR(tp); |
| 981 | 981 | ||
| 982 | rc = raw3270_add_view(&tp->view, &tty3270_fn, | 982 | rc = raw3270_add_view(&tp->view, &tty3270_fn, |
| 983 | tty->index + RAW3270_FIRSTMINOR); | 983 | tty->index + RAW3270_FIRSTMINOR, |
| 984 | RAW3270_VIEW_LOCK_BH); | ||
| 984 | if (rc) { | 985 | if (rc) { |
| 985 | tty3270_free_view(tp); | 986 | tty3270_free_view(tp); |
| 986 | return rc; | 987 | return rc; |
| @@ -751,8 +751,8 @@ void ap_queue_prepare_remove(struct ap_queue *aq) · 750 unmodified lines | |||
| 751 | __ap_flush_queue(aq); | 751 | __ap_flush_queue(aq); |
| 752 | /* set REMOVE state to prevent new messages are queued in */ | 752 | /* set REMOVE state to prevent new messages are queued in */ |
| 753 | aq->state = AP_STATE_REMOVE; | 753 | aq->state = AP_STATE_REMOVE; |
| 754 | del_timer_sync(&aq->timeout); | ||
| 755 | spin_unlock_bh(&aq->lock); | 754 | spin_unlock_bh(&aq->lock); |
| 755 | del_timer_sync(&aq->timeout); | ||
| 756 | } | 756 | } |
| 757 | 757 | ||
| 758 | void ap_queue_remove(struct ap_queue *aq) | 758 | void ap_queue_remove(struct ap_queue *aq) |
| @@ -51,7 +51,8 @@ static debug_info_t *debug_info; · 50 unmodified lines | |||
| 51 | 51 | ||
| 52 | static void __init pkey_debug_init(void) | 52 | static void __init pkey_debug_init(void) |
| 53 | { | 53 | { |
| 54 | debug_info = debug_register("pkey", 1, 1, 4 * sizeof(long)); | 54 | /* 5 arguments per dbf entry (including the format string ptr) */ |
| 55 | debug_info = debug_register("pkey", 1, 1, 5 * sizeof(long)); | ||
| 55 | debug_register_view(debug_info, &debug_sprintf_view); | 56 | debug_register_view(debug_info, &debug_sprintf_view); |
| 56 | debug_set_level(debug_info, 3); | 57 | debug_set_level(debug_info, 3); |
| 57 | } | 58 | } |
| @@ -1595,6 +1595,7 @@ static int ctcm_new_device(struct ccwgroup_device *cgdev) · 1594 unmodified lines | |||
| 1595 | if (priv->channel[direction] == NULL) { | 1595 | if (priv->channel[direction] == NULL) { |
| 1596 | if (direction == CTCM_WRITE) | 1596 | if (direction == CTCM_WRITE) |
| 1597 | channel_free(priv->channel[CTCM_READ]); | 1597 | channel_free(priv->channel[CTCM_READ]); |
| 1598 | result = -ENODEV; | ||
| 1598 | goto out_dev; | 1599 | goto out_dev; |
| 1599 | } | 1600 | } |
| 1600 | priv->channel[direction]->netdev = dev; | 1601 | priv->channel[direction]->netdev = dev; |
| @@ -91,6 +91,7 @@ aic7770_probe(struct device *dev) · 90 unmodified lines | |||
| 91 | ahc = ahc_alloc(&aic7xxx_driver_template, name); | 91 | ahc = ahc_alloc(&aic7xxx_driver_template, name); |
| 92 | if (ahc == NULL) | 92 | if (ahc == NULL) |
| 93 | return (ENOMEM); | 93 | return (ENOMEM); |
| 94 | ahc->dev = dev; | ||
| 94 | error = aic7770_config(ahc, aic7770_ident_table + edev->id.driver_data, | 95 | error = aic7770_config(ahc, aic7770_ident_table + edev->id.driver_data, |
| 95 | eisaBase); | 96 | eisaBase); |
| 96 | if (error != 0) { | 97 | if (error != 0) { |
| @@ -943,6 +943,7 @@ struct ahc_softc { · 942 unmodified lines | |||
| 943 | * Platform specific device information. | 943 | * Platform specific device information. |
| 944 | */ | 944 | */ |
| 945 | ahc_dev_softc_t dev_softc; | 945 | ahc_dev_softc_t dev_softc; |
| 946 | struct device *dev; | ||
| 946 | 947 | ||
| 947 | /* | 948 | /* |
| 948 | * Bus specific device information. | 949 | * Bus specific device information. |
| @@ -860,8 +860,8 @@ int · 859 unmodified lines | |||
| 860 | ahc_dmamem_alloc(struct ahc_softc *ahc, bus_dma_tag_t dmat, void** vaddr, | 860 | ahc_dmamem_alloc(struct ahc_softc *ahc, bus_dma_tag_t dmat, void** vaddr, |
| 861 | int flags, bus_dmamap_t *mapp) | 861 | int flags, bus_dmamap_t *mapp) |
| 862 | { | 862 | { |
| 863 | *vaddr = pci_alloc_consistent(ahc->dev_softc, | 863 | /* XXX: check if we really need the GFP_ATOMIC and unwind this mess! */ |
| 864 | dmat->maxsize, mapp); | 864 | *vaddr = dma_alloc_coherent(ahc->dev, dmat->maxsize, mapp, GFP_ATOMIC); |
| 865 | if (*vaddr == NULL) | 865 | if (*vaddr == NULL) |
| 866 | return ENOMEM; | 866 | return ENOMEM; |
| 867 | return 0; | 867 | return 0; |
| @@ -871,8 +871,7 @@ void · 3 unmodified lines | |||
| 871 | ahc_dmamem_free(struct ahc_softc *ahc, bus_dma_tag_t dmat, | 871 | ahc_dmamem_free(struct ahc_softc *ahc, bus_dma_tag_t dmat, |
| 872 | void* vaddr, bus_dmamap_t map) | 872 | void* vaddr, bus_dmamap_t map) |
| 873 | { | 873 | { |
| 874 | pci_free_consistent(ahc->dev_softc, dmat->maxsize, | 874 | dma_free_coherent(ahc->dev, dmat->maxsize, vaddr, map); |
| 875 | vaddr, map); | ||
| 876 | } | 875 | } |
| 877 | 876 | ||
| 878 | int | 877 | int |
| @@ -1123,8 +1122,7 @@ ahc_linux_register_host(struct ahc_softc *ahc, struct scsi_host_template *templa · 244 unmodified lines | |||
| 1123 | 1122 | ||
| 1124 | host->transportt = ahc_linux_transport_template; | 1123 | host->transportt = ahc_linux_transport_template; |
| 1125 | 1124 | ||
| 1126 | retval = scsi_add_host(host, | 1125 | retval = scsi_add_host(host, ahc->dev); |
| 1127 | (ahc->dev_softc ? &ahc->dev_softc->dev : NULL)); | ||
| 1128 | if (retval) { | 1126 | if (retval) { |
| 1129 | printk(KERN_WARNING "aic7xxx: scsi_add_host failed\n"); | 1127 | printk(KERN_WARNING "aic7xxx: scsi_add_host failed\n"); |
| 1130 | scsi_host_put(host); | 1128 | scsi_host_put(host); |
| @@ -250,6 +250,7 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 249 unmodified lines | |||
| 250 | } | 250 | } |
| 251 | } | 251 | } |
| 252 | ahc->dev_softc = pci; | 252 | ahc->dev_softc = pci; |
| 253 | ahc->dev = &pci->dev; | ||
| 253 | error = ahc_pci_config(ahc, entry); | 254 | error = ahc_pci_config(ahc, entry); |
| 254 | if (error != 0) { | 255 | if (error != 0) { |
| 255 | ahc_free(ahc); | 256 | ahc_free(ahc); |
| @@ -2162,7 +2162,6 @@ static void fc_rport_recv_logo_req(struct fc_lport *lport, struct fc_frame *fp) · 2161 unmodified lines | |||
| 2162 | FC_RPORT_DBG(rdata, "Received LOGO request while in state %s\n", | 2162 | FC_RPORT_DBG(rdata, "Received LOGO request while in state %s\n", |
| 2163 | fc_rport_state(rdata)); | 2163 | fc_rport_state(rdata)); |
| 2164 | 2164 | ||
| 2165 | rdata->flags &= ~FC_RP_STARTED; | ||
| 2166 | fc_rport_enter_delete(rdata, RPORT_EV_STOP); | 2165 | fc_rport_enter_delete(rdata, RPORT_EV_STOP); |
| 2167 | mutex_unlock(&rdata->rp_mutex); | 2166 | mutex_unlock(&rdata->rp_mutex); |
| 2168 | kref_put(&rdata->kref, fc_rport_destroy); | 2167 | kref_put(&rdata->kref, fc_rport_destroy); |
| @@ -1706,8 +1706,12 @@ out_put_budget: · 1705 unmodified lines | |||
| 1706 | ret = BLK_STS_DEV_RESOURCE; | 1706 | ret = BLK_STS_DEV_RESOURCE; |
| 1707 | break; | 1707 | break; |
| 1708 | default: | 1708 | default: |
| 1709 | if (unlikely(!scsi_device_online(sdev))) | ||
| 1710 | scsi_req(req)->result = DID_NO_CONNECT << 16; | ||
| 1711 | else | ||
| 1712 | scsi_req(req)->result = DID_ERROR << 16; | ||
| 1709 | /* | 1713 | /* |
| 1710 | * Make sure to release all allocated ressources when | 1714 | * Make sure to release all allocated resources when |
| 1711 | * we hit an error, as we will never see this command | 1715 | * we hit an error, as we will never see this command |
| 1712 | * again. | 1716 | * again. |
| 1713 | */ | 1717 | */ |
| @@ -463,10 +463,8 @@ static int ni6501_alloc_usb_buffers(struct comedi_device *dev) · 462 unmodified lines | |||
| 463 | 463 | ||
| 464 | size = usb_endpoint_maxp(devpriv->ep_tx); | 464 | size = usb_endpoint_maxp(devpriv->ep_tx); |
| 465 | devpriv->usb_tx_buf = kzalloc(size, GFP_KERNEL); | 465 | devpriv->usb_tx_buf = kzalloc(size, GFP_KERNEL); |
| 466 | if (!devpriv->usb_tx_buf) { | 466 | if (!devpriv->usb_tx_buf) |
| 467 | kfree(devpriv->usb_rx_buf); | ||
| 468 | return -ENOMEM; | 467 | return -ENOMEM; |
| 469 | } | ||
| 470 | 468 | ||
| 471 | return 0; | 469 | return 0; |
| 472 | } | 470 | } |
| @@ -518,6 +516,9 @@ static int ni6501_auto_attach(struct comedi_device *dev, · 45 unmodified lines | |||
| 518 | if (!devpriv) | 516 | if (!devpriv) |
| 519 | return -ENOMEM; | 517 | return -ENOMEM; |
| 520 | 518 | ||
| 519 | mutex_init(&devpriv->mut); | ||
| 520 | usb_set_intfdata(intf, devpriv); | ||
| 521 | |||
| 521 | ret = ni6501_find_endpoints(dev); | 522 | ret = ni6501_find_endpoints(dev); |
| 522 | if (ret) | 523 | if (ret) |
| 523 | return ret; | 524 | return ret; |
| @@ -526,9 +527,6 @@ static int ni6501_auto_attach(struct comedi_device *dev, · 2 unmodified lines | |||
| 526 | if (ret) | 527 | if (ret) |
| 527 | return ret; | 528 | return ret; |
| 528 | 529 | ||
| 529 | mutex_init(&devpriv->mut); | ||
| 530 | usb_set_intfdata(intf, devpriv); | ||
| 531 | |||
| 532 | ret = comedi_alloc_subdevices(dev, 2); | 530 | ret = comedi_alloc_subdevices(dev, 2); |
| 533 | if (ret) | 531 | if (ret) |
| 534 | return ret; | 532 | return ret; |
| @@ -682,10 +682,8 @@ static int vmk80xx_alloc_usb_buffers(struct comedi_device *dev) · 681 unmodified lines | |||
| 682 | 682 | ||
| 683 | size = usb_endpoint_maxp(devpriv->ep_tx); | 683 | size = usb_endpoint_maxp(devpriv->ep_tx); |
| 684 | devpriv->usb_tx_buf = kzalloc(size, GFP_KERNEL); | 684 | devpriv->usb_tx_buf = kzalloc(size, GFP_KERNEL); |
| 685 | if (!devpriv->usb_tx_buf) { | 685 | if (!devpriv->usb_tx_buf) |
| 686 | kfree(devpriv->usb_rx_buf); | ||
| 687 | return -ENOMEM; | 686 | return -ENOMEM; |
| 688 | } | ||
| 689 | 687 | ||
| 690 | return 0; | 688 | return 0; |
| 691 | } | 689 | } |
| @@ -800,6 +798,8 @@ static int vmk80xx_auto_attach(struct comedi_device *dev, · 108 unmodified lines | |||
| 800 | 798 | ||
| 801 | devpriv->model = board->model; | 799 | devpriv->model = board->model; |
| 802 | 800 | ||
| 801 | sema_init(&devpriv->limit_sem, 8); | ||
| 802 | |||
| 803 | ret = vmk80xx_find_usb_endpoints(dev); | 803 | ret = vmk80xx_find_usb_endpoints(dev); |
| 804 | if (ret) | 804 | if (ret) |
| 805 | return ret; | 805 | return ret; |
| @@ -808,8 +808,6 @@ static int vmk80xx_auto_attach(struct comedi_device *dev, · 2 unmodified lines | |||
| 808 | if (ret) | 808 | if (ret) |
| 809 | return ret; | 809 | return ret; |
| 810 | 810 | ||
| 811 | sema_init(&devpriv->limit_sem, 8); | ||
| 812 | |||
| 813 | usb_set_intfdata(intf, devpriv); | 811 | usb_set_intfdata(intf, devpriv); |
| 814 | 812 | ||
| 815 | if (devpriv->model == VMK8055_MODEL) | 813 | if (devpriv->model == VMK8055_MODEL) |
| @@ -298,7 +298,7 @@ submit_bio_retry: · 297 unmodified lines | |||
| 298 | *last_block = current_block; | 298 | *last_block = current_block; |
| 299 | 299 | ||
| 300 | /* shift in advance in case of it followed by too many gaps */ | 300 | /* shift in advance in case of it followed by too many gaps */ |
| 301 | if (unlikely(bio->bi_vcnt >= bio->bi_max_vecs)) { | 301 | if (bio->bi_iter.bi_size >= bio->bi_max_vecs * PAGE_SIZE) { |
| 302 | /* err should reassign to 0 after submitting */ | 302 | /* err should reassign to 0 after submitting */ |
| 303 | err = 0; | 303 | err = 0; |
| 304 | goto submit_bio_out; | 304 | goto submit_bio_out; |
| @@ -109,10 +109,10 @@ · 108 unmodified lines | |||
| 109 | #define AD7192_CH_AIN3 BIT(6) /* AIN3 - AINCOM */ | 109 | #define AD7192_CH_AIN3 BIT(6) /* AIN3 - AINCOM */ |
| 110 | #define AD7192_CH_AIN4 BIT(7) /* AIN4 - AINCOM */ | 110 | #define AD7192_CH_AIN4 BIT(7) /* AIN4 - AINCOM */ |
| 111 | 111 | ||
| 112 | #define AD7193_CH_AIN1P_AIN2M 0x000 /* AIN1(+) - AIN2(-) */ | 112 | #define AD7193_CH_AIN1P_AIN2M 0x001 /* AIN1(+) - AIN2(-) */ |
| 113 | #define AD7193_CH_AIN3P_AIN4M 0x001 /* AIN3(+) - AIN4(-) */ | 113 | #define AD7193_CH_AIN3P_AIN4M 0x002 /* AIN3(+) - AIN4(-) */ |
| 114 | #define AD7193_CH_AIN5P_AIN6M 0x002 /* AIN5(+) - AIN6(-) */ | 114 | #define AD7193_CH_AIN5P_AIN6M 0x004 /* AIN5(+) - AIN6(-) */ |
| 115 | #define AD7193_CH_AIN7P_AIN8M 0x004 /* AIN7(+) - AIN8(-) */ | 115 | #define AD7193_CH_AIN7P_AIN8M 0x008 /* AIN7(+) - AIN8(-) */ |
| 116 | #define AD7193_CH_TEMP 0x100 /* Temp senseor */ | 116 | #define AD7193_CH_TEMP 0x100 /* Temp senseor */ |
| 117 | #define AD7193_CH_AIN2P_AIN2M 0x200 /* AIN2(+) - AIN2(-) */ | 117 | #define AD7193_CH_AIN2P_AIN2M 0x200 /* AIN2(+) - AIN2(-) */ |
| 118 | #define AD7193_CH_AIN1 0x401 /* AIN1 - AINCOM */ | 118 | #define AD7193_CH_AIN1 0x401 /* AIN1 - AINCOM */ |
| @@ -269,7 +269,7 @@ static IIO_DEV_ATTR_VPEAK(0644, · 268 unmodified lines | |||
| 269 | static IIO_DEV_ATTR_IPEAK(0644, | 269 | static IIO_DEV_ATTR_IPEAK(0644, |
| 270 | ade7854_read_32bit, | 270 | ade7854_read_32bit, |
| 271 | ade7854_write_32bit, | 271 | ade7854_write_32bit, |
| 272 | ADE7854_VPEAK); | 272 | ADE7854_IPEAK); |
| 273 | static IIO_DEV_ATTR_APHCAL(0644, | 273 | static IIO_DEV_ATTR_APHCAL(0644, |
| 274 | ade7854_read_16bit, | 274 | ade7854_read_16bit, |
| 275 | ade7854_write_16bit, | 275 | ade7854_write_16bit, |
| @@ -1431,7 +1431,7 @@ int most_register_interface(struct most_interface *iface) · 1430 unmodified lines | |||
| 1431 | 1431 | ||
| 1432 | INIT_LIST_HEAD(&iface->p->channel_list); | 1432 | INIT_LIST_HEAD(&iface->p->channel_list); |
| 1433 | iface->p->dev_id = id; | 1433 | iface->p->dev_id = id; |
| 1434 | snprintf(iface->p->name, STRING_SIZE, "mdev%d", id); | 1434 | strcpy(iface->p->name, iface->description); |
| 1435 | iface->dev.init_name = iface->p->name; | 1435 | iface->dev.init_name = iface->p->name; |
| 1436 | iface->dev.bus = &mc.bus; | 1436 | iface->dev.bus = &mc.bus; |
| 1437 | iface->dev.parent = &mc.dev; | 1437 | iface->dev.parent = &mc.dev; |
| @@ -1520,11 +1520,13 @@ static int __init sc16is7xx_init(void) · 1519 unmodified lines | |||
| 1520 | #endif | 1520 | #endif |
| 1521 | return ret; | 1521 | return ret; |
| 1522 | 1522 | ||
| 1523 | #ifdef CONFIG_SERIAL_SC16IS7XX_SPI | ||
| 1523 | err_spi: | 1524 | err_spi: |
| 1525 | #endif | ||
| 1524 | #ifdef CONFIG_SERIAL_SC16IS7XX_I2C | 1526 | #ifdef CONFIG_SERIAL_SC16IS7XX_I2C |
| 1525 | i2c_del_driver(&sc16is7xx_i2c_uart_driver); | 1527 | i2c_del_driver(&sc16is7xx_i2c_uart_driver); |
| 1526 | #endif | ||
| 1527 | err_i2c: | 1528 | err_i2c: |
| 1529 | #endif | ||
| 1528 | uart_unregister_driver(&sc16is7xx_uart); | 1530 | uart_unregister_driver(&sc16is7xx_uart); |
| 1529 | return ret; | 1531 | return ret; |
| 1530 | } | 1532 | } |
| @@ -2512,14 +2512,16 @@ done: · 2511 unmodified lines | |||
| 2512 | * center of the last stop bit in sampling clocks. | 2512 | * center of the last stop bit in sampling clocks. |
| 2513 | */ | 2513 | */ |
| 2514 | int last_stop = bits * 2 - 1; | 2514 | int last_stop = bits * 2 - 1; |
| 2515 | int deviation = min_err * srr * last_stop / 2 / baud; | 2515 | int deviation = DIV_ROUND_CLOSEST(min_err * last_stop * |
| 2516 | (int)(srr + 1), | ||
| 2517 | 2 * (int)baud); | ||
| 2516 | 2518 | ||
| 2517 | if (abs(deviation) >= 2) { | 2519 | if (abs(deviation) >= 2) { |
| 2518 | /* At least two sampling clocks off at the | 2520 | /* At least two sampling clocks off at the |
| 2519 | * last stop bit; we can increase the error | 2521 | * last stop bit; we can increase the error |
| 2520 | * margin by shifting the sampling point. | 2522 | * margin by shifting the sampling point. |
| 2521 | */ | 2523 | */ |
| 2522 | int shift = min(-8, max(7, deviation / 2)); | 2524 | int shift = clamp(deviation / 2, -8, 7); |
| 2523 | 2525 | ||
| 2524 | hssrr |= (shift << HSCIF_SRHP_SHIFT) & | 2526 | hssrr |= (shift << HSCIF_SRHP_SHIFT) & |
| 2525 | HSCIF_SRHP_MASK; | 2527 | HSCIF_SRHP_MASK; |
| @@ -1520,7 +1520,8 @@ static void csi_J(struct vc_data *vc, int vpar) · 1519 unmodified lines | |||
| 1520 | return; | 1520 | return; |
| 1521 | } | 1521 | } |
| 1522 | scr_memsetw(start, vc->vc_video_erase_char, 2 * count); | 1522 | scr_memsetw(start, vc->vc_video_erase_char, 2 * count); |
| 1523 | update_region(vc, (unsigned long) start, count); | 1523 | if (con_should_update(vc)) |
| 1524 | do_update_region(vc, (unsigned long) start, count); | ||
| 1524 | vc->vc_need_wrap = 0; | 1525 | vc->vc_need_wrap = 0; |
| 1525 | } | 1526 | } |
| 1526 | 1527 | ||
| @@ -203,8 +203,7 @@ void afs_put_cb_interest(struct afs_net *net, struct afs_cb_interest *cbi) · 202 unmodified lines | |||
| 203 | */ | 203 | */ |
| 204 | void afs_init_callback_state(struct afs_server *server) | 204 | void afs_init_callback_state(struct afs_server *server) |
| 205 | { | 205 | { |
| 206 | if (!test_and_clear_bit(AFS_SERVER_FL_NEW, &server->flags)) | 206 | server->cb_s_break++; |
| 207 | server->cb_s_break++; | ||
| 208 | } | 207 | } |
| 209 | 208 | ||
| 210 | /* | 209 | /* |
| @@ -34,7 +34,7 @@ static void SRXAFSCB_TellMeAboutYourself(struct work_struct *); · 33 unmodified lines | |||
| 34 | static int afs_deliver_yfs_cb_callback(struct afs_call *); | 34 | static int afs_deliver_yfs_cb_callback(struct afs_call *); |
| 35 | 35 | ||
| 36 | #define CM_NAME(name) \ | 36 | #define CM_NAME(name) \ |
| 37 | const char afs_SRXCB##name##_name[] __tracepoint_string = \ | 37 | char afs_SRXCB##name##_name[] __tracepoint_string = \ |
| 38 | "CB." #name | 38 | "CB." #name |
| 39 | 39 | ||
| 40 | /* | 40 | /* |
| @@ -216,9 +216,7 @@ struct inode *afs_iget_pseudo_dir(struct super_block *sb, bool root) · 215 unmodified lines | |||
| 216 | set_nlink(inode, 2); | 216 | set_nlink(inode, 2); |
| 217 | inode->i_uid = GLOBAL_ROOT_UID; | 217 | inode->i_uid = GLOBAL_ROOT_UID; |
| 218 | inode->i_gid = GLOBAL_ROOT_GID; | 218 | inode->i_gid = GLOBAL_ROOT_GID; |
| 219 | inode->i_ctime.tv_sec = get_seconds(); | 219 | inode->i_ctime = inode->i_atime = inode->i_mtime = current_time(inode); |
| 220 | inode->i_ctime.tv_nsec = 0; | ||
| 221 | inode->i_atime = inode->i_mtime = inode->i_ctime; | ||
| 222 | inode->i_blocks = 0; | 220 | inode->i_blocks = 0; |
| 223 | inode_set_iversion_raw(inode, 0); | 221 | inode_set_iversion_raw(inode, 0); |
| 224 | inode->i_generation = 0; | 222 | inode->i_generation = 0; |
| @@ -474,7 +474,6 @@ struct afs_server { · 473 unmodified lines | |||
| 474 | time64_t put_time; /* Time at which last put */ | 474 | time64_t put_time; /* Time at which last put */ |
| 475 | time64_t update_at; /* Time at which to next update the record */ | 475 | time64_t update_at; /* Time at which to next update the record */ |
| 476 | unsigned long flags; | 476 | unsigned long flags; |
| 477 | #define AFS_SERVER_FL_NEW 0 /* New server, don't inc cb_s_break */ | ||
| 478 | #define AFS_SERVER_FL_NOT_READY 1 /* The record is not ready for use */ | 477 | #define AFS_SERVER_FL_NOT_READY 1 /* The record is not ready for use */ |
| 479 | #define AFS_SERVER_FL_NOT_FOUND 2 /* VL server says no such server */ | 478 | #define AFS_SERVER_FL_NOT_FOUND 2 /* VL server says no such server */ |
| 480 | #define AFS_SERVER_FL_VL_FAIL 3 /* Failed to access VL server */ | 479 | #define AFS_SERVER_FL_VL_FAIL 3 /* Failed to access VL server */ |
| @@ -827,7 +826,7 @@ static inline struct afs_cb_interest *afs_get_cb_interest(struct afs_cb_interest · 346 unmodified lines | |||
| 827 | 826 | ||
| 828 | static inline unsigned int afs_calc_vnode_cb_break(struct afs_vnode *vnode) | 827 | static inline unsigned int afs_calc_vnode_cb_break(struct afs_vnode *vnode) |
| 829 | { | 828 | { |
| 830 | return vnode->cb_break + vnode->cb_s_break + vnode->cb_v_break; | 829 | return vnode->cb_break + vnode->cb_v_break; |
| 831 | } | 830 | } |
| 832 | 831 | ||
| 833 | static inline bool afs_cb_is_broken(unsigned int cb_break, | 832 | static inline bool afs_cb_is_broken(unsigned int cb_break, |
| @@ -835,7 +834,6 @@ static inline bool afs_cb_is_broken(unsigned int cb_break, · 1 unmodified line | |||
| 835 | const struct afs_cb_interest *cbi) | 834 | const struct afs_cb_interest *cbi) |
| 836 | { | 835 | { |
| 837 | return !cbi || cb_break != (vnode->cb_break + | 836 | return !cbi || cb_break != (vnode->cb_break + |
| 838 | cbi->server->cb_s_break + | ||
| 839 | vnode->volume->cb_v_break); | 837 | vnode->volume->cb_v_break); |
| 840 | } | 838 | } |
| 841 | 839 | ||
| @@ -572,13 +572,17 @@ static void afs_deliver_to_call(struct afs_call *call) · 571 unmodified lines | |||
| 572 | case -ENODATA: | 572 | case -ENODATA: |
| 573 | case -EBADMSG: | 573 | case -EBADMSG: |
| 574 | case -EMSGSIZE: | 574 | case -EMSGSIZE: |
| 575 | default: | ||
| 576 | abort_code = RXGEN_CC_UNMARSHAL; | 575 | abort_code = RXGEN_CC_UNMARSHAL; |
| 577 | if (state != AFS_CALL_CL_AWAIT_REPLY) | 576 | if (state != AFS_CALL_CL_AWAIT_REPLY) |
| 578 | abort_code = RXGEN_SS_UNMARSHAL; | 577 | abort_code = RXGEN_SS_UNMARSHAL; |
| 579 | rxrpc_kernel_abort_call(call->net->socket, call->rxcall, | 578 | rxrpc_kernel_abort_call(call->net->socket, call->rxcall, |
| 580 | abort_code, ret, "KUM"); | 579 | abort_code, ret, "KUM"); |
| 581 | goto local_abort; | 580 | goto local_abort; |
| 581 | default: | ||
| 582 | abort_code = RX_USER_ABORT; | ||
| 583 | rxrpc_kernel_abort_call(call->net->socket, call->rxcall, | ||
| 584 | abort_code, ret, "KER"); | ||
| 585 | goto local_abort; | ||
| 582 | } | 586 | } |
| 583 | } | 587 | } |
| 584 | 588 | ||
| @@ -226,7 +226,6 @@ static struct afs_server *afs_alloc_server(struct afs_net *net, · 225 unmodified lines | |||
| 226 | RCU_INIT_POINTER(server->addresses, alist); | 226 | RCU_INIT_POINTER(server->addresses, alist); |
| 227 | server->addr_version = alist->version; | 227 | server->addr_version = alist->version; |
| 228 | server->uuid = *uuid; | 228 | server->uuid = *uuid; |
| 229 | server->flags = (1UL << AFS_SERVER_FL_NEW); | ||
| 230 | server->update_at = ktime_get_real_seconds() + afs_server_update_delay; | 229 | server->update_at = ktime_get_real_seconds() + afs_server_update_delay; |
| 231 | rwlock_init(&server->fs_lock); | 230 | rwlock_init(&server->fs_lock); |
| 232 | INIT_HLIST_HEAD(&server->cb_volumes); | 231 | INIT_HLIST_HEAD(&server->cb_volumes); |
| @@ -264,6 +264,7 @@ static void afs_kill_pages(struct address_space *mapping, · 263 unmodified lines | |||
| 264 | first = page->index + 1; | 264 | first = page->index + 1; |
| 265 | lock_page(page); | 265 | lock_page(page); |
| 266 | generic_error_remove_page(mapping, page); | 266 | generic_error_remove_page(mapping, page); |
| 267 | unlock_page(page); | ||
| 267 | } | 268 | } |
| 268 | 269 | ||
| 269 | __pagevec_release(&pv); | 270 | __pagevec_release(&pv); |
| @@ -1333,6 +1333,7 @@ cifsFileInfo_get_locked(struct cifsFileInfo *cifs_file) · 1332 unmodified lines | |||
| 1333 | } | 1333 | } |
| 1334 | 1334 | ||
| 1335 | struct cifsFileInfo *cifsFileInfo_get(struct cifsFileInfo *cifs_file); | 1335 | struct cifsFileInfo *cifsFileInfo_get(struct cifsFileInfo *cifs_file); |
| 1336 | void _cifsFileInfo_put(struct cifsFileInfo *cifs_file, bool wait_oplock_hdlr); | ||
| 1336 | void cifsFileInfo_put(struct cifsFileInfo *cifs_file); | 1337 | void cifsFileInfo_put(struct cifsFileInfo *cifs_file); |
| 1337 | 1338 | ||
| 1338 | #define CIFS_CACHE_READ_FLG 1 | 1339 | #define CIFS_CACHE_READ_FLG 1 |
| @@ -1855,6 +1856,7 @@ GLOBAL_EXTERN spinlock_t gidsidlock; · 516 unmodified lines | |||
| 1855 | #endif /* CONFIG_CIFS_ACL */ | 1856 | #endif /* CONFIG_CIFS_ACL */ |
| 1856 | 1857 | ||
| 1857 | void cifs_oplock_break(struct work_struct *work); | 1858 | void cifs_oplock_break(struct work_struct *work); |
| 1859 | void cifs_queue_oplock_break(struct cifsFileInfo *cfile); | ||
| 1858 | 1860 | ||
| 1859 | extern const struct slow_work_ops cifs_oplock_break_ops; | 1861 | extern const struct slow_work_ops cifs_oplock_break_ops; |
| 1860 | extern struct workqueue_struct *cifsiod_wq; | 1862 | extern struct workqueue_struct *cifsiod_wq; |
| @@ -360,12 +360,30 @@ cifsFileInfo_get(struct cifsFileInfo *cifs_file) · 359 unmodified lines | |||
| 360 | return cifs_file; | 360 | return cifs_file; |
| 361 | } | 361 | } |
| 362 | 362 | ||
| 363 | /* | 363 | /** |
| 364 | * Release a reference on the file private data. This may involve closing | 364 | * cifsFileInfo_put - release a reference of file priv data |
| 365 | * the filehandle out on the server. Must be called without holding | 365 | * |
| 366 | * tcon->open_file_lock and cifs_file->file_info_lock. | 366 | * Always potentially wait for oplock handler. See _cifsFileInfo_put(). |
| 367 | */ | 367 | */ |
| 368 | void cifsFileInfo_put(struct cifsFileInfo *cifs_file) | 368 | void cifsFileInfo_put(struct cifsFileInfo *cifs_file) |
| 369 | { | ||
| 370 | _cifsFileInfo_put(cifs_file, true); | ||
| 371 | } | ||
| 372 | |||
| 373 | /** | ||
| 374 | * _cifsFileInfo_put - release a reference of file priv data | ||
| 375 | * | ||
| 376 | * This may involve closing the filehandle @cifs_file out on the | ||
| 377 | * server. Must be called without holding tcon->open_file_lock and | ||
| 378 | * cifs_file->file_info_lock. | ||
| 379 | * | ||
| 380 | * If @wait_for_oplock_handler is true and we are releasing the last | ||
| 381 | * reference, wait for any running oplock break handler of the file | ||
| 382 | * and cancel any pending one. If calling this function from the | ||
| 383 | * oplock break handler, you need to pass false. | ||
| 384 | * | ||
| 385 | */ | ||
| 386 | void _cifsFileInfo_put(struct cifsFileInfo *cifs_file, bool wait_oplock_handler) | ||
| 369 | { | 387 | { |
| 370 | struct inode *inode = d_inode(cifs_file->dentry); | 388 | struct inode *inode = d_inode(cifs_file->dentry); |
| 371 | struct cifs_tcon *tcon = tlink_tcon(cifs_file->tlink); | 389 | struct cifs_tcon *tcon = tlink_tcon(cifs_file->tlink); |
| @@ -414,7 +432,8 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file) · 42 unmodified lines | |||
| 414 | 432 | ||
| 415 | spin_unlock(&tcon->open_file_lock); | 433 | spin_unlock(&tcon->open_file_lock); |
| 416 | 434 | ||
| 417 | oplock_break_cancelled = cancel_work_sync(&cifs_file->oplock_break); | 435 | oplock_break_cancelled = wait_oplock_handler ? |
| 436 | cancel_work_sync(&cifs_file->oplock_break) : false; | ||
| 418 | 437 | ||
| 419 | if (!tcon->need_reconnect && !cifs_file->invalidHandle) { | 438 | if (!tcon->need_reconnect && !cifs_file->invalidHandle) { |
| 420 | struct TCP_Server_Info *server = tcon->ses->server; | 439 | struct TCP_Server_Info *server = tcon->ses->server; |
| @@ -4603,6 +4622,7 @@ void cifs_oplock_break(struct work_struct *work) · 4182 unmodified lines | |||
| 4603 | cinode); | 4622 | cinode); |
| 4604 | cifs_dbg(FYI, "Oplock release rc = %d\n", rc); | 4623 | cifs_dbg(FYI, "Oplock release rc = %d\n", rc); |
| 4605 | } | 4624 | } |
| 4625 | _cifsFileInfo_put(cfile, false /* do not wait for ourself */); | ||
| 4606 | cifs_done_oplock_break(cinode); | 4626 | cifs_done_oplock_break(cinode); |
| 4607 | } | 4627 | } |
| 4608 | 4628 | ||
| @@ -501,8 +501,7 @@ is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv) · 500 unmodified lines | |||
| 501 | CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2, | 501 | CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2, |
| 502 | &pCifsInode->flags); | 502 | &pCifsInode->flags); |
| 503 | 503 | ||
| 504 | queue_work(cifsoplockd_wq, | 504 | cifs_queue_oplock_break(netfile); |
| 505 | &netfile->oplock_break); | ||
| 506 | netfile->oplock_break_cancelled = false; | 505 | netfile->oplock_break_cancelled = false; |
| 507 | 506 | ||
| 508 | spin_unlock(&tcon->open_file_lock); | 507 | spin_unlock(&tcon->open_file_lock); |
| @@ -607,6 +606,28 @@ void cifs_put_writer(struct cifsInodeInfo *cinode) · 98 unmodified lines | |||
| 607 | spin_unlock(&cinode->writers_lock); | 606 | spin_unlock(&cinode->writers_lock); |
| 608 | } | 607 | } |
| 609 | 608 | ||
| 609 | /** | ||
| 610 | * cifs_queue_oplock_break - queue the oplock break handler for cfile | ||
| 611 | * | ||
| 612 | * This function is called from the demultiplex thread when it | ||
| 613 | * receives an oplock break for @cfile. | ||
| 614 | * | ||
| 615 | * Assumes the tcon->open_file_lock is held. | ||
| 616 | * Assumes cfile->file_info_lock is NOT held. | ||
| 617 | */ | ||
| 618 | void cifs_queue_oplock_break(struct cifsFileInfo *cfile) | ||
| 619 | { | ||
| 620 | /* | ||
| 621 | * Bump the handle refcount now while we hold the | ||
| 622 | * open_file_lock to enforce the validity of it for the oplock | ||
| 623 | * break handler. The matching put is done at the end of the | ||
| 624 | * handler. | ||
| 625 | */ | ||
| 626 | cifsFileInfo_get(cfile); | ||
| 627 | |||
| 628 | queue_work(cifsoplockd_wq, &cfile->oplock_break); | ||
| 629 | } | ||
| 630 | |||
| 610 | void cifs_done_oplock_break(struct cifsInodeInfo *cinode) | 631 | void cifs_done_oplock_break(struct cifsInodeInfo *cinode) |
| 611 | { | 632 | { |
| 612 | clear_bit(CIFS_INODE_PENDING_OPLOCK_BREAK, &cinode->flags); | 633 | clear_bit(CIFS_INODE_PENDING_OPLOCK_BREAK, &cinode->flags); |
| @@ -555,7 +555,7 @@ smb2_tcon_has_lease(struct cifs_tcon *tcon, struct smb2_lease_break *rsp, · 554 unmodified lines | |||
| 555 | clear_bit(CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2, | 555 | clear_bit(CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2, |
| 556 | &cinode->flags); | 556 | &cinode->flags); |
| 557 | 557 | ||
| 558 | queue_work(cifsoplockd_wq, &cfile->oplock_break); | 558 | cifs_queue_oplock_break(cfile); |
| 559 | kfree(lw); | 559 | kfree(lw); |
| 560 | return true; | 560 | return true; |
| 561 | } | 561 | } |
| @@ -712,8 +712,8 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server) · 150 unmodified lines | |||
| 712 | CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2, | 712 | CIFS_INODE_DOWNGRADE_OPLOCK_TO_L2, |
| 713 | &cinode->flags); | 713 | &cinode->flags); |
| 714 | spin_unlock(&cfile->file_info_lock); | 714 | spin_unlock(&cfile->file_info_lock); |
| 715 | queue_work(cifsoplockd_wq, | 715 | |
| 716 | &cfile->oplock_break); | 716 | cifs_queue_oplock_break(cfile); |
| 717 | 717 | ||
| 718 | spin_unlock(&tcon->open_file_lock); | 718 | spin_unlock(&tcon->open_file_lock); |
| 719 | spin_unlock(&cifs_tcp_ses_lock); | 719 | spin_unlock(&cifs_tcp_ses_lock); |
| @@ -2389,6 +2389,8 @@ smb2_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, · 2388 unmodified lines | |||
| 2389 | 2389 | ||
| 2390 | rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, &err_iov, | 2390 | rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, &err_iov, |
| 2391 | &resp_buftype); | 2391 | &resp_buftype); |
| 2392 | if (!rc) | ||
| 2393 | SMB2_close(xid, tcon, fid.persistent_fid, fid.volatile_fid); | ||
| 2392 | if (!rc || !err_iov.iov_base) { | 2394 | if (!rc || !err_iov.iov_base) { |
| 2393 | rc = -ENOENT; | 2395 | rc = -ENOENT; |
| 2394 | goto free_path; | 2396 | goto free_path; |
| @@ -832,8 +832,11 @@ SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses) · 831 unmodified lines | |||
| 832 | } else if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID)) { | 832 | } else if (rsp->DialectRevision == cpu_to_le16(SMB21_PROT_ID)) { |
| 833 | /* ops set to 3.0 by default for default so update */ | 833 | /* ops set to 3.0 by default for default so update */ |
| 834 | ses->server->ops = &smb21_operations; | 834 | ses->server->ops = &smb21_operations; |
| 835 | } else if (rsp->DialectRevision == cpu_to_le16(SMB311_PROT_ID)) | 835 | ses->server->vals = &smb21_values; |
| 836 | } else if (rsp->DialectRevision == cpu_to_le16(SMB311_PROT_ID)) { | ||
| 836 | ses->server->ops = &smb311_operations; | 837 | ses->server->ops = &smb311_operations; |
| 838 | ses->server->vals = &smb311_values; | ||
| 839 | } | ||
| 837 | } else if (le16_to_cpu(rsp->DialectRevision) != | 840 | } else if (le16_to_cpu(rsp->DialectRevision) != |
| 838 | ses->server->vals->protocol_id) { | 841 | ses->server->vals->protocol_id) { |
| 839 | /* if requested single dialect ensure returned dialect matched */ | 842 | /* if requested single dialect ensure returned dialect matched */ |
| @@ -3448,8 +3451,6 @@ SMB2_read(const unsigned int xid, struct cifs_io_parms *io_parms, · 2608 unmodified lines | |||
| 3448 | rqst.rq_nvec = 1; | 3451 | rqst.rq_nvec = 1; |
| 3449 | 3452 | ||
| 3450 | rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov); | 3453 | rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov); |
| 3451 | cifs_small_buf_release(req); | ||
| 3452 | |||
| 3453 | rsp = (struct smb2_read_rsp *)rsp_iov.iov_base; | 3454 | rsp = (struct smb2_read_rsp *)rsp_iov.iov_base; |
| 3454 | 3455 | ||
| 3455 | if (rc) { | 3456 | if (rc) { |
| @@ -3471,6 +3472,8 @@ SMB2_read(const unsigned int xid, struct cifs_io_parms *io_parms, · 15 unmodified lines | |||
| 3471 | io_parms->tcon->tid, ses->Suid, | 3472 | io_parms->tcon->tid, ses->Suid, |
| 3472 | io_parms->offset, io_parms->length); | 3473 | io_parms->offset, io_parms->length); |
| 3473 | 3474 | ||
| 3475 | cifs_small_buf_release(req); | ||
| 3476 | |||
| 3474 | *nbytes = le32_to_cpu(rsp->DataLength); | 3477 | *nbytes = le32_to_cpu(rsp->DataLength); |
| 3475 | if ((*nbytes > CIFS_MAX_MSGSIZE) || | 3478 | if ((*nbytes > CIFS_MAX_MSGSIZE) || |
| 3476 | (*nbytes > io_parms->length)) { | 3479 | (*nbytes > io_parms->length)) { |
| @@ -3769,7 +3772,6 @@ SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms, · 292 unmodified lines | |||
| 3769 | 3772 | ||
| 3770 | rc = cifs_send_recv(xid, io_parms->tcon->ses, &rqst, | 3773 | rc = cifs_send_recv(xid, io_parms->tcon->ses, &rqst, |
| 3771 | &resp_buftype, flags, &rsp_iov); | 3774 | &resp_buftype, flags, &rsp_iov); |
| 3772 | cifs_small_buf_release(req); | ||
| 3773 | rsp = (struct smb2_write_rsp *)rsp_iov.iov_base; | 3775 | rsp = (struct smb2_write_rsp *)rsp_iov.iov_base; |
| 3774 | 3776 | ||
| 3775 | if (rc) { | 3777 | if (rc) { |
| @@ -3787,6 +3789,7 @@ SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms, · 11 unmodified lines | |||
| 3787 | io_parms->offset, *nbytes); | 3789 | io_parms->offset, *nbytes); |
| 3788 | } | 3790 | } |
| 3789 | 3791 | ||
| 3792 | cifs_small_buf_release(req); | ||
| 3790 | free_rsp_buf(resp_buftype, rsp); | 3793 | free_rsp_buf(resp_buftype, rsp); |
| 3791 | return rc; | 3794 | return rc; |
| 3792 | } | 3795 | } |
| @@ -338,7 +338,7 @@ static struct io_uring_cqe *io_get_cqring(struct io_ring_ctx *ctx) · 337 unmodified lines | |||
| 338 | tail = ctx->cached_cq_tail; | 338 | tail = ctx->cached_cq_tail; |
| 339 | /* See comment at the top of the file */ | 339 | /* See comment at the top of the file */ |
| 340 | smp_rmb(); | 340 | smp_rmb(); |
| 341 | if (tail + 1 == READ_ONCE(ring->r.head)) | 341 | if (tail - READ_ONCE(ring->r.head) == ring->ring_entries) |
| 342 | return NULL; | 342 | return NULL; |
| 343 | 343 | ||
| 344 | ctx->cached_cq_tail++; | 344 | ctx->cached_cq_tail++; |
| @@ -682,11 +682,9 @@ static void io_iopoll_req_issued(struct io_kiocb *req) · 337 unmodified lines | |||
| 682 | list_add_tail(&req->list, &ctx->poll_list); | 682 | list_add_tail(&req->list, &ctx->poll_list); |
| 683 | } | 683 | } |
| 684 | 684 | ||
| 685 | static void io_file_put(struct io_submit_state *state, struct file *file) | 685 | static void io_file_put(struct io_submit_state *state) |
| 686 | { | 686 | { |
| 687 | if (!state) { | 687 | if (state->file) { |
| 688 | fput(file); | ||
| 689 | } else if (state->file) { | ||
| 690 | int diff = state->has_refs - state->used_refs; | 688 | int diff = state->has_refs - state->used_refs; |
| 691 | 689 | ||
| 692 | if (diff) | 690 | if (diff) |
| @@ -711,7 +709,7 @@ static struct file *io_file_get(struct io_submit_state *state, int fd) · 18 unmodified lines | |||
| 711 | state->ios_left--; | 709 | state->ios_left--; |
| 712 | return state->file; | 710 | return state->file; |
| 713 | } | 711 | } |
| 714 | io_file_put(state, NULL); | 712 | io_file_put(state); |
| 715 | } | 713 | } |
| 716 | state->file = fget_many(fd, state->ios_left); | 714 | state->file = fget_many(fd, state->ios_left); |
| 717 | if (!state->file) | 715 | if (!state->file) |
| @@ -1671,7 +1669,7 @@ out: · 953 unmodified lines | |||
| 1671 | static void io_submit_state_end(struct io_submit_state *state) | 1669 | static void io_submit_state_end(struct io_submit_state *state) |
| 1672 | { | 1670 | { |
| 1673 | blk_finish_plug(&state->plug); | 1671 | blk_finish_plug(&state->plug); |
| 1674 | io_file_put(state, NULL); | 1672 | io_file_put(state); |
| 1675 | if (state->free_reqs) | 1673 | if (state->free_reqs) |
| 1676 | kmem_cache_free_bulk(req_cachep, state->free_reqs, | 1674 | kmem_cache_free_bulk(req_cachep, state->free_reqs, |
| 1677 | &state->reqs[state->cur_req]); | 1675 | &state->reqs[state->cur_req]); |
| @@ -1920,6 +1918,10 @@ static int io_sq_thread(void *data) · 242 unmodified lines | |||
| 1920 | unuse_mm(cur_mm); | 1918 | unuse_mm(cur_mm); |
| 1921 | mmput(cur_mm); | 1919 | mmput(cur_mm); |
| 1922 | } | 1920 | } |
| 1921 | |||
| 1922 | if (kthread_should_park()) | ||
| 1923 | kthread_parkme(); | ||
| 1924 | |||
| 1923 | return 0; | 1925 | return 0; |
| 1924 | } | 1926 | } |
| 1925 | 1927 | ||
| @@ -2054,6 +2056,7 @@ static void io_sq_thread_stop(struct io_ring_ctx *ctx) · 128 unmodified lines | |||
| 2054 | if (ctx->sqo_thread) { | 2056 | if (ctx->sqo_thread) { |
| 2055 | ctx->sqo_stop = 1; | 2057 | ctx->sqo_stop = 1; |
| 2056 | mb(); | 2058 | mb(); |
| 2059 | kthread_park(ctx->sqo_thread); | ||
| 2057 | kthread_stop(ctx->sqo_thread); | 2060 | kthread_stop(ctx->sqo_thread); |
| 2058 | ctx->sqo_thread = NULL; | 2061 | ctx->sqo_thread = NULL; |
| 2059 | } | 2062 | } |
| @@ -2236,10 +2239,6 @@ static int io_sq_offload_start(struct io_ring_ctx *ctx, · 176 unmodified lines | |||
| 2236 | mmgrab(current->mm); | 2239 | mmgrab(current->mm); |
| 2237 | ctx->sqo_mm = current->mm; | 2240 | ctx->sqo_mm = current->mm; |
| 2238 | 2241 | ||
| 2239 | ctx->sq_thread_idle = msecs_to_jiffies(p->sq_thread_idle); | ||
| 2240 | if (!ctx->sq_thread_idle) | ||
| 2241 | ctx->sq_thread_idle = HZ; | ||
| 2242 | |||
| 2243 | ret = -EINVAL; | 2242 | ret = -EINVAL; |
| 2244 | if (!cpu_possible(p->sq_thread_cpu)) | 2243 | if (!cpu_possible(p->sq_thread_cpu)) |
| 2245 | goto err; | 2244 | goto err; |
| @@ -2249,10 +2248,18 @@ static int io_sq_offload_start(struct io_ring_ctx *ctx, · 3 unmodified lines | |||
| 2249 | if (!capable(CAP_SYS_ADMIN)) | 2248 | if (!capable(CAP_SYS_ADMIN)) |
| 2250 | goto err; | 2249 | goto err; |
| 2251 | 2250 | ||
| 2251 | ctx->sq_thread_idle = msecs_to_jiffies(p->sq_thread_idle); | ||
| 2252 | if (!ctx->sq_thread_idle) | ||
| 2253 | ctx->sq_thread_idle = HZ; | ||
| 2254 | |||
| 2252 | if (p->flags & IORING_SETUP_SQ_AFF) { | 2255 | if (p->flags & IORING_SETUP_SQ_AFF) { |
| 2253 | int cpu; | 2256 | int cpu; |
| 2254 | 2257 | ||
| 2255 | cpu = array_index_nospec(p->sq_thread_cpu, NR_CPUS); | 2258 | cpu = array_index_nospec(p->sq_thread_cpu, NR_CPUS); |
| 2259 | ret = -EINVAL; | ||
| 2260 | if (!cpu_possible(p->sq_thread_cpu)) | ||
| 2261 | goto err; | ||
| 2262 | |||
| 2256 | ctx->sqo_thread = kthread_create_on_cpu(io_sq_thread, | 2263 | ctx->sqo_thread = kthread_create_on_cpu(io_sq_thread, |
| 2257 | ctx, cpu, | 2264 | ctx, cpu, |
| 2258 | "io_uring-sq"); | 2265 | "io_uring-sq"); |
| @@ -2922,11 +2929,23 @@ SYSCALL_DEFINE2(io_uring_setup, u32, entries, · 663 unmodified lines | |||
| 2922 | 2929 | ||
| 2923 | static int __io_uring_register(struct io_ring_ctx *ctx, unsigned opcode, | 2930 | static int __io_uring_register(struct io_ring_ctx *ctx, unsigned opcode, |
| 2924 | void __user *arg, unsigned nr_args) | 2931 | void __user *arg, unsigned nr_args) |
| 2932 | __releases(ctx->uring_lock) | ||
| 2933 | __acquires(ctx->uring_lock) | ||
| 2925 | { | 2934 | { |
| 2926 | int ret; | 2935 | int ret; |
| 2927 | 2936 | ||
| 2928 | percpu_ref_kill(&ctx->refs); | 2937 | percpu_ref_kill(&ctx->refs); |
| 2938 | |||
| 2939 | /* | ||
| 2940 | * Drop uring mutex before waiting for references to exit. If another | ||
| 2941 | * thread is currently inside io_uring_enter() it might need to grab | ||
| 2942 | * the uring_lock to make progress. If we hold it here across the drain | ||
| 2943 | * wait, then we can deadlock. It's safe to drop the mutex here, since | ||
| 2944 | * no new references will come in after we've killed the percpu ref. | ||
| 2945 | */ | ||
| 2946 | mutex_unlock(&ctx->uring_lock); | ||
| 2929 | wait_for_completion(&ctx->ctx_done); | 2947 | wait_for_completion(&ctx->ctx_done); |
| 2948 | mutex_lock(&ctx->uring_lock); | ||
| 2930 | 2949 | ||
| 2931 | switch (opcode) { | 2950 | switch (opcode) { |
| 2932 | case IORING_REGISTER_BUFFERS: | 2951 | case IORING_REGISTER_BUFFERS: |
| @@ -442,7 +442,9 @@ nfsd3_proc_readdir(struct svc_rqst *rqstp) · 441 unmodified lines | |||
| 442 | struct nfsd3_readdirargs *argp = rqstp->rq_argp; | 442 | struct nfsd3_readdirargs *argp = rqstp->rq_argp; |
| 443 | struct nfsd3_readdirres *resp = rqstp->rq_resp; | 443 | struct nfsd3_readdirres *resp = rqstp->rq_resp; |
| 444 | __be32 nfserr; | 444 | __be32 nfserr; |
| 445 | int count; | 445 | int count = 0; |
| 446 | struct page **p; | ||
| 447 | caddr_t page_addr = NULL; | ||
| 446 | 448 | ||
| 447 | dprintk("nfsd: READDIR(3) %s %d bytes at %d\n", | 449 | dprintk("nfsd: READDIR(3) %s %d bytes at %d\n", |
| 448 | SVCFH_fmt(&argp->fh), | 450 | SVCFH_fmt(&argp->fh), |
| @@ -462,7 +464,18 @@ nfsd3_proc_readdir(struct svc_rqst *rqstp) · 13 unmodified lines | |||
| 462 | nfserr = nfsd_readdir(rqstp, &resp->fh, (loff_t*) &argp->cookie, | 464 | nfserr = nfsd_readdir(rqstp, &resp->fh, (loff_t*) &argp->cookie, |
| 463 | &resp->common, nfs3svc_encode_entry); | 465 | &resp->common, nfs3svc_encode_entry); |
| 464 | memcpy(resp->verf, argp->verf, 8); | 466 | memcpy(resp->verf, argp->verf, 8); |
| 465 | resp->count = resp->buffer - argp->buffer; | 467 | count = 0; |
| 468 | for (p = rqstp->rq_respages + 1; p < rqstp->rq_next_page; p++) { | ||
| 469 | page_addr = page_address(*p); | ||
| 470 | |||
| 471 | if (((caddr_t)resp->buffer >= page_addr) && | ||
| 472 | ((caddr_t)resp->buffer < page_addr + PAGE_SIZE)) { | ||
| 473 | count += (caddr_t)resp->buffer - page_addr; | ||
| 474 | break; | ||
| 475 | } | ||
| 476 | count += PAGE_SIZE; | ||
| 477 | } | ||
| 478 | resp->count = count >> 2; | ||
| 466 | if (resp->offset) { | 479 | if (resp->offset) { |
| 467 | loff_t offset = argp->cookie; | 480 | loff_t offset = argp->cookie; |
| 468 | 481 | ||
| @@ -573,6 +573,7 @@ int · 572 unmodified lines | |||
| 573 | nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p) | 573 | nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p) |
| 574 | { | 574 | { |
| 575 | struct nfsd3_readdirargs *args = rqstp->rq_argp; | 575 | struct nfsd3_readdirargs *args = rqstp->rq_argp; |
| 576 | int len; | ||
| 576 | u32 max_blocksize = svc_max_payload(rqstp); | 577 | u32 max_blocksize = svc_max_payload(rqstp); |
| 577 | 578 | ||
| 578 | p = decode_fh(p, &args->fh); | 579 | p = decode_fh(p, &args->fh); |
| @@ -582,8 +583,14 @@ nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p) · 3 unmodified lines | |||
| 582 | args->verf = p; p += 2; | 583 | args->verf = p; p += 2; |
| 583 | args->dircount = ~0; | 584 | args->dircount = ~0; |
| 584 | args->count = ntohl(*p++); | 585 | args->count = ntohl(*p++); |
| 585 | args->count = min_t(u32, args->count, max_blocksize); | 586 | len = args->count = min_t(u32, args->count, max_blocksize); |
| 586 | args->buffer = page_address(*(rqstp->rq_next_page++)); | 587 | |
| 588 | while (len > 0) { | ||
| 589 | struct page *p = *(rqstp->rq_next_page++); | ||
| 590 | if (!args->buffer) | ||
| 591 | args->buffer = page_address(p); | ||
| 592 | len -= PAGE_SIZE; | ||
| 593 | } | ||
| 587 | 594 | ||
| 588 | return xdr_argsize_check(rqstp, p); | 595 | return xdr_argsize_check(rqstp, p); |
| 589 | } | 596 | } |
| @@ -1010,8 +1010,9 @@ static void nfsd4_cb_prepare(struct rpc_task *task, void *calldata) · 1009 unmodified lines | |||
| 1010 | cb->cb_seq_status = 1; | 1010 | cb->cb_seq_status = 1; |
| 1011 | cb->cb_status = 0; | 1011 | cb->cb_status = 0; |
| 1012 | if (minorversion) { | 1012 | if (minorversion) { |
| 1013 | if (!nfsd41_cb_get_slot(clp, task)) | 1013 | if (!cb->cb_holds_slot && !nfsd41_cb_get_slot(clp, task)) |
| 1014 | return; | 1014 | return; |
| 1015 | cb->cb_holds_slot = true; | ||
| 1015 | } | 1016 | } |
| 1016 | rpc_call_start(task); | 1017 | rpc_call_start(task); |
| 1017 | } | 1018 | } |
| @@ -1038,6 +1039,9 @@ static bool nfsd4_cb_sequence_done(struct rpc_task *task, struct nfsd4_callback · 20 unmodified lines | |||
| 1038 | return true; | 1039 | return true; |
| 1039 | } | 1040 | } |
| 1040 | 1041 | ||
| 1042 | if (!cb->cb_holds_slot) | ||
| 1043 | goto need_restart; | ||
| 1044 | |||
| 1041 | switch (cb->cb_seq_status) { | 1045 | switch (cb->cb_seq_status) { |
| 1042 | case 0: | 1046 | case 0: |
| 1043 | /* | 1047 | /* |
| @@ -1076,6 +1080,7 @@ static bool nfsd4_cb_sequence_done(struct rpc_task *task, struct nfsd4_callback · 32 unmodified lines | |||
| 1076 | cb->cb_seq_status); | 1080 | cb->cb_seq_status); |
| 1077 | } | 1081 | } |
| 1078 | 1082 | ||
| 1083 | cb->cb_holds_slot = false; | ||
| 1079 | clear_bit(0, &clp->cl_cb_slot_busy); | 1084 | clear_bit(0, &clp->cl_cb_slot_busy); |
| 1080 | rpc_wake_up_next(&clp->cl_cb_waitq); | 1085 | rpc_wake_up_next(&clp->cl_cb_waitq); |
| 1081 | dprintk("%s: freed slot, new seqid=%d\n", __func__, | 1086 | dprintk("%s: freed slot, new seqid=%d\n", __func__, |
| @@ -1283,6 +1288,7 @@ void nfsd4_init_cb(struct nfsd4_callback *cb, struct nfs4_client *clp, · 201 unmodified lines | |||
| 1283 | cb->cb_seq_status = 1; | 1288 | cb->cb_seq_status = 1; |
| 1284 | cb->cb_status = 0; | 1289 | cb->cb_status = 0; |
| 1285 | cb->cb_need_restart = false; | 1290 | cb->cb_need_restart = false; |
| 1291 | cb->cb_holds_slot = false; | ||
| 1286 | } | 1292 | } |
| 1287 | 1293 | ||
| 1288 | void nfsd4_run_cb(struct nfsd4_callback *cb) | 1294 | void nfsd4_run_cb(struct nfsd4_callback *cb) |
| @@ -265,6 +265,7 @@ find_or_allocate_block(struct nfs4_lockowner *lo, struct knfsd_fh *fh, · 264 unmodified lines | |||
| 265 | static void | 265 | static void |
| 266 | free_blocked_lock(struct nfsd4_blocked_lock *nbl) | 266 | free_blocked_lock(struct nfsd4_blocked_lock *nbl) |
| 267 | { | 267 | { |
| 268 | locks_delete_block(&nbl->nbl_lock); | ||
| 268 | locks_release_private(&nbl->nbl_lock); | 269 | locks_release_private(&nbl->nbl_lock); |
| 269 | kfree(nbl); | 270 | kfree(nbl); |
| 270 | } | 271 | } |
| @@ -293,11 +294,18 @@ remove_blocked_locks(struct nfs4_lockowner *lo) · 22 unmodified lines | |||
| 293 | nbl = list_first_entry(&reaplist, struct nfsd4_blocked_lock, | 294 | nbl = list_first_entry(&reaplist, struct nfsd4_blocked_lock, |
| 294 | nbl_lru); | 295 | nbl_lru); |
| 295 | list_del_init(&nbl->nbl_lru); | 296 | list_del_init(&nbl->nbl_lru); |
| 296 | locks_delete_block(&nbl->nbl_lock); | ||
| 297 | free_blocked_lock(nbl); | 297 | free_blocked_lock(nbl); |
| 298 | } | 298 | } |
| 299 | } | 299 | } |
| 300 | 300 | ||
| 301 | static void | ||
| 302 | nfsd4_cb_notify_lock_prepare(struct nfsd4_callback *cb) | ||
| 303 | { | ||
| 304 | struct nfsd4_blocked_lock *nbl = container_of(cb, | ||
| 305 | struct nfsd4_blocked_lock, nbl_cb); | ||
| 306 | locks_delete_block(&nbl->nbl_lock); | ||
| 307 | } | ||
| 308 | |||
| 301 | static int | 309 | static int |
| 302 | nfsd4_cb_notify_lock_done(struct nfsd4_callback *cb, struct rpc_task *task) | 310 | nfsd4_cb_notify_lock_done(struct nfsd4_callback *cb, struct rpc_task *task) |
| 303 | { | 311 | { |
| @@ -325,6 +333,7 @@ nfsd4_cb_notify_lock_release(struct nfsd4_callback *cb) · 21 unmodified lines | |||
| 325 | } | 333 | } |
| 326 | 334 | ||
| 327 | static const struct nfsd4_callback_ops nfsd4_cb_notify_lock_ops = { | 335 | static const struct nfsd4_callback_ops nfsd4_cb_notify_lock_ops = { |
| 336 | .prepare = nfsd4_cb_notify_lock_prepare, | ||
| 328 | .done = nfsd4_cb_notify_lock_done, | 337 | .done = nfsd4_cb_notify_lock_done, |
| 329 | .release = nfsd4_cb_notify_lock_release, | 338 | .release = nfsd4_cb_notify_lock_release, |
| 330 | }; | 339 | }; |
| @@ -4863,7 +4872,6 @@ nfs4_laundromat(struct nfsd_net *nn) · 4532 unmodified lines | |||
| 4863 | nbl = list_first_entry(&reaplist, | 4872 | nbl = list_first_entry(&reaplist, |
| 4864 | struct nfsd4_blocked_lock, nbl_lru); | 4873 | struct nfsd4_blocked_lock, nbl_lru); |
| 4865 | list_del_init(&nbl->nbl_lru); | 4874 | list_del_init(&nbl->nbl_lru); |
| 4866 | locks_delete_block(&nbl->nbl_lock); | ||
| 4867 | free_blocked_lock(nbl); | 4875 | free_blocked_lock(nbl); |
| 4868 | } | 4876 | } |
| 4869 | out: | 4877 | out: |
| @@ -70,6 +70,7 @@ struct nfsd4_callback { · 69 unmodified lines | |||
| 70 | int cb_seq_status; | 70 | int cb_seq_status; |
| 71 | int cb_status; | 71 | int cb_status; |
| 72 | bool cb_need_restart; | 72 | bool cb_need_restart; |
| 73 | bool cb_holds_slot; | ||
| 73 | }; | 74 | }; |
| 74 | 75 | ||
| 75 | struct nfsd4_callback_ops { | 76 | struct nfsd4_callback_ops { |
| @@ -1143,6 +1143,24 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf, · 1142 unmodified lines | |||
| 1143 | count = -EINTR; | 1143 | count = -EINTR; |
| 1144 | goto out_mm; | 1144 | goto out_mm; |
| 1145 | } | 1145 | } |
| 1146 | /* | ||
| 1147 | * Avoid to modify vma->vm_flags | ||
| 1148 | * without locked ops while the | ||
| 1149 | * coredump reads the vm_flags. | ||
| 1150 | */ | ||
| 1151 | if (!mmget_still_valid(mm)) { | ||
| 1152 | /* | ||
| 1153 | * Silently return "count" | ||
| 1154 | * like if get_task_mm() | ||
| 1155 | * failed. FIXME: should this | ||
| 1156 | * function have returned | ||
| 1157 | * -ESRCH if get_task_mm() | ||
| 1158 | * failed like if | ||
| 1159 | * get_proc_task() fails? | ||
| 1160 | */ | ||
| 1161 | up_write(&mm->mmap_sem); | ||
| 1162 | goto out_mm; | ||
| 1163 | } | ||
| 1146 | for (vma = mm->mmap; vma; vma = vma->vm_next) { | 1164 | for (vma = mm->mmap; vma; vma = vma->vm_next) { |
| 1147 | vma->vm_flags &= ~VM_SOFTDIRTY; | 1165 | vma->vm_flags &= ~VM_SOFTDIRTY; |
| 1148 | vma_set_page_prot(vma); | 1166 | vma_set_page_prot(vma); |
| @@ -629,6 +629,8 @@ static void userfaultfd_event_wait_completion(struct userfaultfd_ctx *ctx, · 628 unmodified lines | |||
| 629 | 629 | ||
| 630 | /* the various vma->vm_userfaultfd_ctx still points to it */ | 630 | /* the various vma->vm_userfaultfd_ctx still points to it */ |
| 631 | down_write(&mm->mmap_sem); | 631 | down_write(&mm->mmap_sem); |
| 632 | /* no task can run (and in turn coredump) yet */ | ||
| 633 | VM_WARN_ON(!mmget_still_valid(mm)); | ||
| 632 | for (vma = mm->mmap; vma; vma = vma->vm_next) | 634 | for (vma = mm->mmap; vma; vma = vma->vm_next) |
| 633 | if (vma->vm_userfaultfd_ctx.ctx == release_new_ctx) { | 635 | if (vma->vm_userfaultfd_ctx.ctx == release_new_ctx) { |
| 634 | vma->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX; | 636 | vma->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX; |
| @@ -883,6 +885,8 @@ static int userfaultfd_release(struct inode *inode, struct file *file) · 248 unmodified lines | |||
| 883 | * taking the mmap_sem for writing. | 885 | * taking the mmap_sem for writing. |
| 884 | */ | 886 | */ |
| 885 | down_write(&mm->mmap_sem); | 887 | down_write(&mm->mmap_sem); |
| 888 | if (!mmget_still_valid(mm)) | ||
| 889 | goto skip_mm; | ||
| 886 | prev = NULL; | 890 | prev = NULL; |
| 887 | for (vma = mm->mmap; vma; vma = vma->vm_next) { | 891 | for (vma = mm->mmap; vma; vma = vma->vm_next) { |
| 888 | cond_resched(); | 892 | cond_resched(); |
| @@ -905,6 +909,7 @@ static int userfaultfd_release(struct inode *inode, struct file *file) · 16 unmodified lines | |||
| 905 | vma->vm_flags = new_flags; | 909 | vma->vm_flags = new_flags; |
| 906 | vma->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX; | 910 | vma->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX; |
| 907 | } | 911 | } |
| 912 | skip_mm: | ||
| 908 | up_write(&mm->mmap_sem); | 913 | up_write(&mm->mmap_sem); |
| 909 | mmput(mm); | 914 | mmput(mm); |
| 910 | wakeup: | 915 | wakeup: |
| @@ -1333,6 +1338,8 @@ static int userfaultfd_register(struct userfaultfd_ctx *ctx, · 422 unmodified lines | |||
| 1333 | goto out; | 1338 | goto out; |
| 1334 | 1339 | ||
| 1335 | down_write(&mm->mmap_sem); | 1340 | down_write(&mm->mmap_sem); |
| 1341 | if (!mmget_still_valid(mm)) | ||
| 1342 | goto out_unlock; | ||
| 1336 | vma = find_vma_prev(mm, start, &prev); | 1343 | vma = find_vma_prev(mm, start, &prev); |
| 1337 | if (!vma) | 1344 | if (!vma) |
| 1338 | goto out_unlock; | 1345 | goto out_unlock; |
| @@ -1520,6 +1527,8 @@ static int userfaultfd_unregister(struct userfaultfd_ctx *ctx, · 181 unmodified lines | |||
| 1520 | goto out; | 1527 | goto out; |
| 1521 | 1528 | ||
| 1522 | down_write(&mm->mmap_sem); | 1529 | down_write(&mm->mmap_sem); |
| 1530 | if (!mmget_still_valid(mm)) | ||
| 1531 | goto out_unlock; | ||
| 1523 | vma = find_vma_prev(mm, start, &prev); | 1532 | vma = find_vma_prev(mm, start, &prev); |
| 1524 | if (!vma) | 1533 | if (!vma) |
| 1525 | goto out_unlock; | 1534 | goto out_unlock; |
| @@ -548,7 +548,6 @@ struct request_queue { · 547 unmodified lines | |||
| 548 | struct rcu_head rcu_head; | 548 | struct rcu_head rcu_head; |
| 549 | wait_queue_head_t mq_freeze_wq; | 549 | wait_queue_head_t mq_freeze_wq; |
| 550 | struct percpu_ref q_usage_counter; | 550 | struct percpu_ref q_usage_counter; |
| 551 | struct list_head all_q_node; | ||
| 552 | 551 | ||
| 553 | struct blk_mq_tag_set *tag_set; | 552 | struct blk_mq_tag_set *tag_set; |
| 554 | struct list_head tag_set_list; | 553 | struct list_head tag_set_list; |
| @@ -160,8 +160,9 @@ static inline void bvec_advance(const struct bio_vec *bvec, · 159 unmodified lines | |||
| 160 | bv->bv_page = nth_page(bv->bv_page, 1); | 160 | bv->bv_page = nth_page(bv->bv_page, 1); |
| 161 | bv->bv_offset = 0; | 161 | bv->bv_offset = 0; |
| 162 | } else { | 162 | } else { |
| 163 | bv->bv_page = bvec->bv_page; | 163 | bv->bv_page = bvec_nth_page(bvec->bv_page, bvec->bv_offset / |
| 164 | bv->bv_offset = bvec->bv_offset; | 164 | PAGE_SIZE); |
| 165 | bv->bv_offset = bvec->bv_offset & ~PAGE_MASK; | ||
| 165 | } | 166 | } |
| 166 | bv->bv_len = min_t(unsigned int, PAGE_SIZE - bv->bv_offset, | 167 | bv->bv_len = min_t(unsigned int, PAGE_SIZE - bv->bv_offset, |
| 167 | bvec->bv_len - iter_all->done); | 168 | bvec->bv_len - iter_all->done); |
| @@ -1611,7 +1611,12 @@ efi_status_t efi_setup_gop(efi_system_table_t *sys_table_arg, · 1610 unmodified lines | |||
| 1611 | struct screen_info *si, efi_guid_t *proto, | 1611 | struct screen_info *si, efi_guid_t *proto, |
| 1612 | unsigned long size); | 1612 | unsigned long size); |
| 1613 | 1613 | ||
| 1614 | bool efi_runtime_disabled(void); | 1614 | #ifdef CONFIG_EFI |
| 1615 | extern bool efi_runtime_disabled(void); | ||
| 1616 | #else | ||
| 1617 | static inline bool efi_runtime_disabled(void) { return true; } | ||
| 1618 | #endif | ||
| 1619 | |||
| 1615 | extern void efi_call_virt_check_flags(unsigned long flags, const char *call); | 1620 | extern void efi_call_virt_check_flags(unsigned long flags, const char *call); |
| 1616 | extern unsigned long efi_call_virt_save_flags(void); | 1621 | extern unsigned long efi_call_virt_save_flags(void); |
| 1617 | 1622 | ||
| @@ -31,6 +31,7 @@ struct elevator_mq_ops { · 30 unmodified lines | |||
| 31 | void (*exit_sched)(struct elevator_queue *); | 31 | void (*exit_sched)(struct elevator_queue *); |
| 32 | int (*init_hctx)(struct blk_mq_hw_ctx *, unsigned int); | 32 | int (*init_hctx)(struct blk_mq_hw_ctx *, unsigned int); |
| 33 | void (*exit_hctx)(struct blk_mq_hw_ctx *, unsigned int); | 33 | void (*exit_hctx)(struct blk_mq_hw_ctx *, unsigned int); |
| 34 | void (*depth_updated)(struct blk_mq_hw_ctx *); | ||
| 34 | 35 | ||
| 35 | bool (*allow_merge)(struct request_queue *, struct request *, struct bio *); | 36 | bool (*allow_merge)(struct request_queue *, struct request *, struct bio *); |
| 36 | bool (*bio_merge)(struct blk_mq_hw_ctx *, struct bio *); | 37 | bool (*bio_merge)(struct blk_mq_hw_ctx *, struct bio *); |
| @@ -448,6 +448,18 @@ static inline void eth_addr_dec(u8 *addr) · 447 unmodified lines | |||
| 448 | u64_to_ether_addr(u, addr); | 448 | u64_to_ether_addr(u, addr); |
| 449 | } | 449 | } |
| 450 | 450 | ||
| 451 | /** | ||
| 452 | * eth_addr_inc() - Increment the given MAC address. | ||
| 453 | * @addr: Pointer to a six-byte array containing Ethernet address to increment. | ||
| 454 | */ | ||
| 455 | static inline void eth_addr_inc(u8 *addr) | ||
| 456 | { | ||
| 457 | u64 u = ether_addr_to_u64(addr); | ||
| 458 | |||
| 459 | u++; | ||
| 460 | u64_to_ether_addr(u, addr); | ||
| 461 | } | ||
| 462 | |||
| 451 | /** | 463 | /** |
| 452 | * is_etherdev_addr - Tell if given Ethernet address belongs to the device. | 464 | * is_etherdev_addr - Tell if given Ethernet address belongs to the device. |
| 453 | * @dev: Pointer to a device structure | 465 | * @dev: Pointer to a device structure |
| @@ -173,6 +173,7 @@ struct kretprobe_instance { · 172 unmodified lines | |||
| 173 | struct kretprobe *rp; | 173 | struct kretprobe *rp; |
| 174 | kprobe_opcode_t *ret_addr; | 174 | kprobe_opcode_t *ret_addr; |
| 175 | struct task_struct *task; | 175 | struct task_struct *task; |
| 176 | void *fp; | ||
| 176 | char data[0]; | 177 | char data[0]; |
| 177 | }; | 178 | }; |
| 178 | 179 | ||
| @@ -49,6 +49,27 @@ static inline void mmdrop(struct mm_struct *mm) · 48 unmodified lines | |||
| 49 | __mmdrop(mm); | 49 | __mmdrop(mm); |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | /* | ||
| 53 | * This has to be called after a get_task_mm()/mmget_not_zero() | ||
| 54 | * followed by taking the mmap_sem for writing before modifying the | ||
| 55 | * vmas or anything the coredump pretends not to change from under it. | ||
| 56 | * | ||
| 57 | * NOTE: find_extend_vma() called from GUP context is the only place | ||
| 58 | * that can modify the "mm" (notably the vm_start/end) under mmap_sem | ||
| 59 | * for reading and outside the context of the process, so it is also | ||
| 60 | * the only case that holds the mmap_sem for reading that must call | ||
| 61 | * this function. Generally if the mmap_sem is hold for reading | ||
| 62 | * there's no need of this check after get_task_mm()/mmget_not_zero(). | ||
| 63 | * | ||
| 64 | * This function can be obsoleted and the check can be removed, after | ||
| 65 | * the coredump code will hold the mmap_sem for writing before | ||
| 66 | * invoking the ->core_dump methods. | ||
| 67 | */ | ||
| 68 | static inline bool mmget_still_valid(struct mm_struct *mm) | ||
| 69 | { | ||
| 70 | return likely(!mm->core_state); | ||
| 71 | } | ||
| 72 | |||
| 52 | /** | 73 | /** |
| 53 | * mmget() - Pin the address space associated with a &struct mm_struct. | 74 | * mmget() - Pin the address space associated with a &struct mm_struct. |
| 54 | * @mm: The address space to pin. | 75 | * @mm: The address space to pin. |
| @@ -21,6 +21,7 @@ struct shmem_inode_info { · 20 unmodified lines | |||
| 21 | struct list_head swaplist; /* chain of maybes on swap */ | 21 | struct list_head swaplist; /* chain of maybes on swap */ |
| 22 | struct shared_policy policy; /* NUMA memory alloc policy */ | 22 | struct shared_policy policy; /* NUMA memory alloc policy */ |
| 23 | struct simple_xattrs xattrs; /* list of xattrs */ | 23 | struct simple_xattrs xattrs; /* list of xattrs */ |
| 24 | atomic_t stop_eviction; /* hold when working on inode */ | ||
| 24 | struct inode vfs_inode; | 25 | struct inode vfs_inode; |
| 25 | }; | 26 | }; |
| 26 | 27 | ||
| @@ -316,6 +316,8 @@ struct nf_conn *nf_ct_tmpl_alloc(struct net *net, · 315 unmodified lines | |||
| 316 | gfp_t flags); | 316 | gfp_t flags); |
| 317 | void nf_ct_tmpl_free(struct nf_conn *tmpl); | 317 | void nf_ct_tmpl_free(struct nf_conn *tmpl); |
| 318 | 318 | ||
| 319 | u32 nf_ct_get_id(const struct nf_conn *ct); | ||
| 320 | |||
| 319 | static inline void | 321 | static inline void |
| 320 | nf_ct_set(struct sk_buff *skb, struct nf_conn *ct, enum ip_conntrack_info info) | 322 | nf_ct_set(struct sk_buff *skb, struct nf_conn *ct, enum ip_conntrack_info info) |
| 321 | { | 323 | { |
| @@ -75,6 +75,12 @@ bool nf_conntrack_invert_icmp_tuple(struct nf_conntrack_tuple *tuple, · 74 unmodified lines | |||
| 75 | bool nf_conntrack_invert_icmpv6_tuple(struct nf_conntrack_tuple *tuple, | 75 | bool nf_conntrack_invert_icmpv6_tuple(struct nf_conntrack_tuple *tuple, |
| 76 | const struct nf_conntrack_tuple *orig); | 76 | const struct nf_conntrack_tuple *orig); |
| 77 | 77 | ||
| 78 | int nf_conntrack_inet_error(struct nf_conn *tmpl, struct sk_buff *skb, | ||
| 79 | unsigned int dataoff, | ||
| 80 | const struct nf_hook_state *state, | ||
| 81 | u8 l4proto, | ||
| 82 | union nf_inet_addr *outer_daddr); | ||
| 83 | |||
| 78 | int nf_conntrack_icmpv4_error(struct nf_conn *tmpl, | 84 | int nf_conntrack_icmpv4_error(struct nf_conn *tmpl, |
| 79 | struct sk_buff *skb, | 85 | struct sk_buff *skb, |
| 80 | unsigned int dataoff, | 86 | unsigned int dataoff, |
| @@ -439,10 +439,12 @@ · 438 unmodified lines | |||
| 439 | #define KEY_TITLE 0x171 | 439 | #define KEY_TITLE 0x171 |
| 440 | #define KEY_SUBTITLE 0x172 | 440 | #define KEY_SUBTITLE 0x172 |
| 441 | #define KEY_ANGLE 0x173 | 441 | #define KEY_ANGLE 0x173 |
| 442 | #define KEY_ZOOM 0x174 | 442 | #define KEY_FULL_SCREEN 0x174 /* AC View Toggle */ |
| 443 | #define KEY_ZOOM KEY_FULL_SCREEN | ||
| 443 | #define KEY_MODE 0x175 | 444 | #define KEY_MODE 0x175 |
| 444 | #define KEY_KEYBOARD 0x176 | 445 | #define KEY_KEYBOARD 0x176 |
| 445 | #define KEY_SCREEN 0x177 | 446 | #define KEY_ASPECT_RATIO 0x177 /* HUTRR37: Aspect */ |
| 447 | #define KEY_SCREEN KEY_ASPECT_RATIO | ||
| 446 | #define KEY_PC 0x178 /* Media Select Computer */ | 448 | #define KEY_PC 0x178 /* Media Select Computer */ |
| 447 | #define KEY_TV 0x179 /* Media Select TV */ | 449 | #define KEY_TV 0x179 /* Media Select TV */ |
| 448 | #define KEY_TV2 0x17a /* Media Select Cable */ | 450 | #define KEY_TV2 0x17a /* Media Select Cable */ |
| @@ -582,6 +582,8 @@ asmlinkage __visible void __init start_kernel(void) · 581 unmodified lines | |||
| 582 | page_alloc_init(); | 582 | page_alloc_init(); |
| 583 | 583 | ||
| 584 | pr_notice("Kernel command line: %s\n", boot_command_line); | 584 | pr_notice("Kernel command line: %s\n", boot_command_line); |
| 585 | /* parameters may set static keys */ | ||
| 586 | jump_label_init(); | ||
| 585 | parse_early_param(); | 587 | parse_early_param(); |
| 586 | after_dashes = parse_args("Booting kernel", | 588 | after_dashes = parse_args("Booting kernel", |
| 587 | static_command_line, __start___param, | 589 | static_command_line, __start___param, |
| @@ -591,8 +593,6 @@ asmlinkage __visible void __init start_kernel(void) · 3 unmodified lines | |||
| 591 | parse_args("Setting init args", after_dashes, NULL, 0, -1, -1, | 593 | parse_args("Setting init args", after_dashes, NULL, 0, -1, -1, |
| 592 | NULL, set_init_arg); | 594 | NULL, set_init_arg); |
| 593 | 595 | ||
| 594 | jump_label_init(); | ||
| 595 | |||
| 596 | /* | 596 | /* |
| 597 | * These use large bootmem allocations and must precede | 597 | * These use large bootmem allocations and must precede |
| 598 | * kmem_cache_init() | 598 | * kmem_cache_init() |
| @@ -9077,26 +9077,29 @@ static void perf_event_addr_filters_apply(struct perf_event *event) · 9076 unmodified lines | |||
| 9077 | if (task == TASK_TOMBSTONE) | 9077 | if (task == TASK_TOMBSTONE) |
| 9078 | return; | 9078 | return; |
| 9079 | 9079 | ||
| 9080 | if (!ifh->nr_file_filters) | 9080 | if (ifh->nr_file_filters) { |
| 9081 | return; | 9081 | mm = get_task_mm(event->ctx->task); |
| 9082 | 9082 | if (!mm) | |
| 9083 | mm = get_task_mm(event->ctx->task); | 9083 | goto restart; |
| 9084 | if (!mm) | ||
| 9085 | goto restart; | ||
| 9086 | 9084 | ||
| 9087 | down_read(&mm->mmap_sem); | 9085 | down_read(&mm->mmap_sem); |
| 9086 | } | ||
| 9088 | 9087 | ||
| 9089 | raw_spin_lock_irqsave(&ifh->lock, flags); | 9088 | raw_spin_lock_irqsave(&ifh->lock, flags); |
| 9090 | list_for_each_entry(filter, &ifh->list, entry) { | 9089 | list_for_each_entry(filter, &ifh->list, entry) { |
| 9091 | event->addr_filter_ranges[count].start = 0; | 9090 | if (filter->path.dentry) { |
| 9092 | event->addr_filter_ranges[count].size = 0; | 9091 | /* |
| 9092 | * Adjust base offset if the filter is associated to a | ||
| 9093 | * binary that needs to be mapped: | ||
| 9094 | */ | ||
| 9095 | event->addr_filter_ranges[count].start = 0; | ||
| 9096 | event->addr_filter_ranges[count].size = 0; | ||
| 9093 | 9097 | ||
| 9094 | /* | ||
| 9095 | * Adjust base offset if the filter is associated to a binary | ||
| 9096 | * that needs to be mapped: | ||
| 9097 | */ | ||
| 9098 | if (filter->path.dentry) | ||
| 9099 | perf_addr_filter_apply(filter, mm, &event->addr_filter_ranges[count]); | 9098 | perf_addr_filter_apply(filter, mm, &event->addr_filter_ranges[count]); |
| 9099 | } else { | ||
| 9100 | event->addr_filter_ranges[count].start = filter->offset; | ||
| 9101 | event->addr_filter_ranges[count].size = filter->size; | ||
| 9102 | } | ||
| 9100 | 9103 | ||
| 9101 | count++; | 9104 | count++; |
| 9102 | } | 9105 | } |
| @@ -9104,9 +9107,11 @@ static void perf_event_addr_filters_apply(struct perf_event *event) · 1 unmodified line | |||
| 9104 | event->addr_filters_gen++; | 9107 | event->addr_filters_gen++; |
| 9105 | raw_spin_unlock_irqrestore(&ifh->lock, flags); | 9108 | raw_spin_unlock_irqrestore(&ifh->lock, flags); |
| 9106 | 9109 | ||
| 9107 | up_read(&mm->mmap_sem); | 9110 | if (ifh->nr_file_filters) { |
| 9111 | up_read(&mm->mmap_sem); | ||
| 9108 | 9112 | ||
| 9109 | mmput(mm); | 9113 | mmput(mm); |
| 9114 | } | ||
| 9110 | 9115 | ||
| 9111 | restart: | 9116 | restart: |
| 9112 | perf_event_stop(event, 1); | 9117 | perf_event_stop(event, 1); |
| @@ -455,24 +455,21 @@ void perf_aux_output_end(struct perf_output_handle *handle, unsigned long size) · 454 unmodified lines | |||
| 455 | rb->aux_head += size; | 455 | rb->aux_head += size; |
| 456 | } | 456 | } |
| 457 | 457 | ||
| 458 | if (size || handle->aux_flags) { | 458 | /* |
| 459 | /* | 459 | * Only send RECORD_AUX if we have something useful to communicate |
| 460 | * Only send RECORD_AUX if we have something useful to communicate | 460 | * |
| 461 | * | 461 | * Note: the OVERWRITE records by themselves are not considered |
| 462 | * Note: the OVERWRITE records by themselves are not considered | 462 | * useful, as they don't communicate any *new* information, |
| 463 | * useful, as they don't communicate any *new* information, | 463 | * aside from the short-lived offset, that becomes history at |
| 464 | * aside from the short-lived offset, that becomes history at | 464 | * the next event sched-in and therefore isn't useful. |
| 465 | * the next event sched-in and therefore isn't useful. | 465 | * The userspace that needs to copy out AUX data in overwrite |
| 466 | * The userspace that needs to copy out AUX data in overwrite | 466 | * mode should know to use user_page::aux_head for the actual |
| 467 | * mode should know to use user_page::aux_head for the actual | 467 | * offset. So, from now on we don't output AUX records that |
| 468 | * offset. So, from now on we don't output AUX records that | 468 | * have *only* OVERWRITE flag set. |
| 469 | * have *only* OVERWRITE flag set. | 469 | */ |
| 470 | */ | 470 | if (size || (handle->aux_flags & ~(u64)PERF_AUX_FLAG_OVERWRITE)) |
| 471 | 471 | perf_event_aux_event(handle->event, aux_head, size, | |
| 472 | if (handle->aux_flags & ~(u64)PERF_AUX_FLAG_OVERWRITE) | 472 | handle->aux_flags); |
| 473 | perf_event_aux_event(handle->event, aux_head, size, | ||
| 474 | handle->aux_flags); | ||
| 475 | } | ||
| 476 | 473 | ||
| 477 | rb->user_page->aux_head = rb->aux_head; | 474 | rb->user_page->aux_head = rb->aux_head; |
| 478 | if (rb_need_aux_wakeup(rb)) | 475 | if (rb_need_aux_wakeup(rb)) |
| @@ -709,7 +709,6 @@ static void unoptimize_kprobe(struct kprobe *p, bool force) · 708 unmodified lines | |||
| 709 | static int reuse_unused_kprobe(struct kprobe *ap) | 709 | static int reuse_unused_kprobe(struct kprobe *ap) |
| 710 | { | 710 | { |
| 711 | struct optimized_kprobe *op; | 711 | struct optimized_kprobe *op; |
| 712 | int ret; | ||
| 713 | 712 | ||
| 714 | /* | 713 | /* |
| 715 | * Unused kprobe MUST be on the way of delayed unoptimizing (means | 714 | * Unused kprobe MUST be on the way of delayed unoptimizing (means |
| @@ -720,9 +719,8 @@ static int reuse_unused_kprobe(struct kprobe *ap) · 4 unmodified lines | |||
| 720 | /* Enable the probe again */ | 719 | /* Enable the probe again */ |
| 721 | ap->flags &= ~KPROBE_FLAG_DISABLED; | 720 | ap->flags &= ~KPROBE_FLAG_DISABLED; |
| 722 | /* Optimize it again (remove from op->list) */ | 721 | /* Optimize it again (remove from op->list) */ |
| 723 | ret = kprobe_optready(ap); | 722 | if (!kprobe_optready(ap)) |
| 724 | if (ret) | 723 | return -EINVAL; |
| 725 | return ret; | ||
| 726 | 724 | ||
| 727 | optimize_kprobe(ap); | 725 | optimize_kprobe(ap); |
| 728 | return 0; | 726 | return 0; |
| @@ -4907,8 +4907,9 @@ void lockdep_unregister_key(struct lock_class_key *key) · 4906 unmodified lines | |||
| 4907 | return; | 4907 | return; |
| 4908 | 4908 | ||
| 4909 | raw_local_irq_save(flags); | 4909 | raw_local_irq_save(flags); |
| 4910 | arch_spin_lock(&lockdep_lock); | 4910 | if (!graph_lock()) |
| 4911 | current->lockdep_recursion = 1; | 4911 | goto out_irq; |
| 4912 | |||
| 4912 | pf = get_pending_free(); | 4913 | pf = get_pending_free(); |
| 4913 | hlist_for_each_entry_rcu(k, hash_head, hash_entry) { | 4914 | hlist_for_each_entry_rcu(k, hash_head, hash_entry) { |
| 4914 | if (k == key) { | 4915 | if (k == key) { |
| @@ -4920,8 +4921,8 @@ void lockdep_unregister_key(struct lock_class_key *key) · 5 unmodified lines | |||
| 4920 | WARN_ON_ONCE(!found); | 4921 | WARN_ON_ONCE(!found); |
| 4921 | __lockdep_free_key_range(pf, key, 1); | 4922 | __lockdep_free_key_range(pf, key, 1); |
| 4922 | call_rcu_zapped(pf); | 4923 | call_rcu_zapped(pf); |
| 4923 | current->lockdep_recursion = 0; | 4924 | graph_unlock(); |
| 4924 | arch_spin_unlock(&lockdep_lock); | 4925 | out_irq: |
| 4925 | raw_local_irq_restore(flags); | 4926 | raw_local_irq_restore(flags); |
| 4926 | 4927 | ||
| 4927 | /* Wait until is_dynamic_key() has finished accessing k->hash_entry. */ | 4928 | /* Wait until is_dynamic_key() has finished accessing k->hash_entry. */ |
| @@ -252,7 +252,6 @@ static void task_non_contending(struct task_struct *p) · 251 unmodified lines | |||
| 252 | if (dl_entity_is_special(dl_se)) | 252 | if (dl_entity_is_special(dl_se)) |
| 253 | return; | 253 | return; |
| 254 | 254 | ||
| 255 | WARN_ON(hrtimer_active(&dl_se->inactive_timer)); | ||
| 256 | WARN_ON(dl_se->dl_non_contending); | 255 | WARN_ON(dl_se->dl_non_contending); |
| 257 | 256 | ||
| 258 | zerolag_time = dl_se->deadline - | 257 | zerolag_time = dl_se->deadline - |
| @@ -269,7 +268,7 @@ static void task_non_contending(struct task_struct *p) · 10 unmodified lines | |||
| 269 | * If the "0-lag time" already passed, decrease the active | 268 | * If the "0-lag time" already passed, decrease the active |
| 270 | * utilization now, instead of starting a timer | 269 | * utilization now, instead of starting a timer |
| 271 | */ | 270 | */ |
| 272 | if (zerolag_time < 0) { | 271 | if ((zerolag_time < 0) || hrtimer_active(&dl_se->inactive_timer)) { |
| 273 | if (dl_task(p)) | 272 | if (dl_task(p)) |
| 274 | sub_running_bw(dl_se, dl_rq); | 273 | sub_running_bw(dl_se, dl_rq); |
| 275 | if (!dl_task(p) || p->state == TASK_DEAD) { | 274 | if (!dl_task(p) || p->state == TASK_DEAD) { |
| @@ -4885,6 +4885,8 @@ static enum hrtimer_restart sched_cfs_slack_timer(struct hrtimer *timer) · 4884 unmodified lines | |||
| 4885 | return HRTIMER_NORESTART; | 4885 | return HRTIMER_NORESTART; |
| 4886 | } | 4886 | } |
| 4887 | 4887 | ||
| 4888 | extern const u64 max_cfs_quota_period; | ||
| 4889 | |||
| 4888 | static enum hrtimer_restart sched_cfs_period_timer(struct hrtimer *timer) | 4890 | static enum hrtimer_restart sched_cfs_period_timer(struct hrtimer *timer) |
| 4889 | { | 4891 | { |
| 4890 | struct cfs_bandwidth *cfs_b = | 4892 | struct cfs_bandwidth *cfs_b = |
| @@ -4892,6 +4894,7 @@ static enum hrtimer_restart sched_cfs_period_timer(struct hrtimer *timer) · 1 unmodified line | |||
| 4892 | unsigned long flags; | 4894 | unsigned long flags; |
| 4893 | int overrun; | 4895 | int overrun; |
| 4894 | int idle = 0; | 4896 | int idle = 0; |
| 4897 | int count = 0; | ||
| 4895 | 4898 | ||
| 4896 | raw_spin_lock_irqsave(&cfs_b->lock, flags); | 4899 | raw_spin_lock_irqsave(&cfs_b->lock, flags); |
| 4897 | for (;;) { | 4900 | for (;;) { |
| @@ -4899,6 +4902,28 @@ static enum hrtimer_restart sched_cfs_period_timer(struct hrtimer *timer) · 1 unmodified line | |||
| 4899 | if (!overrun) | 4902 | if (!overrun) |
| 4900 | break; | 4903 | break; |
| 4901 | 4904 | ||
| 4905 | if (++count > 3) { | ||
| 4906 | u64 new, old = ktime_to_ns(cfs_b->period); | ||
| 4907 | |||
| 4908 | new = (old * 147) / 128; /* ~115% */ | ||
| 4909 | new = min(new, max_cfs_quota_period); | ||
| 4910 | |||
| 4911 | cfs_b->period = ns_to_ktime(new); | ||
| 4912 | |||
| 4913 | /* since max is 1s, this is limited to 1e9^2, which fits in u64 */ | ||
| 4914 | cfs_b->quota *= new; | ||
| 4915 | cfs_b->quota = div64_u64(cfs_b->quota, old); | ||
| 4916 | |||
| 4917 | pr_warn_ratelimited( | ||
| 4918 | "cfs_period_timer[cpu%d]: period too short, scaling up (new cfs_period_us %lld, cfs_quota_us = %lld)\n", | ||
| 4919 | smp_processor_id(), | ||
| 4920 | div_u64(new, NSEC_PER_USEC), | ||
| 4921 | div_u64(cfs_b->quota, NSEC_PER_USEC)); | ||
| 4922 | |||
| 4923 | /* reset count so we don't come right back in here */ | ||
| 4924 | count = 0; | ||
| 4925 | } | ||
| 4926 | |||
| 4902 | idle = do_sched_cfs_period_timer(cfs_b, overrun, flags); | 4927 | idle = do_sched_cfs_period_timer(cfs_b, overrun, flags); |
| 4903 | } | 4928 | } |
| 4904 | if (idle) | 4929 | if (idle) |
| @@ -3581,7 +3581,7 @@ SYSCALL_DEFINE4(pidfd_send_signal, int, pidfd, int, sig, · 3580 unmodified lines | |||
| 3581 | if (flags) | 3581 | if (flags) |
| 3582 | return -EINVAL; | 3582 | return -EINVAL; |
| 3583 | 3583 | ||
| 3584 | f = fdget_raw(pidfd); | 3584 | f = fdget(pidfd); |
| 3585 | if (!f.file) | 3585 | if (!f.file) |
| 3586 | return -EBADF; | 3586 | return -EBADF; |
| 3587 | 3587 | ||
| @@ -272,7 +272,7 @@ static u64 notrace suspended_sched_clock_read(void) · 271 unmodified lines | |||
| 272 | return cd.read_data[seq & 1].epoch_cyc; | 272 | return cd.read_data[seq & 1].epoch_cyc; |
| 273 | } | 273 | } |
| 274 | 274 | ||
| 275 | static int sched_clock_suspend(void) | 275 | int sched_clock_suspend(void) |
| 276 | { | 276 | { |
| 277 | struct clock_read_data *rd = &cd.read_data[0]; | 277 | struct clock_read_data *rd = &cd.read_data[0]; |
| 278 | 278 | ||
| @@ -283,7 +283,7 @@ static int sched_clock_suspend(void) · 4 unmodified lines | |||
| 283 | return 0; | 283 | return 0; |
| 284 | } | 284 | } |
| 285 | 285 | ||
| 286 | static void sched_clock_resume(void) | 286 | void sched_clock_resume(void) |
| 287 | { | 287 | { |
| 288 | struct clock_read_data *rd = &cd.read_data[0]; | 288 | struct clock_read_data *rd = &cd.read_data[0]; |
| 289 | 289 | ||
| @@ -487,6 +487,7 @@ void tick_freeze(void) · 486 unmodified lines | |||
| 487 | trace_suspend_resume(TPS("timekeeping_freeze"), | 487 | trace_suspend_resume(TPS("timekeeping_freeze"), |
| 488 | smp_processor_id(), true); | 488 | smp_processor_id(), true); |
| 489 | system_state = SYSTEM_SUSPEND; | 489 | system_state = SYSTEM_SUSPEND; |
| 490 | sched_clock_suspend(); | ||
| 490 | timekeeping_suspend(); | 491 | timekeeping_suspend(); |
| 491 | } else { | 492 | } else { |
| 492 | tick_suspend_local(); | 493 | tick_suspend_local(); |
| @@ -510,6 +511,7 @@ void tick_unfreeze(void) · 17 unmodified lines | |||
| 510 | 511 | ||
| 511 | if (tick_freeze_depth == num_online_cpus()) { | 512 | if (tick_freeze_depth == num_online_cpus()) { |
| 512 | timekeeping_resume(); | 513 | timekeeping_resume(); |
| 514 | sched_clock_resume(); | ||
| 513 | system_state = SYSTEM_RUNNING; | 515 | system_state = SYSTEM_RUNNING; |
| 514 | trace_suspend_resume(TPS("timekeeping_freeze"), | 516 | trace_suspend_resume(TPS("timekeeping_freeze"), |
| 515 | smp_processor_id(), false); | 517 | smp_processor_id(), false); |
| @@ -14,6 +14,13 @@ extern u64 timekeeping_max_deferment(void); · 13 unmodified lines | |||
| 14 | extern void timekeeping_warp_clock(void); | 14 | extern void timekeeping_warp_clock(void); |
| 15 | extern int timekeeping_suspend(void); | 15 | extern int timekeeping_suspend(void); |
| 16 | extern void timekeeping_resume(void); | 16 | extern void timekeeping_resume(void); |
| 17 | #ifdef CONFIG_GENERIC_SCHED_CLOCK | ||
| 18 | extern int sched_clock_suspend(void); | ||
| 19 | extern void sched_clock_resume(void); | ||
| 20 | #else | ||
| 21 | static inline int sched_clock_suspend(void) { return 0; } | ||
| 22 | static inline void sched_clock_resume(void) { } | ||
| 23 | #endif | ||
| 17 | 24 | ||
| 18 | extern void do_timer(unsigned long ticks); | 25 | extern void do_timer(unsigned long ticks); |
| 19 | extern void update_wall_time(void); | 26 | extern void update_wall_time(void); |
| @@ -33,6 +33,7 @@ · 32 unmodified lines | |||
| 33 | #include <linux/list.h> | 33 | #include <linux/list.h> |
| 34 | #include <linux/hash.h> | 34 | #include <linux/hash.h> |
| 35 | #include <linux/rcupdate.h> | 35 | #include <linux/rcupdate.h> |
| 36 | #include <linux/kprobes.h> | ||
| 36 | 37 | ||
| 37 | #include <trace/events/sched.h> | 38 | #include <trace/events/sched.h> |
| 38 | 39 | ||
| @@ -6246,7 +6247,7 @@ void ftrace_reset_array_ops(struct trace_array *tr) · 6207 unmodified lines | |||
| 6246 | tr->ops->func = ftrace_stub; | 6247 | tr->ops->func = ftrace_stub; |
| 6247 | } | 6248 | } |
| 6248 | 6249 | ||
| 6249 | static inline void | 6250 | static nokprobe_inline void |
| 6250 | __ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip, | 6251 | __ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip, |
| 6251 | struct ftrace_ops *ignored, struct pt_regs *regs) | 6252 | struct ftrace_ops *ignored, struct pt_regs *regs) |
| 6252 | { | 6253 | { |
| @@ -6306,11 +6307,13 @@ static void ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip, · 53 unmodified lines | |||
| 6306 | { | 6307 | { |
| 6307 | __ftrace_ops_list_func(ip, parent_ip, NULL, regs); | 6308 | __ftrace_ops_list_func(ip, parent_ip, NULL, regs); |
| 6308 | } | 6309 | } |
| 6310 | NOKPROBE_SYMBOL(ftrace_ops_list_func); | ||
| 6309 | #else | 6311 | #else |
| 6310 | static void ftrace_ops_no_ops(unsigned long ip, unsigned long parent_ip) | 6312 | static void ftrace_ops_no_ops(unsigned long ip, unsigned long parent_ip) |
| 6311 | { | 6313 | { |
| 6312 | __ftrace_ops_list_func(ip, parent_ip, NULL, NULL); | 6314 | __ftrace_ops_list_func(ip, parent_ip, NULL, NULL); |
| 6313 | } | 6315 | } |
| 6316 | NOKPROBE_SYMBOL(ftrace_ops_no_ops); | ||
| 6314 | #endif | 6317 | #endif |
| 6315 | 6318 | ||
| 6316 | /* | 6319 | /* |
| @@ -6337,6 +6340,7 @@ static void ftrace_ops_assist_func(unsigned long ip, unsigned long parent_ip, · 20 unmodified lines | |||
| 6337 | preempt_enable_notrace(); | 6340 | preempt_enable_notrace(); |
| 6338 | trace_clear_recursion(bit); | 6341 | trace_clear_recursion(bit); |
| 6339 | } | 6342 | } |
| 6343 | NOKPROBE_SYMBOL(ftrace_ops_assist_func); | ||
| 6340 | 6344 | ||
| 6341 | /** | 6345 | /** |
| 6342 | * ftrace_ops_get_func - get the function a trampoline should call | 6346 | * ftrace_ops_get_func - get the function a trampoline should call |
| @@ -135,7 +135,8 @@ static void watchdog_overflow_callback(struct perf_event *event, · 134 unmodified lines | |||
| 135 | if (__this_cpu_read(hard_watchdog_warn) == true) | 135 | if (__this_cpu_read(hard_watchdog_warn) == true) |
| 136 | return; | 136 | return; |
| 137 | 137 | ||
| 138 | pr_emerg("Watchdog detected hard LOCKUP on cpu %d", this_cpu); | 138 | pr_emerg("Watchdog detected hard LOCKUP on cpu %d\n", |
| 139 | this_cpu); | ||
| 139 | print_modules(); | 140 | print_modules(); |
| 140 | print_irqtrace_events(current); | 141 | print_irqtrace_events(current); |
| 141 | if (regs) | 142 | if (regs) |
| @@ -761,9 +761,9 @@ endmenu # "Memory Debugging" · 760 unmodified lines | |||
| 761 | config ARCH_HAS_KCOV | 761 | config ARCH_HAS_KCOV |
| 762 | bool | 762 | bool |
| 763 | help | 763 | help |
| 764 | KCOV does not have any arch-specific code, but currently it is enabled | 764 | An architecture should select this when it can successfully |
| 765 | only for x86_64. KCOV requires testing on other archs, and most likely | 765 | build and run with CONFIG_KCOV. This typically requires |
| 766 | disabling of instrumentation for some early boot code. | 766 | disabling instrumentation for some early boot code. |
| 767 | 767 | ||
| 768 | config CC_HAS_SANCOV_TRACE_PC | 768 | config CC_HAS_SANCOV_TRACE_PC |
| 769 | def_bool $(cc-option,-fsanitize-coverage=trace-pc) | 769 | def_bool $(cc-option,-fsanitize-coverage=trace-pc) |
| @@ -1401,6 +1401,7 @@ static void scan_block(void *_start, void *_end, · 1400 unmodified lines | |||
| 1401 | /* | 1401 | /* |
| 1402 | * Scan a large memory block in MAX_SCAN_SIZE chunks to reduce the latency. | 1402 | * Scan a large memory block in MAX_SCAN_SIZE chunks to reduce the latency. |
| 1403 | */ | 1403 | */ |
| 1404 | #ifdef CONFIG_SMP | ||
| 1404 | static void scan_large_block(void *start, void *end) | 1405 | static void scan_large_block(void *start, void *end) |
| 1405 | { | 1406 | { |
| 1406 | void *next; | 1407 | void *next; |
| @@ -1412,6 +1413,7 @@ static void scan_large_block(void *start, void *end) · 5 unmodified lines | |||
| 1412 | cond_resched(); | 1413 | cond_resched(); |
| 1413 | } | 1414 | } |
| 1414 | } | 1415 | } |
| 1416 | #endif | ||
| 1415 | 1417 | ||
| 1416 | /* | 1418 | /* |
| 1417 | * Scan a memory block corresponding to a kmemleak_object. A condition is | 1419 | * Scan a memory block corresponding to a kmemleak_object. A condition is |
| @@ -45,6 +45,7 @@ · 44 unmodified lines | |||
| 45 | #include <linux/moduleparam.h> | 45 | #include <linux/moduleparam.h> |
| 46 | #include <linux/pkeys.h> | 46 | #include <linux/pkeys.h> |
| 47 | #include <linux/oom.h> | 47 | #include <linux/oom.h> |
| 48 | #include <linux/sched/mm.h> | ||
| 48 | 49 | ||
| 49 | #include <linux/uaccess.h> | 50 | #include <linux/uaccess.h> |
| 50 | #include <asm/cacheflush.h> | 51 | #include <asm/cacheflush.h> |
| @@ -2525,7 +2526,8 @@ find_extend_vma(struct mm_struct *mm, unsigned long addr) · 2474 unmodified lines | |||
| 2525 | vma = find_vma_prev(mm, addr, &prev); | 2526 | vma = find_vma_prev(mm, addr, &prev); |
| 2526 | if (vma && (vma->vm_start <= addr)) | 2527 | if (vma && (vma->vm_start <= addr)) |
| 2527 | return vma; | 2528 | return vma; |
| 2528 | if (!prev || expand_stack(prev, addr)) | 2529 | /* don't alter vm_end if the coredump is running */ |
| 2530 | if (!prev || !mmget_still_valid(mm) || expand_stack(prev, addr)) | ||
| 2529 | return NULL; | 2531 | return NULL; |
| 2530 | if (prev->vm_flags & VM_LOCKED) | 2532 | if (prev->vm_flags & VM_LOCKED) |
| 2531 | populate_vma_page_range(prev, addr, prev->vm_end, NULL); | 2533 | populate_vma_page_range(prev, addr, prev->vm_end, NULL); |
| @@ -2551,6 +2553,9 @@ find_extend_vma(struct mm_struct *mm, unsigned long addr) · 19 unmodified lines | |||
| 2551 | return vma; | 2553 | return vma; |
| 2552 | if (!(vma->vm_flags & VM_GROWSDOWN)) | 2554 | if (!(vma->vm_flags & VM_GROWSDOWN)) |
| 2553 | return NULL; | 2555 | return NULL; |
| 2556 | /* don't alter vm_start if the coredump is running */ | ||
| 2557 | if (!mmget_still_valid(mm)) | ||
| 2558 | return NULL; | ||
| 2554 | start = vma->vm_start; | 2559 | start = vma->vm_start; |
| 2555 | if (expand_stack(vma, addr)) | 2560 | if (expand_stack(vma, addr)) |
| 2556 | return NULL; | 2561 | return NULL; |
| @@ -8005,7 +8005,10 @@ void *__init alloc_large_system_hash(const char *tablename, · 8004 unmodified lines | |||
| 8005 | bool has_unmovable_pages(struct zone *zone, struct page *page, int count, | 8005 | bool has_unmovable_pages(struct zone *zone, struct page *page, int count, |
| 8006 | int migratetype, int flags) | 8006 | int migratetype, int flags) |
| 8007 | { | 8007 | { |
| 8008 | unsigned long pfn, iter, found; | 8008 | unsigned long found; |
| 8009 | unsigned long iter = 0; | ||
| 8010 | unsigned long pfn = page_to_pfn(page); | ||
| 8011 | const char *reason = "unmovable page"; | ||
| 8009 | 8012 | ||
| 8010 | /* | 8013 | /* |
| 8011 | * TODO we could make this much more efficient by not checking every | 8014 | * TODO we could make this much more efficient by not checking every |
| @@ -8015,17 +8018,20 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count, · 3 unmodified lines | |||
| 8015 | * can still lead to having bootmem allocations in zone_movable. | 8018 | * can still lead to having bootmem allocations in zone_movable. |
| 8016 | */ | 8019 | */ |
| 8017 | 8020 | ||
| 8018 | /* | 8021 | if (is_migrate_cma_page(page)) { |
| 8019 | * CMA allocations (alloc_contig_range) really need to mark isolate | 8022 | /* |
| 8020 | * CMA pageblocks even when they are not movable in fact so consider | 8023 | * CMA allocations (alloc_contig_range) really need to mark |
| 8021 | * them movable here. | 8024 | * isolate CMA pageblocks even when they are not movable in fact |
| 8022 | */ | 8025 | * so consider them movable here. |
| 8023 | if (is_migrate_cma(migratetype) && | 8026 | */ |
| 8024 | is_migrate_cma(get_pageblock_migratetype(page))) | 8027 | if (is_migrate_cma(migratetype)) |
| 8025 | return false; | 8028 | return false; |
| 8029 | |||
| 8030 | reason = "CMA page"; | ||
| 8031 | goto unmovable; | ||
| 8032 | } | ||
| 8026 | 8033 | ||
| 8027 | pfn = page_to_pfn(page); | 8034 | for (found = 0; iter < pageblock_nr_pages; iter++) { |
| 8028 | for (found = 0, iter = 0; iter < pageblock_nr_pages; iter++) { | ||
| 8029 | unsigned long check = pfn + iter; | 8035 | unsigned long check = pfn + iter; |
| 8030 | 8036 | ||
| 8031 | if (!pfn_valid_within(check)) | 8037 | if (!pfn_valid_within(check)) |
| @@ -8105,7 +8111,7 @@ bool has_unmovable_pages(struct zone *zone, struct page *page, int count, · 73 unmodified lines | |||
| 8105 | unmovable: | 8111 | unmovable: |
| 8106 | WARN_ON_ONCE(zone_idx(zone) == ZONE_MOVABLE); | 8112 | WARN_ON_ONCE(zone_idx(zone) == ZONE_MOVABLE); |
| 8107 | if (flags & REPORT_FAILURE) | 8113 | if (flags & REPORT_FAILURE) |
| 8108 | dump_page(pfn_to_page(pfn+iter), "unmovable page"); | 8114 | dump_page(pfn_to_page(pfn + iter), reason); |
| 8109 | return true; | 8115 | return true; |
| 8110 | } | 8116 | } |
| 8111 | 8117 | ||
| @@ -2567,8 +2567,8 @@ int __init pcpu_embed_first_chunk(size_t reserved_size, size_t dyn_size, · 2566 unmodified lines | |||
| 2567 | ai->groups[group].base_offset = areas[group] - base; | 2567 | ai->groups[group].base_offset = areas[group] - base; |
| 2568 | } | 2568 | } |
| 2569 | 2569 | ||
| 2570 | pr_info("Embedded %zu pages/cpu @%p s%zu r%zu d%zu u%zu\n", | 2570 | pr_info("Embedded %zu pages/cpu s%zu r%zu d%zu u%zu\n", |
| 2571 | PFN_DOWN(size_sum), base, ai->static_size, ai->reserved_size, | 2571 | PFN_DOWN(size_sum), ai->static_size, ai->reserved_size, |
| 2572 | ai->dyn_size, ai->unit_size); | 2572 | ai->dyn_size, ai->unit_size); |
| 2573 | 2573 | ||
| 2574 | rc = pcpu_setup_first_chunk(ai, base); | 2574 | rc = pcpu_setup_first_chunk(ai, base); |
| @@ -2692,8 +2692,8 @@ int __init pcpu_page_first_chunk(size_t reserved_size, · 117 unmodified lines | |||
| 2692 | } | 2692 | } |
| 2693 | 2693 | ||
| 2694 | /* we're ready, commit */ | 2694 | /* we're ready, commit */ |
| 2695 | pr_info("%d %s pages/cpu @%p s%zu r%zu d%zu\n", | 2695 | pr_info("%d %s pages/cpu s%zu r%zu d%zu\n", |
| 2696 | unit_pages, psize_str, vm.addr, ai->static_size, | 2696 | unit_pages, psize_str, ai->static_size, |
| 2697 | ai->reserved_size, ai->dyn_size); | 2697 | ai->reserved_size, ai->dyn_size); |
| 2698 | 2698 | ||
| 2699 | rc = pcpu_setup_first_chunk(ai, vm.addr); | 2699 | rc = pcpu_setup_first_chunk(ai, vm.addr); |
| @@ -1081,9 +1081,14 @@ static void shmem_evict_inode(struct inode *inode) · 1080 unmodified lines | |||
| 1081 | } | 1081 | } |
| 1082 | spin_unlock(&sbinfo->shrinklist_lock); | 1082 | spin_unlock(&sbinfo->shrinklist_lock); |
| 1083 | } | 1083 | } |
| 1084 | if (!list_empty(&info->swaplist)) { | 1084 | while (!list_empty(&info->swaplist)) { |
| 1085 | /* Wait while shmem_unuse() is scanning this inode... */ | ||
| 1086 | wait_var_event(&info->stop_eviction, | ||
| 1087 | !atomic_read(&info->stop_eviction)); | ||
| 1085 | mutex_lock(&shmem_swaplist_mutex); | 1088 | mutex_lock(&shmem_swaplist_mutex); |
| 1086 | list_del_init(&info->swaplist); | 1089 | /* ...but beware of the race if we peeked too early */ |
| 1090 | if (!atomic_read(&info->stop_eviction)) | ||
| 1091 | list_del_init(&info->swaplist); | ||
| 1087 | mutex_unlock(&shmem_swaplist_mutex); | 1092 | mutex_unlock(&shmem_swaplist_mutex); |
| 1088 | } | 1093 | } |
| 1089 | } | 1094 | } |
| @@ -1099,10 +1104,11 @@ extern struct swap_info_struct *swap_info[]; · 9 unmodified lines | |||
| 1099 | static int shmem_find_swap_entries(struct address_space *mapping, | 1104 | static int shmem_find_swap_entries(struct address_space *mapping, |
| 1100 | pgoff_t start, unsigned int nr_entries, | 1105 | pgoff_t start, unsigned int nr_entries, |
| 1101 | struct page **entries, pgoff_t *indices, | 1106 | struct page **entries, pgoff_t *indices, |
| 1102 | bool frontswap) | 1107 | unsigned int type, bool frontswap) |
| 1103 | { | 1108 | { |
| 1104 | XA_STATE(xas, &mapping->i_pages, start); | 1109 | XA_STATE(xas, &mapping->i_pages, start); |
| 1105 | struct page *page; | 1110 | struct page *page; |
| 1111 | swp_entry_t entry; | ||
| 1106 | unsigned int ret = 0; | 1112 | unsigned int ret = 0; |
| 1107 | 1113 | ||
| 1108 | if (!nr_entries) | 1114 | if (!nr_entries) |
| @@ -1116,13 +1122,12 @@ static int shmem_find_swap_entries(struct address_space *mapping, · 7 unmodified lines | |||
| 1116 | if (!xa_is_value(page)) | 1122 | if (!xa_is_value(page)) |
| 1117 | continue; | 1123 | continue; |
| 1118 | 1124 | ||
| 1119 | if (frontswap) { | 1125 | entry = radix_to_swp_entry(page); |
| 1120 | swp_entry_t entry = radix_to_swp_entry(page); | 1126 | if (swp_type(entry) != type) |
| 1121 | 1127 | continue; | |
| 1122 | if (!frontswap_test(swap_info[swp_type(entry)], | 1128 | if (frontswap && |
| 1123 | swp_offset(entry))) | 1129 | !frontswap_test(swap_info[type], swp_offset(entry))) |
| 1124 | continue; | 1130 | continue; |
| 1125 | } | ||
| 1126 | 1131 | ||
| 1127 | indices[ret] = xas.xa_index; | 1132 | indices[ret] = xas.xa_index; |
| 1128 | entries[ret] = page; | 1133 | entries[ret] = page; |
| @@ -1194,7 +1199,7 @@ static int shmem_unuse_inode(struct inode *inode, unsigned int type, · 65 unmodified lines | |||
| 1194 | 1199 | ||
| 1195 | pvec.nr = shmem_find_swap_entries(mapping, start, nr_entries, | 1200 | pvec.nr = shmem_find_swap_entries(mapping, start, nr_entries, |
| 1196 | pvec.pages, indices, | 1201 | pvec.pages, indices, |
| 1197 | frontswap); | 1202 | type, frontswap); |
| 1198 | if (pvec.nr == 0) { | 1203 | if (pvec.nr == 0) { |
| 1199 | ret = 0; | 1204 | ret = 0; |
| 1200 | break; | 1205 | break; |
| @@ -1227,36 +1232,27 @@ int shmem_unuse(unsigned int type, bool frontswap, · 26 unmodified lines | |||
| 1227 | unsigned long *fs_pages_to_unuse) | 1232 | unsigned long *fs_pages_to_unuse) |
| 1228 | { | 1233 | { |
| 1229 | struct shmem_inode_info *info, *next; | 1234 | struct shmem_inode_info *info, *next; |
| 1230 | struct inode *inode; | ||
| 1231 | struct inode *prev_inode = NULL; | ||
| 1232 | int error = 0; | 1235 | int error = 0; |
| 1233 | 1236 | ||
| 1234 | if (list_empty(&shmem_swaplist)) | 1237 | if (list_empty(&shmem_swaplist)) |
| 1235 | return 0; | 1238 | return 0; |
| 1236 | 1239 | ||
| 1237 | mutex_lock(&shmem_swaplist_mutex); | 1240 | mutex_lock(&shmem_swaplist_mutex); |
| 1238 | |||
| 1239 | /* | ||
| 1240 | * The extra refcount on the inode is necessary to safely dereference | ||
| 1241 | * p->next after re-acquiring the lock. New shmem inodes with swap | ||
| 1242 | * get added to the end of the list and we will scan them all. | ||
| 1243 | */ | ||
| 1244 | list_for_each_entry_safe(info, next, &shmem_swaplist, swaplist) { | 1241 | list_for_each_entry_safe(info, next, &shmem_swaplist, swaplist) { |
| 1245 | if (!info->swapped) { | 1242 | if (!info->swapped) { |
| 1246 | list_del_init(&info->swaplist); | 1243 | list_del_init(&info->swaplist); |
| 1247 | continue; | 1244 | continue; |
| 1248 | } | 1245 | } |
| 1249 | 1246 | /* | |
| 1250 | inode = igrab(&info->vfs_inode); | 1247 | * Drop the swaplist mutex while searching the inode for swap; |
| 1251 | if (!inode) | 1248 | * but before doing so, make sure shmem_evict_inode() will not |
| 1252 | continue; | 1249 | * remove placeholder inode from swaplist, nor let it be freed |
| 1253 | 1250 | * (igrab() would protect from unlink, but not from unmount). | |
| 1251 | */ | ||
| 1252 | atomic_inc(&info->stop_eviction); | ||
| 1254 | mutex_unlock(&shmem_swaplist_mutex); | 1253 | mutex_unlock(&shmem_swaplist_mutex); |
| 1255 | if (prev_inode) | ||
| 1256 | iput(prev_inode); | ||
| 1257 | prev_inode = inode; | ||
| 1258 | 1254 | ||
| 1259 | error = shmem_unuse_inode(inode, type, frontswap, | 1255 | error = shmem_unuse_inode(&info->vfs_inode, type, frontswap, |
| 1260 | fs_pages_to_unuse); | 1256 | fs_pages_to_unuse); |
| 1261 | cond_resched(); | 1257 | cond_resched(); |
| 1262 | 1258 | ||
| @@ -1264,14 +1260,13 @@ int shmem_unuse(unsigned int type, bool frontswap, · 1 unmodified line | |||
| 1264 | next = list_next_entry(info, swaplist); | 1260 | next = list_next_entry(info, swaplist); |
| 1265 | if (!info->swapped) | 1261 | if (!info->swapped) |
| 1266 | list_del_init(&info->swaplist); | 1262 | list_del_init(&info->swaplist); |
| 1263 | if (atomic_dec_and_test(&info->stop_eviction)) | ||
| 1264 | wake_up_var(&info->stop_eviction); | ||
| 1267 | if (error) | 1265 | if (error) |
| 1268 | break; | 1266 | break; |
| 1269 | } | 1267 | } |
| 1270 | mutex_unlock(&shmem_swaplist_mutex); | 1268 | mutex_unlock(&shmem_swaplist_mutex); |
| 1271 | 1269 | ||
| 1272 | if (prev_inode) | ||
| 1273 | iput(prev_inode); | ||
| 1274 | |||
| 1275 | return error; | 1270 | return error; |
| 1276 | } | 1271 | } |
| 1277 | 1272 | ||
| @@ -2238,6 +2233,7 @@ static struct inode *shmem_get_inode(struct super_block *sb, const struct inode · 960 unmodified lines | |||
| 2238 | info = SHMEM_I(inode); | 2233 | info = SHMEM_I(inode); |
| 2239 | memset(info, 0, (char *)inode - (char *)info); | 2234 | memset(info, 0, (char *)inode - (char *)info); |
| 2240 | spin_lock_init(&info->lock); | 2235 | spin_lock_init(&info->lock); |
| 2236 | atomic_set(&info->stop_eviction, 0); | ||
| 2241 | info->seals = F_SEAL_SEAL; | 2237 | info->seals = F_SEAL_SEAL; |
| 2242 | info->flags = flags & VM_NORESERVE; | 2238 | info->flags = flags & VM_NORESERVE; |
| 2243 | INIT_LIST_HEAD(&info->shrinklist); | 2239 | INIT_LIST_HEAD(&info->shrinklist); |
| @@ -2374,7 +2374,6 @@ static void *alloc_slabmgmt(struct kmem_cache *cachep, · 2373 unmodified lines | |||
| 2374 | /* Slab management obj is off-slab. */ | 2374 | /* Slab management obj is off-slab. */ |
| 2375 | freelist = kmem_cache_alloc_node(cachep->freelist_cache, | 2375 | freelist = kmem_cache_alloc_node(cachep->freelist_cache, |
| 2376 | local_flags, nodeid); | 2376 | local_flags, nodeid); |
| 2377 | freelist = kasan_reset_tag(freelist); | ||
| 2378 | if (!freelist) | 2377 | if (!freelist) |
| 2379 | return NULL; | 2378 | return NULL; |
| 2380 | } else { | 2379 | } else { |
| @@ -2023,7 +2023,6 @@ static unsigned int find_next_to_unuse(struct swap_info_struct *si, · 2022 unmodified lines | |||
| 2023 | * If the boolean frontswap is true, only unuse pages_to_unuse pages; | 2023 | * If the boolean frontswap is true, only unuse pages_to_unuse pages; |
| 2024 | * pages_to_unuse==0 means all pages; ignored if frontswap is false | 2024 | * pages_to_unuse==0 means all pages; ignored if frontswap is false |
| 2025 | */ | 2025 | */ |
| 2026 | #define SWAP_UNUSE_MAX_TRIES 3 | ||
| 2027 | int try_to_unuse(unsigned int type, bool frontswap, | 2026 | int try_to_unuse(unsigned int type, bool frontswap, |
| 2028 | unsigned long pages_to_unuse) | 2027 | unsigned long pages_to_unuse) |
| 2029 | { | 2028 | { |
| @@ -2035,7 +2034,6 @@ int try_to_unuse(unsigned int type, bool frontswap, · 5 unmodified lines | |||
| 2035 | struct page *page; | 2034 | struct page *page; |
| 2036 | swp_entry_t entry; | 2035 | swp_entry_t entry; |
| 2037 | unsigned int i; | 2036 | unsigned int i; |
| 2038 | int retries = 0; | ||
| 2039 | 2037 | ||
| 2040 | if (!si->inuse_pages) | 2038 | if (!si->inuse_pages) |
| 2041 | return 0; | 2039 | return 0; |
| @@ -2053,11 +2051,9 @@ retry: · 11 unmodified lines | |||
| 2053 | 2051 | ||
| 2054 | spin_lock(&mmlist_lock); | 2052 | spin_lock(&mmlist_lock); |
| 2055 | p = &init_mm.mmlist; | 2053 | p = &init_mm.mmlist; |
| 2056 | while ((p = p->next) != &init_mm.mmlist) { | 2054 | while (si->inuse_pages && |
| 2057 | if (signal_pending(current)) { | 2055 | !signal_pending(current) && |
| 2058 | retval = -EINTR; | 2056 | (p = p->next) != &init_mm.mmlist) { |
| 2059 | break; | ||
| 2060 | } | ||
| 2061 | 2057 | ||
| 2062 | mm = list_entry(p, struct mm_struct, mmlist); | 2058 | mm = list_entry(p, struct mm_struct, mmlist); |
| 2063 | if (!mmget_not_zero(mm)) | 2059 | if (!mmget_not_zero(mm)) |
| @@ -2084,7 +2080,9 @@ retry: · 20 unmodified lines | |||
| 2084 | mmput(prev_mm); | 2080 | mmput(prev_mm); |
| 2085 | 2081 | ||
| 2086 | i = 0; | 2082 | i = 0; |
| 2087 | while ((i = find_next_to_unuse(si, i, frontswap)) != 0) { | 2083 | while (si->inuse_pages && |
| 2084 | !signal_pending(current) && | ||
| 2085 | (i = find_next_to_unuse(si, i, frontswap)) != 0) { | ||
| 2088 | 2086 | ||
| 2089 | entry = swp_entry(type, i); | 2087 | entry = swp_entry(type, i); |
| 2090 | page = find_get_page(swap_address_space(entry), i); | 2088 | page = find_get_page(swap_address_space(entry), i); |
| @@ -2117,14 +2115,18 @@ retry: · 26 unmodified lines | |||
| 2117 | * If yes, we would need to do retry the unuse logic again. | 2115 | * If yes, we would need to do retry the unuse logic again. |
| 2118 | * Under global memory pressure, swap entries can be reinserted back | 2116 | * Under global memory pressure, swap entries can be reinserted back |
| 2119 | * into process space after the mmlist loop above passes over them. | 2117 | * into process space after the mmlist loop above passes over them. |
| 2120 | * Its not worth continuosuly retrying to unuse the swap in this case. | 2118 | * |
| 2121 | * So we try SWAP_UNUSE_MAX_TRIES times. | 2119 | * Limit the number of retries? No: when mmget_not_zero() above fails, |
| 2120 | * that mm is likely to be freeing swap from exit_mmap(), which proceeds | ||
| 2121 | * at its own independent pace; and even shmem_writepage() could have | ||
| 2122 | * been preempted after get_swap_page(), temporarily hiding that swap. | ||
| 2123 | * It's easy and robust (though cpu-intensive) just to keep retrying. | ||
| 2122 | */ | 2124 | */ |
| 2123 | if (++retries >= SWAP_UNUSE_MAX_TRIES) | 2125 | if (si->inuse_pages) { |
| 2124 | retval = -EBUSY; | 2126 | if (!signal_pending(current)) |
| 2125 | else if (si->inuse_pages) | 2127 | goto retry; |
| 2126 | goto retry; | 2128 | retval = -EINTR; |
| 2127 | 2129 | } | |
| 2128 | out: | 2130 | out: |
| 2129 | return (retval == FRONTSWAP_PAGES_UNUSED) ? 0 : retval; | 2131 | return (retval == FRONTSWAP_PAGES_UNUSED) ? 0 : retval; |
| 2130 | } | 2132 | } |
| @@ -2176,7 +2176,6 @@ static void shrink_active_list(unsigned long nr_to_scan, · 2175 unmodified lines | |||
| 2176 | * 10TB 320 32GB | 2176 | * 10TB 320 32GB |
| 2177 | */ | 2177 | */ |
| 2178 | static bool inactive_list_is_low(struct lruvec *lruvec, bool file, | 2178 | static bool inactive_list_is_low(struct lruvec *lruvec, bool file, |
| 2179 | struct mem_cgroup *memcg, | ||
| 2180 | struct scan_control *sc, bool actual_reclaim) | 2179 | struct scan_control *sc, bool actual_reclaim) |
| 2181 | { | 2180 | { |
| 2182 | enum lru_list active_lru = file * LRU_FILE + LRU_ACTIVE; | 2181 | enum lru_list active_lru = file * LRU_FILE + LRU_ACTIVE; |
| @@ -2197,16 +2196,12 @@ static bool inactive_list_is_low(struct lruvec *lruvec, bool file, · 14 unmodified lines | |||
| 2197 | inactive = lruvec_lru_size(lruvec, inactive_lru, sc->reclaim_idx); | 2196 | inactive = lruvec_lru_size(lruvec, inactive_lru, sc->reclaim_idx); |
| 2198 | active = lruvec_lru_size(lruvec, active_lru, sc->reclaim_idx); | 2197 | active = lruvec_lru_size(lruvec, active_lru, sc->reclaim_idx); |
| 2199 | 2198 | ||
| 2200 | if (memcg) | ||
| 2201 | refaults = memcg_page_state(memcg, WORKINGSET_ACTIVATE); | ||
| 2202 | else | ||
| 2203 | refaults = node_page_state(pgdat, WORKINGSET_ACTIVATE); | ||
| 2204 | |||
| 2205 | /* | 2199 | /* |
| 2206 | * When refaults are being observed, it means a new workingset | 2200 | * When refaults are being observed, it means a new workingset |
| 2207 | * is being established. Disable active list protection to get | 2201 | * is being established. Disable active list protection to get |
| 2208 | * rid of the stale workingset quickly. | 2202 | * rid of the stale workingset quickly. |
| 2209 | */ | 2203 | */ |
| 2204 | refaults = lruvec_page_state(lruvec, WORKINGSET_ACTIVATE); | ||
| 2210 | if (file && actual_reclaim && lruvec->refaults != refaults) { | 2205 | if (file && actual_reclaim && lruvec->refaults != refaults) { |
| 2211 | inactive_ratio = 0; | 2206 | inactive_ratio = 0; |
| 2212 | } else { | 2207 | } else { |
| @@ -2227,12 +2222,10 @@ static bool inactive_list_is_low(struct lruvec *lruvec, bool file, · 14 unmodified lines | |||
| 2227 | } | 2222 | } |
| 2228 | 2223 | ||
| 2229 | static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan, | 2224 | static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan, |
| 2230 | struct lruvec *lruvec, struct mem_cgroup *memcg, | 2225 | struct lruvec *lruvec, struct scan_control *sc) |
| 2231 | struct scan_control *sc) | ||
| 2232 | { | 2226 | { |
| 2233 | if (is_active_lru(lru)) { | 2227 | if (is_active_lru(lru)) { |
| 2234 | if (inactive_list_is_low(lruvec, is_file_lru(lru), | 2228 | if (inactive_list_is_low(lruvec, is_file_lru(lru), sc, true)) |
| 2235 | memcg, sc, true)) | ||
| 2236 | shrink_active_list(nr_to_scan, lruvec, sc, lru); | 2229 | shrink_active_list(nr_to_scan, lruvec, sc, lru); |
| 2237 | return 0; | 2230 | return 0; |
| 2238 | } | 2231 | } |
| @@ -2332,7 +2325,7 @@ static void get_scan_count(struct lruvec *lruvec, struct mem_cgroup *memcg, · 93 unmodified lines | |||
| 2332 | * anonymous pages on the LRU in eligible zones. | 2325 | * anonymous pages on the LRU in eligible zones. |
| 2333 | * Otherwise, the small LRU gets thrashed. | 2326 | * Otherwise, the small LRU gets thrashed. |
| 2334 | */ | 2327 | */ |
| 2335 | if (!inactive_list_is_low(lruvec, false, memcg, sc, false) && | 2328 | if (!inactive_list_is_low(lruvec, false, sc, false) && |
| 2336 | lruvec_lru_size(lruvec, LRU_INACTIVE_ANON, sc->reclaim_idx) | 2329 | lruvec_lru_size(lruvec, LRU_INACTIVE_ANON, sc->reclaim_idx) |
| 2337 | >> sc->priority) { | 2330 | >> sc->priority) { |
| 2338 | scan_balance = SCAN_ANON; | 2331 | scan_balance = SCAN_ANON; |
| @@ -2350,7 +2343,7 @@ static void get_scan_count(struct lruvec *lruvec, struct mem_cgroup *memcg, · 11 unmodified lines | |||
| 2350 | * lruvec even if it has plenty of old anonymous pages unless the | 2343 | * lruvec even if it has plenty of old anonymous pages unless the |
| 2351 | * system is under heavy pressure. | 2344 | * system is under heavy pressure. |
| 2352 | */ | 2345 | */ |
| 2353 | if (!inactive_list_is_low(lruvec, true, memcg, sc, false) && | 2346 | if (!inactive_list_is_low(lruvec, true, sc, false) && |
| 2354 | lruvec_lru_size(lruvec, LRU_INACTIVE_FILE, sc->reclaim_idx) >> sc->priority) { | 2347 | lruvec_lru_size(lruvec, LRU_INACTIVE_FILE, sc->reclaim_idx) >> sc->priority) { |
| 2355 | scan_balance = SCAN_FILE; | 2348 | scan_balance = SCAN_FILE; |
| 2356 | goto out; | 2349 | goto out; |
| @@ -2503,7 +2496,7 @@ static void shrink_node_memcg(struct pglist_data *pgdat, struct mem_cgroup *memc · 146 unmodified lines | |||
| 2503 | nr[lru] -= nr_to_scan; | 2496 | nr[lru] -= nr_to_scan; |
| 2504 | 2497 | ||
| 2505 | nr_reclaimed += shrink_list(lru, nr_to_scan, | 2498 | nr_reclaimed += shrink_list(lru, nr_to_scan, |
| 2506 | lruvec, memcg, sc); | 2499 | lruvec, sc); |
| 2507 | } | 2500 | } |
| 2508 | } | 2501 | } |
| 2509 | 2502 | ||
| @@ -2570,7 +2563,7 @@ static void shrink_node_memcg(struct pglist_data *pgdat, struct mem_cgroup *memc · 60 unmodified lines | |||
| 2570 | * Even if we did not try to evict anon pages at all, we want to | 2563 | * Even if we did not try to evict anon pages at all, we want to |
| 2571 | * rebalance the anon lru active/inactive ratio. | 2564 | * rebalance the anon lru active/inactive ratio. |
| 2572 | */ | 2565 | */ |
| 2573 | if (inactive_list_is_low(lruvec, false, memcg, sc, true)) | 2566 | if (inactive_list_is_low(lruvec, false, sc, true)) |
| 2574 | shrink_active_list(SWAP_CLUSTER_MAX, lruvec, | 2567 | shrink_active_list(SWAP_CLUSTER_MAX, lruvec, |
| 2575 | sc, LRU_ACTIVE_ANON); | 2568 | sc, LRU_ACTIVE_ANON); |
| 2576 | } | 2569 | } |
| @@ -2969,12 +2962,8 @@ static void snapshot_refaults(struct mem_cgroup *root_memcg, pg_data_t *pgdat) · 392 unmodified lines | |||
| 2969 | unsigned long refaults; | 2962 | unsigned long refaults; |
| 2970 | struct lruvec *lruvec; | 2963 | struct lruvec *lruvec; |
| 2971 | 2964 | ||
| 2972 | if (memcg) | ||
| 2973 | refaults = memcg_page_state(memcg, WORKINGSET_ACTIVATE); | ||
| 2974 | else | ||
| 2975 | refaults = node_page_state(pgdat, WORKINGSET_ACTIVATE); | ||
| 2976 | |||
| 2977 | lruvec = mem_cgroup_lruvec(pgdat, memcg); | 2965 | lruvec = mem_cgroup_lruvec(pgdat, memcg); |
| 2966 | refaults = lruvec_page_state(lruvec, WORKINGSET_ACTIVATE); | ||
| 2978 | lruvec->refaults = refaults; | 2967 | lruvec->refaults = refaults; |
| 2979 | } while ((memcg = mem_cgroup_iter(root_memcg, memcg, NULL))); | 2968 | } while ((memcg = mem_cgroup_iter(root_memcg, memcg, NULL))); |
| 2980 | } | 2969 | } |
| @@ -3339,7 +3328,7 @@ static void age_active_anon(struct pglist_data *pgdat, · 358 unmodified lines | |||
| 3339 | do { | 3328 | do { |
| 3340 | struct lruvec *lruvec = mem_cgroup_lruvec(pgdat, memcg); | 3329 | struct lruvec *lruvec = mem_cgroup_lruvec(pgdat, memcg); |
| 3341 | 3330 | ||
| 3342 | if (inactive_list_is_low(lruvec, false, memcg, sc, true)) | 3331 | if (inactive_list_is_low(lruvec, false, sc, true)) |
| 3343 | shrink_active_list(SWAP_CLUSTER_MAX, lruvec, | 3332 | shrink_active_list(SWAP_CLUSTER_MAX, lruvec, |
| 3344 | sc, LRU_ACTIVE_ANON); | 3333 | sc, LRU_ACTIVE_ANON); |
| 3345 | 3334 | ||
| @@ -1274,13 +1274,8 @@ const char * const vmstat_text[] = { · 1273 unmodified lines | |||
| 1274 | #endif | 1274 | #endif |
| 1275 | #endif /* CONFIG_MEMORY_BALLOON */ | 1275 | #endif /* CONFIG_MEMORY_BALLOON */ |
| 1276 | #ifdef CONFIG_DEBUG_TLBFLUSH | 1276 | #ifdef CONFIG_DEBUG_TLBFLUSH |
| 1277 | #ifdef CONFIG_SMP | ||
| 1278 | "nr_tlb_remote_flush", | 1277 | "nr_tlb_remote_flush", |
| 1279 | "nr_tlb_remote_flush_received", | 1278 | "nr_tlb_remote_flush_received", |
| 1280 | #else | ||
| 1281 | "", /* nr_tlb_remote_flush */ | ||
| 1282 | "", /* nr_tlb_remote_flush_received */ | ||
| 1283 | #endif /* CONFIG_SMP */ | ||
| 1284 | "nr_tlb_local_flush_all", | 1279 | "nr_tlb_local_flush_all", |
| 1285 | "nr_tlb_local_flush_one", | 1280 | "nr_tlb_local_flush_one", |
| 1286 | #endif /* CONFIG_DEBUG_TLBFLUSH */ | 1281 | #endif /* CONFIG_DEBUG_TLBFLUSH */ |
| @@ -2027,7 +2027,8 @@ static int ebt_size_mwt(struct compat_ebt_entry_mwt *match32, · 2026 unmodified lines | |||
| 2027 | if (match_kern) | 2027 | if (match_kern) |
| 2028 | match_kern->match_size = ret; | 2028 | match_kern->match_size = ret; |
| 2029 | 2029 | ||
| 2030 | if (WARN_ON(type == EBT_COMPAT_TARGET && size_left)) | 2030 | /* rule should have no remaining data after target */ |
| 2031 | if (type == EBT_COMPAT_TARGET && size_left) | ||
| 2031 | return -EINVAL; | 2032 | return -EINVAL; |
| 2032 | 2033 | ||
| 2033 | match32 = (struct compat_ebt_entry_mwt *) buf; | 2034 | match32 = (struct compat_ebt_entry_mwt *) buf; |
| @@ -1198,25 +1198,39 @@ static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie) · 1197 unmodified lines | |||
| 1198 | return dst; | 1198 | return dst; |
| 1199 | } | 1199 | } |
| 1200 | 1200 | ||
| 1201 | static void ipv4_link_failure(struct sk_buff *skb) | 1201 | static void ipv4_send_dest_unreach(struct sk_buff *skb) |
| 1202 | { | 1202 | { |
| 1203 | struct ip_options opt; | 1203 | struct ip_options opt; |
| 1204 | struct rtable *rt; | ||
| 1205 | int res; | 1204 | int res; |
| 1206 | 1205 | ||
| 1207 | /* Recompile ip options since IPCB may not be valid anymore. | 1206 | /* Recompile ip options since IPCB may not be valid anymore. |
| 1207 | * Also check we have a reasonable ipv4 header. | ||
| 1208 | */ | 1208 | */ |
| 1209 | memset(&opt, 0, sizeof(opt)); | 1209 | if (!pskb_network_may_pull(skb, sizeof(struct iphdr)) || |
| 1210 | opt.optlen = ip_hdr(skb)->ihl*4 - sizeof(struct iphdr); | 1210 | ip_hdr(skb)->version != 4 || ip_hdr(skb)->ihl < 5) |
| 1211 | return; | ||
| 1211 | 1212 | ||
| 1212 | rcu_read_lock(); | 1213 | memset(&opt, 0, sizeof(opt)); |
| 1213 | res = __ip_options_compile(dev_net(skb->dev), &opt, skb, NULL); | 1214 | if (ip_hdr(skb)->ihl > 5) { |
| 1214 | rcu_read_unlock(); | 1215 | if (!pskb_network_may_pull(skb, ip_hdr(skb)->ihl * 4)) |
| 1216 | return; | ||
| 1217 | opt.optlen = ip_hdr(skb)->ihl * 4 - sizeof(struct iphdr); | ||
| 1215 | 1218 | ||
| 1216 | if (res) | 1219 | rcu_read_lock(); |
| 1217 | return; | 1220 | res = __ip_options_compile(dev_net(skb->dev), &opt, skb, NULL); |
| 1221 | rcu_read_unlock(); | ||
| 1218 | 1222 | ||
| 1223 | if (res) | ||
| 1224 | return; | ||
| 1225 | } | ||
| 1219 | __icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0, &opt); | 1226 | __icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0, &opt); |
| 1227 | } | ||
| 1228 | |||
| 1229 | static void ipv4_link_failure(struct sk_buff *skb) | ||
| 1230 | { | ||
| 1231 | struct rtable *rt; | ||
| 1232 | |||
| 1233 | ipv4_send_dest_unreach(skb); | ||
| 1220 | 1234 | ||
| 1221 | rt = skb_rtable(skb); | 1235 | rt = skb_rtable(skb); |
| 1222 | if (rt) | 1236 | if (rt) |
| @@ -49,6 +49,7 @@ static int ip_ping_group_range_min[] = { 0, 0 }; · 48 unmodified lines | |||
| 49 | static int ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX }; | 49 | static int ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX }; |
| 50 | static int comp_sack_nr_max = 255; | 50 | static int comp_sack_nr_max = 255; |
| 51 | static u32 u32_max_div_HZ = UINT_MAX / HZ; | 51 | static u32 u32_max_div_HZ = UINT_MAX / HZ; |
| 52 | static int one_day_secs = 24 * 3600; | ||
| 52 | 53 | ||
| 53 | /* obsolete */ | 54 | /* obsolete */ |
| 54 | static int sysctl_tcp_low_latency __read_mostly; | 55 | static int sysctl_tcp_low_latency __read_mostly; |
| @@ -1160,7 +1161,9 @@ static struct ctl_table ipv4_net_table[] = { · 1105 unmodified lines | |||
| 1160 | .data = &init_net.ipv4.sysctl_tcp_min_rtt_wlen, | 1161 | .data = &init_net.ipv4.sysctl_tcp_min_rtt_wlen, |
| 1161 | .maxlen = sizeof(int), | 1162 | .maxlen = sizeof(int), |
| 1162 | .mode = 0644, | 1163 | .mode = 0644, |
| 1163 | .proc_handler = proc_dointvec | 1164 | .proc_handler = proc_dointvec_minmax, |
| 1165 | .extra1 = &zero, | ||
| 1166 | .extra2 = &one_day_secs | ||
| 1164 | }, | 1167 | }, |
| 1165 | { | 1168 | { |
| 1166 | .procname = "tcp_autocorking", | 1169 | .procname = "tcp_autocorking", |
| @@ -476,7 +476,7 @@ static int ip6addrlbl_valid_dump_req(const struct nlmsghdr *nlh, · 475 unmodified lines | |||
| 476 | } | 476 | } |
| 477 | 477 | ||
| 478 | if (nlmsg_attrlen(nlh, sizeof(*ifal))) { | 478 | if (nlmsg_attrlen(nlh, sizeof(*ifal))) { |
| 479 | NL_SET_ERR_MSG_MOD(extack, "Invalid data after header for address label dump requewst"); | 479 | NL_SET_ERR_MSG_MOD(extack, "Invalid data after header for address label dump request"); |
| 480 | return -EINVAL; | 480 | return -EINVAL; |
| 481 | } | 481 | } |
| 482 | 482 | ||
| @@ -11,6 +11,7 @@ · 10 unmodified lines | |||
| 11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
| 12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
| 13 | #include <linux/netdevice.h> | 13 | #include <linux/netdevice.h> |
| 14 | #include <linux/etherdevice.h> | ||
| 14 | #include <linux/skbuff.h> | 15 | #include <linux/skbuff.h> |
| 15 | 16 | ||
| 16 | #include <net/ncsi.h> | 17 | #include <net/ncsi.h> |
| @@ -667,7 +668,10 @@ static int ncsi_rsp_handler_oem_bcm_gma(struct ncsi_request *nr) · 650 unmodified lines | |||
| 667 | ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE; | 668 | ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE; |
| 668 | memcpy(saddr.sa_data, &rsp->data[BCM_MAC_ADDR_OFFSET], ETH_ALEN); | 669 | memcpy(saddr.sa_data, &rsp->data[BCM_MAC_ADDR_OFFSET], ETH_ALEN); |
| 669 | /* Increase mac address by 1 for BMC's address */ | 670 | /* Increase mac address by 1 for BMC's address */ |
| 670 | saddr.sa_data[ETH_ALEN - 1]++; | 671 | eth_addr_inc((u8 *)saddr.sa_data); |
| 672 | if (!is_valid_ether_addr((const u8 *)saddr.sa_data)) | ||
| 673 | return -ENXIO; | ||
| 674 | |||
| 671 | ret = ops->ndo_set_mac_address(ndev, &saddr); | 675 | ret = ops->ndo_set_mac_address(ndev, &saddr); |
| 672 | if (ret < 0) | 676 | if (ret < 0) |
| 673 | netdev_warn(ndev, "NCSI: 'Writing mac address to device failed\n"); | 677 | netdev_warn(ndev, "NCSI: 'Writing mac address to device failed\n"); |
| @@ -1678,7 +1678,7 @@ ip_vs_in_icmp(struct netns_ipvs *ipvs, struct sk_buff *skb, int *related, · 1677 unmodified lines | |||
| 1678 | if (!cp) { | 1678 | if (!cp) { |
| 1679 | int v; | 1679 | int v; |
| 1680 | 1680 | ||
| 1681 | if (!sysctl_schedule_icmp(ipvs)) | 1681 | if (ipip || !sysctl_schedule_icmp(ipvs)) |
| 1682 | return NF_ACCEPT; | 1682 | return NF_ACCEPT; |
| 1683 | 1683 | ||
| 1684 | if (!ip_vs_try_to_schedule(ipvs, AF_INET, skb, pd, &v, &cp, &ciph)) | 1684 | if (!ip_vs_try_to_schedule(ipvs, AF_INET, skb, pd, &v, &cp, &ciph)) |
| @@ -25,6 +25,7 @@ · 24 unmodified lines | |||
| 25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
| 26 | #include <linux/random.h> | 26 | #include <linux/random.h> |
| 27 | #include <linux/jhash.h> | 27 | #include <linux/jhash.h> |
| 28 | #include <linux/siphash.h> | ||
| 28 | #include <linux/err.h> | 29 | #include <linux/err.h> |
| 29 | #include <linux/percpu.h> | 30 | #include <linux/percpu.h> |
| 30 | #include <linux/moduleparam.h> | 31 | #include <linux/moduleparam.h> |
| @@ -449,6 +450,40 @@ nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse, · 418 unmodified lines | |||
| 449 | } | 450 | } |
| 450 | EXPORT_SYMBOL_GPL(nf_ct_invert_tuple); | 451 | EXPORT_SYMBOL_GPL(nf_ct_invert_tuple); |
| 451 | 452 | ||
| 453 | /* Generate a almost-unique pseudo-id for a given conntrack. | ||
| 454 | * | ||
| 455 | * intentionally doesn't re-use any of the seeds used for hash | ||
| 456 | * table location, we assume id gets exposed to userspace. | ||
| 457 | * | ||
| 458 | * Following nf_conn items do not change throughout lifetime | ||
| 459 | * of the nf_conn after it has been committed to main hash table: | ||
| 460 | * | ||
| 461 | * 1. nf_conn address | ||
| 462 | * 2. nf_conn->ext address | ||
| 463 | * 3. nf_conn->master address (normally NULL) | ||
| 464 | * 4. tuple | ||
| 465 | * 5. the associated net namespace | ||
| 466 | */ | ||
| 467 | u32 nf_ct_get_id(const struct nf_conn *ct) | ||
| 468 | { | ||
| 469 | static __read_mostly siphash_key_t ct_id_seed; | ||
| 470 | unsigned long a, b, c, d; | ||
| 471 | |||
| 472 | net_get_random_once(&ct_id_seed, sizeof(ct_id_seed)); | ||
| 473 | |||
| 474 | a = (unsigned long)ct; | ||
| 475 | b = (unsigned long)ct->master ^ net_hash_mix(nf_ct_net(ct)); | ||
| 476 | c = (unsigned long)ct->ext; | ||
| 477 | d = (unsigned long)siphash(&ct->tuplehash, sizeof(ct->tuplehash), | ||
| 478 | &ct_id_seed); | ||
| 479 | #ifdef CONFIG_64BIT | ||
| 480 | return siphash_4u64((u64)a, (u64)b, (u64)c, (u64)d, &ct_id_seed); | ||
| 481 | #else | ||
| 482 | return siphash_4u32((u32)a, (u32)b, (u32)c, (u32)d, &ct_id_seed); | ||
| 483 | #endif | ||
| 484 | } | ||
| 485 | EXPORT_SYMBOL_GPL(nf_ct_get_id); | ||
| 486 | |||
| 452 | static void | 487 | static void |
| 453 | clean_from_lists(struct nf_conn *ct) | 488 | clean_from_lists(struct nf_conn *ct) |
| 454 | { | 489 | { |
| @@ -982,12 +1017,9 @@ __nf_conntrack_confirm(struct sk_buff *skb) · 527 unmodified lines | |||
| 982 | 1017 | ||
| 983 | /* set conntrack timestamp, if enabled. */ | 1018 | /* set conntrack timestamp, if enabled. */ |
| 984 | tstamp = nf_conn_tstamp_find(ct); | 1019 | tstamp = nf_conn_tstamp_find(ct); |
| 985 | if (tstamp) { | 1020 | if (tstamp) |
| 986 | if (skb->tstamp == 0) | 1021 | tstamp->start = ktime_get_real_ns(); |
| 987 | __net_timestamp(skb); | ||
| 988 | 1022 | ||
| 989 | tstamp->start = ktime_to_ns(skb->tstamp); | ||
| 990 | } | ||
| 991 | /* Since the lookup is lockless, hash insertion must be done after | 1023 | /* Since the lookup is lockless, hash insertion must be done after |
| 992 | * starting the timer and setting the CONFIRMED bit. The RCU barriers | 1024 | * starting the timer and setting the CONFIRMED bit. The RCU barriers |
| 993 | * guarantee that no other CPU can find the conntrack before the above | 1025 | * guarantee that no other CPU can find the conntrack before the above |
| @@ -1350,6 +1382,7 @@ __nf_conntrack_alloc(struct net *net, · 356 unmodified lines | |||
| 1350 | /* save hash for reusing when confirming */ | 1382 | /* save hash for reusing when confirming */ |
| 1351 | *(unsigned long *)(&ct->tuplehash[IP_CT_DIR_REPLY].hnnode.pprev) = hash; | 1383 | *(unsigned long *)(&ct->tuplehash[IP_CT_DIR_REPLY].hnnode.pprev) = hash; |
| 1352 | ct->status = 0; | 1384 | ct->status = 0; |
| 1385 | ct->timeout = 0; | ||
| 1353 | write_pnet(&ct->ct_net, net); | 1386 | write_pnet(&ct->ct_net, net); |
| 1354 | memset(&ct->__nfct_init_offset[0], 0, | 1387 | memset(&ct->__nfct_init_offset[0], 0, |
| 1355 | offsetof(struct nf_conn, proto) - | 1388 | offsetof(struct nf_conn, proto) - |
| @@ -29,6 +29,7 @@ · 28 unmodified lines | |||
| 29 | #include <linux/spinlock.h> | 29 | #include <linux/spinlock.h> |
| 30 | #include <linux/interrupt.h> | 30 | #include <linux/interrupt.h> |
| 31 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
| 32 | #include <linux/siphash.h> | ||
| 32 | 33 | ||
| 33 | #include <linux/netfilter.h> | 34 | #include <linux/netfilter.h> |
| 34 | #include <net/netlink.h> | 35 | #include <net/netlink.h> |
| @@ -485,7 +486,9 @@ nla_put_failure: · 450 unmodified lines | |||
| 485 | 486 | ||
| 486 | static int ctnetlink_dump_id(struct sk_buff *skb, const struct nf_conn *ct) | 487 | static int ctnetlink_dump_id(struct sk_buff *skb, const struct nf_conn *ct) |
| 487 | { | 488 | { |
| 488 | if (nla_put_be32(skb, CTA_ID, htonl((unsigned long)ct))) | 489 | __be32 id = (__force __be32)nf_ct_get_id(ct); |
| 490 | |||
| 491 | if (nla_put_be32(skb, CTA_ID, id)) | ||
| 489 | goto nla_put_failure; | 492 | goto nla_put_failure; |
| 490 | return 0; | 493 | return 0; |
| 491 | 494 | ||
| @@ -1286,8 +1289,9 @@ static int ctnetlink_del_conntrack(struct net *net, struct sock *ctnl, · 794 unmodified lines | |||
| 1286 | } | 1289 | } |
| 1287 | 1290 | ||
| 1288 | if (cda[CTA_ID]) { | 1291 | if (cda[CTA_ID]) { |
| 1289 | u_int32_t id = ntohl(nla_get_be32(cda[CTA_ID])); | 1292 | __be32 id = nla_get_be32(cda[CTA_ID]); |
| 1290 | if (id != (u32)(unsigned long)ct) { | 1293 | |
| 1294 | if (id != (__force __be32)nf_ct_get_id(ct)) { | ||
| 1291 | nf_ct_put(ct); | 1295 | nf_ct_put(ct); |
| 1292 | return -ENOENT; | 1296 | return -ENOENT; |
| 1293 | } | 1297 | } |
| @@ -2692,6 +2696,25 @@ nla_put_failure: · 1398 unmodified lines | |||
| 2692 | 2696 | ||
| 2693 | static const union nf_inet_addr any_addr; | 2697 | static const union nf_inet_addr any_addr; |
| 2694 | 2698 | ||
| 2699 | static __be32 nf_expect_get_id(const struct nf_conntrack_expect *exp) | ||
| 2700 | { | ||
| 2701 | static __read_mostly siphash_key_t exp_id_seed; | ||
| 2702 | unsigned long a, b, c, d; | ||
| 2703 | |||
| 2704 | net_get_random_once(&exp_id_seed, sizeof(exp_id_seed)); | ||
| 2705 | |||
| 2706 | a = (unsigned long)exp; | ||
| 2707 | b = (unsigned long)exp->helper; | ||
| 2708 | c = (unsigned long)exp->master; | ||
| 2709 | d = (unsigned long)siphash(&exp->tuple, sizeof(exp->tuple), &exp_id_seed); | ||
| 2710 | |||
| 2711 | #ifdef CONFIG_64BIT | ||
| 2712 | return (__force __be32)siphash_4u64((u64)a, (u64)b, (u64)c, (u64)d, &exp_id_seed); | ||
| 2713 | #else | ||
| 2714 | return (__force __be32)siphash_4u32((u32)a, (u32)b, (u32)c, (u32)d, &exp_id_seed); | ||
| 2715 | #endif | ||
| 2716 | } | ||
| 2717 | |||
| 2695 | static int | 2718 | static int |
| 2696 | ctnetlink_exp_dump_expect(struct sk_buff *skb, | 2719 | ctnetlink_exp_dump_expect(struct sk_buff *skb, |
| 2697 | const struct nf_conntrack_expect *exp) | 2720 | const struct nf_conntrack_expect *exp) |
| @@ -2739,7 +2762,7 @@ ctnetlink_exp_dump_expect(struct sk_buff *skb, · 41 unmodified lines | |||
| 2739 | } | 2762 | } |
| 2740 | #endif | 2763 | #endif |
| 2741 | if (nla_put_be32(skb, CTA_EXPECT_TIMEOUT, htonl(timeout)) || | 2764 | if (nla_put_be32(skb, CTA_EXPECT_TIMEOUT, htonl(timeout)) || |
| 2742 | nla_put_be32(skb, CTA_EXPECT_ID, htonl((unsigned long)exp)) || | 2765 | nla_put_be32(skb, CTA_EXPECT_ID, nf_expect_get_id(exp)) || |
| 2743 | nla_put_be32(skb, CTA_EXPECT_FLAGS, htonl(exp->flags)) || | 2766 | nla_put_be32(skb, CTA_EXPECT_FLAGS, htonl(exp->flags)) || |
| 2744 | nla_put_be32(skb, CTA_EXPECT_CLASS, htonl(exp->class))) | 2767 | nla_put_be32(skb, CTA_EXPECT_CLASS, htonl(exp->class))) |
| 2745 | goto nla_put_failure; | 2768 | goto nla_put_failure; |
| @@ -3044,7 +3067,8 @@ static int ctnetlink_get_expect(struct net *net, struct sock *ctnl, · 298 unmodified lines | |||
| 3044 | 3067 | ||
| 3045 | if (cda[CTA_EXPECT_ID]) { | 3068 | if (cda[CTA_EXPECT_ID]) { |
| 3046 | __be32 id = nla_get_be32(cda[CTA_EXPECT_ID]); | 3069 | __be32 id = nla_get_be32(cda[CTA_EXPECT_ID]); |
| 3047 | if (ntohl(id) != (u32)(unsigned long)exp) { | 3070 | |
| 3071 | if (id != nf_expect_get_id(exp)) { | ||
| 3048 | nf_ct_expect_put(exp); | 3072 | nf_ct_expect_put(exp); |
| 3049 | return -ENOENT; | 3073 | return -ENOENT; |
| 3050 | } | 3074 | } |
| @@ -55,7 +55,7 @@ void nf_l4proto_log_invalid(const struct sk_buff *skb, · 54 unmodified lines | |||
| 55 | struct va_format vaf; | 55 | struct va_format vaf; |
| 56 | va_list args; | 56 | va_list args; |
| 57 | 57 | ||
| 58 | if (net->ct.sysctl_log_invalid != protonum || | 58 | if (net->ct.sysctl_log_invalid != protonum && |
| 59 | net->ct.sysctl_log_invalid != IPPROTO_RAW) | 59 | net->ct.sysctl_log_invalid != IPPROTO_RAW) |
| 60 | return; | 60 | return; |
| 61 | 61 | ||
| @@ -103,49 +103,94 @@ int nf_conntrack_icmp_packet(struct nf_conn *ct, · 102 unmodified lines | |||
| 103 | return NF_ACCEPT; | 103 | return NF_ACCEPT; |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | /* Returns conntrack if it dealt with ICMP, and filled in skb fields */ | 106 | /* Check inner header is related to any of the existing connections */ |
| 107 | static int | 107 | int nf_conntrack_inet_error(struct nf_conn *tmpl, struct sk_buff *skb, |
| 108 | icmp_error_message(struct nf_conn *tmpl, struct sk_buff *skb, | 108 | unsigned int dataoff, |
| 109 | const struct nf_hook_state *state) | 109 | const struct nf_hook_state *state, |
| 110 | u8 l4proto, union nf_inet_addr *outer_daddr) | ||
| 110 | { | 111 | { |
| 111 | struct nf_conntrack_tuple innertuple, origtuple; | 112 | struct nf_conntrack_tuple innertuple, origtuple; |
| 112 | const struct nf_conntrack_tuple_hash *h; | 113 | const struct nf_conntrack_tuple_hash *h; |
| 113 | const struct nf_conntrack_zone *zone; | 114 | const struct nf_conntrack_zone *zone; |
| 114 | enum ip_conntrack_info ctinfo; | 115 | enum ip_conntrack_info ctinfo; |
| 115 | struct nf_conntrack_zone tmp; | 116 | struct nf_conntrack_zone tmp; |
| 117 | union nf_inet_addr *ct_daddr; | ||
| 118 | enum ip_conntrack_dir dir; | ||
| 119 | struct nf_conn *ct; | ||
| 116 | 120 | ||
| 117 | WARN_ON(skb_nfct(skb)); | 121 | WARN_ON(skb_nfct(skb)); |
| 118 | zone = nf_ct_zone_tmpl(tmpl, skb, &tmp); | 122 | zone = nf_ct_zone_tmpl(tmpl, skb, &tmp); |
| 119 | 123 | ||
| 120 | /* Are they talking about one of our connections? */ | 124 | /* Are they talking about one of our connections? */ |
| 121 | if (!nf_ct_get_tuplepr(skb, | 125 | if (!nf_ct_get_tuplepr(skb, dataoff, |
| 122 | skb_network_offset(skb) + ip_hdrlen(skb) | 126 | state->pf, state->net, &origtuple)) |
| 123 | + sizeof(struct icmphdr), | ||
| 124 | PF_INET, state->net, &origtuple)) { | ||
| 125 | pr_debug("icmp_error_message: failed to get tuple\n"); | ||
| 126 | return -NF_ACCEPT; | 127 | return -NF_ACCEPT; |
| 127 | } | ||
| 128 | 128 | ||
| 129 | /* Ordinarily, we'd expect the inverted tupleproto, but it's | 129 | /* Ordinarily, we'd expect the inverted tupleproto, but it's |
| 130 | been preserved inside the ICMP. */ | 130 | been preserved inside the ICMP. */ |
| 131 | if (!nf_ct_invert_tuple(&innertuple, &origtuple)) { | 131 | if (!nf_ct_invert_tuple(&innertuple, &origtuple)) |
| 132 | pr_debug("icmp_error_message: no match\n"); | ||
| 133 | return -NF_ACCEPT; | 132 | return -NF_ACCEPT; |
| 134 | } | ||
| 135 | |||
| 136 | ctinfo = IP_CT_RELATED; | ||
| 137 | 133 | ||
| 138 | h = nf_conntrack_find_get(state->net, zone, &innertuple); | 134 | h = nf_conntrack_find_get(state->net, zone, &innertuple); |
| 139 | if (!h) { | 135 | if (!h) |
| 140 | pr_debug("icmp_error_message: no match\n"); | 136 | return -NF_ACCEPT; |
| 137 | |||
| 138 | /* Consider: A -> T (=This machine) -> B | ||
| 139 | * Conntrack entry will look like this: | ||
| 140 | * Original: A->B | ||
| 141 | * Reply: B->T (SNAT case) OR A | ||
| 142 | * | ||
| 143 | * When this function runs, we got packet that looks like this: | ||
| 144 | * iphdr|icmphdr|inner_iphdr|l4header (tcp, udp, ..). | ||
| 145 | * | ||
| 146 | * Above nf_conntrack_find_get() makes lookup based on inner_hdr, | ||
| 147 | * so we should expect that destination of the found connection | ||
| 148 | * matches outer header destination address. | ||
| 149 | * | ||
| 150 | * In above example, we can consider these two cases: | ||
| 151 | * 1. Error coming in reply direction from B or M (middle box) to | ||
| 152 | * T (SNAT case) or A. | ||
| 153 | * Inner saddr will be B, dst will be T or A. | ||
| 154 | * The found conntrack will be reply tuple (B->T/A). | ||
| 155 | * 2. Error coming in original direction from A or M to B. | ||
| 156 | * Inner saddr will be A, inner daddr will be B. | ||
| 157 | * The found conntrack will be original tuple (A->B). | ||
| 158 | * | ||
| 159 | * In both cases, conntrack[dir].dst == inner.dst. | ||
| 160 | * | ||
| 161 | * A bogus packet could look like this: | ||
| 162 | * Inner: B->T | ||
| 163 | * Outer: B->X (other machine reachable by T). | ||
| 164 | * | ||
| 165 | * In this case, lookup yields connection A->B and will | ||
| 166 | * set packet from B->X as *RELATED*, even though no connection | ||
| 167 | * from X was ever seen. | ||
| 168 | */ | ||
| 169 | ct = nf_ct_tuplehash_to_ctrack(h); | ||
| 170 | dir = NF_CT_DIRECTION(h); | ||
| 171 | ct_daddr = &ct->tuplehash[dir].tuple.dst.u3; | ||
| 172 | if (!nf_inet_addr_cmp(outer_daddr, ct_daddr)) { | ||
| 173 | if (state->pf == AF_INET) { | ||
| 174 | nf_l4proto_log_invalid(skb, state->net, state->pf, | ||
| 175 | l4proto, | ||
| 176 | "outer daddr %pI4 != inner %pI4", | ||
| 177 | &outer_daddr->ip, &ct_daddr->ip); | ||
| 178 | } else if (state->pf == AF_INET6) { | ||
| 179 | nf_l4proto_log_invalid(skb, state->net, state->pf, | ||
| 180 | l4proto, | ||
| 181 | "outer daddr %pI6 != inner %pI6", | ||
| 182 | &outer_daddr->ip6, &ct_daddr->ip6); | ||
| 183 | } | ||
| 184 | nf_ct_put(ct); | ||
| 141 | return -NF_ACCEPT; | 185 | return -NF_ACCEPT; |
| 142 | } | 186 | } |
| 143 | 187 | ||
| 144 | if (NF_CT_DIRECTION(h) == IP_CT_DIR_REPLY) | 188 | ctinfo = IP_CT_RELATED; |
| 189 | if (dir == IP_CT_DIR_REPLY) | ||
| 145 | ctinfo += IP_CT_IS_REPLY; | 190 | ctinfo += IP_CT_IS_REPLY; |
| 146 | 191 | ||
| 147 | /* Update skb to refer to this connection */ | 192 | /* Update skb to refer to this connection */ |
| 148 | nf_ct_set(skb, nf_ct_tuplehash_to_ctrack(h), ctinfo); | 193 | nf_ct_set(skb, ct, ctinfo); |
| 149 | return NF_ACCEPT; | 194 | return NF_ACCEPT; |
| 150 | } | 195 | } |
| 151 | 196 | ||
| @@ -162,11 +207,12 @@ int nf_conntrack_icmpv4_error(struct nf_conn *tmpl, · 10 unmodified lines | |||
| 162 | struct sk_buff *skb, unsigned int dataoff, | 207 | struct sk_buff *skb, unsigned int dataoff, |
| 163 | const struct nf_hook_state *state) | 208 | const struct nf_hook_state *state) |
| 164 | { | 209 | { |
| 210 | union nf_inet_addr outer_daddr; | ||
| 165 | const struct icmphdr *icmph; | 211 | const struct icmphdr *icmph; |
| 166 | struct icmphdr _ih; | 212 | struct icmphdr _ih; |
| 167 | 213 | ||
| 168 | /* Not enough header? */ | 214 | /* Not enough header? */ |
| 169 | icmph = skb_header_pointer(skb, ip_hdrlen(skb), sizeof(_ih), &_ih); | 215 | icmph = skb_header_pointer(skb, dataoff, sizeof(_ih), &_ih); |
| 170 | if (icmph == NULL) { | 216 | if (icmph == NULL) { |
| 171 | icmp_error_log(skb, state, "short packet"); | 217 | icmp_error_log(skb, state, "short packet"); |
| 172 | return -NF_ACCEPT; | 218 | return -NF_ACCEPT; |
| @@ -199,7 +245,12 @@ int nf_conntrack_icmpv4_error(struct nf_conn *tmpl, · 26 unmodified lines | |||
| 199 | icmph->type != ICMP_REDIRECT) | 245 | icmph->type != ICMP_REDIRECT) |
| 200 | return NF_ACCEPT; | 246 | return NF_ACCEPT; |
| 201 | 247 | ||
| 202 | return icmp_error_message(tmpl, skb, state); | 248 | memset(&outer_daddr, 0, sizeof(outer_daddr)); |
| 249 | outer_daddr.ip = ip_hdr(skb)->daddr; | ||
| 250 | |||
| 251 | dataoff += sizeof(*icmph); | ||
| 252 | return nf_conntrack_inet_error(tmpl, skb, dataoff, state, | ||
| 253 | IPPROTO_ICMP, &outer_daddr); | ||
| 203 | } | 254 | } |
| 204 | 255 | ||
| 205 | #if IS_ENABLED(CONFIG_NF_CT_NETLINK) | 256 | #if IS_ENABLED(CONFIG_NF_CT_NETLINK) |
| @@ -123,51 +123,6 @@ int nf_conntrack_icmpv6_packet(struct nf_conn *ct, · 122 unmodified lines | |||
| 123 | return NF_ACCEPT; | 123 | return NF_ACCEPT; |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | static int | ||
| 127 | icmpv6_error_message(struct net *net, struct nf_conn *tmpl, | ||
| 128 | struct sk_buff *skb, | ||
| 129 | unsigned int icmp6off) | ||
| 130 | { | ||
| 131 | struct nf_conntrack_tuple intuple, origtuple; | ||
| 132 | const struct nf_conntrack_tuple_hash *h; | ||
| 133 | enum ip_conntrack_info ctinfo; | ||
| 134 | struct nf_conntrack_zone tmp; | ||
| 135 | |||
| 136 | WARN_ON(skb_nfct(skb)); | ||
| 137 | |||
| 138 | /* Are they talking about one of our connections? */ | ||
| 139 | if (!nf_ct_get_tuplepr(skb, | ||
| 140 | skb_network_offset(skb) | ||
| 141 | + sizeof(struct ipv6hdr) | ||
| 142 | + sizeof(struct icmp6hdr), | ||
| 143 | PF_INET6, net, &origtuple)) { | ||
| 144 | pr_debug("icmpv6_error: Can't get tuple\n"); | ||
| 145 | return -NF_ACCEPT; | ||
| 146 | } | ||
| 147 | |||
| 148 | /* Ordinarily, we'd expect the inverted tupleproto, but it's | ||
| 149 | been preserved inside the ICMP. */ | ||
| 150 | if (!nf_ct_invert_tuple(&intuple, &origtuple)) { | ||
| 151 | pr_debug("icmpv6_error: Can't invert tuple\n"); | ||
| 152 | return -NF_ACCEPT; | ||
| 153 | } | ||
| 154 | |||
| 155 | ctinfo = IP_CT_RELATED; | ||
| 156 | |||
| 157 | h = nf_conntrack_find_get(net, nf_ct_zone_tmpl(tmpl, skb, &tmp), | ||
| 158 | &intuple); | ||
| 159 | if (!h) { | ||
| 160 | pr_debug("icmpv6_error: no match\n"); | ||
| 161 | return -NF_ACCEPT; | ||
| 162 | } else { | ||
| 163 | if (NF_CT_DIRECTION(h) == IP_CT_DIR_REPLY) | ||
| 164 | ctinfo += IP_CT_IS_REPLY; | ||
| 165 | } | ||
| 166 | |||
| 167 | /* Update skb to refer to this connection */ | ||
| 168 | nf_ct_set(skb, nf_ct_tuplehash_to_ctrack(h), ctinfo); | ||
| 169 | return NF_ACCEPT; | ||
| 170 | } | ||
| 171 | 126 | ||
| 172 | static void icmpv6_error_log(const struct sk_buff *skb, | 127 | static void icmpv6_error_log(const struct sk_buff *skb, |
| 173 | const struct nf_hook_state *state, | 128 | const struct nf_hook_state *state, |
| @@ -182,6 +137,7 @@ int nf_conntrack_icmpv6_error(struct nf_conn *tmpl, · 8 unmodified lines | |||
| 182 | unsigned int dataoff, | 137 | unsigned int dataoff, |
| 183 | const struct nf_hook_state *state) | 138 | const struct nf_hook_state *state) |
| 184 | { | 139 | { |
| 140 | union nf_inet_addr outer_daddr; | ||
| 185 | const struct icmp6hdr *icmp6h; | 141 | const struct icmp6hdr *icmp6h; |
| 186 | struct icmp6hdr _ih; | 142 | struct icmp6hdr _ih; |
| 187 | int type; | 143 | int type; |
| @@ -210,7 +166,11 @@ int nf_conntrack_icmpv6_error(struct nf_conn *tmpl, · 22 unmodified lines | |||
| 210 | if (icmp6h->icmp6_type >= 128) | 166 | if (icmp6h->icmp6_type >= 128) |
| 211 | return NF_ACCEPT; | 167 | return NF_ACCEPT; |
| 212 | 168 | ||
| 213 | return icmpv6_error_message(state->net, tmpl, skb, dataoff); | 169 | memcpy(&outer_daddr.ip6, &ipv6_hdr(skb)->daddr, |
| 170 | sizeof(outer_daddr.ip6)); | ||
| 171 | dataoff += sizeof(*icmp6h); | ||
| 172 | return nf_conntrack_inet_error(tmpl, skb, dataoff, state, | ||
| 173 | IPPROTO_ICMPV6, &outer_daddr); | ||
| 214 | } | 174 | } |
| 215 | 175 | ||
| 216 | #if IS_ENABLED(CONFIG_NF_CT_NETLINK) | 176 | #if IS_ENABLED(CONFIG_NF_CT_NETLINK) |
| @@ -415,9 +415,14 @@ static void nf_nat_l4proto_unique_tuple(struct nf_conntrack_tuple *tuple, · 414 unmodified lines | |||
| 415 | case IPPROTO_ICMPV6: | 415 | case IPPROTO_ICMPV6: |
| 416 | /* id is same for either direction... */ | 416 | /* id is same for either direction... */ |
| 417 | keyptr = &tuple->src.u.icmp.id; | 417 | keyptr = &tuple->src.u.icmp.id; |
| 418 | min = range->min_proto.icmp.id; | 418 | if (!(range->flags & NF_NAT_RANGE_PROTO_SPECIFIED)) { |
| 419 | range_size = ntohs(range->max_proto.icmp.id) - | 419 | min = 0; |
| 420 | ntohs(range->min_proto.icmp.id) + 1; | 420 | range_size = 65536; |
| 421 | } else { | ||
| 422 | min = ntohs(range->min_proto.icmp.id); | ||
| 423 | range_size = ntohs(range->max_proto.icmp.id) - | ||
| 424 | ntohs(range->min_proto.icmp.id) + 1; | ||
| 425 | } | ||
| 421 | goto find_free_id; | 426 | goto find_free_id; |
| 422 | #if IS_ENABLED(CONFIG_NF_CT_PROTO_GRE) | 427 | #if IS_ENABLED(CONFIG_NF_CT_PROTO_GRE) |
| 423 | case IPPROTO_GRE: | 428 | case IPPROTO_GRE: |
| @@ -1544,7 +1544,7 @@ static int nft_chain_parse_hook(struct net *net, · 1543 unmodified lines | |||
| 1544 | if (IS_ERR(type)) | 1544 | if (IS_ERR(type)) |
| 1545 | return PTR_ERR(type); | 1545 | return PTR_ERR(type); |
| 1546 | } | 1546 | } |
| 1547 | if (!(type->hook_mask & (1 << hook->num))) | 1547 | if (hook->num > NF_MAX_HOOKS || !(type->hook_mask & (1 << hook->num))) |
| 1548 | return -EOPNOTSUPP; | 1548 | return -EOPNOTSUPP; |
| 1549 | 1549 | ||
| 1550 | if (type->type == NFT_CHAIN_T_NAT && | 1550 | if (type->type == NFT_CHAIN_T_NAT && |
| @@ -540,7 +540,7 @@ __build_packet_message(struct nfnl_log_net *log, · 539 unmodified lines | |||
| 540 | goto nla_put_failure; | 540 | goto nla_put_failure; |
| 541 | } | 541 | } |
| 542 | 542 | ||
| 543 | if (skb->tstamp) { | 543 | if (hooknum <= NF_INET_FORWARD && skb->tstamp) { |
| 544 | struct nfulnl_msg_packet_timestamp ts; | 544 | struct nfulnl_msg_packet_timestamp ts; |
| 545 | struct timespec64 kts = ktime_to_timespec64(skb->tstamp); | 545 | struct timespec64 kts = ktime_to_timespec64(skb->tstamp); |
| 546 | ts.sec = cpu_to_be64(kts.tv_sec); | 546 | ts.sec = cpu_to_be64(kts.tv_sec); |
| @@ -582,7 +582,7 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue, · 581 unmodified lines | |||
| 582 | if (nfqnl_put_bridge(entry, skb) < 0) | 582 | if (nfqnl_put_bridge(entry, skb) < 0) |
| 583 | goto nla_put_failure; | 583 | goto nla_put_failure; |
| 584 | 584 | ||
| 585 | if (entskb->tstamp) { | 585 | if (entry->state.hook <= NF_INET_FORWARD && entskb->tstamp) { |
| 586 | struct nfqnl_msg_packet_timestamp ts; | 586 | struct nfqnl_msg_packet_timestamp ts; |
| 587 | struct timespec64 kts = ktime_to_timespec64(entskb->tstamp); | 587 | struct timespec64 kts = ktime_to_timespec64(entskb->tstamp); |
| 588 | 588 | ||
| @@ -163,19 +163,24 @@ time_mt(const struct sk_buff *skb, struct xt_action_param *par) · 162 unmodified lines | |||
| 163 | s64 stamp; | 163 | s64 stamp; |
| 164 | 164 | ||
| 165 | /* | 165 | /* |
| 166 | * We cannot use get_seconds() instead of __net_timestamp() here. | 166 | * We need real time here, but we can neither use skb->tstamp |
| 167 | * nor __net_timestamp(). | ||
| 168 | * | ||
| 169 | * skb->tstamp and skb->skb_mstamp_ns overlap, however, they | ||
| 170 | * use different clock types (real vs monotonic). | ||
| 171 | * | ||
| 167 | * Suppose you have two rules: | 172 | * Suppose you have two rules: |
| 168 | * 1. match before 13:00 | 173 | * 1. match before 13:00 |
| 169 | * 2. match after 13:00 | 174 | * 2. match after 13:00 |
| 175 | * | ||
| 170 | * If you match against processing time (get_seconds) it | 176 | * If you match against processing time (get_seconds) it |
| 171 | * may happen that the same packet matches both rules if | 177 | * may happen that the same packet matches both rules if |
| 172 | * it arrived at the right moment before 13:00. | 178 | * it arrived at the right moment before 13:00, so it would be |
| 179 | * better to check skb->tstamp and set it via __net_timestamp() | ||
| 180 | * if needed. This however breaks outgoing packets tx timestamp, | ||
| 181 | * and causes them to get delayed forever by fq packet scheduler. | ||
| 173 | */ | 182 | */ |
| 174 | if (skb->tstamp == 0) | 183 | stamp = get_seconds(); |
| 175 | __net_timestamp((struct sk_buff *)skb); | ||
| 176 | |||
| 177 | stamp = ktime_to_ns(skb->tstamp); | ||
| 178 | stamp = div_s64(stamp, NSEC_PER_SEC); | ||
| 179 | 184 | ||
| 180 | if (info->flags & XT_TIME_LOCAL_TZ) | 185 | if (info->flags & XT_TIME_LOCAL_TZ) |
| 181 | /* Adjust for local timezone */ | 186 | /* Adjust for local timezone */ |
| @@ -44,6 +44,17 @@ struct rds_ib_mr *rds_ib_alloc_fmr(struct rds_ib_device *rds_ibdev, int npages) · 43 unmodified lines | |||
| 44 | else | 44 | else |
| 45 | pool = rds_ibdev->mr_1m_pool; | 45 | pool = rds_ibdev->mr_1m_pool; |
| 46 | 46 | ||
| 47 | if (atomic_read(&pool->dirty_count) >= pool->max_items / 10) | ||
| 48 | queue_delayed_work(rds_ib_mr_wq, &pool->flush_worker, 10); | ||
| 49 | |||
| 50 | /* Switch pools if one of the pool is reaching upper limit */ | ||
| 51 | if (atomic_read(&pool->dirty_count) >= pool->max_items * 9 / 10) { | ||
| 52 | if (pool->pool_type == RDS_IB_MR_8K_POOL) | ||
| 53 | pool = rds_ibdev->mr_1m_pool; | ||
| 54 | else | ||
| 55 | pool = rds_ibdev->mr_8k_pool; | ||
| 56 | } | ||
| 57 | |||
| 47 | ibmr = rds_ib_try_reuse_ibmr(pool); | 58 | ibmr = rds_ib_try_reuse_ibmr(pool); |
| 48 | if (ibmr) | 59 | if (ibmr) |
| 49 | return ibmr; | 60 | return ibmr; |
| @@ -454,9 +454,6 @@ struct rds_ib_mr *rds_ib_try_reuse_ibmr(struct rds_ib_mr_pool *pool) · 453 unmodified lines | |||
| 454 | struct rds_ib_mr *ibmr = NULL; | 454 | struct rds_ib_mr *ibmr = NULL; |
| 455 | int iter = 0; | 455 | int iter = 0; |
| 456 | 456 | ||
| 457 | if (atomic_read(&pool->dirty_count) >= pool->max_items_soft / 10) | ||
| 458 | queue_delayed_work(rds_ib_mr_wq, &pool->flush_worker, 10); | ||
| 459 | |||
| 460 | while (1) { | 457 | while (1) { |
| 461 | ibmr = rds_ib_reuse_mr(pool); | 458 | ibmr = rds_ib_reuse_mr(pool); |
| 462 | if (ibmr) | 459 | if (ibmr) |
| @@ -16,6 +16,7 @@ · 15 unmodified lines | |||
| 16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
| 17 | 17 | ||
| 18 | static struct sk_buff_head loopback_queue; | 18 | static struct sk_buff_head loopback_queue; |
| 19 | #define ROSE_LOOPBACK_LIMIT 1000 | ||
| 19 | static struct timer_list loopback_timer; | 20 | static struct timer_list loopback_timer; |
| 20 | 21 | ||
| 21 | static void rose_set_loopback_timer(void); | 22 | static void rose_set_loopback_timer(void); |
| @@ -35,29 +36,27 @@ static int rose_loopback_running(void) · 13 unmodified lines | |||
| 35 | 36 | ||
| 36 | int rose_loopback_queue(struct sk_buff *skb, struct rose_neigh *neigh) | 37 | int rose_loopback_queue(struct sk_buff *skb, struct rose_neigh *neigh) |
| 37 | { | 38 | { |
| 38 | struct sk_buff *skbn; | 39 | struct sk_buff *skbn = NULL; |
| 39 | 40 | ||
| 40 | skbn = skb_clone(skb, GFP_ATOMIC); | 41 | if (skb_queue_len(&loopback_queue) < ROSE_LOOPBACK_LIMIT) |
| 42 | skbn = skb_clone(skb, GFP_ATOMIC); | ||
| 41 | 43 | ||
| 42 | kfree_skb(skb); | 44 | if (skbn) { |
| 43 | 45 | consume_skb(skb); | |
| 44 | if (skbn != NULL) { | ||
| 45 | skb_queue_tail(&loopback_queue, skbn); | 46 | skb_queue_tail(&loopback_queue, skbn); |
| 46 | 47 | ||
| 47 | if (!rose_loopback_running()) | 48 | if (!rose_loopback_running()) |
| 48 | rose_set_loopback_timer(); | 49 | rose_set_loopback_timer(); |
| 50 | } else { | ||
| 51 | kfree_skb(skb); | ||
| 49 | } | 52 | } |
| 50 | 53 | ||
| 51 | return 1; | 54 | return 1; |
| 52 | } | 55 | } |
| 53 | 56 | ||
| 54 | |||
| 55 | static void rose_set_loopback_timer(void) | 57 | static void rose_set_loopback_timer(void) |
| 56 | { | 58 | { |
| 57 | del_timer(&loopback_timer); | 59 | mod_timer(&loopback_timer, jiffies + 10); |
| 58 | |||
| 59 | loopback_timer.expires = jiffies + 10; | ||
| 60 | add_timer(&loopback_timer); | ||
| 61 | } | 60 | } |
| 62 | 61 | ||
| 63 | static void rose_loopback_timer(struct timer_list *unused) | 62 | static void rose_loopback_timer(struct timer_list *unused) |
| @@ -68,8 +67,12 @@ static void rose_loopback_timer(struct timer_list *unused) · 4 unmodified lines | |||
| 68 | struct sock *sk; | 67 | struct sock *sk; |
| 69 | unsigned short frametype; | 68 | unsigned short frametype; |
| 70 | unsigned int lci_i, lci_o; | 69 | unsigned int lci_i, lci_o; |
| 70 | int count; | ||
| 71 | 71 | ||
| 72 | while ((skb = skb_dequeue(&loopback_queue)) != NULL) { | 72 | for (count = 0; count < ROSE_LOOPBACK_LIMIT; count++) { |
| 73 | skb = skb_dequeue(&loopback_queue); | ||
| 74 | if (!skb) | ||
| 75 | return; | ||
| 73 | if (skb->len < ROSE_MIN_LEN) { | 76 | if (skb->len < ROSE_MIN_LEN) { |
| 74 | kfree_skb(skb); | 77 | kfree_skb(skb); |
| 75 | continue; | 78 | continue; |
| @@ -106,6 +109,8 @@ static void rose_loopback_timer(struct timer_list *unused) · 30 unmodified lines | |||
| 106 | kfree_skb(skb); | 109 | kfree_skb(skb); |
| 107 | } | 110 | } |
| 108 | } | 111 | } |
| 112 | if (!skb_queue_empty(&loopback_queue)) | ||
| 113 | mod_timer(&loopback_timer, jiffies + 1); | ||
| 109 | } | 114 | } |
| 110 | 115 | ||
| 111 | void __exit rose_loopback_clear(void) | 116 | void __exit rose_loopback_clear(void) |
| @@ -1161,19 +1161,19 @@ int rxrpc_extract_header(struct rxrpc_skb_priv *sp, struct sk_buff *skb) · 1160 unmodified lines | |||
| 1161 | * handle data received on the local endpoint | 1161 | * handle data received on the local endpoint |
| 1162 | * - may be called in interrupt context | 1162 | * - may be called in interrupt context |
| 1163 | * | 1163 | * |
| 1164 | * The socket is locked by the caller and this prevents the socket from being | 1164 | * [!] Note that as this is called from the encap_rcv hook, the socket is not |
| 1165 | * shut down and the local endpoint from going away, thus sk_user_data will not | 1165 | * held locked by the caller and nothing prevents sk_user_data on the UDP from |
| 1166 | * be cleared until this function returns. | 1166 | * being cleared in the middle of processing this function. |
| 1167 | * | 1167 | * |
| 1168 | * Called with the RCU read lock held from the IP layer via UDP. | 1168 | * Called with the RCU read lock held from the IP layer via UDP. |
| 1169 | */ | 1169 | */ |
| 1170 | int rxrpc_input_packet(struct sock *udp_sk, struct sk_buff *skb) | 1170 | int rxrpc_input_packet(struct sock *udp_sk, struct sk_buff *skb) |
| 1171 | { | 1171 | { |
| 1172 | struct rxrpc_local *local = rcu_dereference_sk_user_data(udp_sk); | ||
| 1172 | struct rxrpc_connection *conn; | 1173 | struct rxrpc_connection *conn; |
| 1173 | struct rxrpc_channel *chan; | 1174 | struct rxrpc_channel *chan; |
| 1174 | struct rxrpc_call *call = NULL; | 1175 | struct rxrpc_call *call = NULL; |
| 1175 | struct rxrpc_skb_priv *sp; | 1176 | struct rxrpc_skb_priv *sp; |
| 1176 | struct rxrpc_local *local = udp_sk->sk_user_data; | ||
| 1177 | struct rxrpc_peer *peer = NULL; | 1177 | struct rxrpc_peer *peer = NULL; |
| 1178 | struct rxrpc_sock *rx = NULL; | 1178 | struct rxrpc_sock *rx = NULL; |
| 1179 | unsigned int channel; | 1179 | unsigned int channel; |
| @@ -1181,6 +1181,10 @@ int rxrpc_input_packet(struct sock *udp_sk, struct sk_buff *skb) · 1 unmodified line | |||
| 1181 | 1181 | ||
| 1182 | _enter("%p", udp_sk); | 1182 | _enter("%p", udp_sk); |
| 1183 | 1183 | ||
| 1184 | if (unlikely(!local)) { | ||
| 1185 | kfree_skb(skb); | ||
| 1186 | return 0; | ||
| 1187 | } | ||
| 1184 | if (skb->tstamp == 0) | 1188 | if (skb->tstamp == 0) |
| 1185 | skb->tstamp = ktime_get_real(); | 1189 | skb->tstamp = ktime_get_real(); |
| 1186 | 1190 | ||
| @@ -304,7 +304,8 @@ nomem: · 303 unmodified lines | |||
| 304 | ret = -ENOMEM; | 304 | ret = -ENOMEM; |
| 305 | sock_error: | 305 | sock_error: |
| 306 | mutex_unlock(&rxnet->local_mutex); | 306 | mutex_unlock(&rxnet->local_mutex); |
| 307 | kfree(local); | 307 | if (local) |
| 308 | call_rcu(&local->rcu, rxrpc_local_rcu); | ||
| 308 | _leave(" = %d", ret); | 309 | _leave(" = %d", ret); |
| 309 | return ERR_PTR(ret); | 310 | return ERR_PTR(ret); |
| 310 | 311 | ||
| @@ -54,6 +54,7 @@ static void cache_init(struct cache_head *h, struct cache_detail *detail) · 53 unmodified lines | |||
| 54 | h->last_refresh = now; | 54 | h->last_refresh = now; |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | static inline int cache_is_valid(struct cache_head *h); | ||
| 57 | static void cache_fresh_locked(struct cache_head *head, time_t expiry, | 58 | static void cache_fresh_locked(struct cache_head *head, time_t expiry, |
| 58 | struct cache_detail *detail); | 59 | struct cache_detail *detail); |
| 59 | static void cache_fresh_unlocked(struct cache_head *head, | 60 | static void cache_fresh_unlocked(struct cache_head *head, |
| @@ -105,6 +106,8 @@ static struct cache_head *sunrpc_cache_add_entry(struct cache_detail *detail, · 45 unmodified lines | |||
| 105 | if (cache_is_expired(detail, tmp)) { | 106 | if (cache_is_expired(detail, tmp)) { |
| 106 | hlist_del_init_rcu(&tmp->cache_list); | 107 | hlist_del_init_rcu(&tmp->cache_list); |
| 107 | detail->entries --; | 108 | detail->entries --; |
| 109 | if (cache_is_valid(tmp) == -EAGAIN) | ||
| 110 | set_bit(CACHE_NEGATIVE, &tmp->flags); | ||
| 108 | cache_fresh_locked(tmp, 0, detail); | 111 | cache_fresh_locked(tmp, 0, detail); |
| 109 | freeme = tmp; | 112 | freeme = tmp; |
| 110 | break; | 113 | break; |
| @@ -2081,8 +2081,8 @@ call_transmit_status(struct rpc_task *task) · 2080 unmodified lines | |||
| 2081 | * test first. | 2081 | * test first. |
| 2082 | */ | 2082 | */ |
| 2083 | if (rpc_task_transmitted(task)) { | 2083 | if (rpc_task_transmitted(task)) { |
| 2084 | if (task->tk_status == 0) | 2084 | task->tk_status = 0; |
| 2085 | xprt_request_wait_receive(task); | 2085 | xprt_request_wait_receive(task); |
| 2086 | return; | 2086 | return; |
| 2087 | } | 2087 | } |
| 2088 | 2088 | ||
| @@ -2167,6 +2167,9 @@ call_bc_transmit_status(struct rpc_task *task) · 78 unmodified lines | |||
| 2167 | { | 2167 | { |
| 2168 | struct rpc_rqst *req = task->tk_rqstp; | 2168 | struct rpc_rqst *req = task->tk_rqstp; |
| 2169 | 2169 | ||
| 2170 | if (rpc_task_transmitted(task)) | ||
| 2171 | task->tk_status = 0; | ||
| 2172 | |||
| 2170 | dprint_status(task); | 2173 | dprint_status(task); |
| 2171 | 2174 | ||
| 2172 | switch (task->tk_status) { | 2175 | switch (task->tk_status) { |
| @@ -904,7 +904,9 @@ int tls_set_device_offload_rx(struct sock *sk, struct tls_context *ctx) · 903 unmodified lines | |||
| 904 | goto release_netdev; | 904 | goto release_netdev; |
| 905 | 905 | ||
| 906 | free_sw_resources: | 906 | free_sw_resources: |
| 907 | up_read(&device_offload_lock); | ||
| 907 | tls_sw_free_resources_rx(sk); | 908 | tls_sw_free_resources_rx(sk); |
| 909 | down_read(&device_offload_lock); | ||
| 908 | release_ctx: | 910 | release_ctx: |
| 909 | ctx->priv_ctx_rx = NULL; | 911 | ctx->priv_ctx_rx = NULL; |
| 910 | release_netdev: | 912 | release_netdev: |
| @@ -939,8 +941,6 @@ void tls_device_offload_cleanup_rx(struct sock *sk) · 28 unmodified lines | |||
| 939 | } | 941 | } |
| 940 | out: | 942 | out: |
| 941 | up_read(&device_offload_lock); | 943 | up_read(&device_offload_lock); |
| 942 | kfree(tls_ctx->rx.rec_seq); | ||
| 943 | kfree(tls_ctx->rx.iv); | ||
| 944 | tls_sw_release_resources_rx(sk); | 944 | tls_sw_release_resources_rx(sk); |
| 945 | } | 945 | } |
| 946 | 946 | ||
| @@ -194,6 +194,9 @@ static void update_chksum(struct sk_buff *skb, int headln) · 193 unmodified lines | |||
| 194 | 194 | ||
| 195 | static void complete_skb(struct sk_buff *nskb, struct sk_buff *skb, int headln) | 195 | static void complete_skb(struct sk_buff *nskb, struct sk_buff *skb, int headln) |
| 196 | { | 196 | { |
| 197 | struct sock *sk = skb->sk; | ||
| 198 | int delta; | ||
| 199 | |||
| 197 | skb_copy_header(nskb, skb); | 200 | skb_copy_header(nskb, skb); |
| 198 | 201 | ||
| 199 | skb_put(nskb, skb->len); | 202 | skb_put(nskb, skb->len); |
| @@ -201,11 +204,15 @@ static void complete_skb(struct sk_buff *nskb, struct sk_buff *skb, int headln) · 1 unmodified line | |||
| 201 | update_chksum(nskb, headln); | 204 | update_chksum(nskb, headln); |
| 202 | 205 | ||
| 203 | nskb->destructor = skb->destructor; | 206 | nskb->destructor = skb->destructor; |
| 204 | nskb->sk = skb->sk; | 207 | nskb->sk = sk; |
| 205 | skb->destructor = NULL; | 208 | skb->destructor = NULL; |
| 206 | skb->sk = NULL; | 209 | skb->sk = NULL; |
| 207 | refcount_add(nskb->truesize - skb->truesize, | 210 | |
| 208 | &nskb->sk->sk_wmem_alloc); | 211 | delta = nskb->truesize - skb->truesize; |
| 212 | if (likely(delta < 0)) | ||
| 213 | WARN_ON_ONCE(refcount_sub_and_test(-delta, &sk->sk_wmem_alloc)); | ||
| 214 | else if (delta) | ||
| 215 | refcount_add(delta, &sk->sk_wmem_alloc); | ||
| 209 | } | 216 | } |
| 210 | 217 | ||
| 211 | /* This function may be called after the user socket is already | 218 | /* This function may be called after the user socket is already |
| @@ -293,11 +293,8 @@ static void tls_sk_proto_close(struct sock *sk, long timeout) · 292 unmodified lines | |||
| 293 | #endif | 293 | #endif |
| 294 | } | 294 | } |
| 295 | 295 | ||
| 296 | if (ctx->rx_conf == TLS_SW) { | 296 | if (ctx->rx_conf == TLS_SW) |
| 297 | kfree(ctx->rx.rec_seq); | ||
| 298 | kfree(ctx->rx.iv); | ||
| 299 | tls_sw_free_resources_rx(sk); | 297 | tls_sw_free_resources_rx(sk); |
| 300 | } | ||
| 301 | 298 | ||
| 302 | #ifdef CONFIG_TLS_DEVICE | 299 | #ifdef CONFIG_TLS_DEVICE |
| 303 | if (ctx->rx_conf == TLS_HW) | 300 | if (ctx->rx_conf == TLS_HW) |
| @@ -2091,6 +2091,9 @@ void tls_sw_release_resources_rx(struct sock *sk) · 2090 unmodified lines | |||
| 2091 | struct tls_context *tls_ctx = tls_get_ctx(sk); | 2091 | struct tls_context *tls_ctx = tls_get_ctx(sk); |
| 2092 | struct tls_sw_context_rx *ctx = tls_sw_ctx_rx(tls_ctx); | 2092 | struct tls_sw_context_rx *ctx = tls_sw_ctx_rx(tls_ctx); |
| 2093 | 2093 | ||
| 2094 | kfree(tls_ctx->rx.rec_seq); | ||
| 2095 | kfree(tls_ctx->rx.iv); | ||
| 2096 | |||
| 2094 | if (ctx->aead_recv) { | 2097 | if (ctx->aead_recv) { |
| 2095 | kfree_skb(ctx->recv_pkt); | 2098 | kfree_skb(ctx->recv_pkt); |
| 2096 | ctx->recv_pkt = NULL; | 2099 | ctx->recv_pkt = NULL; |
| @@ -13,7 +13,7 @@ gen-atomic-long.sh asm-generic/atomic-long.h · 12 unmodified lines | |||
| 13 | gen-atomic-fallback.sh linux/atomic-fallback.h | 13 | gen-atomic-fallback.sh linux/atomic-fallback.h |
| 14 | EOF | 14 | EOF |
| 15 | while read script header; do | 15 | while read script header; do |
| 16 | ${ATOMICDIR}/${script} ${ATOMICTBL} > ${LINUXDIR}/include/${header} | 16 | /bin/sh ${ATOMICDIR}/${script} ${ATOMICTBL} > ${LINUXDIR}/include/${header} |
| 17 | HASH="$(sha1sum ${LINUXDIR}/include/${header})" | 17 | HASH="$(sha1sum ${LINUXDIR}/include/${header})" |
| 18 | HASH="${HASH%% *}" | 18 | HASH="${HASH%% *}" |
| 19 | printf "// %s\n" "${HASH}" >> ${LINUXDIR}/include/${header} | 19 | printf "// %s\n" "${HASH}" >> ${LINUXDIR}/include/${header} |
| @@ -560,7 +560,7 @@ static int propagate_exception(struct dev_cgroup *devcg_root, · 559 unmodified lines | |||
| 560 | devcg->behavior == DEVCG_DEFAULT_ALLOW) { | 560 | devcg->behavior == DEVCG_DEFAULT_ALLOW) { |
| 561 | rc = dev_exception_add(devcg, ex); | 561 | rc = dev_exception_add(devcg, ex); |
| 562 | if (rc) | 562 | if (rc) |
| 563 | break; | 563 | return rc; |
| 564 | } else { | 564 | } else { |
| 565 | /* | 565 | /* |
| 566 | * in the other possible cases: | 566 | * in the other possible cases: |
| @@ -713,8 +713,11 @@ snd_info_create_entry(const char *name, struct snd_info_entry *parent, · 712 unmodified lines | |||
| 713 | INIT_LIST_HEAD(&entry->list); | 713 | INIT_LIST_HEAD(&entry->list); |
| 714 | entry->parent = parent; | 714 | entry->parent = parent; |
| 715 | entry->module = module; | 715 | entry->module = module; |
| 716 | if (parent) | 716 | if (parent) { |
| 717 | mutex_lock(&parent->access); | ||
| 717 | list_add_tail(&entry->list, &parent->children); | 718 | list_add_tail(&entry->list, &parent->children); |
| 719 | mutex_unlock(&parent->access); | ||
| 720 | } | ||
| 718 | return entry; | 721 | return entry; |
| 719 | } | 722 | } |
| 720 | 723 | ||
| @@ -792,7 +795,12 @@ void snd_info_free_entry(struct snd_info_entry * entry) · 71 unmodified lines | |||
| 792 | list_for_each_entry_safe(p, n, &entry->children, list) | 795 | list_for_each_entry_safe(p, n, &entry->children, list) |
| 793 | snd_info_free_entry(p); | 796 | snd_info_free_entry(p); |
| 794 | 797 | ||
| 795 | list_del(&entry->list); | 798 | p = entry->parent; |
| 799 | if (p) { | ||
| 800 | mutex_lock(&p->access); | ||
| 801 | list_del(&entry->list); | ||
| 802 | mutex_unlock(&p->access); | ||
| 803 | } | ||
| 796 | kfree(entry->name); | 804 | kfree(entry->name); |
| 797 | if (entry->private_free) | 805 | if (entry->private_free) |
| 798 | entry->private_free(entry); | 806 | entry->private_free(entry); |
| @@ -382,14 +382,7 @@ int snd_card_disconnect(struct snd_card *card) · 381 unmodified lines | |||
| 382 | card->shutdown = 1; | 382 | card->shutdown = 1; |
| 383 | spin_unlock(&card->files_lock); | 383 | spin_unlock(&card->files_lock); |
| 384 | 384 | ||
| 385 | /* phase 1: disable fops (user space) operations for ALSA API */ | 385 | /* replace file->f_op with special dummy operations */ |
| 386 | mutex_lock(&snd_card_mutex); | ||
| 387 | snd_cards[card->number] = NULL; | ||
| 388 | clear_bit(card->number, snd_cards_lock); | ||
| 389 | mutex_unlock(&snd_card_mutex); | ||
| 390 | |||
| 391 | /* phase 2: replace file->f_op with special dummy operations */ | ||
| 392 | |||
| 393 | spin_lock(&card->files_lock); | 386 | spin_lock(&card->files_lock); |
| 394 | list_for_each_entry(mfile, &card->files_list, list) { | 387 | list_for_each_entry(mfile, &card->files_list, list) { |
| 395 | /* it's critical part, use endless loop */ | 388 | /* it's critical part, use endless loop */ |
| @@ -405,7 +398,7 @@ int snd_card_disconnect(struct snd_card *card) · 9 unmodified lines | |||
| 405 | } | 398 | } |
| 406 | spin_unlock(&card->files_lock); | 399 | spin_unlock(&card->files_lock); |
| 407 | 400 | ||
| 408 | /* phase 3: notify all connected devices about disconnection */ | 401 | /* notify all connected devices about disconnection */ |
| 409 | /* at this point, they cannot respond to any calls except release() */ | 402 | /* at this point, they cannot respond to any calls except release() */ |
| 410 | 403 | ||
| 411 | #if IS_ENABLED(CONFIG_SND_MIXER_OSS) | 404 | #if IS_ENABLED(CONFIG_SND_MIXER_OSS) |
| @@ -421,6 +414,13 @@ int snd_card_disconnect(struct snd_card *card) · 9 unmodified lines | |||
| 421 | device_del(&card->card_dev); | 414 | device_del(&card->card_dev); |
| 422 | card->registered = false; | 415 | card->registered = false; |
| 423 | } | 416 | } |
| 417 | |||
| 418 | /* disable fops (user space) operations for ALSA API */ | ||
| 419 | mutex_lock(&snd_card_mutex); | ||
| 420 | snd_cards[card->number] = NULL; | ||
| 421 | clear_bit(card->number, snd_cards_lock); | ||
| 422 | mutex_unlock(&snd_card_mutex); | ||
| 423 | |||
| 424 | #ifdef CONFIG_PM | 424 | #ifdef CONFIG_PM |
| 425 | wake_up(&card->power_sleep); | 425 | wake_up(&card->power_sleep); |
| 426 | #endif | 426 | #endif |
| @@ -969,6 +969,7 @@ int snd_hda_codec_device_new(struct hda_bus *bus, struct snd_card *card, · 968 unmodified lines | |||
| 969 | 969 | ||
| 970 | /* power-up all before initialization */ | 970 | /* power-up all before initialization */ |
| 971 | hda_set_power_state(codec, AC_PWRST_D0); | 971 | hda_set_power_state(codec, AC_PWRST_D0); |
| 972 | codec->core.dev.power.power_state = PMSG_ON; | ||
| 972 | 973 | ||
| 973 | snd_hda_codec_proc_new(codec); | 974 | snd_hda_codec_proc_new(codec); |
| 974 | 975 | ||
| @@ -7266,6 +7266,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { · 7265 unmodified lines | |||
| 7266 | {0x12, 0x90a60140}, | 7266 | {0x12, 0x90a60140}, |
| 7267 | {0x14, 0x90170150}, | 7267 | {0x14, 0x90170150}, |
| 7268 | {0x21, 0x02211020}), | 7268 | {0x21, 0x02211020}), |
| 7269 | SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | ||
| 7270 | {0x21, 0x02211020}), | ||
| 7269 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, | 7271 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, |
| 7270 | {0x14, 0x90170110}, | 7272 | {0x14, 0x90170110}, |
| 7271 | {0x21, 0x02211020}), | 7273 | {0x21, 0x02211020}), |
| @@ -7376,6 +7378,10 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { · 104 unmodified lines | |||
| 7376 | {0x21, 0x0221101f}), | 7378 | {0x21, 0x0221101f}), |
| 7377 | SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | 7379 | SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
| 7378 | ALC256_STANDARD_PINS), | 7380 | ALC256_STANDARD_PINS), |
| 7381 | SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | ||
| 7382 | {0x14, 0x90170110}, | ||
| 7383 | {0x1b, 0x01011020}, | ||
| 7384 | {0x21, 0x0221101f}), | ||
| 7379 | SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC, | 7385 | SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC, |
| 7380 | {0x14, 0x90170110}, | 7386 | {0x14, 0x90170110}, |
| 7381 | {0x1b, 0x90a70130}, | 7387 | {0x1b, 0x90a70130}, |
| @@ -32,6 +32,7 @@ · 31 unmodified lines | |||
| 32 | 32 | ||
| 33 | #ifndef __KERNEL__ | 33 | #ifndef __KERNEL__ |
| 34 | #include <stdlib.h> | 34 | #include <stdlib.h> |
| 35 | #include <time.h> | ||
| 35 | #endif | 36 | #endif |
| 36 | 37 | ||
| 37 | /* | 38 | /* |
| @@ -2233,7 +2233,7 @@ eval_type_str(unsigned long long val, const char *type, int pointer) · 2232 unmodified lines | |||
| 2233 | return val & 0xffffffff; | 2233 | return val & 0xffffffff; |
| 2234 | 2234 | ||
| 2235 | if (strcmp(type, "u64") == 0 || | 2235 | if (strcmp(type, "u64") == 0 || |
| 2236 | strcmp(type, "s64")) | 2236 | strcmp(type, "s64") == 0) |
| 2237 | return val; | 2237 | return val; |
| 2238 | 2238 | ||
| 2239 | if (strcmp(type, "s8") == 0) | 2239 | if (strcmp(type, "s8") == 0) |
| @@ -1308,6 +1308,7 @@ static void init_features(struct perf_session *session) · 1307 unmodified lines | |||
| 1308 | for (feat = HEADER_FIRST_FEATURE; feat < HEADER_LAST_FEATURE; feat++) | 1308 | for (feat = HEADER_FIRST_FEATURE; feat < HEADER_LAST_FEATURE; feat++) |
| 1309 | perf_header__set_feat(&session->header, feat); | 1309 | perf_header__set_feat(&session->header, feat); |
| 1310 | 1310 | ||
| 1311 | perf_header__clear_feat(&session->header, HEADER_DIR_FORMAT); | ||
| 1311 | perf_header__clear_feat(&session->header, HEADER_BUILD_ID); | 1312 | perf_header__clear_feat(&session->header, HEADER_BUILD_ID); |
| 1312 | perf_header__clear_feat(&session->header, HEADER_TRACING_DATA); | 1313 | perf_header__clear_feat(&session->header, HEADER_TRACING_DATA); |
| 1313 | perf_header__clear_feat(&session->header, HEADER_BRANCH_STACK); | 1314 | perf_header__clear_feat(&session->header, HEADER_BRANCH_STACK); |
| @@ -1377,6 +1377,7 @@ int cmd_top(int argc, const char **argv) · 1376 unmodified lines | |||
| 1377 | * */ | 1377 | * */ |
| 1378 | .overwrite = 0, | 1378 | .overwrite = 0, |
| 1379 | .sample_time = true, | 1379 | .sample_time = true, |
| 1380 | .sample_time_set = true, | ||
| 1380 | }, | 1381 | }, |
| 1381 | .max_stack = sysctl__max_stack(), | 1382 | .max_stack = sysctl__max_stack(), |
| 1382 | .annotation_opts = annotation__default_options, | 1383 | .annotation_opts = annotation__default_options, |
| @@ -331,7 +331,7 @@ if perf_db_export_calls: · 330 unmodified lines | |||
| 331 | 'return_id,' | 331 | 'return_id,' |
| 332 | 'CASE WHEN flags=0 THEN \'\' WHEN flags=1 THEN \'no call\' WHEN flags=2 THEN \'no return\' WHEN flags=3 THEN \'no call/return\' WHEN flags=6 THEN \'jump\' ELSE flags END AS flags,' | 332 | 'CASE WHEN flags=0 THEN \'\' WHEN flags=1 THEN \'no call\' WHEN flags=2 THEN \'no return\' WHEN flags=3 THEN \'no call/return\' WHEN flags=6 THEN \'jump\' ELSE flags END AS flags,' |
| 333 | 'parent_call_path_id,' | 333 | 'parent_call_path_id,' |
| 334 | 'parent_id' | 334 | 'calls.parent_id' |
| 335 | ' FROM calls INNER JOIN call_paths ON call_paths.id = call_path_id') | 335 | ' FROM calls INNER JOIN call_paths ON call_paths.id = call_path_id') |
| 336 | 336 | ||
| 337 | do_query(query, 'CREATE VIEW samples_view AS ' | 337 | do_query(query, 'CREATE VIEW samples_view AS ' |
| @@ -57,9 +57,11 @@ struct bpf_prog_info_node *perf_env__find_bpf_prog_info(struct perf_env *env, · 56 unmodified lines | |||
| 57 | else if (prog_id > node->info_linear->info.id) | 57 | else if (prog_id > node->info_linear->info.id) |
| 58 | n = n->rb_right; | 58 | n = n->rb_right; |
| 59 | else | 59 | else |
| 60 | break; | 60 | goto out; |
| 61 | } | 61 | } |
| 62 | node = NULL; | ||
| 62 | 63 | ||
| 64 | out: | ||
| 63 | up_read(&env->bpf_progs.lock); | 65 | up_read(&env->bpf_progs.lock); |
| 64 | return node; | 66 | return node; |
| 65 | } | 67 | } |
| @@ -109,10 +111,12 @@ struct btf_node *perf_env__find_btf(struct perf_env *env, __u32 btf_id) · 43 unmodified lines | |||
| 109 | else if (btf_id > node->id) | 111 | else if (btf_id > node->id) |
| 110 | n = n->rb_right; | 112 | n = n->rb_right; |
| 111 | else | 113 | else |
| 112 | break; | 114 | goto out; |
| 113 | } | 115 | } |
| 116 | node = NULL; | ||
| 114 | 117 | ||
| 115 | up_read(&env->bpf_progs.lock); | 118 | up_read(&env->bpf_progs.lock); |
| 119 | out: | ||
| 116 | return node; | 120 | return node; |
| 117 | } | 121 | } |
| 118 | 122 | ||
| @@ -1868,12 +1868,12 @@ static void *perf_evlist__poll_thread(void *arg) · 1867 unmodified lines | |||
| 1868 | { | 1868 | { |
| 1869 | struct perf_evlist *evlist = arg; | 1869 | struct perf_evlist *evlist = arg; |
| 1870 | bool draining = false; | 1870 | bool draining = false; |
| 1871 | int i; | 1871 | int i, done = 0; |
| 1872 | |||
| 1873 | while (!done) { | ||
| 1874 | bool got_data = false; | ||
| 1872 | 1875 | ||
| 1873 | while (draining || !(evlist->thread.done)) { | 1876 | if (evlist->thread.done) |
| 1874 | if (draining) | ||
| 1875 | draining = false; | ||
| 1876 | else if (evlist->thread.done) | ||
| 1877 | draining = true; | 1877 | draining = true; |
| 1878 | 1878 | ||
| 1879 | if (!draining) | 1879 | if (!draining) |
| @@ -1894,9 +1894,13 @@ static void *perf_evlist__poll_thread(void *arg) · 14 unmodified lines | |||
| 1894 | pr_warning("cannot locate proper evsel for the side band event\n"); | 1894 | pr_warning("cannot locate proper evsel for the side band event\n"); |
| 1895 | 1895 | ||
| 1896 | perf_mmap__consume(map); | 1896 | perf_mmap__consume(map); |
| 1897 | got_data = true; | ||
| 1897 | } | 1898 | } |
| 1898 | perf_mmap__read_done(map); | 1899 | perf_mmap__read_done(map); |
| 1899 | } | 1900 | } |
| 1901 | |||
| 1902 | if (draining && !got_data) | ||
| 1903 | break; | ||
| 1900 | } | 1904 | } |
| 1901 | return NULL; | 1905 | return NULL; |
| 1902 | } | 1906 | } |
| @@ -2368,7 +2368,7 @@ int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event, · 2367 unmodified lines | |||
| 2368 | if (data->user_regs.abi) { | 2368 | if (data->user_regs.abi) { |
| 2369 | u64 mask = evsel->attr.sample_regs_user; | 2369 | u64 mask = evsel->attr.sample_regs_user; |
| 2370 | 2370 | ||
| 2371 | sz = hweight_long(mask) * sizeof(u64); | 2371 | sz = hweight64(mask) * sizeof(u64); |
| 2372 | OVERFLOW_CHECK(array, sz, max_size); | 2372 | OVERFLOW_CHECK(array, sz, max_size); |
| 2373 | data->user_regs.mask = mask; | 2373 | data->user_regs.mask = mask; |
| 2374 | data->user_regs.regs = (u64 *)array; | 2374 | data->user_regs.regs = (u64 *)array; |
| @@ -2424,7 +2424,7 @@ int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event, · 49 unmodified lines | |||
| 2424 | if (data->intr_regs.abi != PERF_SAMPLE_REGS_ABI_NONE) { | 2424 | if (data->intr_regs.abi != PERF_SAMPLE_REGS_ABI_NONE) { |
| 2425 | u64 mask = evsel->attr.sample_regs_intr; | 2425 | u64 mask = evsel->attr.sample_regs_intr; |
| 2426 | 2426 | ||
| 2427 | sz = hweight_long(mask) * sizeof(u64); | 2427 | sz = hweight64(mask) * sizeof(u64); |
| 2428 | OVERFLOW_CHECK(array, sz, max_size); | 2428 | OVERFLOW_CHECK(array, sz, max_size); |
| 2429 | data->intr_regs.mask = mask; | 2429 | data->intr_regs.mask = mask; |
| 2430 | data->intr_regs.regs = (u64 *)array; | 2430 | data->intr_regs.regs = (u64 *)array; |
| @@ -2552,7 +2552,7 @@ size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type, · 121 unmodified lines | |||
| 2552 | if (type & PERF_SAMPLE_REGS_USER) { | 2552 | if (type & PERF_SAMPLE_REGS_USER) { |
| 2553 | if (sample->user_regs.abi) { | 2553 | if (sample->user_regs.abi) { |
| 2554 | result += sizeof(u64); | 2554 | result += sizeof(u64); |
| 2555 | sz = hweight_long(sample->user_regs.mask) * sizeof(u64); | 2555 | sz = hweight64(sample->user_regs.mask) * sizeof(u64); |
| 2556 | result += sz; | 2556 | result += sz; |
| 2557 | } else { | 2557 | } else { |
| 2558 | result += sizeof(u64); | 2558 | result += sizeof(u64); |
| @@ -2580,7 +2580,7 @@ size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type, · 21 unmodified lines | |||
| 2580 | if (type & PERF_SAMPLE_REGS_INTR) { | 2580 | if (type & PERF_SAMPLE_REGS_INTR) { |
| 2581 | if (sample->intr_regs.abi) { | 2581 | if (sample->intr_regs.abi) { |
| 2582 | result += sizeof(u64); | 2582 | result += sizeof(u64); |
| 2583 | sz = hweight_long(sample->intr_regs.mask) * sizeof(u64); | 2583 | sz = hweight64(sample->intr_regs.mask) * sizeof(u64); |
| 2584 | result += sz; | 2584 | result += sz; |
| 2585 | } else { | 2585 | } else { |
| 2586 | result += sizeof(u64); | 2586 | result += sizeof(u64); |
| @@ -2710,7 +2710,7 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type, · 123 unmodified lines | |||
| 2710 | if (type & PERF_SAMPLE_REGS_USER) { | 2710 | if (type & PERF_SAMPLE_REGS_USER) { |
| 2711 | if (sample->user_regs.abi) { | 2711 | if (sample->user_regs.abi) { |
| 2712 | *array++ = sample->user_regs.abi; | 2712 | *array++ = sample->user_regs.abi; |
| 2713 | sz = hweight_long(sample->user_regs.mask) * sizeof(u64); | 2713 | sz = hweight64(sample->user_regs.mask) * sizeof(u64); |
| 2714 | memcpy(array, sample->user_regs.regs, sz); | 2714 | memcpy(array, sample->user_regs.regs, sz); |
| 2715 | array = (void *)array + sz; | 2715 | array = (void *)array + sz; |
| 2716 | } else { | 2716 | } else { |
| @@ -2746,7 +2746,7 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type, · 29 unmodified lines | |||
| 2746 | if (type & PERF_SAMPLE_REGS_INTR) { | 2746 | if (type & PERF_SAMPLE_REGS_INTR) { |
| 2747 | if (sample->intr_regs.abi) { | 2747 | if (sample->intr_regs.abi) { |
| 2748 | *array++ = sample->intr_regs.abi; | 2748 | *array++ = sample->intr_regs.abi; |
| 2749 | sz = hweight_long(sample->intr_regs.mask) * sizeof(u64); | 2749 | sz = hweight64(sample->intr_regs.mask) * sizeof(u64); |
| 2750 | memcpy(array, sample->intr_regs.regs, sz); | 2750 | memcpy(array, sample->intr_regs.regs, sz); |
| 2751 | array = (void *)array + sz; | 2751 | array = (void *)array + sz; |
| 2752 | } else { | 2752 | } else { |
| @@ -2606,6 +2606,7 @@ static int process_bpf_prog_info(struct feat_fd *ff, void *data __maybe_unused) · 2605 unmodified lines | |||
| 2606 | perf_env__insert_bpf_prog_info(env, info_node); | 2606 | perf_env__insert_bpf_prog_info(env, info_node); |
| 2607 | } | 2607 | } |
| 2608 | 2608 | ||
| 2609 | up_write(&env->bpf_progs.lock); | ||
| 2609 | return 0; | 2610 | return 0; |
| 2610 | out: | 2611 | out: |
| 2611 | free(info_linear); | 2612 | free(info_linear); |
| @@ -2623,7 +2624,9 @@ static int process_bpf_prog_info(struct feat_fd *ff __maybe_unused, void *data _ · 11 unmodified lines | |||
| 2623 | static int process_bpf_btf(struct feat_fd *ff, void *data __maybe_unused) | 2624 | static int process_bpf_btf(struct feat_fd *ff, void *data __maybe_unused) |
| 2624 | { | 2625 | { |
| 2625 | struct perf_env *env = &ff->ph->env; | 2626 | struct perf_env *env = &ff->ph->env; |
| 2627 | struct btf_node *node = NULL; | ||
| 2626 | u32 count, i; | 2628 | u32 count, i; |
| 2629 | int err = -1; | ||
| 2627 | 2630 | ||
| 2628 | if (ff->ph->needs_swap) { | 2631 | if (ff->ph->needs_swap) { |
| 2629 | pr_warning("interpreting btf from systems with endianity is not yet supported\n"); | 2632 | pr_warning("interpreting btf from systems with endianity is not yet supported\n"); |
| @@ -2636,31 +2639,32 @@ static int process_bpf_btf(struct feat_fd *ff, void *data __maybe_unused) · 6 unmodified lines | |||
| 2636 | down_write(&env->bpf_progs.lock); | 2639 | down_write(&env->bpf_progs.lock); |
| 2637 | 2640 | ||
| 2638 | for (i = 0; i < count; ++i) { | 2641 | for (i = 0; i < count; ++i) { |
| 2639 | struct btf_node *node; | ||
| 2640 | u32 id, data_size; | 2642 | u32 id, data_size; |
| 2641 | 2643 | ||
| 2642 | if (do_read_u32(ff, &id)) | 2644 | if (do_read_u32(ff, &id)) |
| 2643 | return -1; | 2645 | goto out; |
| 2644 | if (do_read_u32(ff, &data_size)) | 2646 | if (do_read_u32(ff, &data_size)) |
| 2645 | return -1; | 2647 | goto out; |
| 2646 | 2648 | ||
| 2647 | node = malloc(sizeof(struct btf_node) + data_size); | 2649 | node = malloc(sizeof(struct btf_node) + data_size); |
| 2648 | if (!node) | 2650 | if (!node) |
| 2649 | return -1; | 2651 | goto out; |
| 2650 | 2652 | ||
| 2651 | node->id = id; | 2653 | node->id = id; |
| 2652 | node->data_size = data_size; | 2654 | node->data_size = data_size; |
| 2653 | 2655 | ||
| 2654 | if (__do_read(ff, node->data, data_size)) { | 2656 | if (__do_read(ff, node->data, data_size)) |
| 2655 | free(node); | 2657 | goto out; |
| 2656 | return -1; | ||
| 2657 | } | ||
| 2658 | 2658 | ||
| 2659 | perf_env__insert_btf(env, node); | 2659 | perf_env__insert_btf(env, node); |
| 2660 | node = NULL; | ||
| 2660 | } | 2661 | } |
| 2661 | 2662 | ||
| 2663 | err = 0; | ||
| 2664 | out: | ||
| 2662 | up_write(&env->bpf_progs.lock); | 2665 | up_write(&env->bpf_progs.lock); |
| 2663 | return 0; | 2666 | free(node); |
| 2667 | return err; | ||
| 2664 | } | 2668 | } |
| 2665 | 2669 | ||
| 2666 | struct feature_ops { | 2670 | struct feature_ops { |
| @@ -261,6 +261,22 @@ bool __map__is_extra_kernel_map(const struct map *map) · 260 unmodified lines | |||
| 261 | return kmap && kmap->name[0]; | 261 | return kmap && kmap->name[0]; |
| 262 | } | 262 | } |
| 263 | 263 | ||
| 264 | bool __map__is_bpf_prog(const struct map *map) | ||
| 265 | { | ||
| 266 | const char *name; | ||
| 267 | |||
| 268 | if (map->dso->binary_type == DSO_BINARY_TYPE__BPF_PROG_INFO) | ||
| 269 | return true; | ||
| 270 | |||
| 271 | /* | ||
| 272 | * If PERF_RECORD_BPF_EVENT is not included, the dso will not have | ||
| 273 | * type of DSO_BINARY_TYPE__BPF_PROG_INFO. In such cases, we can | ||
| 274 | * guess the type based on name. | ||
| 275 | */ | ||
| 276 | name = map->dso->short_name; | ||
| 277 | return name && (strstr(name, "bpf_prog_") == name); | ||
| 278 | } | ||
| 279 | |||
| 264 | bool map__has_symbols(const struct map *map) | 280 | bool map__has_symbols(const struct map *map) |
| 265 | { | 281 | { |
| 266 | return dso__has_symbols(map->dso); | 282 | return dso__has_symbols(map->dso); |
| @@ -910,10 +926,8 @@ static void __maps__insert_name(struct maps *maps, struct map *map) · 643 unmodified lines | |||
| 910 | rc = strcmp(m->dso->short_name, map->dso->short_name); | 926 | rc = strcmp(m->dso->short_name, map->dso->short_name); |
| 911 | if (rc < 0) | 927 | if (rc < 0) |
| 912 | p = &(*p)->rb_left; | 928 | p = &(*p)->rb_left; |
| 913 | else if (rc > 0) | ||
| 914 | p = &(*p)->rb_right; | ||
| 915 | else | 929 | else |
| 916 | return; | 930 | p = &(*p)->rb_right; |
| 917 | } | 931 | } |
| 918 | rb_link_node(&map->rb_node_name, parent, p); | 932 | rb_link_node(&map->rb_node_name, parent, p); |
| 919 | rb_insert_color(&map->rb_node_name, &maps->names); | 933 | rb_insert_color(&map->rb_node_name, &maps->names); |
| @@ -159,10 +159,12 @@ int map__set_kallsyms_ref_reloc_sym(struct map *map, const char *symbol_name, · 158 unmodified lines | |||
| 159 | 159 | ||
| 160 | bool __map__is_kernel(const struct map *map); | 160 | bool __map__is_kernel(const struct map *map); |
| 161 | bool __map__is_extra_kernel_map(const struct map *map); | 161 | bool __map__is_extra_kernel_map(const struct map *map); |
| 162 | bool __map__is_bpf_prog(const struct map *map); | ||
| 162 | 163 | ||
| 163 | static inline bool __map__is_kmodule(const struct map *map) | 164 | static inline bool __map__is_kmodule(const struct map *map) |
| 164 | { | 165 | { |
| 165 | return !__map__is_kernel(map) && !__map__is_extra_kernel_map(map); | 166 | return !__map__is_kernel(map) && !__map__is_extra_kernel_map(map) && |
| 167 | !__map__is_bpf_prog(map); | ||
| 166 | } | 168 | } |
| 167 | 169 | ||
| 168 | bool map__has_symbols(const struct map *map); | 170 | bool map__has_symbols(const struct map *map); |
| @@ -6,12 +6,14 @@ if [ $(id -u) != 0 ]; then · 5 unmodified lines | |||
| 6 | exit 0 | 6 | exit 0 |
| 7 | fi | 7 | fi |
| 8 | 8 | ||
| 9 | ret=0 | ||
| 9 | echo "--------------------" | 10 | echo "--------------------" |
| 10 | echo "running psock_fanout test" | 11 | echo "running psock_fanout test" |
| 11 | echo "--------------------" | 12 | echo "--------------------" |
| 12 | ./in_netns.sh ./psock_fanout | 13 | ./in_netns.sh ./psock_fanout |
| 13 | if [ $? -ne 0 ]; then | 14 | if [ $? -ne 0 ]; then |
| 14 | echo "[FAIL]" | 15 | echo "[FAIL]" |
| 16 | ret=1 | ||
| 15 | else | 17 | else |
| 16 | echo "[PASS]" | 18 | echo "[PASS]" |
| 17 | fi | 19 | fi |
| @@ -22,6 +24,7 @@ echo "--------------------" · 4 unmodified lines | |||
| 22 | ./in_netns.sh ./psock_tpacket | 24 | ./in_netns.sh ./psock_tpacket |
| 23 | if [ $? -ne 0 ]; then | 25 | if [ $? -ne 0 ]; then |
| 24 | echo "[FAIL]" | 26 | echo "[FAIL]" |
| 27 | ret=1 | ||
| 25 | else | 28 | else |
| 26 | echo "[PASS]" | 29 | echo "[PASS]" |
| 27 | fi | 30 | fi |
| @@ -32,6 +35,8 @@ echo "--------------------" · 4 unmodified lines | |||
| 32 | ./in_netns.sh ./txring_overwrite | 35 | ./in_netns.sh ./txring_overwrite |
| 33 | if [ $? -ne 0 ]; then | 36 | if [ $? -ne 0 ]; then |
| 34 | echo "[FAIL]" | 37 | echo "[FAIL]" |
| 38 | ret=1 | ||
| 35 | else | 39 | else |
| 36 | echo "[PASS]" | 40 | echo "[PASS]" |
| 37 | fi | 41 | fi |
| 42 | exit $ret | ||
| @@ -7,7 +7,7 @@ echo "--------------------" · 6 unmodified lines | |||
| 7 | ./socket | 7 | ./socket |
| 8 | if [ $? -ne 0 ]; then | 8 | if [ $? -ne 0 ]; then |
| 9 | echo "[FAIL]" | 9 | echo "[FAIL]" |
| 10 | exit 1 | ||
| 10 | else | 11 | else |
| 11 | echo "[PASS]" | 12 | echo "[PASS]" |
| 12 | fi | 13 | fi |
| 13 | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | # Makefile for netfilter selftests | 2 | # Makefile for netfilter selftests |
| 3 | 3 | ||
| 4 | TEST_PROGS := nft_trans_stress.sh nft_nat.sh bridge_brouter.sh | 4 | TEST_PROGS := nft_trans_stress.sh nft_nat.sh bridge_brouter.sh \ |
| 5 | conntrack_icmp_related.sh | ||
| 5 | 6 | ||
| 6 | include ../lib.mk | 7 | include ../lib.mk |
| @@ -0,0 +1,283 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # | ||
| 3 | # check that ICMP df-needed/pkttoobig icmp are set are set as related | ||
| 4 | # state | ||
| 5 | # | ||
| 6 | # Setup is: | ||
| 7 | # | ||
| 8 | # nsclient1 -> nsrouter1 -> nsrouter2 -> nsclient2 | ||
| 9 | # MTU 1500, except for nsrouter2 <-> nsclient2 link (1280). | ||
| 10 | # ping nsclient2 from nsclient1, checking that conntrack did set RELATED | ||
| 11 | # 'fragmentation needed' icmp packet. | ||
| 12 | # | ||
| 13 | # In addition, nsrouter1 will perform IP masquerading, i.e. also | ||
| 14 | # check the icmp errors are propagated to the correct host as per | ||
| 15 | # nat of "established" icmp-echo "connection". | ||
| 16 | |||
| 17 | # Kselftest framework requirement - SKIP code is 4. | ||
| 18 | ksft_skip=4 | ||
| 19 | ret=0 | ||
| 20 | |||
| 21 | nft --version > /dev/null 2>&1 | ||
| 22 | if [ $? -ne 0 ];then | ||
| 23 | echo "SKIP: Could not run test without nft tool" | ||
| 24 | exit $ksft_skip | ||
| 25 | fi | ||
| 26 | |||
| 27 | ip -Version > /dev/null 2>&1 | ||
| 28 | if [ $? -ne 0 ];then | ||
| 29 | echo "SKIP: Could not run test without ip tool" | ||
| 30 | exit $ksft_skip | ||
| 31 | fi | ||
| 32 | |||
| 33 | cleanup() { | ||
| 34 | for i in 1 2;do ip netns del nsclient$i;done | ||
| 35 | for i in 1 2;do ip netns del nsrouter$i;done | ||
| 36 | } | ||
| 37 | |||
| 38 | ipv4() { | ||
| 39 | echo -n 192.168.$1.2 | ||
| 40 | } | ||
| 41 | |||
| 42 | ipv6 () { | ||
| 43 | echo -n dead:$1::2 | ||
| 44 | } | ||
| 45 | |||
| 46 | check_counter() | ||
| 47 | { | ||
| 48 | ns=$1 | ||
| 49 | name=$2 | ||
| 50 | expect=$3 | ||
| 51 | local lret=0 | ||
| 52 | |||
| 53 | cnt=$(ip netns exec $ns nft list counter inet filter "$name" | grep -q "$expect") | ||
| 54 | if [ $? -ne 0 ]; then | ||
| 55 | echo "ERROR: counter $name in $ns has unexpected value (expected $expect)" 1>&2 | ||
| 56 | ip netns exec $ns nft list counter inet filter "$name" 1>&2 | ||
| 57 | lret=1 | ||
| 58 | fi | ||
| 59 | |||
| 60 | return $lret | ||
| 61 | } | ||
| 62 | |||
| 63 | check_unknown() | ||
| 64 | { | ||
| 65 | expect="packets 0 bytes 0" | ||
| 66 | for n in nsclient1 nsclient2 nsrouter1 nsrouter2; do | ||
| 67 | check_counter $n "unknown" "$expect" | ||
| 68 | if [ $? -ne 0 ] ;then | ||
| 69 | return 1 | ||
| 70 | fi | ||
| 71 | done | ||
| 72 | |||
| 73 | return 0 | ||
| 74 | } | ||
| 75 | |||
| 76 | for n in nsclient1 nsclient2 nsrouter1 nsrouter2; do | ||
| 77 | ip netns add $n | ||
| 78 | ip -net $n link set lo up | ||
| 79 | done | ||
| 80 | |||
| 81 | DEV=veth0 | ||
| 82 | ip link add $DEV netns nsclient1 type veth peer name eth1 netns nsrouter1 | ||
| 83 | DEV=veth0 | ||
| 84 | ip link add $DEV netns nsclient2 type veth peer name eth1 netns nsrouter2 | ||
| 85 | |||
| 86 | DEV=veth0 | ||
| 87 | ip link add $DEV netns nsrouter1 type veth peer name eth2 netns nsrouter2 | ||
| 88 | |||
| 89 | DEV=veth0 | ||
| 90 | for i in 1 2; do | ||
| 91 | ip -net nsclient$i link set $DEV up | ||
| 92 | ip -net nsclient$i addr add $(ipv4 $i)/24 dev $DEV | ||
| 93 | ip -net nsclient$i addr add $(ipv6 $i)/64 dev $DEV | ||
| 94 | done | ||
| 95 | |||
| 96 | ip -net nsrouter1 link set eth1 up | ||
| 97 | ip -net nsrouter1 link set veth0 up | ||
| 98 | |||
| 99 | ip -net nsrouter2 link set eth1 up | ||
| 100 | ip -net nsrouter2 link set eth2 up | ||
| 101 | |||
| 102 | ip -net nsclient1 route add default via 192.168.1.1 | ||
| 103 | ip -net nsclient1 -6 route add default via dead:1::1 | ||
| 104 | |||
| 105 | ip -net nsclient2 route add default via 192.168.2.1 | ||
| 106 | ip -net nsclient2 route add default via dead:2::1 | ||
| 107 | |||
| 108 | i=3 | ||
| 109 | ip -net nsrouter1 addr add 192.168.1.1/24 dev eth1 | ||
| 110 | ip -net nsrouter1 addr add 192.168.3.1/24 dev veth0 | ||
| 111 | ip -net nsrouter1 addr add dead:1::1/64 dev eth1 | ||
| 112 | ip -net nsrouter1 addr add dead:3::1/64 dev veth0 | ||
| 113 | ip -net nsrouter1 route add default via 192.168.3.10 | ||
| 114 | ip -net nsrouter1 -6 route add default via dead:3::10 | ||
| 115 | |||
| 116 | ip -net nsrouter2 addr add 192.168.2.1/24 dev eth1 | ||
| 117 | ip -net nsrouter2 addr add 192.168.3.10/24 dev eth2 | ||
| 118 | ip -net nsrouter2 addr add dead:2::1/64 dev eth1 | ||
| 119 | ip -net nsrouter2 addr add dead:3::10/64 dev eth2 | ||
| 120 | ip -net nsrouter2 route add default via 192.168.3.1 | ||
| 121 | ip -net nsrouter2 route add default via dead:3::1 | ||
| 122 | |||
| 123 | sleep 2 | ||
| 124 | for i in 4 6; do | ||
| 125 | ip netns exec nsrouter1 sysctl -q net.ipv$i.conf.all.forwarding=1 | ||
| 126 | ip netns exec nsrouter2 sysctl -q net.ipv$i.conf.all.forwarding=1 | ||
| 127 | done | ||
| 128 | |||
| 129 | for netns in nsrouter1 nsrouter2; do | ||
| 130 | ip netns exec $netns nft -f - <<EOF | ||
| 131 | table inet filter { | ||
| 132 | counter unknown { } | ||
| 133 | counter related { } | ||
| 134 | chain forward { | ||
| 135 | type filter hook forward priority 0; policy accept; | ||
| 136 | meta l4proto icmpv6 icmpv6 type "packet-too-big" ct state "related" counter name "related" accept | ||
| 137 | meta l4proto icmp icmp type "destination-unreachable" ct state "related" counter name "related" accept | ||
| 138 | meta l4proto { icmp, icmpv6 } ct state new,established accept | ||
| 139 | counter name "unknown" drop | ||
| 140 | } | ||
| 141 | } | ||
| 142 | EOF | ||
| 143 | done | ||
| 144 | |||
| 145 | ip netns exec nsclient1 nft -f - <<EOF | ||
| 146 | table inet filter { | ||
| 147 | counter unknown { } | ||
| 148 | counter related { } | ||
| 149 | chain input { | ||
| 150 | type filter hook input priority 0; policy accept; | ||
| 151 | meta l4proto { icmp, icmpv6 } ct state established,untracked accept | ||
| 152 | |||
| 153 | meta l4proto { icmp, icmpv6 } ct state "related" counter name "related" accept | ||
| 154 | counter name "unknown" drop | ||
| 155 | } | ||
| 156 | } | ||
| 157 | EOF | ||
| 158 | |||
| 159 | ip netns exec nsclient2 nft -f - <<EOF | ||
| 160 | table inet filter { | ||
| 161 | counter unknown { } | ||
| 162 | counter new { } | ||
| 163 | counter established { } | ||
| 164 | |||
| 165 | chain input { | ||
| 166 | type filter hook input priority 0; policy accept; | ||
| 167 | meta l4proto { icmp, icmpv6 } ct state established,untracked accept | ||
| 168 | |||
| 169 | meta l4proto { icmp, icmpv6 } ct state "new" counter name "new" accept | ||
| 170 | meta l4proto { icmp, icmpv6 } ct state "established" counter name "established" accept | ||
| 171 | counter name "unknown" drop | ||
| 172 | } | ||
| 173 | chain output { | ||
| 174 | type filter hook output priority 0; policy accept; | ||
| 175 | meta l4proto { icmp, icmpv6 } ct state established,untracked accept | ||
| 176 | |||
| 177 | meta l4proto { icmp, icmpv6 } ct state "new" counter name "new" | ||
| 178 | meta l4proto { icmp, icmpv6 } ct state "established" counter name "established" | ||
| 179 | counter name "unknown" drop | ||
| 180 | } | ||
| 181 | } | ||
| 182 | EOF | ||
| 183 | |||
| 184 | |||
| 185 | # make sure NAT core rewrites adress of icmp error if nat is used according to | ||
| 186 | # conntrack nat information (icmp error will be directed at nsrouter1 address, | ||
| 187 | # but it needs to be routed to nsclient1 address). | ||
| 188 | ip netns exec nsrouter1 nft -f - <<EOF | ||
| 189 | table ip nat { | ||
| 190 | chain postrouting { | ||
| 191 | type nat hook postrouting priority 0; policy accept; | ||
| 192 | ip protocol icmp oifname "veth0" counter masquerade | ||
| 193 | } | ||
| 194 | } | ||
| 195 | table ip6 nat { | ||
| 196 | chain postrouting { | ||
| 197 | type nat hook postrouting priority 0; policy accept; | ||
| 198 | ip6 nexthdr icmpv6 oifname "veth0" counter masquerade | ||
| 199 | } | ||
| 200 | } | ||
| 201 | EOF | ||
| 202 | |||
| 203 | ip netns exec nsrouter2 ip link set eth1 mtu 1280 | ||
| 204 | ip netns exec nsclient2 ip link set veth0 mtu 1280 | ||
| 205 | sleep 1 | ||
| 206 | |||
| 207 | ip netns exec nsclient1 ping -c 1 -s 1000 -q -M do 192.168.2.2 >/dev/null | ||
| 208 | if [ $? -ne 0 ]; then | ||
| 209 | echo "ERROR: netns ip routing/connectivity broken" 1>&2 | ||
| 210 | cleanup | ||
| 211 | exit 1 | ||
| 212 | fi | ||
| 213 | ip netns exec nsclient1 ping6 -q -c 1 -s 1000 dead:2::2 >/dev/null | ||
| 214 | if [ $? -ne 0 ]; then | ||
| 215 | echo "ERROR: netns ipv6 routing/connectivity broken" 1>&2 | ||
| 216 | cleanup | ||
| 217 | exit 1 | ||
| 218 | fi | ||
| 219 | |||
| 220 | check_unknown | ||
| 221 | if [ $? -ne 0 ]; then | ||
| 222 | ret=1 | ||
| 223 | fi | ||
| 224 | |||
| 225 | expect="packets 0 bytes 0" | ||
| 226 | for netns in nsrouter1 nsrouter2 nsclient1;do | ||
| 227 | check_counter "$netns" "related" "$expect" | ||
| 228 | if [ $? -ne 0 ]; then | ||
| 229 | ret=1 | ||
| 230 | fi | ||
| 231 | done | ||
| 232 | |||
| 233 | expect="packets 2 bytes 2076" | ||
| 234 | check_counter nsclient2 "new" "$expect" | ||
| 235 | if [ $? -ne 0 ]; then | ||
| 236 | ret=1 | ||
| 237 | fi | ||
| 238 | |||
| 239 | ip netns exec nsclient1 ping -q -c 1 -s 1300 -M do 192.168.2.2 > /dev/null | ||
| 240 | if [ $? -eq 0 ]; then | ||
| 241 | echo "ERROR: ping should have failed with PMTU too big error" 1>&2 | ||
| 242 | ret=1 | ||
| 243 | fi | ||
| 244 | |||
| 245 | # nsrouter2 should have generated the icmp error, so | ||
| 246 | # related counter should be 0 (its in forward). | ||
| 247 | expect="packets 0 bytes 0" | ||
| 248 | check_counter "nsrouter2" "related" "$expect" | ||
| 249 | if [ $? -ne 0 ]; then | ||
| 250 | ret=1 | ||
| 251 | fi | ||
| 252 | |||
| 253 | # but nsrouter1 should have seen it, same for nsclient1. | ||
| 254 | expect="packets 1 bytes 576" | ||
| 255 | for netns in nsrouter1 nsclient1;do | ||
| 256 | check_counter "$netns" "related" "$expect" | ||
| 257 | if [ $? -ne 0 ]; then | ||
| 258 | ret=1 | ||
| 259 | fi | ||
| 260 | done | ||
| 261 | |||
| 262 | ip netns exec nsclient1 ping6 -c 1 -s 1300 dead:2::2 > /dev/null | ||
| 263 | if [ $? -eq 0 ]; then | ||
| 264 | echo "ERROR: ping6 should have failed with PMTU too big error" 1>&2 | ||
| 265 | ret=1 | ||
| 266 | fi | ||
| 267 | |||
| 268 | expect="packets 2 bytes 1856" | ||
| 269 | for netns in nsrouter1 nsclient1;do | ||
| 270 | check_counter "$netns" "related" "$expect" | ||
| 271 | if [ $? -ne 0 ]; then | ||
| 272 | ret=1 | ||
| 273 | fi | ||
| 274 | done | ||
| 275 | |||
| 276 | if [ $ret -eq 0 ];then | ||
| 277 | echo "PASS: icmp mtu error had RELATED state" | ||
| 278 | else | ||
| 279 | echo "ERROR: icmp error RELATED state test has failed" | ||
| 280 | fi | ||
| 281 | |||
| 282 | cleanup | ||
| 283 | exit $ret | ||
| @@ -347,6 +347,7 @@ EOF · 346 unmodified lines | |||
| 347 | test_masquerade6() | 347 | test_masquerade6() |
| 348 | { | 348 | { |
| 349 | local family=$1 | 349 | local family=$1 |
| 350 | local natflags=$1 | ||
| 350 | local lret=0 | 351 | local lret=0 |
| 351 | 352 | ||
| 352 | ip netns exec ns0 sysctl net.ipv6.conf.all.forwarding=1 > /dev/null | 353 | ip netns exec ns0 sysctl net.ipv6.conf.all.forwarding=1 > /dev/null |
| @@ -380,7 +381,7 @@ ip netns exec ns0 nft -f - <<EOF · 27 unmodified lines | |||
| 380 | table $family nat { | 381 | table $family nat { |
| 381 | chain postrouting { | 382 | chain postrouting { |
| 382 | type nat hook postrouting priority 0; policy accept; | 383 | type nat hook postrouting priority 0; policy accept; |
| 383 | meta oif veth0 masquerade | 384 | meta oif veth0 masquerade $natflags |
| 384 | } | 385 | } |
| 385 | } | 386 | } |
| 386 | EOF | 387 | EOF |
| @@ -391,7 +392,11 @@ EOF · 4 unmodified lines | |||
| 391 | 392 | ||
| 392 | ip netns exec ns2 ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 | 393 | ip netns exec ns2 ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 |
| 393 | if [ $? -ne 0 ] ; then | 394 | if [ $? -ne 0 ] ; then |
| 395 | <<<<<<< HEAD | ||
| 394 | echo "ERROR: cannot ping ns1 from ns2 with active $family masquerading" | 396 | echo "ERROR: cannot ping ns1 from ns2 with active $family masquerading" |
| 397 | ======= | ||
| 398 | echo "ERROR: cannot ping ns1 from ns2 with active ipv6 masquerade $natflags" | ||
| 399 | >>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1 | ||
| 395 | lret=1 | 400 | lret=1 |
| 396 | fi | 401 | fi |
| 397 | 402 | ||
| @@ -428,20 +433,38 @@ EOF · 30 unmodified lines | |||
| 428 | fi | 433 | fi |
| 429 | done | 434 | done |
| 430 | 435 | ||
| 436 | <<<<<<< HEAD | ||
| 431 | ip netns exec ns0 nft flush chain $family nat postrouting | 437 | ip netns exec ns0 nft flush chain $family nat postrouting |
| 438 | ======= | ||
| 439 | ip netns exec ns2 ping -q -c 1 dead:1::99 > /dev/null # ping ns2->ns1 | ||
| 440 | if [ $? -ne 0 ] ; then | ||
| 441 | echo "ERROR: cannot ping ns1 from ns2 with active ipv6 masquerade $natflags (attempt 2)" | ||
| 442 | lret=1 | ||
| 443 | fi | ||
| 444 | |||
| 445 | ip netns exec ns0 nft flush chain ip6 nat postrouting | ||
| 446 | >>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1 | ||
| 432 | if [ $? -ne 0 ]; then | 447 | if [ $? -ne 0 ]; then |
| 433 | echo "ERROR: Could not flush $family nat postrouting" 1>&2 | 448 | echo "ERROR: Could not flush $family nat postrouting" 1>&2 |
| 434 | lret=1 | 449 | lret=1 |
| 435 | fi | 450 | fi |
| 436 | 451 | ||
| 452 | <<<<<<< HEAD | ||
| 437 | test $lret -eq 0 && echo "PASS: $family IPv6 masquerade for ns2" | 453 | test $lret -eq 0 && echo "PASS: $family IPv6 masquerade for ns2" |
| 454 | ======= | ||
| 455 | test $lret -eq 0 && echo "PASS: IPv6 masquerade $natflags for ns2" | ||
| 456 | >>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1 | ||
| 438 | 457 | ||
| 439 | return $lret | 458 | return $lret |
| 440 | } | 459 | } |
| 441 | 460 | ||
| 442 | test_masquerade() | 461 | test_masquerade() |
| 443 | { | 462 | { |
| 463 | <<<<<<< HEAD | ||
| 444 | local family=$1 | 464 | local family=$1 |
| 465 | ======= | ||
| 466 | local natflags=$1 | ||
| 467 | >>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1 | ||
| 445 | local lret=0 | 468 | local lret=0 |
| 446 | 469 | ||
| 447 | ip netns exec ns0 sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null | 470 | ip netns exec ns0 sysctl net.ipv4.conf.veth0.forwarding=1 > /dev/null |
| @@ -449,7 +472,7 @@ test_masquerade() · 1 unmodified line | |||
| 449 | 472 | ||
| 450 | ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 | 473 | ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 |
| 451 | if [ $? -ne 0 ] ; then | 474 | if [ $? -ne 0 ] ; then |
| 452 | echo "ERROR: canot ping ns1 from ns2" | 475 | echo "ERROR: cannot ping ns1 from ns2 $natflags" |
| 453 | lret=1 | 476 | lret=1 |
| 454 | fi | 477 | fi |
| 455 | 478 | ||
| @@ -475,7 +498,7 @@ ip netns exec ns0 nft -f - <<EOF · 19 unmodified lines | |||
| 475 | table $family nat { | 498 | table $family nat { |
| 476 | chain postrouting { | 499 | chain postrouting { |
| 477 | type nat hook postrouting priority 0; policy accept; | 500 | type nat hook postrouting priority 0; policy accept; |
| 478 | meta oif veth0 masquerade | 501 | meta oif veth0 masquerade $natflags |
| 479 | } | 502 | } |
| 480 | } | 503 | } |
| 481 | EOF | 504 | EOF |
| @@ -486,7 +509,11 @@ EOF · 4 unmodified lines | |||
| 486 | 509 | ||
| 487 | ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 | 510 | ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 |
| 488 | if [ $? -ne 0 ] ; then | 511 | if [ $? -ne 0 ] ; then |
| 512 | <<<<<<< HEAD | ||
| 489 | echo "ERROR: cannot ping ns1 from ns2 with active $family masquerading" | 513 | echo "ERROR: cannot ping ns1 from ns2 with active $family masquerading" |
| 514 | ======= | ||
| 515 | echo "ERROR: cannot ping ns1 from ns2 with active ip masquere $natflags" | ||
| 516 | >>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1 | ||
| 490 | lret=1 | 517 | lret=1 |
| 491 | fi | 518 | fi |
| 492 | 519 | ||
| @@ -522,13 +549,27 @@ EOF · 29 unmodified lines | |||
| 522 | fi | 549 | fi |
| 523 | done | 550 | done |
| 524 | 551 | ||
| 552 | <<<<<<< HEAD | ||
| 525 | ip netns exec ns0 nft flush chain $family nat postrouting | 553 | ip netns exec ns0 nft flush chain $family nat postrouting |
| 554 | ======= | ||
| 555 | ip netns exec ns2 ping -q -c 1 10.0.1.99 > /dev/null # ping ns2->ns1 | ||
| 556 | if [ $? -ne 0 ] ; then | ||
| 557 | echo "ERROR: cannot ping ns1 from ns2 with active ip masquerade $natflags (attempt 2)" | ||
| 558 | lret=1 | ||
| 559 | fi | ||
| 560 | |||
| 561 | ip netns exec ns0 nft flush chain ip nat postrouting | ||
| 562 | >>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1 | ||
| 526 | if [ $? -ne 0 ]; then | 563 | if [ $? -ne 0 ]; then |
| 527 | echo "ERROR: Could not flush $family nat postrouting" 1>&2 | 564 | echo "ERROR: Could not flush $family nat postrouting" 1>&2 |
| 528 | lret=1 | 565 | lret=1 |
| 529 | fi | 566 | fi |
| 530 | 567 | ||
| 568 | <<<<<<< HEAD | ||
| 531 | test $lret -eq 0 && echo "PASS: $family IP masquerade for ns2" | 569 | test $lret -eq 0 && echo "PASS: $family IP masquerade for ns2" |
| 570 | ======= | ||
| 571 | test $lret -eq 0 && echo "PASS: IP masquerade $natflags for ns2" | ||
| 572 | >>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1 | ||
| 532 | 573 | ||
| 533 | return $lret | 574 | return $lret |
| 534 | } | 575 | } |
| @@ -802,11 +843,20 @@ $test_inet_nat && test_local_dnat inet · 267 unmodified lines | |||
| 802 | $test_inet_nat && test_local_dnat6 inet | 843 | $test_inet_nat && test_local_dnat6 inet |
| 803 | 844 | ||
| 804 | reset_counters | 845 | reset_counters |
| 846 | <<<<<<< HEAD | ||
| 805 | test_masquerade ip | 847 | test_masquerade ip |
| 806 | test_masquerade6 ip6 | 848 | test_masquerade6 ip6 |
| 807 | reset_counters | 849 | reset_counters |
| 808 | $test_inet_nat && test_masquerade inet | 850 | $test_inet_nat && test_masquerade inet |
| 809 | $test_inet_nat && test_masquerade6 inet | 851 | $test_inet_nat && test_masquerade6 inet |
| 852 | ======= | ||
| 853 | test_masquerade "" | ||
| 854 | test_masquerade6 "" | ||
| 855 | |||
| 856 | reset_counters | ||
| 857 | test_masquerade "fully-random" | ||
| 858 | test_masquerade6 "fully-random" | ||
| 859 | >>>>>>> cd8dead0c39457e58ec1d36db93aedca811d48f1 | ||
| 810 | 860 | ||
| 811 | reset_counters | 861 | reset_counters |
| 812 | test_redirect ip | 862 | test_redirect ip |
| @@ -187,8 +187,8 @@ static int make_exe(const uint8_t *payload, size_t len) · 186 unmodified lines | |||
| 187 | ph.p_offset = 0; | 187 | ph.p_offset = 0; |
| 188 | ph.p_vaddr = VADDR; | 188 | ph.p_vaddr = VADDR; |
| 189 | ph.p_paddr = 0; | 189 | ph.p_paddr = 0; |
| 190 | ph.p_filesz = sizeof(struct elf64_hdr) + sizeof(struct elf64_phdr) + sizeof(payload); | 190 | ph.p_filesz = sizeof(struct elf64_hdr) + sizeof(struct elf64_phdr) + len; |
| 191 | ph.p_memsz = sizeof(struct elf64_hdr) + sizeof(struct elf64_phdr) + sizeof(payload); | 191 | ph.p_memsz = sizeof(struct elf64_hdr) + sizeof(struct elf64_phdr) + len; |
| 192 | ph.p_align = 4096; | 192 | ph.p_align = 4096; |
| 193 | 193 | ||
| 194 | fd = openat(AT_FDCWD, "/tmp", O_WRONLY|O_EXCL|O_TMPFILE, 0700); | 194 | fd = openat(AT_FDCWD, "/tmp", O_WRONLY|O_EXCL|O_TMPFILE, 0700); |
| @@ -46,12 +46,9 @@ static void fail(const char *fmt, unsigned long a, unsigned long b) · 45 unmodified lines | |||
| 46 | 46 | ||
| 47 | int main(void) | 47 | int main(void) |
| 48 | { | 48 | { |
| 49 | const unsigned int PAGE_SIZE = sysconf(_SC_PAGESIZE); | 49 | const int PAGE_SIZE = sysconf(_SC_PAGESIZE); |
| 50 | #ifdef __arm__ | 50 | const unsigned long va_max = 1UL << 32; |
| 51 | unsigned long va = 2 * PAGE_SIZE; | 51 | unsigned long va; |
| 52 | #else | ||
| 53 | unsigned long va = 0; | ||
| 54 | #endif | ||
| 55 | void *p; | 52 | void *p; |
| 56 | int fd; | 53 | int fd; |
| 57 | unsigned long a, b; | 54 | unsigned long a, b; |
| @@ -60,10 +57,13 @@ int main(void) · 2 unmodified lines | |||
| 60 | if (fd == -1) | 57 | if (fd == -1) |
| 61 | return 1; | 58 | return 1; |
| 62 | 59 | ||
| 63 | p = mmap((void *)va, PAGE_SIZE, PROT_NONE, MAP_PRIVATE|MAP_FILE|MAP_FIXED, fd, 0); | 60 | for (va = 0; va < va_max; va += PAGE_SIZE) { |
| 64 | if (p == MAP_FAILED) { | 61 | p = mmap((void *)va, PAGE_SIZE, PROT_NONE, MAP_PRIVATE|MAP_FILE|MAP_FIXED, fd, 0); |
| 65 | if (errno == EPERM) | 62 | if (p == (void *)va) |
| 66 | return 4; | 63 | break; |
| 64 | } | ||
| 65 | if (va == va_max) { | ||
| 66 | fprintf(stderr, "error: mmap doesn't like you\n"); | ||
| 67 | return 1; | 67 | return 1; |
| 68 | } | 68 | } |
| 69 | 69 | ||