Commit Graph

4714 Commits

Author SHA1 Message Date
Rafael J. Wysocki 61d4ce9119 ACPICA: Utilities: Avoid deleting the same object twice in a row
ACPICA commit c11af67d8f7e3d381068ce7771322f2b5324d687

If original_count is 0 in acpi_ut_update_ref_count (),
acpi_ut_delete_internal_obj () is invoked for the target object, which is
incorrect, because that object has been deleted once already and the
memory allocated to store it may have been reclaimed and allocated
for a different purpose by the host OS.  Moreover, a confusing debug
message following the "Reference Count is already zero, cannot
decrement" warning is printed in that case.

To fix this issue, make acpi_ut_update_ref_count () return after finding
that original_count is 0 and printing the above warning.

Link: https://github.com/acpica/acpica/commit/c11af67d
Link: https://github.com/acpica/acpica/pull/652
Reported-by: Mark Asselstine <mark.asselstine@windriver.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2022-10-14 11:45:39 +08:00
Daniel Borkmann 3c899fa7ce bpf: Add redirect_peer helper
Add an efficient ingress to ingress netns switch that can be used out of tc BPF
programs in order to redirect traffic from host ns ingress into a container
veth device ingress without having to go via CPU backlog queue [0]. For local
containers this can also be utilized and path via CPU backlog queue only needs
to be taken once, not twice. On a high level this borrows from ipvlan which does
similar switch in __netif_receive_skb_core() and then iterates via another_round.
This helps to reduce latency for mentioned use cases.

Pod to remote pod with redirect(), TCP_RR [1]:

  # percpu_netperf 10.217.1.33
          RT_LATENCY:         122.450         (per CPU:         122.666         122.401         122.333         122.401 )
        MEAN_LATENCY:         121.210         (per CPU:         121.100         121.260         121.320         121.160 )
      STDDEV_LATENCY:         120.040         (per CPU:         119.420         119.910         125.460         115.370 )
         MIN_LATENCY:          46.500         (per CPU:          47.000          47.000          47.000          45.000 )
         P50_LATENCY:         118.500         (per CPU:         118.000         119.000         118.000         119.000 )
         P90_LATENCY:         127.500         (per CPU:         127.000         128.000         127.000         128.000 )
         P99_LATENCY:         130.750         (per CPU:         131.000         131.000         129.000         132.000 )

    TRANSACTION_RATE:       32666.400         (per CPU:        8152.200        8169.842        8174.439        8169.897 )

Pod to remote pod with redirect_peer(), TCP_RR:

  # percpu_netperf 10.217.1.33
          RT_LATENCY:          44.449         (per CPU:          43.767          43.127          45.279          45.622 )
        MEAN_LATENCY:          45.065         (per CPU:          44.030          45.530          45.190          45.510 )
      STDDEV_LATENCY:          84.823         (per CPU:          66.770          97.290          84.380          90.850 )
         MIN_LATENCY:          33.500         (per CPU:          33.000          33.000          34.000          34.000 )
         P50_LATENCY:          43.250         (per CPU:          43.000          43.000          43.000          44.000 )
         P90_LATENCY:          46.750         (per CPU:          46.000          47.000          47.000          47.000 )
         P99_LATENCY:          52.750         (per CPU:          51.000          54.000          53.000          53.000 )

    TRANSACTION_RATE:       90039.500         (per CPU:       22848.186       23187.089       22085.077       21919.130 )

  [0] https://linuxplumbersconf.org/event/7/contributions/674/attachments/568/1002/plumbers_2020_cilium_load_balancer.pdf
  [1] https://github.com/borkmann/netperf_scripts/blob/master/percpu_netperf

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20201010234006.7075-3-daniel@iogearbox.net
2022-08-01 10:23:57 +08:00
Menglong Dong ab14b8ba70 drivers/net/bnxt: fix xdp initialization error in bnxt_xdp.c
bnxt failed to check the exist of xdp_set_data_meta_invalid() and
makes meta_data uninited in xdp_buff.

Signed-off-by: Menglong Dong <imagedong@tencent.com>
2022-07-27 11:52:54 +08:00
Alexei Starovoitov 990023faf2 bpf: Implement CAP_BPF
[upstream commit 2c78ee898d8f10ae6fb2fa23a3fbaec96b1b7366]

Implement permissions as stated in uapi/linux/capability.h
In order to do that the verifier allow_ptr_leaks flag is split
into four flags and they are set as:
  env->allow_ptr_leaks = bpf_allow_ptr_leaks();
  env->bypass_spec_v1 = bpf_bypass_spec_v1();
  env->bypass_spec_v4 = bpf_bypass_spec_v4();
  env->bpf_capable = bpf_capable();

The first three currently equivalent to perfmon_capable(), since leaking kernel
pointers and reading kernel memory via side channel attacks is roughly
equivalent to reading kernel memory with cap_perfmon.

'bpf_capable' enables bounded loops, precision tracking, bpf to bpf calls and
other verifier features. 'allow_ptr_leaks' enable ptr leaks, ptr conversions,
subtraction of pointers. 'bypass_spec_v1' disables speculative analysis in the
verifier, run time mitigations in bpf array, and enables indirect variable
access in bpf programs. 'bypass_spec_v4' disables emission of sanitation code
by the verifier.

That means that the networking BPF program loaded with CAP_BPF + CAP_NET_ADMIN
will have speculative checks done by the verifier and other spectre mitigation
applied. Such networking BPF program will not be able to leak kernel pointers
and will not be able to access arbitrary kernel memory.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20200513230355.7858-3-alexei.starovoitov@gmail.com
2022-06-21 10:27:12 +08:00
Menglong Dong e8c5b7e7d4 net: tun: track dropped skb via kfree_skb_reason()
[upstream commit 4b4f052e2d89c2eb7e13ee28ba9e85f8097aef3d]

The TUN can be used as vhost-net backend. E.g, the tun_net_xmit() is the
interface to forward the skb from TUN to vhost-net/virtio-net.

However, there are many "goto drop" in the TUN driver. Therefore, the
kfree_skb_reason() is involved at each "goto drop" to help userspace
ftrace/ebpf to track the reason for the loss of packets.

The below reasons are introduced:

- SKB_DROP_REASON_DEV_READY
- SKB_DROP_REASON_NOMEM
- SKB_DROP_REASON_HDR_TRUNC
- SKB_DROP_REASON_TAP_FILTER
- SKB_DROP_REASON_TAP_TXFILTER

Cc: Joao Martins <joao.m.martins@oracle.com>
Cc: Joe Jin <joe.jin@oracle.com>
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-06-17 10:08:51 +08:00
Menglong Dong 61f9a9637c net: tun: split run_ebpf_filter() and pskb_trim() into different "if statement"
[upstream commit 45a15d89fbcd280571eba8e5ca309e14ba6afa8f]

No functional change.

Just to split the if statement into different conditions to use
kfree_skb_reason() to trace the reason later.

Cc: Joao Martins <joao.m.martins@oracle.com>
Cc: Joe Jin <joe.jin@oracle.com>
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-06-17 10:08:51 +08:00
Menglong Dong a5eb90247e net: tap: track dropped skb via kfree_skb_reason()
[upstream commit 736f16de75f9bb32d76f652cb66f04d1bc685057]

The TAP can be used as vhost-net backend. E.g., the tap_handle_frame() is
the interface to forward the skb from TAP to vhost-net/virtio-net.

However, there are many "goto drop" in the TAP driver. Therefore, the
kfree_skb_reason() is involved at each "goto drop" to help userspace
ftrace/ebpf to track the reason for the loss of packets.

The below reasons are introduced:

- SKB_DROP_REASON_SKB_CSUM
- SKB_DROP_REASON_SKB_GSO_SEG
- SKB_DROP_REASON_SKB_UCOPY_FAULT
- SKB_DROP_REASON_DEV_HDR
- SKB_DROP_REASON_FULL_RING

Cc: Joao Martins <joao.m.martins@oracle.com>
Cc: Joe Jin <joe.jin@oracle.com>
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-06-17 10:08:51 +08:00
Tian Tao d5cd56e771 drm/hisilicon: Fixed pcie resource conflict between drm and firmware
upstream commit: c3480301d750bd58bab35994ecf015a4682a17dd

use the drm_fb_helper_remove_conflicting_pci_framebuffer to remove
the framebuffer initialized by fireware/bootloader to avoid resource
conflict.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Xinliang Liu <xinliang.liu@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/1582524112-5628-1-git-send-email-tiantao6@hisilicon.com
2022-06-07 15:32:52 +08:00
frankjpliu 53729a7e11
Merge pull request #201 from mengensun/tk4/hotfix/urandom
random: add a switch of using rdrand ins in _extract_crng
2022-05-18 19:48:57 +08:00
mengensun ace0b7c6ac random: add a switch of using rdrand ins in _extract_crng
on some old AMD CPU(eg: older then AMD EPYC 7K62) , rdrand is slowly,
random using rdrand to make the random num more hard to be guessed.
while the randomness is not really affect by rdrand.

when user not using random for security case, (eg: just geting some
random num, not using it to generate password) using rdrand on old
amd processor is so expensive.

so, add a swith to rdrand, by default using the rdrand, when closed
using tsc, jiffies, and entropy from the fast_pool to emulate the rdrand

testing on AMD EPYC 7K62 like follow:

---

echo 1 > /proc/sys/kernel/random/tos_use_rdrand
stress-ng --urandom 2 --timeout 10s --times --metrics
bogo ops real time  usr time  sys time   bogo ops/s   bogo ops/s
           (secs)    (secs)    (secs)   (real time) (usr+sys time)
   16542     10.00      0.00     19.98      1654.09       827.93

---

echo 0 > /proc/sys/kernel/random/tos_use_rdrand
stress-ng --urandom 2 --timeout 10s --times --metrics
bogo ops real time  usr time  sys time   bogo ops/s   bogo ops/s
           (secs)    (secs)    (secs)   (real time) (usr+sys time)
  222005     10.00      0.05     19.93     22200.41     11111.36

/dev/urandom reading and geturandom  syscall 13 times faster then using
really rdrand.

Signed-off-by: mengensun <mengensun@tencent.com>
Reviewed-by: frankjpliu <frankjpliu@tencent.com>
Reviewed-by: anakinzhang <anakinzhang@tencent.com>
Reviewed-by: Ruippan <Ruippan@tencent.com>
2022-05-12 10:56:20 +08:00
Menglong Dong a006f67590 net: bpf: fix uninitialized data_meta in xdp
Uninitialized xdp->data_meta can result in NULL pointer deference in
bpf_xdp_adjust_head(). Therefore, fix it by init it with
xdp_set_data_meta_invalid().

Signed-off-by: Menglong Dong <imagedong@tencent.com>
2022-05-10 15:58:50 +08:00
markwhwu b90678a930 virtio_net: Add timeout protection to virnet_send_command
prevent virtio_net from triggering soft lockup

Signed-off-by: Mark Whwu <markwhwu@tencent.com>
2022-04-19 16:17:45 +08:00
Bin Lai a9bcce0fce iommu/phytium: fix PLX acs bug on phytium platform
Phytium platform doesn't support PLX acs feature, it would affect
the device passthrough fucntion. So phytium provide this patch to
avoid this issue.

Signed-off-by: Bin Lai <robinlai@tencent.com>
2022-04-08 10:09:19 +08:00
Bin Lai 33d860bf51 irqchip/phytium-2500: make the msi interrupt dispatched to CPUs which in the same socket for kdump
Phytium-2500 CPU have a quirky hardware feature that the msi interrupt
must be handled in the same socket that follow the haredware connection.
So Phytium vendor provide this patch to handle this case for kdump.

Signed-off-by: Bin Lai <robinlai@tencent.com>
2022-04-08 10:09:19 +08:00
Jianping Liu eb0bcbcb8f fix compile error when open CONFIG_ACPI_APEI on arm64
when open CONFIG_ACPI_APEI on arm64, the compile error as below:
drivers/acpi/apei/hest.c: In function ‘hest_parse_ghes_count’:
drivers/acpi/apei/hest.c:146:7: error: ‘boot_cpu_data’ undeclared (first use in this function); did you mean ‘bootmem_data’?
(boot_cpu_data.x86_vendor != X86_VENDOR_AMD ||
^~~~~~~~~~~~~
bootmem_data
drivers/acpi/apei/hest.c:146:7: note: each undeclared identifier is reported only once for each function it appears in
drivers/acpi/apei/hest.c:146:35: error: ‘X86_VENDOR_AMD’ undeclared (first use in this function); did you mean ‘X86_VENDOR_ANY’?
(boot_cpu_data.x86_vendor != X86_VENDOR_AMD ||
^~~~~~~~~~~~~~
X86_VENDOR_ANY
drivers/acpi/apei/hest.c: In function ‘hest_parse_ghes’:
drivers/acpi/apei/hest.c:161:7: error: ‘boot_cpu_data’ undeclared (first use in this function); did you mean ‘bootmem_data’?
boot_cpu_data.x86_vendor == X86_VENDOR_AMD))
^~~~~~~~~~~~~
bootmem_data
drivers/acpi/apei/hest.c:161:35: error: ‘X86_VENDOR_AMD’ undeclared (first use in this function); did you mean ‘X86_VENDOR_ANY’?
boot_cpu_data.x86_vendor == X86_VENDOR_AMD))
^~~~~~~~~~~~~~
X86_VENDOR_ANY
make[3]: *** [scripts/Makefile.build:261: drivers/acpi/apei/hest.o] Error 1
make[2]: *** [scripts/Makefile.build:496: drivers/acpi/apei] Error 2
make[1]: *** [scripts/Makefile.build:496: drivers/acpi] Error 2
make: *** [Makefile:1734: drivers] Error 2
2022-03-22 10:19:41 +08:00
Kairui Song 9f1ee3e270 Update LPFC driver from 12.4 to 12.8
Driver update from:

https://docs.broadcom.com/docs/elx_elx-lpfc-12.8.542.34-1_rhel8u4.src.rpm

Signed-off-by: Kairui Song <kasong@tencent.com>
2022-01-10 16:38:18 +08:00
mengensun 7a2ee8ca8f virtio-net: check copy length in xdp_linearize_page
at swithing from no-xdp-attached to xdp-attached, some ring elem
may be added to vring before we attach xdp prog, thoes ring elem
length is variable according to EWMA

while xdp_linearize_page assume ring elem length was aways shorter
then PAGE_SIZE - VIRTIO_XDP_HEADROOM, EWMA may giving a ring elem
bigger then PAGE_SIZE - VIRTIO_XDP_HEADROOM, which make the memory
dirty after the page allocated by xdp_linearize_page

fix it by checking length before really copy, and dropped the current
frame if checking failed, because length of ring elem which is add to
ring buffer after xdp attached is aways shorter
then PAGE_SIZE - VIRTIO_XDP_HEADROOM so here we dropped frame as most
as vring length.

upstream kernel have not repaired this, got it by code review,so, here
repair this by Conservativly dropped frame but not let the system dump

Signed-off-by: mengensun<mengensun@tencent.com>
Reviewed-by: mungerjiang<mungerjiang@tencent.com>
Reviewed-by: imagedong<imagedong@tencent.com>
2021-12-20 11:46:29 +08:00
mengensun 1d0a3bfff9 virtio-net: support XDP when not more queues
97c2c69e19 support XDP when not more queues
9ce4e3d6d8 use netdev_warn_once to output warn when without enough queues
3dcc1edcbb reduce raw_smp_processor_id() calling in virtnet_xdp_get_sq

[97c2c69e19 desc]
The number of queues implemented by many virtio backends is limited,
especially some machines have a large number of CPUs. In this case, it
is often impossible to allocate a separate queue for
XDP_TX/XDP_REDIRECT, then xdp cannot be loaded to work, even xdp does
not use the XDP_TX/XDP_REDIRECT.

This patch allows XDP_TX/XDP_REDIRECT to run by reuse the existing SQ
with __netif_tx_lock() hold when there are not enough queues.

[9ce4e3d6d8 disc]
This warning is output when virtnet does not have enough queues, but it
only needs to be printed once to inform the user of this situation. It
is not necessary to print it every time. If the user loads xdp
frequently, this log appears too much.

[3dcc1edcbb desc]
smp_processor_id()/raw* will be called once each when not
more queues in virtnet_xdp_get_sq() which is called in
non-preemptible context, so it's safe to call the function
smp_processor_id() once.

Signed-off-by: Li RongQing <lirongqing@baidu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Reviewed-by: Dust Li <dust.li@linux.alibaba.com>
2021-12-20 11:46:29 +08:00
markwhwu a518984de2 virtio_net: disable cb aggressively
upstream commit:a7766ef18b33674fa164e2e2916cef16d4e17f43

    There are currently two cases where we poll TX vq not in response to a
    callback: start xmit and rx napi.  We currently do this with callbacks
    enabled which can cause extra interrupts from the card.  Used not to be
    a big issue as we run with interrupts disabled but that is no longer the
    case, and in some cases the rate of spurious interrupts is so high
    linux detects this and actually kills the interrupt.

    Fix up by disabling the callbacks before polling the tx vq.

    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2021-10-29 08:50:28 +00:00
markwhwu eb4eba5e09 virtio_net: move txq wakeups under tx q lock
upstream commit:22bc63c58e876cc359d0b1566dee3db8ecc16722

    We currently check num_free outside tx q lock
    which is unsafe: new packets can arrive meanwhile
    and there won't be space in the queue.
    Thus a spurious queue wakeup causing overhead
    and even packet drops.

    Move the check under the lock to fix that.

    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2021-10-29 08:50:28 +00:00
markwhwu 6ea1ce5294 virtio_net: move tx vq operation under tx queue lock
upstream commit: 5a2f966d0f3fa0ef6dada7ab9eda74cacee96b8a

    It's unsafe to operate a vq from multiple threads.
    Unfortunately this is exactly what we do when invoking
    clean tx poll from rx napi.
    Same happens with napi-tx even without the
    opportunistic cleaning from the receive interrupt: that races
    with processing the vq in start_xmit.

    As a fix move everything that deals with the vq to under tx lock.

    Fixes: b92f1e6751a6 ("virtio-net: transmit napi")
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2021-10-29 08:50:28 +00:00
markwhwu efa6c27cf1 virtio_net: Remove BUG() to avoid machine dead
upstream commit:85eb1389458d134bdb75dad502cc026c3753a619

    We should not directly BUG() when there is hdr error, it is
    better to output a print when such error happens. Currently,
    the caller of xmit_skb() already did it.

    Signed-off-by: Xianting Tian <xianting.tian@linux.alibaba.com>
    Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
2021-10-29 08:50:28 +00:00
markwhwu 109f6104d2 virtio_net: check virtqueue_add_sgs() return value
upstream commit: 222722bc6ebfabf5d54467070f05cf9c0a55ea8c

    As virtqueue_add_sgs() can fail, we should check the return value.

    Addresses-Coverity-ID: 1464439 ("Unchecked return value")
    Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
2021-10-29 08:50:28 +00:00
markwhwu 0ff3e24928 virtio_net: disable napi_tx by default
NAPI-TX causes high hi and si cpu usage and a regression of
18% when perfoming wrk http benchmark.Also,NAPI-TX can be enabled by:
    ifconfig eth0 down
    ethtool -C eth0 tx-frames 1
    ifconfig eth0 up

Signed-off-by: Munger Jiang <mungerjiang@tencent.com>
2021-10-29 08:50:28 +00:00
Fuhai Wang 6a0f0233f8 irqchip: phytium2500: fixed interrupts are concentrated in one cpu 2021-10-19 08:40:52 +00:00
Kaixu Xia c5d5d77ee8 EDAC/amd64: Drop some family checks for newer systems
commit dcd01394ce7cd7d25bb15c81ad2e804d8090611f upstream

In general, "pvt->umc != NULL" is used to check if the system is Family
17h+. However, there are a few places that are using direct family
checks.

Replace the remaining family checks with a check for "pvt->umc != NULL".

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20200110015651.14887-6-Yazen.Ghannam@amd.com
2021-09-23 19:21:36 +08:00
Yazen Ghannam 2841a3ef53 EDAC/mce_amd: Always load on SMCA systems
MCA error decoding on SMCA systems is not dependent on family. Return
success early if the system supports the SMCA feature.

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20200110015651.14887-3-Yazen.Ghannam@amd.com
2021-09-23 19:21:33 +08:00
Yazen Ghannam 2035f3ff5c x86/MCE/AMD, EDAC/mce_amd: Add new Load Store unit McaType
Add support for a new version of the Load Store unit bank type as
indicated by its McaType value, which will be present in future SMCA
systems.

Add the new (HWID, MCATYPE) tuple. Reuse the same name, since this is
logically the same to the user.

Also, add the new error descriptions to edac_mce_amd.

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20200110015651.14887-2-Yazen.Ghannam@amd.com
2021-09-23 19:21:30 +08:00
Kaixu Xia b405c696bc EDAC/amd64: Add family ops for Family 19h Models 00h-0Fh
commit 2eb61c91c3e2738218e55f2eaf7e78a4435c233d upstream

Add family ops to support AMD Family 19h systems. Existing Family 17h
functions can be used. Also, add Family 19h to the list of families to
automatically load the module.

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20200110015651.14887-5-Yazen.Ghannam@amd.com
2021-09-23 19:21:21 +08:00
Max Gurtovoy 26ed31d84e nvme-pci: initialize tagset numa value to the value of the ctrl
upstream: d4ec47f120537c75184c3dc939d3b2e1bcc8b260

Both admin's and drive's tagsets should be set according the numa node
of the controller.

Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2021-08-18 07:22:38 +00:00
Max Gurtovoy 5584b66319 nvme-pci: override the value of the controller's numa node
upsteam: 635333e400e2e678258ea45232415cdadadd7818

Set the node value according to the PCI device numa node.

Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2021-08-18 07:22:38 +00:00
Fuhai Wang 947b472829 scsi: smartpqi: compat for tk4
Signed-off-by: Fuhai Wang <fuhaiwang@tencent.com>
2021-08-17 06:30:07 +00:00
Fuhai Wang ff579791c7 scsi: smartpqi: update driver version to v2.1.8-040
url: https://download.adaptec.com/raid/aac/linux/smartpqi_src_v2.1.8-040.tgz

Signed-off-by: Fuhai Wang <fuhaiwang@tencent.com>
2021-08-17 06:30:07 +00:00
Fuhai Wang f454797b67 ampere/arm64: Work around Ampere Altra erratum #82288 PCIE_65
Altra's PCIe controller may generate incorrect addresses when receiving
writes from the CPU with a discontiguous set of byte enables. Attempt to
work around this by handing out Device-nGnRE maps instead of Normal
Non-cacheable maps for PCIe memory areas.

Signed-off-by: D Scott Phillips <scott@os.amperecomputing.com>
2021-07-12 08:57:22 +00:00
Fuhai Wang 1e236c7732 ampere/led: Add Altra LED driver
Add Altra LED driver to control NVME LED.

This driver support control LED via SPCI interface on Altra system.
Currently, it is 2-LEDs system(Activity LED, Status LED). Activity
LED is completely controlled by hardware. Status LED is controlled
by this driver.
There are 4 stages of Status LED:
    - ON
    - OFF
    - Locate(blink at 1Hz)
    - Rebuild(blink at 4Hz)

Example:
To On, Off the LED on slot 9:
    1. Write the seg:bus_number corresponding to LED on slot 9 to
       altra:led
         echo 000b:03 > /sys/class/leds/altra:led/address
    2. Write 1 to brightness attr to ON, 0 to brightness attr to OFF
         echo 1 > /sys/class/leds/altra:led/brightness
         echo 0 > /sys/class/leds/altra:led/brightness
To blink the LED on slot 9:
    1. Write the seg:bus_number corresponding to LED on slot 9 to
       altra:led
         echo 000b:03 > /sys/class/leds/altra:led/address
    2. Write 1 to blink attr to select Locate(blink 1Hz), or 4 to
       blink attr to select Rebuild(blink 4Hz)
         echo 1 > /sys/class/leds/altra:led/blink
         echo 4 > /sys/class/leds/altra:led/blink
    3. Write 1 to shot attr to execute blink
         echo 1 > /sys/class/leds/altra:led/shot

cherry-pick from: AmpereComputing/ampere-centos-kernel@28c026a

Signed-off-by: Dung Cao <dcao@amperecomputing.com>
2021-07-12 08:57:22 +00:00
Fuhai Wang 3a8a503bd2 ampere/i2c: designware: Issue abort if the bus got stuck during a transfer
When the master tries to send data to the slave that has gone offline, the
transmission gets stuck. Even when a slave returns back online, the bus
doesn't return to the normal.

This patch works around the issue by issueing abort if master activity
bit is set and then waits for a sometime that to go through. After this
the bus seem to get back operational.

Signed-off-by: Ilkka Koskinen <ilkka@os.amperecomputing.com>
2021-07-12 08:57:22 +00:00
denisecheng 320a3efd01 kabi: reserve space for kabi
Signed-off-by: denisecheng <denisecheng@tencent.com>
Signed-off-by: denisecheng <denisecheng@tencent.com>
2021-06-23 07:24:18 +00:00
denisecheng 78356abba2 kabi: disable USB_STORAGE module namespace
Signed-off-by: denisecheng <denisecheng@tencent.com>
2021-06-23 07:24:18 +00:00
Quentin Perret c6b1b2242a Revert "fdt: Properly handle "no-map" field in the memory region"
This reverts commit fb326c6ce0dcbb6273202c6e012759754ec8538d.
It is not really a fix, and the backport misses dependencies, which
breaks existing platforms.

Reported-by: Alexandre TORGUE <alexandre.torgue@foss.st.com>
Signed-off-by: Quentin Perret <qperret@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-20 16:08:02 +08:00
Quentin Perret b993bc9e23 Revert "of/fdt: Make sure no-map does not remove already reserved regions"
This reverts commit 3cbd3038c9155038020560729cde50588311105d.
It is not really a fix, and the backport misses dependencies, which
breaks existing platforms.

Reported-by: Alexandre TORGUE <alexandre.torgue@foss.st.com>
Signed-off-by: Quentin Perret <qperret@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-20 16:08:02 +08:00
Lv Yunlong 7bf4a0f55e RDMA/bnxt_re: Fix a double free in bnxt_qplib_alloc_res
[ Upstream commit 34b39efa5ae82fc0ad0acc27653c12a56328dbbe ]

In bnxt_qplib_alloc_res, it calls bnxt_qplib_alloc_dpi_tbl().  Inside
bnxt_qplib_alloc_dpi_tbl, dpit->dbr_bar_reg_iomem is freed via
pci_iounmap() in unmap_io error branch. After the callee returns err code,
bnxt_qplib_alloc_res calls
bnxt_qplib_free_res()->bnxt_qplib_free_dpi_tbl() in the fail branch. Then
dpit->dbr_bar_reg_iomem is freed in the second time by pci_iounmap().

My patch set dpit->dbr_bar_reg_iomem to NULL after it is freed by
pci_iounmap() in the first time, to avoid the double free.

Fixes: 1ac5a4047975 ("RDMA/bnxt_re: Add bnxt_re RoCE driver")
Link: https://lore.kernel.org/r/20210426140614.6722-1-lyl2019@mail.ustc.edu.cn
Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Acked-by: Devesh Sharma <devesh.sharma@broadcom.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-05-20 16:08:01 +08:00
Lv Yunlong 16f15ab203 RDMA/siw: Fix a use after free in siw_alloc_mr
[ Upstream commit 3093ee182f01689b89e9f8797b321603e5de4f63 ]

Our code analyzer reported a UAF.

In siw_alloc_mr(), it calls siw_mr_add_mem(mr,..). In the implementation of
siw_mr_add_mem(), mem is assigned to mr->mem and then mem is freed via
kfree(mem) if xa_alloc_cyclic() failed. Here, mr->mem still point to a
freed object. After, the execution continue up to the err_out branch of
siw_alloc_mr, and the freed mr->mem is used in siw_mr_drop_mem(mr).

My patch moves "mr->mem = mem" behind the if (xa_alloc_cyclic(..)<0) {}
section, to avoid the uaf.

Fixes: 2251334dcac9 ("rdma/siw: application buffer management")
Link: https://lore.kernel.org/r/20210426011647.3561-1-lyl2019@mail.ustc.edu.cn
Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
Reviewed-by: Bernard Metzler <bmt@zurich.ihm.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-05-20 16:08:01 +08:00
Lv Yunlong 003414af91 net:emac/emac-mac: Fix a use after free in emac_mac_tx_buf_send
[ Upstream commit 6d72e7c767acbbdd44ebc7d89c6690b405b32b57 ]

In emac_mac_tx_buf_send, it calls emac_tx_fill_tpd(..,skb,..).
If some error happens in emac_tx_fill_tpd(), the skb will be freed via
dev_kfree_skb(skb) in error branch of emac_tx_fill_tpd().
But the freed skb is still used via skb->len by netdev_sent_queue(,skb->len).

As i observed that emac_tx_fill_tpd() haven't modified the value of skb->len,
thus my patch assigns skb->len to 'len' before the possible free and
use 'len' instead of skb->len later.

Fixes: b9b17debc69d2 ("net: emac: emac gigabit ethernet controller driver")
Signed-off-by: Lv Yunlong <lyl2019@mail.ustc.edu.cn>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-05-20 16:08:00 +08:00
Phillip Potter 3a6272e360 net: geneve: modify IP header check in geneve6_xmit_skb and geneve_xmit_skb
[ Upstream commit d13f048dd40e8577260cd43faea8ec9b77520197 ]

Modify the header size check in geneve6_xmit_skb and geneve_xmit_skb
to use pskb_inet_may_pull rather than pskb_network_may_pull. This fixes
two kernel selftest failures introduced by the commit introducing the
checks:
IPv4 over geneve6: PMTU exceptions
IPv4 over geneve6: PMTU exceptions - nexthop objects

It does this by correctly accounting for the fact that IPv4 packets may
transit over geneve IPv6 tunnels (and vice versa), and still fixes the
uninit-value bug fixed by the original commit.

Reported-by: kernel test robot <oliver.sang@intel.com>
Fixes: 6628ddfec758 ("net: geneve: check skb is large enough for IPv4/IPv6 header")
Suggested-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Acked-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-05-20 16:08:00 +08:00
Shuah Khan 8e9af5a4fb ath10k: Fix ath10k_wmi_tlv_op_pull_peer_stats_info() unlock without lock
[ Upstream commit eaaf52e4b866f265eb791897d622961293fd48c1 ]

ath10k_wmi_tlv_op_pull_peer_stats_info() could try to unlock RCU lock
winthout locking it first when peer reason doesn't match the valid
cases for this function.

Add a default case to return without unlocking.

Fixes: 09078368d516 ("ath10k: hold RCU lock when calling ieee80211_find_sta_by_ifaddr()")
Reported-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210406230228.31301-1-skhan@linuxfoundation.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-05-20 16:08:00 +08:00
Toke Høiland-Jørgensen f9138fe298 ath9k: Fix error check in ath9k_hw_read_revisions() for PCI devices
[ Upstream commit 7dd9a40fd6e0d0f1fd8e1931c007e080801dfdce ]

When the error check in ath9k_hw_read_revisions() was added, it checked for
-EIO which is what ath9k_regread() in the ath9k_htc driver uses. However,
for plain ath9k, the register read function uses ioread32(), which just
returns -1 on error. So if such a read fails, it still gets passed through
and ends up as a weird mac revision in the log output.

Fix this by changing ath9k_regread() to return -1 on error like ioread32()
does, and fix the error check to look for that instead of -EIO.

Fixes: 2f90c7e5d094 ("ath9k: Check for errors when reading SREV register")
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210326180819.142480-1-toke@redhat.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-05-20 16:08:00 +08:00
Martin Schiller 6cb7bdd097 net: phy: intel-xway: enable integrated led functions
[ Upstream commit 357a07c26697a770d39d28b6b111f978deb4017d ]

The Intel xway phys offer the possibility to deactivate the integrated
LED function and to control the LEDs manually.
If this was set by the bootloader, it must be ensured that the
integrated LED function is enabled for all LEDs when loading the driver.

Before commit 6e2d85ec0559 ("net: phy: Stop with excessive soft reset")
the LEDs were enabled by a soft-reset of the PHY (using
genphy_soft_reset). Initialize the XWAY_MDIO_LED with it's default
value (which is applied during a soft reset) instead of adding back
the soft reset. This brings back the default LED configuration while
still preventing an excessive amount of soft resets.

Fixes: 6e2d85ec0559 ("net: phy: Stop with excessive soft reset")
Signed-off-by: Martin Schiller <ms@dev.tdt.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-05-20 16:08:00 +08:00
Yoshihiro Shimoda 46069bcfe1 net: renesas: ravb: Fix a stuck issue when a lot of frames are received
[ Upstream commit 5718458b092bf6bf4482c5df32affba3c3259517 ]

When a lot of frames were received in the short term, the driver
caused a stuck of receiving until a new frame was received. For example,
the following command from other device could cause this issue.

    $ sudo ping -f -l 1000 -c 1000 <this driver's ipaddress>

The previous code always cleared the interrupt flag of RX but checks
the interrupt flags in ravb_poll(). So, ravb_poll() could not call
ravb_rx() in the next time until a new RX frame was received if
ravb_rx() returned true. To fix the issue, always calls ravb_rx()
regardless the interrupt flags condition.

Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-05-20 16:08:00 +08:00
Colin Ian King af5d04baaa net: davinci_emac: Fix incorrect masking of tx and rx error channel
[ Upstream commit d83b8aa5207d81f9f6daec9888390f079cc5db3f ]

The bit-masks used for the TXERRCH and RXERRCH (tx and rx error channels)
are incorrect and always lead to a zero result. The mask values are
currently the incorrect post-right shifted values, fix this by setting
them to the currect values.

(I double checked these against the TMS320TCI6482 data sheet, section
5.30, page 127 to ensure I had the correct mask values for the TXERRCH
and RXERRCH fields in the MACSTATUS register).

Addresses-Coverity: ("Operands don't affect result")
Fixes: a6286ee630f6 ("net: Add TI DaVinci EMAC driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-05-20 16:07:59 +08:00
Sindhu Devale 411c5dad8d RDMA/i40iw: Fix error unwinding when i40iw_hmc_sd_one fails
[ Upstream commit 783a11bf2400e5d5c42a943c3083dc0330751842 ]

When i40iw_hmc_sd_one fails, chunk is freed without the deletion of chunk
entry in the PBLE info list.

Fix it by adding the chunk entry to the PBLE info list only after
successful addition of SD in i40iw_hmc_sd_one.

This fixes a static checker warning reported here:
  https://lore.kernel.org/linux-rdma/YHV4CFXzqTm23AOZ@mwanda/

Fixes: 9715830157be ("i40iw: add pble resource files")
Link: https://lore.kernel.org/r/20210416002104.323-1-shiraz.saleem@intel.com
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sindhu Devale <sindhu.devale@intel.com>
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-05-20 16:07:59 +08:00