Re: xen: sleeping in atomic warnings

From: Juergen Gross
Date: Tue Feb 07 2023 - 09:03:27 EST


On 07.02.23 14:37, Dan Carpenter wrote:
These are static checker warnings from Smatch. The line numbers are
based on next-20230207. To reproduce these warnings then you need to
have the latest Smatch from git and you need to rebuild the cross
function probably four times. I have reviewed most of these and they
all seem valid to me. I remember I reported some a while back but never
heard back. https://lore.kernel.org/all/20210802144037.GA29540@kili/

regards,
dan carpenter

arch/x86/xen/p2m.c:189 alloc_p2m_page() warn: sleeping in atomic context
xen_create_contiguous_region() <- disables preempt
xen_destroy_contiguous_region() <- disables preempt
-> xen_remap_exchanged_ptes()
-> set_phys_to_machine()
-> xen_alloc_p2m_entry()
-> alloc_p2m_pmd()
xen_alloc_p2m_entry() <duplicate>
-> alloc_p2m_page()

Those allocations can't be reached after early boot.

drivers/xen/events/events_base.c:1213 bind_evtchn_to_irq_chip() warn: sleeping in atomic context
pvcalls_front_connect() <- disables preempt
pvcalls_front_accept() <- disables preempt
-> create_active()
-> bind_evtchn_to_irqhandler()
-> bind_evtchn_to_irqhandler_chip()
-> bind_evtchn_to_irq_chip()

Yes, that one looks very suspicious. Basically the same problem as all
the other pvcalls issues below.

drivers/net/ethernet/qlogic/netxen/netxen_nic_hw.c:303 netxen_pcie_sem_lock() warn: sleeping in atomic context
netxen_nic_hw_write_wx_2M() <- disables preempt
netxen_nic_hw_read_wx_2M() <- disables preempt
-> netxen_pcie_sem_lock()

This is not Xen related.

drivers/xen/xen-pciback/pci_stub.c:110 pcistub_device_release() warn: sleeping in atomic context
pcistub_get_pci_dev_by_slot() <- disables preempt
pcistub_get_pci_dev() <- disables preempt
-> pcistub_device_get_pci_dev()
-> pcistub_device_put()
-> pcistub_device_release()

Seems top be problematic, too.

drivers/xen/xen-scsiback.c:1016 __scsiback_del_translation_entry() warn: sleeping in atomic context
scsiback_del_translation_entry() <- disables preempt
scsiback_release_translation_entry() <- disables preempt
-> __scsiback_del_translation_entry()

Needs fixing (same fix as the other scsiback issue).

Thanks for the reports,


Juergen

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature