1. 15 Sep, 2021 9 commits
    • Jan Beulich's avatar
      swiotlb-xen: drop leftover __ref · 68573c1b
      Jan Beulich authored
      Commit a98f5654 ("xen-swiotlb: split xen_swiotlb_init") should not
      only have added __init to the split off function, but also should have
      dropped __ref from the one left.
      Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      
      Link: https://lore.kernel.org/r/7cd163e1-fe13-270b-384c-2708e8273d34@suse.comSigned-off-by: default avatarJuergen Gross <jgross@suse.com>
      68573c1b
    • Jan Beulich's avatar
      swiotlb-xen: limit init retries · cabb7f89
      Jan Beulich authored
      Due to the use of max(1024, ...) there's no point retrying (and issuing
      bogus log messages) when the number of slabs is already no larger than
      this minimum value.
      Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      
      Link: https://lore.kernel.org/r/984fa426-2b7b-4b77-5ce8-766619575b7f@suse.comSigned-off-by: default avatarJuergen Gross <jgross@suse.com>
      cabb7f89
    • Jan Beulich's avatar
      swiotlb-xen: suppress certain init retries · 79ca5f77
      Jan Beulich authored
      Only on the 2nd of the paths leading to xen_swiotlb_init()'s "error"
      label it is useful to retry the allocation; the first one did already
      iterate through all possible order values.
      Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Link: https://lore.kernel.org/r/56477481-87da-4962-9661-5e1b277efde0@suse.comSigned-off-by: default avatarJuergen Gross <jgross@suse.com>
      79ca5f77
    • Jan Beulich's avatar
      swiotlb-xen: maintain slab count properly · d9a688ad
      Jan Beulich authored
      Generic swiotlb code makes sure to keep the slab count a multiple of the
      number of slabs per segment. Yet even without checking whether any such
      assumption is made elsewhere, it is easy to see that xen_swiotlb_fixup()
      might alter unrelated memory when calling xen_create_contiguous_region()
      for the last segment, when that's not a full one - the function acts on
      full order-N regions, not individual pages.
      
      Align the slab count suitably when halving it for a retry. Add a build
      time check and a runtime one. Replace the no longer useful local
      variable "slabs" by an "order" one calculated just once, outside of the
      loop. Re-use "order" for calculating "dma_bits", and change the type of
      the latter as well as the one of "i" while touching this anyway.
      Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      
      Link: https://lore.kernel.org/r/dc054cb0-bec4-4db0-fc06-c9fc957b6e66@suse.comSigned-off-by: default avatarJuergen Gross <jgross@suse.com>
      d9a688ad
    • Jan Beulich's avatar
      swiotlb-xen: fix late init retry · 4c092c59
      Jan Beulich authored
      The commit referenced below removed the assignment of "bytes" from
      xen_swiotlb_init() without - like done for xen_swiotlb_init_early() -
      adding an assignment on the retry path, thus leading to excessively
      sized allocations upon retries.
      
      Fixes: 2d29960a ("swiotlb: dynamically allocate io_tlb_default_mem")
      Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      
      Link: https://lore.kernel.org/r/778299d6-9cfd-1c13-026e-25ee5d14ecb3@suse.comSigned-off-by: default avatarJuergen Gross <jgross@suse.com>
      4c092c59
    • Jan Beulich's avatar
      swiotlb-xen: avoid double free · ce6a80d1
      Jan Beulich authored
      Of the two paths leading to the "error" label in xen_swiotlb_init() one
      didn't allocate anything, while the other did already free what was
      allocated.
      
      Fixes: b8277600 ("xen/swiotlb: Use the swiotlb_late_init_with_tbl to init Xen-SWIOTLB late when PV PCI is used")
      Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      
      Link: https://lore.kernel.org/r/ce9c2adb-8a52-6293-982a-0d6ece943ac6@suse.comSigned-off-by: default avatarJuergen Gross <jgross@suse.com>
      ce6a80d1
    • Jan Beulich's avatar
      xen/pvcalls: backend can be a module · 45da2344
      Jan Beulich authored
      It's not clear to me why only the frontend has been tristate. Switch the
      backend to be, too.
      Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
      Acked-by: default avatarStefano Stabellini <sstabellini@kernel.org>
      
      Link: https://lore.kernel.org/r/54a6070c-92bb-36a3-2fc0-de9ccca438c5@suse.comSigned-off-by: default avatarJuergen Gross <jgross@suse.com>
      45da2344
    • Juergen Gross's avatar
      xen: fix usage of pmd_populate in mremap for pv guests · 36c9b592
      Juergen Gross authored
      Commit 0881ace2 ("mm/mremap: use pmd/pud_poplulate to update page
      table entries") introduced a regression when running as Xen PV guest.
      
      Today pmd_populate() for Xen PV assumes that the PFN inserted is
      referencing a not yet used page table. In case of move_normal_pmd()
      this is not true, resulting in WARN splats like:
      
      [34321.304270] ------------[ cut here ]------------
      [34321.304277] WARNING: CPU: 0 PID: 23628 at arch/x86/xen/multicalls.c:102 xen_mc_flush+0x176/0x1a0
      [34321.304288] Modules linked in:
      [34321.304291] CPU: 0 PID: 23628 Comm: apt-get Not tainted 5.14.1-20210906-doflr-mac80211debug+ #1
      [34321.304294] Hardware name: MSI MS-7640/890FXA-GD70 (MS-7640)  , BIOS V1.8B1 09/13/2010
      [34321.304296] RIP: e030:xen_mc_flush+0x176/0x1a0
      [34321.304300] Code: 89 45 18 48 c1 e9 3f 48 89 ce e9 20 ff ff ff e8 60 03 00 00 66 90 5b 5d 41 5c 41 5d c3 48 c7 45 18 ea ff ff ff be 01 00 00 00 <0f> 0b 8b 55 00 48 c7 c7 10 97 aa 82 31 db 49 c7 c5 38 97 aa 82 65
      [34321.304303] RSP: e02b:ffffc90000a97c90 EFLAGS: 00010002
      [34321.304305] RAX: ffff88807d416398 RBX: ffff88807d416350 RCX: ffff88807d416398
      [34321.304306] RDX: 0000000000000001 RSI: 0000000000000001 RDI: deadbeefdeadf00d
      [34321.304308] RBP: ffff88807d416300 R08: aaaaaaaaaaaaaaaa R09: ffff888006160cc0
      [34321.304309] R10: deadbeefdeadf00d R11: ffffea000026a600 R12: 0000000000000000
      [34321.304310] R13: ffff888012f6b000 R14: 0000000012f6b000 R15: 0000000000000001
      [34321.304320] FS:  00007f5071177800(0000) GS:ffff88807d400000(0000) knlGS:0000000000000000
      [34321.304322] CS:  10000e030 DS: 0000 ES: 0000 CR0: 0000000080050033
      [34321.304323] CR2: 00007f506f542000 CR3: 00000000160cc000 CR4: 0000000000000660
      [34321.304326] Call Trace:
      [34321.304331]  xen_alloc_pte+0x294/0x320
      [34321.304334]  move_pgt_entry+0x165/0x4b0
      [34321.304339]  move_page_tables+0x6fa/0x8d0
      [34321.304342]  move_vma.isra.44+0x138/0x500
      [34321.304345]  __x64_sys_mremap+0x296/0x410
      [34321.304348]  do_syscall_64+0x3a/0x80
      [34321.304352]  entry_SYSCALL_64_after_hwframe+0x44/0xae
      [34321.304355] RIP: 0033:0x7f507196301a
      [34321.304358] Code: 73 01 c3 48 8b 0d 76 0e 0c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 49 89 ca b8 19 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 46 0e 0c 00 f7 d8 64 89 01 48
      [34321.304360] RSP: 002b:00007ffda1eecd38 EFLAGS: 00000246 ORIG_RAX: 0000000000000019
      [34321.304362] RAX: ffffffffffffffda RBX: 000056205f950f30 RCX: 00007f507196301a
      [34321.304363] RDX: 0000000001a00000 RSI: 0000000001900000 RDI: 00007f506dc56000
      [34321.304364] RBP: 0000000001a00000 R08: 0000000000000010 R09: 0000000000000004
      [34321.304365] R10: 0000000000000001 R11: 0000000000000246 R12: 00007f506dc56060
      [34321.304367] R13: 00007f506dc56000 R14: 00007f506dc56060 R15: 000056205f950f30
      [34321.304368] ---[ end trace a19885b78fe8f33e ]---
      [34321.304370] 1 of 2 multicall(s) failed: cpu 0
      [34321.304371]   call  2: op=12297829382473034410 arg=[aaaaaaaaaaaaaaaa] result=-22
      
      Fix that by modifying xen_alloc_ptpage() to only pin the page table in
      case it wasn't pinned already.
      
      Fixes: 0881ace2 ("mm/mremap: use pmd/pud_poplulate to update page table entries")
      Cc: <stable@vger.kernel.org>
      Reported-by: default avatarSander Eikelenboom <linux@eikelenboom.it>
      Tested-by: default avatarSander Eikelenboom <linux@eikelenboom.it>
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Link: https://lore.kernel.org/r/20210908073640.11299-1-jgross@suse.comSigned-off-by: default avatarJuergen Gross <jgross@suse.com>
      36c9b592
    • Juergen Gross's avatar
      xen: reset legacy rtc flag for PV domU · f68aa100
      Juergen Gross authored
      A Xen PV guest doesn't have a legacy RTC device, so reset the legacy
      RTC flag. Otherwise the following WARN splat will occur at boot:
      
      [    1.333404] WARNING: CPU: 1 PID: 1 at /home/gross/linux/head/drivers/rtc/rtc-mc146818-lib.c:25 mc146818_get_time+0x1be/0x210
      [    1.333404] Modules linked in:
      [    1.333404] CPU: 1 PID: 1 Comm: swapper/0 Tainted: G        W         5.14.0-rc7-default+ #282
      [    1.333404] RIP: e030:mc146818_get_time+0x1be/0x210
      [    1.333404] Code: c0 64 01 c5 83 fd 45 89 6b 14 7f 06 83 c5 64 89 6b 14 41 83 ec 01 b8 02 00 00 00 44 89 63 10 5b 5d 41 5c 41 5d 41 5e 41 5f c3 <0f> 0b 48 c7 c7 30 0e ef 82 4c 89 e6 e8 71 2a 24 00 48 c7 c0 ff ff
      [    1.333404] RSP: e02b:ffffc90040093df8 EFLAGS: 00010002
      [    1.333404] RAX: 00000000000000ff RBX: ffffc90040093e34 RCX: 0000000000000000
      [    1.333404] RDX: 0000000000000001 RSI: 0000000000000000 RDI: 000000000000000d
      [    1.333404] RBP: ffffffff82ef0e30 R08: ffff888005013e60 R09: 0000000000000000
      [    1.333404] R10: ffffffff82373e9b R11: 0000000000033080 R12: 0000000000000200
      [    1.333404] R13: 0000000000000000 R14: 0000000000000002 R15: ffffffff82cdc6d4
      [    1.333404] FS:  0000000000000000(0000) GS:ffff88807d440000(0000) knlGS:0000000000000000
      [    1.333404] CS:  10000e030 DS: 0000 ES: 0000 CR0: 0000000080050033
      [    1.333404] CR2: 0000000000000000 CR3: 000000000260a000 CR4: 0000000000050660
      [    1.333404] Call Trace:
      [    1.333404]  ? wakeup_sources_sysfs_init+0x30/0x30
      [    1.333404]  ? rdinit_setup+0x2b/0x2b
      [    1.333404]  early_resume_init+0x23/0xa4
      [    1.333404]  ? cn_proc_init+0x36/0x36
      [    1.333404]  do_one_initcall+0x3e/0x200
      [    1.333404]  kernel_init_freeable+0x232/0x28e
      [    1.333404]  ? rest_init+0xd0/0xd0
      [    1.333404]  kernel_init+0x16/0x120
      [    1.333404]  ret_from_fork+0x1f/0x30
      
      Cc: <stable@vger.kernel.org>
      Fixes: 8d152e7a ("x86/rtc: Replace paravirt rtc check with platform legacy quirk")
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Reviewed-by: default avatarBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Link: https://lore.kernel.org/r/20210903084937.19392-3-jgross@suse.comSigned-off-by: default avatarJuergen Gross <jgross@suse.com>
      f68aa100
  2. 14 Sep, 2021 2 commits
  3. 01 Sep, 2021 2 commits
  4. 30 Aug, 2021 9 commits
  5. 29 Aug, 2021 8 commits
  6. 28 Aug, 2021 3 commits
  7. 27 Aug, 2021 7 commits