1. 21 7月, 2019 7 次提交
    • H
      irqchip/gic-v3-its: Fix command queue pointer comparison bug · ff232a47
      Heyi Guo 提交于
      [ Upstream commit a050fa5476d418fc16b25abe168b3d38ba11e13c ]
      
      When we run several VMs with PCI passthrough and GICv4 enabled, not
      pinning vCPUs, we will occasionally see below warnings in dmesg:
      
      ITS queue timeout (65440 65504 480)
      ITS cmd its_build_vmovp_cmd failed
      
      The reason for the above issue is that in BUILD_SINGLE_CMD_FUNC:
      1. Post the write command.
      2. Release the lock.
      3. Start to read GITS_CREADR to get the reader pointer.
      4. Compare the reader pointer to the target pointer.
      5. If reader pointer does not reach the target, sleep 1us and continue
      to try.
      
      If we have several processors running the above concurrently, other
      CPUs will post write commands while the 1st CPU is waiting the
      completion. So we may have below issue:
      
      phase 1:
      ---rd_idx-----from_idx-----to_idx--0---------
      
      wait 1us:
      
      phase 2:
      --------------from_idx-----to_idx--0-rd_idx--
      
      That is the rd_idx may fly ahead of to_idx, and if in case to_idx is
      near the wrap point, rd_idx will wrap around. So the below condition
      will not be met even after 1s:
      
      if (from_idx < to_idx && rd_idx >= to_idx)
      
      There is another theoretical issue. For a slow and busy ITS, the
      initial rd_idx may fall behind from_idx a lot, just as below:
      
      ---rd_idx---0--from_idx-----to_idx-----------
      
      This will cause the wait function exit too early.
      
      Actually, it does not make much sense to use from_idx to judge if
      to_idx is wrapped, but we need a initial rd_idx when lock is still
      acquired, and it can be used to judge whether to_idx is wrapped and
      the current rd_idx is wrapped.
      
      We switch to a method of calculating the delta of two adjacent reads
      and accumulating it to get the sum, so that we can get the real rd_idx
      from the wrapped value even when the queue is almost full.
      
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Signed-off-by: NHeyi Guo <guoheyi@huawei.com>
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Signed-off-by: NSasha Levin <sashal@kernel.org>
      ff232a47
    • S
      firmware: improve LSM/IMA security behaviour · 244db544
      Sven Van Asbroeck 提交于
      commit 2472d64af2d3561954e2f05365a67692bb852f2a upstream.
      
      The firmware loader queries if LSM/IMA permits it to load firmware
      via the sysfs fallback. Unfortunately, the code does the opposite:
      it expressly permits sysfs fw loading if security_kernel_load_data(
      LOADING_FIRMWARE) returns -EACCES. This happens because a
      zero-on-success return value is cast to a bool that's true on success.
      
      Fix the return value handling so we get the correct behaviour.
      
      Fixes: 6e852651 ("firmware: add call to LSM hook before firmware sysfs fallback")
      Cc: Stable <stable@vger.kernel.org>
      Cc: Mimi Zohar <zohar@linux.vnet.ibm.com>
      Cc: Kees Cook <keescook@chromium.org>
      To: Luis Chamberlain <mcgrof@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "Rafael J. Wysocki" <rafael@kernel.org>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: NSven Van Asbroeck <TheSven73@gmail.com>
      Reviewed-by: NMimi Zohar <zohar@linux.ibm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      244db544
    • J
      drivers: base: cacheinfo: Ensure cpu hotplug work is done before Intel RDT · 079d7f16
      James Morse 提交于
      commit 83b44fe343b5abfcb1b2261289bd0cfcfcfd60a8 upstream.
      
      The cacheinfo structures are alloced/freed by cpu online/offline
      callbacks. Originally these were only used by sysfs to expose the
      cache topology to user space. Without any in-kernel dependencies
      CPUHP_AP_ONLINE_DYN was an appropriate choice.
      
      resctrl has started using these structures to identify CPUs that
      share a cache. It updates its 'domain' structures from cpu
      online/offline callbacks. These depend on the cacheinfo structures
      (resctrl_online_cpu()->domain_add_cpu()->get_cache_id()->
       get_cpu_cacheinfo()).
      These also run as CPUHP_AP_ONLINE_DYN.
      
      Now that there is an in-kernel dependency, move the cacheinfo
      work earlier so we know its done before resctrl's CPUHP_AP_ONLINE_DYN
      work runs.
      
      Fixes: 2264d9c7 ("x86/intel_rdt: Build structures for each resource based on cache topology")
      Cc: <stable@vger.kernel.org>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Cc: Reinette Chatre <reinette.chatre@intel.com>
      Signed-off-by: NJames Morse <james.morse@arm.com>
      Link: https://lore.kernel.org/r/20190624173656.202407-1-james.morse@arm.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      079d7f16
    • M
      nilfs2: do not use unexported cpu_to_le32()/le32_to_cpu() in uapi header · 68048dce
      Masahiro Yamada 提交于
      commit c32cc30c0544f13982ee0185d55f4910319b1a79 upstream.
      
      cpu_to_le32/le32_to_cpu is defined in include/linux/byteorder/generic.h,
      which is not exported to user-space.
      
      UAPI headers must use the ones prefixed with double-underscore.
      
      Detected by compile-testing exported headers:
      
        include/linux/nilfs2_ondisk.h: In function `nilfs_checkpoint_set_snapshot':
        include/linux/nilfs2_ondisk.h:536:17: error: implicit declaration of function `cpu_to_le32' [-Werror=implicit-function-declaration]
          cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) |  \
                         ^
        include/linux/nilfs2_ondisk.h:552:1: note: in expansion of macro `NILFS_CHECKPOINT_FNS'
         NILFS_CHECKPOINT_FNS(SNAPSHOT, snapshot)
         ^~~~~~~~~~~~~~~~~~~~
        include/linux/nilfs2_ondisk.h:536:29: error: implicit declaration of function `le32_to_cpu' [-Werror=implicit-function-declaration]
          cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) |  \
                                     ^
        include/linux/nilfs2_ondisk.h:552:1: note: in expansion of macro `NILFS_CHECKPOINT_FNS'
         NILFS_CHECKPOINT_FNS(SNAPSHOT, snapshot)
         ^~~~~~~~~~~~~~~~~~~~
        include/linux/nilfs2_ondisk.h: In function `nilfs_segment_usage_set_clean':
        include/linux/nilfs2_ondisk.h:622:19: error: implicit declaration of function `cpu_to_le64' [-Werror=implicit-function-declaration]
          su->su_lastmod = cpu_to_le64(0);
                           ^~~~~~~~~~~
      
      Link: http://lkml.kernel.org/r/20190605053006.14332-1-yamada.masahiro@socionext.com
      Fixes: e63e88bc ("nilfs2: move ioctl interface and disk layout to uapi separately")
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: NRyusuke Konishi <konishi.ryusuke@gmail.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Greg KH <gregkh@linuxfoundation.org>
      Cc: Joe Perches <joe@perches.com>
      Cc: <stable@vger.kernel.org>	[4.9+]
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      68048dce
    • C
      Input: synaptics - enable SMBUS on T480 thinkpad trackpad · 86859ef1
      Cole Rogers 提交于
      commit abbe3acd7d72ab4633ade6bd24e8306b67e0add3 upstream.
      
      Thinkpad t480 laptops had some touchpad features disabled, resulting in the
      loss of pinch to activities in GNOME, on wayland, and other touch gestures
      being slower. This patch adds the touchpad of the t480 to the smbus_pnp_ids
      whitelist to enable the extra features. In my testing this does not break
      suspend (on fedora, with wayland, and GNOME, using the rc-6 kernel), while
      also fixing the feature on a T480.
      Signed-off-by: NCole Rogers <colerogers@disroot.org>
      Acked-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      86859ef1
    • K
      e1000e: start network tx queue only when link is up · 438a3dc6
      Konstantin Khlebnikov 提交于
      commit d17ba0f616a08f597d9348c372d89b8c0405ccf3 upstream.
      
      Driver does not want to keep packets in Tx queue when link is lost.
      But present code only reset NIC to flush them, but does not prevent
      queuing new packets. Moreover reset sequence itself could generate
      new packets via netconsole and NIC falls into endless reset loop.
      
      This patch wakes Tx queue only when NIC is ready to send packets.
      
      This is proper fix for problem addressed by commit 0f9e980bf5ee
      ("e1000e: fix cyclic resets at link up with active tx").
      Signed-off-by: NKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Suggested-by: NAlexander Duyck <alexander.duyck@gmail.com>
      Tested-by: NJoseph Yasi <joe.yasi@gmail.com>
      Tested-by: NAaron Brown <aaron.f.brown@intel.com>
      Tested-by: NOleksandr Natalenko <oleksandr@redhat.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      438a3dc6
    • K
      Revert "e1000e: fix cyclic resets at link up with active tx" · 8020568b
      Konstantin Khlebnikov 提交于
      commit caff422ea81e144842bc44bab408d85ac449377b upstream.
      
      This reverts commit 0f9e980bf5ee1a97e2e401c846b2af989eb21c61.
      
      That change cased false-positive warning about hardware hang:
      
      e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx
      IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
      e1000e 0000:00:1f.6 eth0: Detected Hardware Unit Hang:
         TDH                  <0>
         TDT                  <1>
         next_to_use          <1>
         next_to_clean        <0>
      buffer_info[next_to_clean]:
         time_stamp           <fffba7a7>
         next_to_watch        <0>
         jiffies              <fffbb140>
         next_to_watch.status <0>
      MAC Status             <40080080>
      PHY Status             <7949>
      PHY 1000BASE-T Status  <0>
      PHY Extended Status    <3000>
      PCI Status             <10>
      e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: Rx/Tx
      
      Besides warning everything works fine.
      Original issue will be fixed property in following patch.
      Signed-off-by: NKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Reported-by: NJoseph Yasi <joe.yasi@gmail.com>
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=203175Tested-by: NJoseph Yasi <joe.yasi@gmail.com>
      Tested-by: NAaron Brown <aaron.f.brown@intel.com>
      Tested-by: NOleksandr Natalenko <oleksandr@redhat.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8020568b
  2. 14 7月, 2019 33 次提交