1. 21 11月, 2022 30 次提交
  2. 18 11月, 2022 10 次提交
    • O
      !252 hulk backport patchs for ascend feature · f3ff7ed6
      openeuler-ci-bot 提交于
      Merge Pull Request from: @zhangjian210 
       
      This patchset aims to backport patches from hulk about Ascend, It includes some patches as follow:
      
      Sharepool Bugfix:
      1 clean static check warning
      2 Fix add group failed with errno 28
      3 Fix some pages will not be freed when alloc some pages using sharepool, 
        and return error on the first allocation failed whithout releasing the pages 
        allocated before.
      4 Fixing for can't alloc memory from CDM node using CPU-set
      5 Fixing for since the current condition ignores the cpuset enforcement by adding
        __GFP_THISNODEi to the gfp_mask, this will result in allocations that    
        specify __GFP_THISNODE and non-cdm nodes not subject to cpuset restrictions.
      
      Gic Bugfix:
      1 Fixing for when enable CONFIG_ASCEND_INIT_ALL_GICR, the cpu num is too large for
        its_inc_lpi_count()
      
      Boot parameter:
      1 Add ascend_enable_all parameter for enabling all ascend feature
      
      Export symbols:
      pm_autosleep_set_state
      free_workqueue_attrs
      alloc_workqueue_attrs
      apply_workqueue_attrs
      oom_type_notifier_call
      map_kernel_range
      __get_vm_area_caller
      __vmalloc_node_range 
       
      Link:https://gitee.com/openeuler/kernel/pulls/252 
      Reviewed-by: Zheng Zengkai <zhengzengkai@huawei.com> 
      Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com> 
      f3ff7ed6
    • O
      !239 Intel: Enable default kernel config for Intel Emmitsburg pinctrl · 0fd6bc1b
      openeuler-ci-bot 提交于
      Merge Pull Request from: @allen-shi 
       
      This patch is to enable Intel Emmitsburg pinctrl and GPIO driver for default kernel config.
      
      This driver provides an interface that allows configuring of Intel Emmitsburg pins and using them as GPIOs.
      
       **Intel Kernel Issue** 
      [#I610P3](https://gitee.com/openeuler/intel-kernel/issues/I610P3)
      
       **Test** 
      Build and boot kernel with this patch and check /proc/config.gz after boot.
      
       **Known Issue** 
      N/A
      
       **Default Config Change** 
      See the patch. 
       
      Link:https://gitee.com/openeuler/kernel/pulls/239 
      Reviewed-by: Zheng Zengkai <zhengzengkai@huawei.com> 
      Reviewed-by: Liu Chao <liuchao173@huawei.com> 
      Signed-off-by: Zheng Zengkai <zhengzengkai@huawei.com> 
      0fd6bc1b
    • A
      Enable Intel Emmitsburg pinctrl for default config · a32d3483
      Aichun Shi 提交于
      Intel inclusion
      category: feature
      bugzilla: https://gitee.com/openeuler/intel-kernel/issues/I610P3
      CVE: NA
      
      Intel-SIG: openeuler_defconfig: Enable configs for Intel Emmitsburg pinctrl
      
      --------------------------------------------
      
      Enable necessary kernel configs for Intel Emmitsburg pinctrl in
      openeuler_defconfig.
      Signed-off-by: NAichun Shi <aichun.shi@intel.com>
      a32d3483
    • Q
      btrfs: raid56: don't trust any cached sector in __raid56_parity_recover() · 72eae22a
      Qu Wenruo 提交于
      stable inclusion
      from stable-v5.10.137
      commit fb4e220e1b2bbe6b983ebe78fed5eae6ce31c1c2
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I60PLB
      
      Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=fb4e220e1b2bbe6b983ebe78fed5eae6ce31c1c2
      
      --------------------------------
      
      commit f6065f8e upstream.
      
      [BUG]
      There is a small workload which will always fail with recent kernel:
      (A simplified version from btrfs/125 test case)
      
        mkfs.btrfs -f -m raid5 -d raid5 -b 1G $dev1 $dev2 $dev3
        mount $dev1 $mnt
        xfs_io -f -c "pwrite -S 0xee 0 1M" $mnt/file1
        sync
        umount $mnt
        btrfs dev scan -u $dev3
        mount -o degraded $dev1 $mnt
        xfs_io -f -c "pwrite -S 0xff 0 128M" $mnt/file2
        umount $mnt
        btrfs dev scan
        mount $dev1 $mnt
        btrfs balance start --full-balance $mnt
        umount $mnt
      
      The failure is always failed to read some tree blocks:
      
        BTRFS info (device dm-4): relocating block group 217710592 flags data|raid5
        BTRFS error (device dm-4): parent transid verify failed on 38993920 wanted 9 found 7
        BTRFS error (device dm-4): parent transid verify failed on 38993920 wanted 9 found 7
        ...
      
      [CAUSE]
      With the recently added debug output, we can see all RAID56 operations
      related to full stripe 38928384:
      
        56.1183: raid56_read_partial: full_stripe=38928384 devid=2 type=DATA1 offset=0 opf=0x0 physical=9502720 len=65536
        56.1185: raid56_read_partial: full_stripe=38928384 devid=3 type=DATA2 offset=16384 opf=0x0 physical=9519104 len=16384
        56.1185: raid56_read_partial: full_stripe=38928384 devid=3 type=DATA2 offset=49152 opf=0x0 physical=9551872 len=16384
        56.1187: raid56_write_stripe: full_stripe=38928384 devid=3 type=DATA2 offset=0 opf=0x1 physical=9502720 len=16384
        56.1188: raid56_write_stripe: full_stripe=38928384 devid=3 type=DATA2 offset=32768 opf=0x1 physical=9535488 len=16384
        56.1188: raid56_write_stripe: full_stripe=38928384 devid=1 type=PQ1 offset=0 opf=0x1 physical=30474240 len=16384
        56.1189: raid56_write_stripe: full_stripe=38928384 devid=1 type=PQ1 offset=32768 opf=0x1 physical=30507008 len=16384
        56.1218: raid56_write_stripe: full_stripe=38928384 devid=3 type=DATA2 offset=49152 opf=0x1 physical=9551872 len=16384
        56.1219: raid56_write_stripe: full_stripe=38928384 devid=1 type=PQ1 offset=49152 opf=0x1 physical=30523392 len=16384
        56.2721: raid56_parity_recover: full stripe=38928384 eb=39010304 mirror=2
        56.2723: raid56_parity_recover: full stripe=38928384 eb=39010304 mirror=2
        56.2724: raid56_parity_recover: full stripe=38928384 eb=39010304 mirror=2
      
      Before we enter raid56_parity_recover(), we have triggered some metadata
      write for the full stripe 38928384, this leads to us to read all the
      sectors from disk.
      
      Furthermore, btrfs raid56 write will cache its calculated P/Q sectors to
      avoid unnecessary read.
      
      This means, for that full stripe, after any partial write, we will have
      stale data, along with P/Q calculated using that stale data.
      
      Thankfully due to patch "btrfs: only write the sectors in the vertical stripe
      which has data stripes" we haven't submitted all the corrupted P/Q to disk.
      
      When we really need to recover certain range, aka in
      raid56_parity_recover(), we will use the cached rbio, along with its
      cached sectors (the full stripe is all cached).
      
      This explains why we have no event raid56_scrub_read_recover()
      triggered.
      
      Since we have the cached P/Q which is calculated using the stale data,
      the recovered one will just be stale.
      
      In our particular test case, it will always return the same incorrect
      metadata, thus causing the same error message "parent transid verify
      failed on 39010304 wanted 9 found 7" again and again.
      
      [BTRFS DESTRUCTIVE RMW PROBLEM]
      
      Test case btrfs/125 (and above workload) always has its trouble with
      the destructive read-modify-write (RMW) cycle:
      
              0       32K     64K
      Data1:  | Good  | Good  |
      Data2:  | Bad   | Bad   |
      Parity: | Good  | Good  |
      
      In above case, if we trigger any write into Data1, we will use the bad
      data in Data2 to re-generate parity, killing the only chance to recovery
      Data2, thus Data2 is lost forever.
      
      This destructive RMW cycle is not specific to btrfs RAID56, but there
      are some btrfs specific behaviors making the case even worse:
      
      - Btrfs will cache sectors for unrelated vertical stripes.
      
        In above example, if we're only writing into 0~32K range, btrfs will
        still read data range (32K ~ 64K) of Data1, and (64K~128K) of Data2.
        This behavior is to cache sectors for later update.
      
        Incidentally commit d4e28d9b ("btrfs: raid56: make steal_rbio()
        subpage compatible") has a bug which makes RAID56 to never trust the
        cached sectors, thus slightly improve the situation for recovery.
      
        Unfortunately, follow up fix "btrfs: update stripe_sectors::uptodate in
        steal_rbio" will revert the behavior back to the old one.
      
      - Btrfs raid56 partial write will update all P/Q sectors and cache them
      
        This means, even if data at (64K ~ 96K) of Data2 is free space, and
        only (96K ~ 128K) of Data2 is really stale data.
        And we write into that (96K ~ 128K), we will update all the parity
        sectors for the full stripe.
      
        This unnecessary behavior will completely kill the chance of recovery.
      
        Thankfully, an unrelated optimization "btrfs: only write the sectors
        in the vertical stripe which has data stripes" will prevent
        submitting the write bio for untouched vertical sectors.
      
        That optimization will keep the on-disk P/Q untouched for a chance for
        later recovery.
      
      [FIX]
      Although we have no good way to completely fix the destructive RMW
      (unless we go full scrub for each partial write), we can still limit the
      damage.
      
      With patch "btrfs: only write the sectors in the vertical stripe which
      has data stripes" now we won't really submit the P/Q of unrelated
      vertical stripes, so the on-disk P/Q should still be fine.
      
      Now we really need to do is just drop all the cached sectors when doing
      recovery.
      
      By this, we have a chance to read the original P/Q from disk, and have a
      chance to recover the stale data, while still keep the cache to speed up
      regular write path.
      
      In fact, just dropping all the cache for recovery path is good enough to
      allow the test case btrfs/125 along with the small script to pass
      reliably.
      
      The lack of metadata write after the degraded mount, and forced metadata
      COW is saving us this time.
      
      So this patch will fix the behavior by not trust any cache in
      __raid56_parity_recover(), to solve the problem while still keep the
      cache useful.
      
      But please note that this test pass DOES NOT mean we have solved the
      destructive RMW problem, we just do better damage control a little
      better.
      
      Related patches:
      
      - btrfs: only write the sectors in the vertical stripe
      - d4e28d9b ("btrfs: raid56: make steal_rbio() subpage compatible")
      - btrfs: update stripe_sectors::uptodate in steal_rbio
      Acked-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NQu Wenruo <wqu@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      Reviewed-by: NWei Li <liwei391@huawei.com>
      72eae22a
    • Q
      btrfs: only write the sectors in the vertical stripe which has data stripes · 3f783dcd
      Qu Wenruo 提交于
      stable inclusion
      from stable-v5.10.137
      commit 1e1a039f44b7efcef6a4df13c9f105c8daa41be2
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I60PLB
      
      Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=1e1a039f44b7efcef6a4df13c9f105c8daa41be2
      
      --------------------------------
      
      commit bd8f7e62 upstream.
      
      If we have only 8K partial write at the beginning of a full RAID56
      stripe, we will write the following contents:
      
                          0  8K           32K             64K
      Disk 1	(data):     |XX|            |               |
      Disk 2  (data):     |               |               |
      Disk 3  (parity):   |XXXXXXXXXXXXXXX|XXXXXXXXXXXXXXX|
      
      |X| means the sector will be written back to disk.
      
      Note that, although we won't write any sectors from disk 2, but we will
      write the full 64KiB of parity to disk.
      
      This behavior is fine for now, but not for the future (especially for
      RAID56J, as we waste quite some space to journal the unused parity
      stripes).
      
      So here we will also utilize the btrfs_raid_bio::dbitmap, anytime we
      queue a higher level bio into an rbio, we will update rbio::dbitmap to
      indicate which vertical stripes we need to writeback.
      
      And at finish_rmw(), we also check dbitmap to see if we need to write
      any sector in the vertical stripe.
      
      So after the patch, above example will only lead to the following
      writeback pattern:
      
                          0  8K           32K             64K
      Disk 1	(data):     |XX|            |               |
      Disk 2  (data):     |               |               |
      Disk 3  (parity):   |XX|            |               |
      Acked-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NQu Wenruo <wqu@suse.com>
      Signed-off-by: NDavid Sterba <dsterba@suse.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      Reviewed-by: NWei Li <liwei391@huawei.com>
      3f783dcd
    • T
      sched/fair: Fix fault in reweight_entity · e491fe6e
      Tadeusz Struk 提交于
      stable inclusion
      from stable-v5.10.137
      commit 8f317cd888059c59e2fa924bf4b0957cfa53f78e
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I60PLB
      
      Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=8f317cd888059c59e2fa924bf4b0957cfa53f78e
      
      --------------------------------
      
      commit 13765de8 upstream.
      
      Syzbot found a GPF in reweight_entity. This has been bisected to
      commit 4ef0c5c6 ("kernel/sched: Fix sched_fork() access an invalid
      sched_task_group")
      
      There is a race between sched_post_fork() and setpriority(PRIO_PGRP)
      within a thread group that causes a null-ptr-deref in
      reweight_entity() in CFS. The scenario is that the main process spawns
      number of new threads, which then call setpriority(PRIO_PGRP, 0, -20),
      wait, and exit.  For each of the new threads the copy_process() gets
      invoked, which adds the new task_struct and calls sched_post_fork()
      for it.
      
      In the above scenario there is a possibility that
      setpriority(PRIO_PGRP) and set_one_prio() will be called for a thread
      in the group that is just being created by copy_process(), and for
      which the sched_post_fork() has not been executed yet. This will
      trigger a null pointer dereference in reweight_entity(), as it will
      try to access the run queue pointer, which hasn't been set.
      
      Before the mentioned change the cfs_rq pointer for the task  has been
      set in sched_fork(), which is called much earlier in copy_process(),
      before the new task is added to the thread_group.  Now it is done in
      the sched_post_fork(), which is called after that.  To fix the issue
      the remove the update_load param from the update_load param() function
      and call reweight_task() only if the task flag doesn't have the
      TASK_NEW flag set.
      
      Fixes: 4ef0c5c6 ("kernel/sched: Fix sched_fork() access an invalid sched_task_group")
      Reported-by: syzbot+af7a719bc92395ee41b3@syzkaller.appspotmail.com
      Signed-off-by: NTadeusz Struk <tadeusz.struk@linaro.org>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Reviewed-by: NDietmar Eggemann <dietmar.eggemann@arm.com>
      Cc: stable@vger.kernel.org
      Link: https://lkml.kernel.org/r/20220203161846.1160750-1-tadeusz.struk@linaro.orgSigned-off-by: NFedor Pchelkin <pchelkin@ispras.ru>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      Reviewed-by: NWei Li <liwei391@huawei.com>
      e491fe6e
    • J
      net_sched: cls_route: disallow handle of 0 · 66d7622b
      Jamal Hadi Salim 提交于
      stable inclusion
      from stable-v5.10.137
      commit aa318d35bedce767d88648ca3016779f93f1bde5
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I60PLB
      
      Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=aa318d35bedce767d88648ca3016779f93f1bde5
      
      --------------------------------
      
      commit 02799571 upstream.
      
      Follows up on:
      https://lore.kernel.org/all/20220809170518.164662-1-cascardo@canonical.com/
      
      handle of 0 implies from/to of universe realm which is not very
      sensible.
      
      Lets see what this patch will do:
      $sudo tc qdisc add dev $DEV root handle 1:0 prio
      
      //lets manufacture a way to insert handle of 0
      $sudo tc filter add dev $DEV parent 1:0 protocol ip prio 100 \
      route to 0 from 0 classid 1:10 action ok
      
      //gets rejected...
      Error: handle of 0 is not valid.
      We have an error talking to the kernel, -1
      
      //lets create a legit entry..
      sudo tc filter add dev $DEV parent 1:0 protocol ip prio 100 route from 10 \
      classid 1:10 action ok
      
      //what did the kernel insert?
      $sudo tc filter ls dev $DEV parent 1:0
      filter protocol ip pref 100 route chain 0
      filter protocol ip pref 100 route chain 0 fh 0x000a8000 flowid 1:10 from 10
      	action order 1: gact action pass
      	 random type none pass val 0
      	 index 1 ref 1 bind 1
      
      //Lets try to replace that legit entry with a handle of 0
      $ sudo tc filter replace dev $DEV parent 1:0 protocol ip prio 100 \
      handle 0x000a8000 route to 0 from 0 classid 1:10 action drop
      
      Error: Replacing with handle of 0 is invalid.
      We have an error talking to the kernel, -1
      
      And last, lets run Cascardo's POC:
      $ ./poc
      0
      0
      -22
      -22
      -22
      Signed-off-by: NJamal Hadi Salim <jhs@mojatatu.com>
      Acked-by: NStephen Hemminger <stephen@networkplumber.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      Reviewed-by: NWei Li <liwei391@huawei.com>
      66d7622b
    • T
      net/9p: Initialize the iounit field during fid creation · 36dc6265
      Tyler Hicks 提交于
      stable inclusion
      from stable-v5.10.137
      commit 5a2a00b60458214017a5eb8fb78fce723b5e2faf
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I60PLB
      
      Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=5a2a00b60458214017a5eb8fb78fce723b5e2faf
      
      --------------------------------
      
      commit aa7aeee1 upstream.
      
      Ensure that the fid's iounit field is set to zero when a new fid is
      created. Certain 9P operations, such as OPEN and CREATE, allow the
      server to reply with an iounit size which the client code assigns to the
      p9_fid struct shortly after the fid is created by p9_fid_create(). On
      the other hand, an XATTRWALK operation doesn't allow for the server to
      specify an iounit value. The iounit field of the newly allocated p9_fid
      struct remained uninitialized in that case. Depending on allocation
      patterns, the iounit value could have been something reasonable that was
      carried over from previously freed fids or, in the worst case, could
      have been arbitrary values from non-fid related usages of the memory
      location.
      
      The bug was detected in the Windows Subsystem for Linux 2 (WSL2) kernel
      after the uninitialized iounit field resulted in the typical sequence of
      two getxattr(2) syscalls, one to get the size of an xattr and another
      after allocating a sufficiently sized buffer to fit the xattr value, to
      hit an unexpected ERANGE error in the second call to getxattr(2). An
      uninitialized iounit field would sometimes force rsize to be smaller
      than the xattr value size in p9_client_read_once() and the 9P server in
      WSL refused to chunk up the READ on the attr_fid and, instead, returned
      ERANGE to the client. The virtfs server in QEMU seems happy to chunk up
      the READ and this problem goes undetected there.
      
      Link: https://lkml.kernel.org/r/20220710141402.803295-1-tyhicks@linux.microsoft.com
      Fixes: ebf46264 ("fs/9p: Add support user. xattr")
      Cc: stable@vger.kernel.org
      Signed-off-by: NTyler Hicks <tyhicks@linux.microsoft.com>
      Reviewed-by: NChristian Schoenebeck <linux_oss@crudebyte.com>
      Signed-off-by: NDominique Martinet <asmadeus@codewreck.org>
      [tyhicks: Adjusted context due to:
       - Lack of fid refcounting introduced in v5.11 commit 6636b6dc ("9p:
         add refcount to p9_fid struct")
       - Difference in how buffer sizes are specified v5.16 commit
         6e195b0f ("9p: fix a bunch of checkpatch warnings")]
      Signed-off-by: NTyler Hicks <tyhicks@linux.microsoft.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      Reviewed-by: NWei Li <liwei391@huawei.com>
      36dc6265
    • J
      tee: add overflow check in register_shm_helper() · 1513768a
      Jens Wiklander 提交于
      stable inclusion
      from stable-v5.10.137
      commit 578c349570d2a912401963783b36e0ec7a25c053
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I60PLB
      
      Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=578c349570d2a912401963783b36e0ec7a25c053
      
      --------------------------------
      
      commit 573ae4f1 upstream.
      
      With special lengths supplied by user space, register_shm_helper() has
      an integer overflow when calculating the number of pages covered by a
      supplied user space memory region.
      
      This causes internal_get_user_pages_fast() a helper function of
      pin_user_pages_fast() to do a NULL pointer dereference:
      
        Unable to handle kernel NULL pointer dereference at virtual address 0000000000000010
        Modules linked in:
        CPU: 1 PID: 173 Comm: optee_example_a Not tainted 5.19.0 #11
        Hardware name: QEMU QEMU Virtual Machine, BIOS 0.0.0 02/06/2015
        pc : internal_get_user_pages_fast+0x474/0xa80
        Call trace:
         internal_get_user_pages_fast+0x474/0xa80
         pin_user_pages_fast+0x24/0x4c
         register_shm_helper+0x194/0x330
         tee_shm_register_user_buf+0x78/0x120
         tee_ioctl+0xd0/0x11a0
         __arm64_sys_ioctl+0xa8/0xec
         invoke_syscall+0x48/0x114
      
      Fix this by adding an an explicit call to access_ok() in
      tee_shm_register_user_buf() to catch an invalid user space address
      early.
      
      Fixes: 033ddf12 ("tee: add register user memory")
      Cc: stable@vger.kernel.org
      Reported-by: NNimish Mishra <neelam.nimish@gmail.com>
      Reported-by: NAnirban Chakraborty <ch.anirban00727@gmail.com>
      Reported-by: NDebdeep Mukhopadhyay <debdeep.mukhopadhyay@gmail.com>
      Suggested-by: NJerome Forissier <jerome.forissier@linaro.org>
      Signed-off-by: NJens Wiklander <jens.wiklander@linaro.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      Reviewed-by: NWei Li <liwei391@huawei.com>
      1513768a
    • A
      kvm: x86/pmu: Fix the compare function used by the pmu event filter · 4e14dff5
      Aaron Lewis 提交于
      stable inclusion
      from stable-v5.10.137
      commit 98b20e1612e69bf91185cf722a96293a136fe894
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I60PLB
      
      Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=98b20e1612e69bf91185cf722a96293a136fe894
      
      --------------------------------
      
      commit 4ac19ead upstream.
      
      When returning from the compare function the u64 is truncated to an
      int.  This results in a loss of the high nybble[1] in the event select
      and its sign if that nybble is in use.  Switch from using a result that
      can end up being truncated to a result that can only be: 1, 0, -1.
      
      [1] bits 35:32 in the event select register and bits 11:8 in the event
          select.
      
      Fixes: 7ff775ac ("KVM: x86/pmu: Use binary search to check filtered events")
      Signed-off-by: NAaron Lewis <aaronlewis@google.com>
      Reviewed-by: NSean Christopherson <seanjc@google.com>
      Message-Id: <20220517051238.2566934-1-aaronlewis@google.com>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      Reviewed-by: NWei Li <liwei391@huawei.com>
      4e14dff5