Re: [PATCH v5 04/14] vpci: cancel pending map/unmap on vpci removal

2022-01-30 Thread Oleksandr Andrushchenko
I am going to postpone this patch as it does need major re-thinking
on the approach to take. This is possible as it fixes a really rare
use-case seen during development phase, so shouldn't hurt the run-time

Thank you,
Oleksandr

On 25.11.21 13:02, Oleksandr Andrushchenko wrote:
> From: Oleksandr Andrushchenko 
>
> When a vPCI is removed for a PCI device it is possible that we have
> scheduled a delayed work for map/unmap operations for that device.
> For example, the following scenario can illustrate the problem:
>
> pci_physdev_op
> pci_add_device
> init_bars -> modify_bars -> defer_map -> 
> raise_softirq(SCHEDULE_SOFTIRQ)
> iommu_add_device <- FAILS
> vpci_remove_device -> xfree(pdev->vpci)
>
> leave_hypervisor_to_guest
> vpci_process_pending: v->vpci.mem != NULL; v->vpci.pdev->vpci == NULL
>
> For the hardware domain we continue execution as the worse that
> could happen is that MMIO mappings are left in place when the
> device has been deassigned.
>
> For unprivileged domains that get a failure in the middle of a vPCI
> {un}map operation we need to destroy them, as we don't know in which
> state the p2m is. This can only happen in vpci_process_pending for
> DomUs as they won't be allowed to call pci_add_device.
>
> Signed-off-by: Oleksandr Andrushchenko 
>
> ---
> Cc: Roger Pau Monné 
> ---
> Since v4:
>   - crash guest domain if map/unmap operation didn't succeed
>   - re-work vpci cancel work to cancel work on all vCPUs
>   - use new locking scheme with pdev->vpci_lock
> New in v4
>
> Fixes: 86dbcf6e30cb ("vpci: cancel pending map/unmap on vpci removal")
>
> ---
>
> Signed-off-by: Oleksandr Andrushchenko 
> ---
>   xen/drivers/vpci/header.c | 49 ++-
>   xen/drivers/vpci/vpci.c   |  2 ++
>   xen/include/xen/pci.h |  5 
>   xen/include/xen/vpci.h|  6 +
>   4 files changed, 51 insertions(+), 11 deletions(-)
>
> diff --git a/xen/drivers/vpci/header.c b/xen/drivers/vpci/header.c
> index bd23c0274d48..ba333fb2f9b0 100644
> --- a/xen/drivers/vpci/header.c
> +++ b/xen/drivers/vpci/header.c
> @@ -131,7 +131,13 @@ static void modify_decoding(const struct pci_dev *pdev, 
> uint16_t cmd,
>   
>   bool vpci_process_pending(struct vcpu *v)
>   {
> -if ( v->vpci.mem )
> +struct pci_dev *pdev = v->vpci.pdev;
> +
> +if ( !pdev )
> +return false;
> +
> +spin_lock(>vpci_lock);
> +if ( !pdev->vpci_cancel_pending && v->vpci.mem )
>   {
>   struct map_data data = {
>   .d = v->domain,
> @@ -140,32 +146,53 @@ bool vpci_process_pending(struct vcpu *v)
>   int rc = rangeset_consume_ranges(v->vpci.mem, map_range, );
>   
>   if ( rc == -ERESTART )
> +{
> +spin_unlock(>vpci_lock);
>   return true;
> +}
>   
> -spin_lock(>vpci.pdev->vpci_lock);
> -if ( v->vpci.pdev->vpci )
> +if ( pdev->vpci )
>   /* Disable memory decoding unconditionally on failure. */
> -modify_decoding(v->vpci.pdev,
> +modify_decoding(pdev,
>   rc ? v->vpci.cmd & ~PCI_COMMAND_MEMORY : 
> v->vpci.cmd,
>   !rc && v->vpci.rom_only);
> -spin_unlock(>vpci.pdev->vpci_lock);
>   
> -rangeset_destroy(v->vpci.mem);
> -v->vpci.mem = NULL;
>   if ( rc )
> +{
>   /*
>* FIXME: in case of failure remove the device from the domain.
>* Note that there might still be leftover mappings. While this 
> is
> - * safe for Dom0, for DomUs the domain will likely need to be
> - * killed in order to avoid leaking stale p2m mappings on
> - * failure.
> + * safe for Dom0, for DomUs the domain needs to be killed in 
> order
> + * to avoid leaking stale p2m mappings on failure.
>*/
> -vpci_remove_device(v->vpci.pdev);
> +if ( is_hardware_domain(v->domain) )
> +vpci_remove_device_locked(pdev);
> +else
> +domain_crash(v->domain);
> +}
>   }
> +spin_unlock(>vpci_lock);
>   
>   return false;
>   }
>   
> +void vpci_cancel_pending_locked(struct pci_dev *pdev)
> +{
> +struct vcpu *v;
> +
> +ASSERT(spin_is_locked(>vpci_lock));
> +
> +/* Cancel any pending work now on all vCPUs. */
> +for_each_vcpu( pdev->domain, v )
> +{
> +if ( v->vpci.mem && (v->vpci.pdev == pdev) )
> +{
> +rangeset_destroy(v->vpci.mem);
> +v->vpci.mem = NULL;
> +}
> +}
> +}
> +
>   static int __init apply_map(struct domain *d, const struct pci_dev *pdev,
>   struct rangeset *mem, uint16_t cmd)
>   {
> diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c
> index ceaac4516ff8..37103e207635 100644
> --- a/xen/drivers/vpci/vpci.c
> +++ b/xen/drivers/vpci/vpci.c
> @@ -54,7 +54,9 

Re: [PATCH v5 03/14] vpci: move lock outside of struct vpci

2022-01-30 Thread Oleksandr Andrushchenko
Hi, Jan, Roger!

On 26.01.22 13:13, Roger Pau Monné wrote:
> On Wed, Jan 26, 2022 at 08:40:09AM +, Oleksandr Andrushchenko wrote:
>> Hello, Roger, Jan!
>>
>> On 12.01.22 16:42, Jan Beulich wrote:
>>> On 11.01.2022 16:17, Roger Pau Monné wrote:
 On Thu, Nov 25, 2021 at 01:02:40PM +0200, Oleksandr Andrushchenko wrote:
> diff --git a/xen/drivers/vpci/vpci.c b/xen/drivers/vpci/vpci.c
> index 657697fe3406..ceaac4516ff8 100644
> --- a/xen/drivers/vpci/vpci.c
> +++ b/xen/drivers/vpci/vpci.c
> @@ -35,12 +35,10 @@ extern vpci_register_init_t *const 
> __start_vpci_array[];
>extern vpci_register_init_t *const __end_vpci_array[];
>#define NUM_VPCI_INIT (__end_vpci_array - __start_vpci_array)
>
> -void vpci_remove_device(struct pci_dev *pdev)
> +static void vpci_remove_device_handlers_locked(struct pci_dev *pdev)
>{
> -if ( !has_vpci(pdev->domain) )
> -return;
> +ASSERT(spin_is_locked(>vpci_lock));
>
> -spin_lock(>vpci->lock);
>while ( !list_empty(>vpci->handlers) )
>{
>struct vpci_register *r = 
> list_first_entry(>vpci->handlers,
> @@ -50,15 +48,33 @@ void vpci_remove_device(struct pci_dev *pdev)
>list_del(>node);
>xfree(r);
>}
> -spin_unlock(>vpci->lock);
> +}
> +
> +void vpci_remove_device_locked(struct pci_dev *pdev)
 I think this could be static instead, as it's only used by
 vpci_remove_device and vpci_add_handlers which are local to the
 file.
>> This is going to be used outside later on while processing pending mappings,
>> so I think it is not worth it defining it static here and then removing the 
>> static
>> key word later on: please see [PATCH v5 04/14] vpci: cancel pending 
>> map/unmap on vpci removal [1]
> I have some comments there also, which might change the approach
> you are using.
>
>>> Does the splitting out of vpci_remove_device_handlers_locked() belong in
>>> this patch in the first place? There's no second caller being added, so
>>> this looks to be an orthogonal adjustment.
>> I think of it as a preparation for the upcoming code: although the reason 
>> for the
>> change might not be immediately seen in this patch it is still in line with 
>> what
>> happens next.
> Right - it's generally best if the change is done together as the new
> callers are added. Otherwise it's hard to understand why certain changes
> are made, and you will likely get asked the same question on next
> rounds.
>
> It's also possible that the code that requires this is changed in
> further iterations so there's no longer a need for the splitting.
Ok, sounds reasonable
I will not split the functions without the obvious need
>
> Thanks, Roger.
Thank you,
Oleksandr

[libvirt test] 167962: regressions - FAIL

2022-01-30 Thread osstest service owner
flight 167962 libvirt real [real]
http://logs.test-lab.xenproject.org/osstest/logs/167962/

Regressions :-(

Tests which did not succeed and are blocking,
including tests which could not be run:
 build-amd64-libvirt   6 libvirt-buildfail REGR. vs. 151777
 build-arm64-libvirt   6 libvirt-buildfail REGR. vs. 151777
 build-i386-libvirt6 libvirt-buildfail REGR. vs. 151777
 build-armhf-libvirt   6 libvirt-buildfail REGR. vs. 151777

Tests which did not succeed, but are not blocking:
 test-amd64-amd64-libvirt  1 build-check(1)   blocked  n/a
 test-amd64-amd64-libvirt-pair  1 build-check(1)   blocked  n/a
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 1 build-check(1) blocked n/a
 test-amd64-amd64-libvirt-vhd  1 build-check(1)   blocked  n/a
 test-amd64-amd64-libvirt-xsm  1 build-check(1)   blocked  n/a
 test-amd64-i386-libvirt   1 build-check(1)   blocked  n/a
 test-amd64-i386-libvirt-pair  1 build-check(1)   blocked  n/a
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 1 build-check(1) blocked n/a
 test-amd64-i386-libvirt-raw   1 build-check(1)   blocked  n/a
 test-amd64-i386-libvirt-xsm   1 build-check(1)   blocked  n/a
 test-arm64-arm64-libvirt  1 build-check(1)   blocked  n/a
 test-arm64-arm64-libvirt-qcow2  1 build-check(1)   blocked  n/a
 test-arm64-arm64-libvirt-raw  1 build-check(1)   blocked  n/a
 test-armhf-armhf-libvirt-raw  1 build-check(1)   blocked  n/a
 test-arm64-arm64-libvirt-xsm  1 build-check(1)   blocked  n/a
 test-armhf-armhf-libvirt  1 build-check(1)   blocked  n/a
 test-armhf-armhf-libvirt-qcow2  1 build-check(1)   blocked  n/a

version targeted for testing:
 libvirt  18813edbf28b42ad9d068e0584c4408019c09bff
baseline version:
 libvirt  2c846fa6bcc11929c9fb857a22430fb9945654ad

Last test of basis   151777  2020-07-10 04:19:19 Z  570 days
Failing since151818  2020-07-11 04:18:52 Z  569 days  551 attempts
Testing same since   167942  2022-01-29 04:18:56 Z2 days3 attempts


People who touched revisions under test:
Adolfo Jayme Barrientos 
  Aleksandr Alekseev 
  Aleksei Zakharov 
  Andika Triwidada 
  Andrea Bolognani 
  Ani Sinha 
  Balázs Meskó 
  Barrett Schonefeld 
  Bastian Germann 
  Bastien Orivel 
  BiaoXiang Ye 
  Bihong Yu 
  Binfeng Wu 
  Bjoern Walk 
  Boris Fiuczynski 
  Brad Laue 
  Brian Turek 
  Bruno Haible 
  Chris Mayo 
  Christian Borntraeger 
  Christian Ehrhardt 
  Christian Kirbach 
  Christian Schoenebeck 
  Christophe Fergeau 
  Cole Robinson 
  Collin Walling 
  Cornelia Huck 
  Cédric Bosdonnat 
  Côme Borsoi 
  Daniel Henrique Barboza 
  Daniel Letai 
  Daniel P. Berrange 
  Daniel P. Berrangé 
  Didik Supriadi 
  dinglimin 
  Divya Garg 
  Dmitrii Shcherbakov 
  Dmytro Linkin 
  Eiichi Tsukata 
  Eric Farman 
  Erik Skultety 
  Fabian Affolter 
  Fabian Freyer 
  Fabiano Fidêncio 
  Fangge Jin 
  Farhan Ali 
  Fedora Weblate Translation 
  Franck Ridel 
  Gavi Teitz 
  gongwei 
  Guoyi Tu
  Göran Uddeborg 
  Halil Pasic 
  Han Han 
  Hao Wang 
  Hela Basa 
  Helmut Grohne 
  Hiroki Narukawa 
  Hyman Huang(黄勇) 
  Ian Wienand 
  Ioanna Alifieraki 
  Ivan Teterevkov 
  Jakob Meng 
  Jamie Strandboge 
  Jamie Strandboge 
  Jan Kuparinen 
  jason lee 
  Jean-Baptiste Holcroft 
  Jia Zhou 
  Jianan Gao 
  Jim Fehlig 
  Jin Yan 
  Jinsheng Zhang 
  Jiri Denemark 
  Joachim Falk 
  John Ferlan 
  Jonathan Watt 
  Jonathon Jongsma 
  Julio Faracco 
  Justin Gatzen 
  Ján Tomko 
  Kashyap Chamarthy 
  Kevin Locke 
  Koichi Murase 
  Kristina Hanicova 
  Laine Stump 
  Laszlo Ersek 
  Lee Yarwood 
  Lei Yang 
  Liao Pingfang 
  Lin Ma 
  Lin Ma 
  Lin Ma 
  Liu Yiding 
  Luke Yue 
  Luyao Zhong 
  Marc Hartmayer 
  Marc-André Lureau 
  Marek Marczykowski-Górecki 
  Markus Schade 
  Martin Kletzander 
  Masayoshi Mizuma 
  Matej Cepl 
  Matt Coleman 
  Matt Coleman 
  Mauro Matteo Cascella 
  Meina Li 
  Michal Privoznik 
  Michał Smyk 
  Milo Casagrande 
  Moshe Levi 
  Muha Aliss 
  Nathan 
  Neal Gompa 
  Nick Chevsky 
  Nick Shyrokovskiy 
  Nickys Music Group 
  Nico Pache 
  Nicolas Lécureuil 
  Nicolas Lécureuil 
  Nikolay Shirokovskiy 
  Olaf Hering 
  Olesya Gerasimenko 
  Or Ozeri 
  Orion Poplawski 
  Pany 
  Patrick Magauran 
  Paulo de Rezende Pinatti 
  Pavel Hrdina 
  Peng Liang 
  Peter Krempa 
  Pino Toscano 
  Pino Toscano 
  Piotr Drąg 
  Prathamesh Chavan 
  Praveen K Paladugu 
  Richard W.M. Jones 
  Ricky Tigg 
  Robin Lee 
  Rohit Kumar 
  Roman Bogorodskiy 
  Roman Bolshakov 
  Ryan Gahagan 
  Ryan Schmidt 
  Sam Hartman 
  Scott Shambarger 
  Sebastian Mitterle 
  SeongHyun Jo 
  Shalini Chellathurai Saroja 
  Shaojun Yang 
  shenjiatong 
  Shi Lei 
  simmon 
  Simon 

Re: [PATCH] xen: update missing ioctl magic numers documentation

2022-01-30 Thread Juergen Gross

On 30.01.22 20:23, Randy Dunlap wrote:

Add missing ioctl "magic numbers" for various Xen interfaces
(xenbus_dev.h, gntalloc.h, gntdev.h, and privcmd.h).

Signed-off-by: Randy Dunlap 
Cc: Boris Ostrovsky 
Cc: Juergen Gross 
Cc: Stefano Stabellini 
Cc: xen-devel@lists.xenproject.org
---
  Documentation/userspace-api/ioctl/ioctl-number.rst |3 +++
  1 file changed, 3 insertions(+)

--- linux-next-20220128.orig/Documentation/userspace-api/ioctl/ioctl-number.rst
+++ linux-next-20220128/Documentation/userspace-api/ioctl/ioctl-number.rst
@@ -115,6 +115,7 @@ Code  Seq#Include File
  'B'   00-1F  linux/cciss_ioctl.h conflict!
  'B'   00-0F  include/linux/pmu.h conflict!
  'B'   C0-FF  advanced bbus   

+'B'   00-0F  xen/xenbus_dev.hconflict!


Hmm, shouldn't xenbus_dev.h be moved to include/uapi/xen ?


  'C'   alllinux/soundcard.h   conflict!
  'C'   01-2F  linux/capi.hconflict!
  'C'   F0-FF  drivers/net/wan/cosa.h  conflict!
@@ -134,6 +135,7 @@ Code  Seq#Include File
  'F'   80-8F  linux/arcfb.h   conflict!
  'F'   DD video/sstfb.h   conflict!
  'G'   00-3F  drivers/misc/sgi-gru/grulib.h   conflict!
+'E'   00-0F  xen/gntalloc.h, xen/gntdev.hconflict!


Should be 'G' IMO.


  'H'   00-7F  linux/hiddev.h  conflict!
  'H'   00-0F  linux/hidraw.h  conflict!
  'H'   01 linux/mei.h conflict!
@@ -176,6 +178,7 @@ Code  Seq#Include File
  'P'   60-6F  sound/sscape_ioctl.hconflict!
  'P'   00-0F  drivers/usb/class/usblp.c   conflict!
  'P'   01-09  drivers/misc/pci_endpoint_test.cconflict!
+'P'   00-0F  xen/privcmd.h   conflict!
  'Q'   alllinux/soundcard.h
  'R'   00-1F  linux/random.h  conflict!
  'R'   01 linux/rfkill.h  conflict!




Juergen


OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: [PATCH] xen: xenbus_dev.h: delete incorrect file name

2022-01-30 Thread Juergen Gross

On 30.01.22 20:17, Randy Dunlap wrote:

It is better/preferred not to include file names in source files
because (a) they are not needed and (b) they can be incorrect,
so just delete this incorrect file name.

Signed-off-by: Randy Dunlap 
Cc: Boris Ostrovsky 
Cc: Juergen Gross 
Cc: Stefano Stabellini 
Cc: xen-devel@lists.xenproject.org
---
  include/xen/xenbus_dev.h |1 -
  1 file changed, 1 deletion(-)

--- linux-next-20220128.orig/include/xen/xenbus_dev.h
+++ linux-next-20220128/include/xen/xenbus_dev.h
@@ -1,5 +1,4 @@
  
/**
- * evtchn.h


I think the following line should be deleted, too (can be done while
committing).


   *
   * Interface to /dev/xen/xenbus_backend.
   *



Reviewed-by: Juergen Gross 


Juergen


OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


Re: [PATCH] Improve docs for IOCTL_GNTDEV_MAP_GRANT_REF

2022-01-30 Thread Juergen Gross

On 30.01.22 19:35, Demi Marie Obenour wrote:

The current implementation of gntdev guarantees that the first call to
IOCTL_GNTDEV_MAP_GRANT_REF will set @index to 0.  This is required to
use gntdev for Wayland, which is a future desire of Qubes OS.
Additionally, requesting zero grants results in an error, but this was
not documented either.  Document both of these.


Please add a "Signed-off-by:" tag to your commit message.

See Documentation/process/submitting-patches.rst in the kernel source
tree, look for "Sign your work - the Developer's Certificate of Origin".


Juergen


OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


[PATCH] Improve docs for IOCTL_GNTDEV_MAP_GRANT_REF

2022-01-30 Thread Demi Marie Obenour
The current implementation of gntdev guarantees that the first call to
IOCTL_GNTDEV_MAP_GRANT_REF will set @index to 0.  This is required to
use gntdev for Wayland, which is a future desire of Qubes OS.
Additionally, requesting zero grants results in an error, but this was
not documented either.  Document both of these.
---
 include/uapi/xen/gntdev.h | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/uapi/xen/gntdev.h b/include/uapi/xen/gntdev.h
index 9ac5515b9bc2..7a7145395c09 100644
--- a/include/uapi/xen/gntdev.h
+++ b/include/uapi/xen/gntdev.h
@@ -47,7 +47,13 @@ struct ioctl_gntdev_grant_ref {
 /*
  * Inserts the grant references into the mapping table of an instance
  * of gntdev. N.B. This does not perform the mapping, which is deferred
- * until mmap() is called with @index as the offset.
+ * until mmap() is called with @index as the offset. @index should be
+ * considered opaque to userspace, with one exception: if no grant
+ * references have ever been inserted into the mapping table of this
+ * instance, @index will be set to 0. This is necessary to use gntdev
+ * with userspace APIs that expect a file descriptor that can be
+ * mmap()'d at offset 0, such as Wayland. If @count is set to 0, this
+ * ioctl will fail.
  */
 #define IOCTL_GNTDEV_MAP_GRANT_REF \
 _IOC(_IOC_NONE, 'G', 0, sizeof(struct ioctl_gntdev_map_grant_ref))
-- 
Sincerely,
Demi Marie Obenour
she/her/hers

OpenPGP_0xB288B55FFF9C22C1.asc
Description: OpenPGP public key


OpenPGP_signature
Description: OpenPGP digital signature


[qemu-mainline test] 167959: tolerable FAIL - PUSHED

2022-01-30 Thread osstest service owner
flight 167959 qemu-mainline real [real]
http://logs.test-lab.xenproject.org/osstest/logs/167959/

Failures :-/ but no regressions.

Tests which did not succeed, but are not blocking:
 test-amd64-amd64-xl-rtds 20 guest-localmigrate/x10   fail  like 167955
 test-amd64-amd64-xl-qemuu-win7-amd64 19 guest-stopfail like 167955
 test-amd64-amd64-qemuu-nested-amd 20 debian-hvm-install/l1/l2 fail like 167955
 test-armhf-armhf-libvirt 16 saverestore-support-checkfail  like 167955
 test-amd64-i386-xl-qemuu-win7-amd64 19 guest-stop fail like 167955
 test-armhf-armhf-libvirt-raw 15 saverestore-support-checkfail  like 167955
 test-amd64-i386-xl-qemuu-ws16-amd64 19 guest-stop fail like 167955
 test-amd64-amd64-xl-qemuu-ws16-amd64 19 guest-stopfail like 167955
 test-armhf-armhf-libvirt-qcow2 15 saverestore-support-check   fail like 167955
 test-arm64-arm64-xl-seattle  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-seattle  16 saverestore-support-checkfail   never pass
 test-amd64-amd64-libvirt 15 migrate-support-checkfail   never pass
 test-amd64-i386-libvirt-xsm  15 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt-xsm 15 migrate-support-checkfail   never pass
 test-amd64-i386-libvirt  15 migrate-support-checkfail   never pass
 test-amd64-i386-xl-pvshim14 guest-start  fail   never pass
 test-arm64-arm64-xl  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl  16 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl-credit1  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-credit1  16 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl-xsm  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-xsm  16 saverestore-support-checkfail   never pass
 test-arm64-arm64-libvirt-xsm 15 migrate-support-checkfail   never pass
 test-arm64-arm64-libvirt-xsm 16 saverestore-support-checkfail   never pass
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 13 migrate-support-check 
fail never pass
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 13 migrate-support-check 
fail never pass
 test-arm64-arm64-xl-thunderx 15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-thunderx 16 saverestore-support-checkfail   never pass
 test-amd64-amd64-libvirt-vhd 14 migrate-support-checkfail   never pass
 test-arm64-arm64-libvirt-raw 14 migrate-support-checkfail   never pass
 test-arm64-arm64-libvirt-raw 15 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl-vhd  14 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-vhd  15 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl  15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl  16 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 16 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-cubietruck 15 migrate-support-checkfail never pass
 test-armhf-armhf-xl-cubietruck 16 saverestore-support-checkfail never pass
 test-arm64-arm64-xl-credit2  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-credit2  16 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt 15 migrate-support-checkfail   never pass
 test-armhf-armhf-libvirt-raw 14 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-arndale  15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-arndale  16 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-credit1  15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit1  16 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-multivcpu 15 migrate-support-checkfail  never pass
 test-armhf-armhf-xl-multivcpu 16 saverestore-support-checkfail  never pass
 test-amd64-i386-libvirt-raw  14 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-vhd  14 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-vhd  15 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt-qcow2 14 migrate-support-checkfail never pass
 test-armhf-armhf-xl-credit2  15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  16 saverestore-support-checkfail   never pass

version targeted for testing:
 qemuubfc3db5cf64ab538d6b3c56eab6423372758b258
baseline version:
 qemuud90e6f665d3ac197f83d93ad37147fe677521209

Last test of basis   167955  2022-01-30 10:08:20 Z0 days
Testing same since   167959  2022-01-30 19:39:38 Z0 days1 attempts


People who 

[linux-linus test] 167958: tolerable FAIL - PUSHED

2022-01-30 Thread osstest service owner
flight 167958 linux-linus real [real]
flight 167960 linux-linus real-retest [real]
http://logs.test-lab.xenproject.org/osstest/logs/167958/
http://logs.test-lab.xenproject.org/osstest/logs/167960/

Failures :-/ but no regressions.

Tests which are failing intermittently (not blocking):
 test-armhf-armhf-xl-credit1  10 host-ping-check-xen fail pass in 167960-retest

Regressions which are regarded as allowable (not blocking):
 test-armhf-armhf-xl-rtds18 guest-start/debian.repeat fail REGR. vs. 167954

Tests which did not succeed, but are not blocking:
 test-armhf-armhf-libvirt-qcow2 15 saverestore-support-check fail blocked in 
167954
 test-armhf-armhf-xl-credit1 15 migrate-support-check fail in 167960 never pass
 test-armhf-armhf-xl-credit1 16 saverestore-support-check fail in 167960 never 
pass
 test-amd64-amd64-xl-qemut-win7-amd64 19 guest-stopfail like 167954
 test-armhf-armhf-libvirt 16 saverestore-support-checkfail  like 167954
 test-amd64-amd64-qemuu-nested-amd 20 debian-hvm-install/l1/l2 fail like 167954
 test-amd64-amd64-xl-qemuu-ws16-amd64 19 guest-stopfail like 167954
 test-amd64-amd64-xl-qemut-ws16-amd64 19 guest-stopfail like 167954
 test-amd64-amd64-xl-qemuu-win7-amd64 19 guest-stopfail like 167954
 test-armhf-armhf-libvirt-raw 15 saverestore-support-checkfail  like 167954
 test-arm64-arm64-xl-seattle  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-seattle  16 saverestore-support-checkfail   never pass
 test-amd64-amd64-libvirt 15 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt-xsm 15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl  16 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl-credit2  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-credit2  16 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl-xsm  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-xsm  16 saverestore-support-checkfail   never pass
 test-arm64-arm64-libvirt-xsm 15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-credit1  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-credit1  16 saverestore-support-checkfail   never pass
 test-arm64-arm64-libvirt-xsm 16 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl-thunderx 15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-thunderx 16 saverestore-support-checkfail   never pass
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 13 migrate-support-check 
fail never pass
 test-amd64-amd64-libvirt-qcow2 14 migrate-support-checkfail never pass
 test-amd64-amd64-libvirt-raw 14 migrate-support-checkfail   never pass
 test-arm64-arm64-libvirt-raw 14 migrate-support-checkfail   never pass
 test-arm64-arm64-libvirt-raw 15 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl-vhd  14 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-vhd  15 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 16 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt 15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  16 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-cubietruck 15 migrate-support-checkfail never pass
 test-armhf-armhf-xl-cubietruck 16 saverestore-support-checkfail never pass
 test-armhf-armhf-xl-multivcpu 15 migrate-support-checkfail  never pass
 test-armhf-armhf-xl-multivcpu 16 saverestore-support-checkfail  never pass
 test-armhf-armhf-xl-arndale  15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-arndale  16 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl  15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl  16 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt-raw 14 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-vhd  14 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-vhd  15 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt-qcow2 14 migrate-support-checkfail never pass

version targeted for testing:
 linux26291c54e111ff6ba87a164d85d4a4e134b7315c
baseline version:
 linux8dd71685dcb7839f6d91417e0a9237daca363908

Last test of basis   167954  2022-01-30 09:39:43 Z0 days
Testing same since   167958  2022-01-30 17:39:44 Z0 days1 attempts


People who touched revisions under test:

[PATCH v6 19/21] ACPI: power: Switch to sys-off handler API

2022-01-30 Thread Dmitry Osipenko
Switch to sys-off API that replaces legacy pm_power_off callbacks.

Signed-off-by: Dmitry Osipenko 
---
 drivers/acpi/sleep.c | 25 +++--
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index a60ff5dfed3a..e27ac5b4645b 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -47,19 +47,11 @@ static void acpi_sleep_tts_switch(u32 acpi_state)
}
 }
 
-static int tts_notify_reboot(struct notifier_block *this,
-   unsigned long code, void *x)
+static void tts_reboot_prepare(struct reboot_prep_data *data)
 {
acpi_sleep_tts_switch(ACPI_STATE_S5);
-   return NOTIFY_DONE;
 }
 
-static struct notifier_block tts_notifier = {
-   .notifier_call  = tts_notify_reboot,
-   .next   = NULL,
-   .priority   = 0,
-};
-
 static int acpi_sleep_prepare(u32 acpi_state)
 {
 #ifdef CONFIG_ACPI_SLEEP
@@ -1031,7 +1023,7 @@ static void acpi_sleep_hibernate_setup(void)
 static inline void acpi_sleep_hibernate_setup(void) {}
 #endif /* !CONFIG_HIBERNATION */
 
-static void acpi_power_off_prepare(void)
+static void acpi_power_off_prepare(struct power_off_prep_data *data)
 {
/* Prepare to power off the system */
acpi_sleep_prepare(ACPI_STATE_S5);
@@ -1039,7 +1031,7 @@ static void acpi_power_off_prepare(void)
acpi_os_wait_events_complete();
 }
 
-static void acpi_power_off(void)
+static void acpi_power_off(struct power_off_data *data)
 {
/* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
pr_debug("%s called\n", __func__);
@@ -1047,6 +1039,11 @@ static void acpi_power_off(void)
acpi_enter_sleep_state(ACPI_STATE_S5);
 }
 
+static struct sys_off_handler acpi_sys_off_handler = {
+   .power_off_priority = POWEROFF_PRIO_FIRMWARE,
+   .reboot_prepare_cb = tts_reboot_prepare,
+};
+
 int __init acpi_sleep_init(void)
 {
char supported[ACPI_S_STATE_COUNT * 3 + 1];
@@ -1063,8 +1060,8 @@ int __init acpi_sleep_init(void)
 
if (acpi_sleep_state_supported(ACPI_STATE_S5)) {
sleep_states[ACPI_STATE_S5] = 1;
-   pm_power_off_prepare = acpi_power_off_prepare;
-   pm_power_off = acpi_power_off;
+   acpi_sys_off_handler.power_off_cb = acpi_power_off;
+   acpi_sys_off_handler.power_off_prepare_cb = 
acpi_power_off_prepare;
} else {
acpi_no_s5 = true;
}
@@ -1080,6 +1077,6 @@ int __init acpi_sleep_init(void)
 * Register the tts_notifier to reboot notifier list so that the _TTS
 * object can also be evaluated when the system enters S5.
 */
-   register_reboot_notifier(_notifier);
+   register_sys_off_handler(_sys_off_handler);
return 0;
 }
-- 
2.34.1




[PATCH v6 20/21] regulator: pfuze100: Use devm_register_sys_off_handler()

2022-01-30 Thread Dmitry Osipenko
Use devm_register_sys_off_handler() that replaces global
pm_power_off_prepare variable and allows to register multiple
power-off handlers.

Acked-by: Mark Brown 
Signed-off-by: Dmitry Osipenko 
---
 drivers/regulator/pfuze100-regulator.c | 38 ++
 1 file changed, 14 insertions(+), 24 deletions(-)

diff --git a/drivers/regulator/pfuze100-regulator.c 
b/drivers/regulator/pfuze100-regulator.c
index d60d7d1b7fa2..2eca8d43a097 100644
--- a/drivers/regulator/pfuze100-regulator.c
+++ b/drivers/regulator/pfuze100-regulator.c
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -76,6 +77,7 @@ struct pfuze_chip {
struct pfuze_regulator regulator_descs[PFUZE100_MAX_REGULATOR];
struct regulator_dev *regulators[PFUZE100_MAX_REGULATOR];
struct pfuze_regulator *pfuze_regulators;
+   struct sys_off_handler sys_off;
 };
 
 static const int pfuze100_swbst[] = {
@@ -569,10 +571,10 @@ static inline struct device_node *match_of_node(int index)
return pfuze_matches[index].of_node;
 }
 
-static struct pfuze_chip *syspm_pfuze_chip;
-
-static void pfuze_power_off_prepare(void)
+static void pfuze_power_off_prepare(struct power_off_prep_data *data)
 {
+   struct pfuze_chip *syspm_pfuze_chip = data->cb_data;
+
dev_info(syspm_pfuze_chip->dev, "Configure standby mode for power off");
 
/* Switch from default mode: APS/APS to APS/Off */
@@ -611,24 +613,23 @@ static void pfuze_power_off_prepare(void)
 
 static int pfuze_power_off_prepare_init(struct pfuze_chip *pfuze_chip)
 {
+   int err;
+
if (pfuze_chip->chip_id != PFUZE100) {
dev_warn(pfuze_chip->dev, "Requested pm_power_off_prepare 
handler for not supported chip\n");
return -ENODEV;
}
 
-   if (pm_power_off_prepare) {
-   dev_warn(pfuze_chip->dev, "pm_power_off_prepare is already 
registered.\n");
-   return -EBUSY;
-   }
+   pfuze_chip->sys_off.power_off_prepare_cb = pfuze_power_off_prepare;
+   pfuze_chip->sys_off.cb_data = pfuze_chip;
 
-   if (syspm_pfuze_chip) {
-   dev_warn(pfuze_chip->dev, "syspm_pfuze_chip is already set.\n");
-   return -EBUSY;
+   err = devm_register_sys_off_handler(pfuze_chip->dev, 
_chip->sys_off);
+   if (err) {
+   dev_err(pfuze_chip->dev,
+   "failed to register sys-off handler: %d\n", err);
+   return err;
}
 
-   syspm_pfuze_chip = pfuze_chip;
-   pm_power_off_prepare = pfuze_power_off_prepare;
-
return 0;
 }
 
@@ -837,23 +838,12 @@ static int pfuze100_regulator_probe(struct i2c_client 
*client,
return 0;
 }
 
-static int pfuze100_regulator_remove(struct i2c_client *client)
-{
-   if (syspm_pfuze_chip) {
-   syspm_pfuze_chip = NULL;
-   pm_power_off_prepare = NULL;
-   }
-
-   return 0;
-}
-
 static struct i2c_driver pfuze_driver = {
.driver = {
.name = "pfuze100-regulator",
.of_match_table = pfuze_dt_ids,
},
.probe = pfuze100_regulator_probe,
-   .remove = pfuze100_regulator_remove,
 };
 module_i2c_driver(pfuze_driver);
 
-- 
2.34.1




[PATCH v6 21/21] reboot: Remove pm_power_off_prepare()

2022-01-30 Thread Dmitry Osipenko
All pm_power_off_prepare() users were converted to sys-off handler API.
Remove the obsolete callback.

Signed-off-by: Dmitry Osipenko 
---
 include/linux/pm.h |  1 -
 kernel/reboot.c| 11 ---
 2 files changed, 12 deletions(-)

diff --git a/include/linux/pm.h b/include/linux/pm.h
index f7d2be686359..62879bfc4b8e 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -21,7 +21,6 @@
  * Callbacks for platform drivers to implement.
  */
 extern void (*pm_power_off)(void);
-extern void (*pm_power_off_prepare)(void);
 
 struct device; /* we have a circular dep with device.h */
 #ifdef CONFIG_VT_CONSOLE_SLEEP
diff --git a/kernel/reboot.c b/kernel/reboot.c
index 1ae5ba86b150..6e0d4deda987 100644
--- a/kernel/reboot.c
+++ b/kernel/reboot.c
@@ -48,13 +48,6 @@ int reboot_cpu;
 enum reboot_type reboot_type = BOOT_ACPI;
 int reboot_force;
 
-/*
- * If set, this is used for preparing the system to power off.
- */
-
-void (*pm_power_off_prepare)(void);
-EXPORT_SYMBOL_GPL(pm_power_off_prepare);
-
 /**
  * emergency_restart - reboot the system
  *
@@ -828,10 +821,6 @@ void do_kernel_power_off(void)
 
 static void do_kernel_power_off_prepare(void)
 {
-   /* legacy pm_power_off_prepare() is unchained and has highest priority 
*/
-   if (pm_power_off_prepare)
-   return pm_power_off_prepare();
-
blocking_notifier_call_chain(_off_handler_list, POWEROFF_PREPARE,
 NULL);
 }
-- 
2.34.1




[PATCH v6 16/21] mips: Use do_kernel_power_off()

2022-01-30 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off()
that invokes chained power-off handlers. It also invokes legacy
pm_power_off() for now, which will be removed once all drivers will
be converted to the new power-off API.

Signed-off-by: Dmitry Osipenko 
---
 arch/mips/kernel/reset.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/mips/kernel/reset.c b/arch/mips/kernel/reset.c
index 6288780b779e..e7ce07b3e79b 100644
--- a/arch/mips/kernel/reset.c
+++ b/arch/mips/kernel/reset.c
@@ -114,8 +114,7 @@ void machine_halt(void)
 
 void machine_power_off(void)
 {
-   if (pm_power_off)
-   pm_power_off();
+   do_kernel_power_off();
 
 #ifdef CONFIG_SMP
preempt_disable();
-- 
2.34.1




[PATCH v6 17/21] nds32: Use do_kernel_power_off()

2022-01-30 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off()
that invokes chained power-off handlers. It also invokes legacy
pm_power_off() for now, which will be removed once all drivers will
be converted to the new power-off API.

Signed-off-by: Dmitry Osipenko 
---
 arch/nds32/kernel/process.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/nds32/kernel/process.c b/arch/nds32/kernel/process.c
index 49fab9e39cbf..0936dcd7db1b 100644
--- a/arch/nds32/kernel/process.c
+++ b/arch/nds32/kernel/process.c
@@ -54,8 +54,7 @@ EXPORT_SYMBOL(machine_halt);
 
 void machine_power_off(void)
 {
-   if (pm_power_off)
-   pm_power_off();
+   do_kernel_power_off();
 }
 
 EXPORT_SYMBOL(machine_power_off);
-- 
2.34.1




[PATCH v6 18/21] memory: emif: Use kernel_can_power_off()

2022-01-30 Thread Dmitry Osipenko
Replace legacy pm_power_off with kernel_can_power_off() helper that
is aware about chained power-off handlers.

Signed-off-by: Dmitry Osipenko 
---
 drivers/memory/emif.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/memory/emif.c b/drivers/memory/emif.c
index 762d0c0f0716..cab10d5274a0 100644
--- a/drivers/memory/emif.c
+++ b/drivers/memory/emif.c
@@ -630,7 +630,7 @@ static irqreturn_t emif_threaded_isr(int irq, void *dev_id)
dev_emerg(emif->dev, "SDRAM temperature exceeds operating 
limit.. Needs shut down!!!\n");
 
/* If we have Power OFF ability, use it, else try restarting */
-   if (pm_power_off) {
+   if (kernel_can_power_off()) {
kernel_power_off();
} else {
WARN(1, "FIXME: NO pm_power_off!!! trying restart\n");
-- 
2.34.1




[PATCH v6 15/21] ia64: Use do_kernel_power_off()

2022-01-30 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off()
that invokes chained power-off handlers. It also invokes legacy
pm_power_off() for now, which will be removed once all drivers will
be converted to the new power-off API.

Signed-off-by: Dmitry Osipenko 
---
 arch/ia64/kernel/process.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index 834df24a88f1..cee4d7db2143 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -599,8 +600,7 @@ machine_halt (void)
 void
 machine_power_off (void)
 {
-   if (pm_power_off)
-   pm_power_off();
+   do_kernel_power_off();
machine_halt();
 }
 
-- 
2.34.1




[PATCH v6 14/21] x86: Use do_kernel_power_off()

2022-01-30 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off()
that invokes chained power-off handlers. It also invokes legacy
pm_power_off() for now, which will be removed once all drivers will
be converted to the new power-off API.

Signed-off-by: Dmitry Osipenko 
---
 arch/x86/kernel/reboot.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index fa700b46588e..c3636ea4aa71 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -739,10 +739,10 @@ static void native_machine_halt(void)
 
 static void native_machine_power_off(void)
 {
-   if (pm_power_off) {
+   if (kernel_can_power_off()) {
if (!reboot_force)
machine_shutdown();
-   pm_power_off();
+   do_kernel_power_off();
}
/* A fallback in case there is no PM info available */
tboot_shutdown(TB_SHUTDOWN_HALT);
-- 
2.34.1




[PATCH v6 13/21] sh: Use do_kernel_power_off()

2022-01-30 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off()
that invokes chained power-off handlers. It also invokes legacy
pm_power_off() for now, which will be removed once all drivers will
be converted to the new power-off API.

Signed-off-by: Dmitry Osipenko 
---
 arch/sh/kernel/reboot.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/sh/kernel/reboot.c b/arch/sh/kernel/reboot.c
index 5c33f036418b..e8eeedc9b182 100644
--- a/arch/sh/kernel/reboot.c
+++ b/arch/sh/kernel/reboot.c
@@ -46,8 +46,7 @@ static void native_machine_shutdown(void)
 
 static void native_machine_power_off(void)
 {
-   if (pm_power_off)
-   pm_power_off();
+   do_kernel_power_off();
 }
 
 static void native_machine_halt(void)
-- 
2.34.1




[PATCH v6 12/21] m68k: Switch to new sys-off handler API

2022-01-30 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use
register_power_off_handler() that registers power-off handlers and
do_kernel_power_off() that invokes chained power-off handlers. Legacy
pm_power_off() will be removed once all drivers will be converted to
the new power-off API.

Normally arch code should adopt only the do_kernel_power_off() at first,
but m68k is a special case because it uses pm_power_off() "inside out",
i.e. pm_power_off() invokes machine_power_off() [in fact it does nothing],
while it's machine_power_off() that should invoke the pm_power_off(), and
thus, we can't convert platforms to the new API separately. There are only
two platforms changed here, so it's not a big deal.

Acked-by: Geert Uytterhoeven 
Signed-off-by: Dmitry Osipenko 
---
 arch/m68k/emu/natfeat.c | 3 ++-
 arch/m68k/include/asm/machdep.h | 1 -
 arch/m68k/kernel/process.c  | 5 ++---
 arch/m68k/kernel/setup_mm.c | 1 -
 arch/m68k/kernel/setup_no.c | 1 -
 arch/m68k/mac/config.c  | 4 +++-
 6 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/arch/m68k/emu/natfeat.c b/arch/m68k/emu/natfeat.c
index 71b78ecee75c..b19dc00026d9 100644
--- a/arch/m68k/emu/natfeat.c
+++ b/arch/m68k/emu/natfeat.c
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -90,5 +91,5 @@ void __init nf_init(void)
pr_info("NatFeats found (%s, %lu.%lu)\n", buf, version >> 16,
version & 0x);
 
-   mach_power_off = nf_poweroff;
+   register_platform_power_off(nf_poweroff);
 }
diff --git a/arch/m68k/include/asm/machdep.h b/arch/m68k/include/asm/machdep.h
index 8fd80ef1b77e..8d8c3ee2069f 100644
--- a/arch/m68k/include/asm/machdep.h
+++ b/arch/m68k/include/asm/machdep.h
@@ -24,7 +24,6 @@ extern int (*mach_get_rtc_pll)(struct rtc_pll_info *);
 extern int (*mach_set_rtc_pll)(struct rtc_pll_info *);
 extern void (*mach_reset)( void );
 extern void (*mach_halt)( void );
-extern void (*mach_power_off)( void );
 extern unsigned long (*mach_hd_init) (unsigned long, unsigned long);
 extern void (*mach_hd_setup)(char *, int *);
 extern void (*mach_heartbeat) (int);
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
index a6030dbaa089..e160a7c57bd3 100644
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -67,12 +67,11 @@ void machine_halt(void)
 
 void machine_power_off(void)
 {
-   if (mach_power_off)
-   mach_power_off();
+   do_kernel_power_off();
for (;;);
 }
 
-void (*pm_power_off)(void) = machine_power_off;
+void (*pm_power_off)(void);
 EXPORT_SYMBOL(pm_power_off);
 
 void show_regs(struct pt_regs * regs)
diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
index 8f94feed969c..47d55541612f 100644
--- a/arch/m68k/kernel/setup_mm.c
+++ b/arch/m68k/kernel/setup_mm.c
@@ -98,7 +98,6 @@ EXPORT_SYMBOL(mach_get_rtc_pll);
 EXPORT_SYMBOL(mach_set_rtc_pll);
 void (*mach_reset)( void );
 void (*mach_halt)( void );
-void (*mach_power_off)( void );
 #ifdef CONFIG_HEARTBEAT
 void (*mach_heartbeat) (int);
 EXPORT_SYMBOL(mach_heartbeat);
diff --git a/arch/m68k/kernel/setup_no.c b/arch/m68k/kernel/setup_no.c
index 5e4104f07a44..00bf82258233 100644
--- a/arch/m68k/kernel/setup_no.c
+++ b/arch/m68k/kernel/setup_no.c
@@ -55,7 +55,6 @@ int (*mach_hwclk) (int, struct rtc_time*);
 /* machine dependent reboot functions */
 void (*mach_reset)(void);
 void (*mach_halt)(void);
-void (*mach_power_off)(void);
 
 #ifdef CONFIG_M68000
 #if defined(CONFIG_M68328)
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c
index 65d124ec80bb..382f656c29ea 100644
--- a/arch/m68k/mac/config.c
+++ b/arch/m68k/mac/config.c
@@ -12,6 +12,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -140,7 +141,6 @@ void __init config_mac(void)
mach_hwclk = mac_hwclk;
mach_reset = mac_reset;
mach_halt = mac_poweroff;
-   mach_power_off = mac_poweroff;
 #if IS_ENABLED(CONFIG_INPUT_M68K_BEEP)
mach_beep = mac_mksound;
 #endif
@@ -160,6 +160,8 @@ void __init config_mac(void)
 
if (macintosh_config->ident == MAC_MODEL_IICI)
mach_l2_flush = via_l2_flush;
+
+   register_platform_power_off(mac_poweroff);
 }
 
 
-- 
2.34.1




[PATCH v6 11/21] powerpc: Use do_kernel_power_off()

2022-01-30 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off()
that invokes chained power-off handlers. It also invokes legacy
pm_power_off() for now, which will be removed once all drivers will
be converted to the new power-off API.

Acked-by: Michael Ellerman 
Signed-off-by: Dmitry Osipenko 
---
 arch/powerpc/kernel/setup-common.c | 4 +---
 arch/powerpc/xmon/xmon.c   | 3 +--
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/kernel/setup-common.c 
b/arch/powerpc/kernel/setup-common.c
index f8da937df918..8158e940db81 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -161,9 +161,7 @@ void machine_restart(char *cmd)
 void machine_power_off(void)
 {
machine_shutdown();
-   if (pm_power_off)
-   pm_power_off();
-
+   do_kernel_power_off();
smp_send_stop();
machine_hang();
 }
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index fd72753e8ad5..c916bf250796 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -1243,8 +1243,7 @@ static void bootcmds(void)
} else if (cmd == 'h') {
ppc_md.halt();
} else if (cmd == 'p') {
-   if (pm_power_off)
-   pm_power_off();
+   do_kernel_power_off();
}
 }
 
-- 
2.34.1




[PATCH v6 10/21] xen/x86: Use do_kernel_power_off()

2022-01-30 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off()
that invokes chained power-off handlers. It also invokes legacy
pm_power_off() for now, which will be removed once all drivers will
be converted to the new power-off API.

Acked-by: Juergen Gross 
Signed-off-by: Dmitry Osipenko 
---
 arch/x86/xen/enlighten_pv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c
index 5004feb16783..527fa545eb1f 100644
--- a/arch/x86/xen/enlighten_pv.c
+++ b/arch/x86/xen/enlighten_pv.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1068,8 +1069,7 @@ static void xen_machine_halt(void)
 
 static void xen_machine_power_off(void)
 {
-   if (pm_power_off)
-   pm_power_off();
+   do_kernel_power_off();
xen_reboot(SHUTDOWN_poweroff);
 }
 
-- 
2.34.1




[PATCH v6 09/21] parisc: Use do_kernel_power_off()

2022-01-30 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off()
that invokes chained power-off handlers. It also invokes legacy
pm_power_off() for now, which will be removed once all drivers will
be converted to the new power-off API.

Acked-by: Helge Deller  # parisc
Signed-off-by: Dmitry Osipenko 
---
 arch/parisc/kernel/process.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
index ea3d83b6fb62..928201b1f58f 100644
--- a/arch/parisc/kernel/process.c
+++ b/arch/parisc/kernel/process.c
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -114,8 +115,7 @@ void machine_power_off(void)
pdc_chassis_send_status(PDC_CHASSIS_DIRECT_SHUTDOWN);
 
/* ipmi_poweroff may have been installed. */
-   if (pm_power_off)
-   pm_power_off();
+   do_kernel_power_off();

/* It seems we have no way to power the system off via
 * software. The user has to press the button himself. */
-- 
2.34.1




[PATCH v6 08/21] arm64: Use do_kernel_power_off()

2022-01-30 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off()
that invokes chained power-off handlers. It also invokes legacy
pm_power_off() for now, which will be removed once all drivers will
be converted to the new power-off API.

Acked-by: Catalin Marinas 
Signed-off-by: Dmitry Osipenko 
---
 arch/arm64/kernel/process.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
index 5369e649fa79..6816a23bacc2 100644
--- a/arch/arm64/kernel/process.c
+++ b/arch/arm64/kernel/process.c
@@ -111,8 +111,7 @@ void machine_power_off(void)
 {
local_irq_disable();
smp_send_stop();
-   if (pm_power_off)
-   pm_power_off();
+   do_kernel_power_off();
 }
 
 /*
-- 
2.34.1




[PATCH v6 07/21] riscv: Use do_kernel_power_off()

2022-01-30 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off()
that invokes chained power-off handlers. It also invokes legacy
pm_power_off() for now, which will be removed once all drivers will
be converted to the new power-off API.

Acked-by: Palmer Dabbelt 
Signed-off-by: Dmitry Osipenko 
---
 arch/riscv/kernel/reset.c | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/arch/riscv/kernel/reset.c b/arch/riscv/kernel/reset.c
index 9c842c41684a..912288572226 100644
--- a/arch/riscv/kernel/reset.c
+++ b/arch/riscv/kernel/reset.c
@@ -23,16 +23,12 @@ void machine_restart(char *cmd)
 
 void machine_halt(void)
 {
-   if (pm_power_off != NULL)
-   pm_power_off();
-   else
-   default_power_off();
+   do_kernel_power_off();
+   default_power_off();
 }
 
 void machine_power_off(void)
 {
-   if (pm_power_off != NULL)
-   pm_power_off();
-   else
-   default_power_off();
+   do_kernel_power_off();
+   default_power_off();
 }
-- 
2.34.1




[PATCH v6 06/21] csky: Use do_kernel_power_off()

2022-01-30 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off()
that invokes chained power-off handlers. It also invokes legacy
pm_power_off() for now, which will be removed once all drivers will
be converted to the new power-off API.

Acked-by: Guo Ren 
Signed-off-by: Dmitry Osipenko 
---
 arch/csky/kernel/power.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/csky/kernel/power.c b/arch/csky/kernel/power.c
index 923ee4e381b8..86ee202906f8 100644
--- a/arch/csky/kernel/power.c
+++ b/arch/csky/kernel/power.c
@@ -9,16 +9,14 @@ EXPORT_SYMBOL(pm_power_off);
 void machine_power_off(void)
 {
local_irq_disable();
-   if (pm_power_off)
-   pm_power_off();
+   do_kernel_power_off();
asm volatile ("bkpt");
 }
 
 void machine_halt(void)
 {
local_irq_disable();
-   if (pm_power_off)
-   pm_power_off();
+   do_kernel_power_off();
asm volatile ("bkpt");
 }
 
-- 
2.34.1




[PATCH v6 04/21] kernel: Add combined power-off+restart handler call chain API

2022-01-30 Thread Dmitry Osipenko
SoC platforms often have multiple ways of how to perform system's
power-off and restart operations. Meanwhile today's kernel is limited to
a single option. Add combined power-off+restart handler call chain API,
which is inspired by the restart API. The new API provides both power-off
and restart functionality.

The old pm_power_off method will be kept around till all users are
converted to the new API.

Current restart API will be replaced by the new unified API since
new API is its superset. The restart functionality of the sys-off handler
API is built upon the existing restart-notifier APIs.

In order to ease conversion to the new API, convenient helpers are added
for the common use-cases. They will reduce amount of boilerplate code and
remove global variables. These helpers preserve old behaviour for cases
where only one power-off handler is expected, this is what all existing
drivers want, and thus, they could be easily converted to the new API.
Users of the new API should explicitly enable power-off chaining by
setting corresponding flag of the power_handler structure.

Signed-off-by: Dmitry Osipenko 
---
 include/linux/reboot.h   | 265 ++-
 kernel/power/hibernate.c |   2 +-
 kernel/reboot.c  | 555 ++-
 3 files changed, 814 insertions(+), 8 deletions(-)

diff --git a/include/linux/reboot.h b/include/linux/reboot.h
index af907a3d68d1..c2fa8d63c129 100644
--- a/include/linux/reboot.h
+++ b/include/linux/reboot.h
@@ -8,10 +8,35 @@
 
 struct device;
 
-#define SYS_DOWN   0x0001  /* Notify of system down */
-#define SYS_RESTARTSYS_DOWN
-#define SYS_HALT   0x0002  /* Notify of system halt */
-#define SYS_POWER_OFF  0x0003  /* Notify of system power off */
+enum reboot_prepare_mode {
+   SYS_DOWN = 1,   /* Notify of system down */
+   SYS_RESTART = SYS_DOWN,
+   SYS_HALT,   /* Notify of system halt */
+   SYS_POWER_OFF,  /* Notify of system power off */
+};
+
+/*
+ * Standard restart priority levels. Intended to be set in the
+ * sys_off_handler.restart_priority field.
+ *
+ * Use `RESTART_PRIO_ABC +- prio` style for additional levels.
+ *
+ * RESTART_PRIO_RESERVED:  Falls back to RESTART_PRIO_DEFAULT.
+ * Drivers may leave priority initialized
+ * to zero, to auto-set it to the default level.
+ *
+ * RESTART_PRIO_LOW:   Use this for handler of last resort.
+ *
+ * RESTART_PRIO_DEFAULT:   Use this for default/generic handler.
+ *
+ * RESTART_PRIO_HIGH:  Use this if you have multiple handlers and
+ * this handler has higher priority than the
+ * default handler.
+ */
+#define RESTART_PRIO_RESERVED  0
+#define RESTART_PRIO_LOW   8
+#define RESTART_PRIO_DEFAULT   128
+#define RESTART_PRIO_HIGH  192
 
 enum reboot_mode {
REBOOT_UNDEFINED = -1,
@@ -49,6 +74,237 @@ extern int register_restart_handler(struct notifier_block 
*);
 extern int unregister_restart_handler(struct notifier_block *);
 extern void do_kernel_restart(char *cmd);
 
+/*
+ * System power-off and restart API.
+ */
+
+/*
+ * Standard power-off priority levels. Intended to be set in the
+ * sys_off_handler.power_off_priority field.
+ *
+ * Use `POWEROFF_PRIO_ABC +- prio` style for additional levels.
+ *
+ * POWEROFF_PRIO_RESERVED: Falls back to POWEROFF_PRIO_DEFAULT.
+ * Drivers may leave priority initialized
+ * to zero, to auto-set it to the default level.
+ *
+ * POWEROFF_PRIO_PLATFORM: Intended to be used by platform-level handler.
+ * Has lowest priority since device drivers are
+ * expected to take over platform handler which
+ * doesn't allow further callback chaining.
+ *
+ * POWEROFF_PRIO_DEFAULT:  Use this for default/generic handler.
+ *
+ * POWEROFF_PRIO_FIRMWARE: Use this if handler uses firmware call.
+ * Has highest priority since firmware is expected
+ * to know best how to power-off hardware properly.
+ */
+#define POWEROFF_PRIO_RESERVED 0
+#define POWEROFF_PRIO_PLATFORM 1
+#define POWEROFF_PRIO_DEFAULT  128
+#define POWEROFF_PRIO_HIGH 192
+#define POWEROFF_PRIO_FIRMWARE 224
+
+enum poweroff_mode {
+   POWEROFF_NORMAL = 0,
+   POWEROFF_PREPARE,
+};
+
+/**
+ * struct power_off_data - Power-off callback argument
+ *
+ * @cb_data: Callback data.
+ */
+struct power_off_data {
+   void *cb_data;
+};
+
+/**
+ * struct power_off_prep_data - Power-off preparation callback argument
+ *
+ * @cb_data: Callback data.
+ */
+struct power_off_prep_data {
+   void *cb_data;
+};
+
+/**
+ * struct restart_data - Restart callback argument
+ *
+ * @cb_data: Callback data.
+ * @cmd: Restart 

[PATCH v6 05/21] ARM: Use do_kernel_power_off()

2022-01-30 Thread Dmitry Osipenko
Kernel now supports chained power-off handlers. Use do_kernel_power_off()
that invokes chained power-off handlers. It also invokes legacy
pm_power_off() for now, which will be removed once all drivers will
be converted to the new power-off API.

Reviewed-by: Russell King (Oracle) 
Signed-off-by: Dmitry Osipenko 
---
 arch/arm/kernel/reboot.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/arm/kernel/reboot.c b/arch/arm/kernel/reboot.c
index 3044fcb8d073..2cb943422554 100644
--- a/arch/arm/kernel/reboot.c
+++ b/arch/arm/kernel/reboot.c
@@ -116,9 +116,7 @@ void machine_power_off(void)
 {
local_irq_disable();
smp_send_stop();
-
-   if (pm_power_off)
-   pm_power_off();
+   do_kernel_power_off();
 }
 
 /*
-- 
2.34.1




[PATCH v6 03/21] reboot: Print error message if restart handler has duplicated priority

2022-01-30 Thread Dmitry Osipenko
Add sanity check which ensures that there are no two restart handlers
registered using the same priority. This requirement will become mandatory
once all drivers will be converted to the new API and such errors will be
fixed.

Signed-off-by: Dmitry Osipenko 
---
 kernel/reboot.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/kernel/reboot.c b/kernel/reboot.c
index 6bcc5d6a6572..35f0cde641c1 100644
--- a/kernel/reboot.c
+++ b/kernel/reboot.c
@@ -182,6 +182,21 @@ static ATOMIC_NOTIFIER_HEAD(restart_handler_list);
  */
 int register_restart_handler(struct notifier_block *nb)
 {
+   int ret;
+
+   ret = atomic_notifier_chain_register_unique_prio(_handler_list, 
nb);
+   if (ret != -EBUSY)
+   return ret;
+
+   /*
+* Handler must have unique priority. Otherwise call order is
+* determined by registration order, which is unreliable.
+*
+* This requirement will become mandatory once all drivers
+* will be converted to use new sys-off API.
+*/
+   pr_err("failed to register restart handler using unique priority\n");
+
return atomic_notifier_chain_register(_handler_list, nb);
 }
 EXPORT_SYMBOL(register_restart_handler);
-- 
2.34.1




[PATCH v6 01/21] notifier: Add blocking_notifier_call_chain_is_empty()

2022-01-30 Thread Dmitry Osipenko
Add blocking_notifier_call_chain_is_empty() that returns true if call
chain is empty.

Signed-off-by: Dmitry Osipenko 
---
 include/linux/notifier.h |  2 ++
 kernel/notifier.c| 13 +
 2 files changed, 15 insertions(+)

diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 87069b8459af..d4717bc0ab85 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -173,6 +173,8 @@ extern int blocking_notifier_call_chain_robust(struct 
blocking_notifier_head *nh
 extern int raw_notifier_call_chain_robust(struct raw_notifier_head *nh,
unsigned long val_up, unsigned long val_down, void *v);
 
+extern bool blocking_notifier_call_chain_is_empty(struct 
blocking_notifier_head *nh);
+
 #define NOTIFY_DONE0x  /* Don't care */
 #define NOTIFY_OK  0x0001  /* Suits me */
 #define NOTIFY_STOP_MASK   0x8000  /* Don't call further */
diff --git a/kernel/notifier.c b/kernel/notifier.c
index ba005ebf4730..4ed6bda8f127 100644
--- a/kernel/notifier.c
+++ b/kernel/notifier.c
@@ -323,6 +323,19 @@ int blocking_notifier_call_chain(struct 
blocking_notifier_head *nh,
 }
 EXPORT_SYMBOL_GPL(blocking_notifier_call_chain);
 
+/**
+ * blocking_notifier_call_chain_is_empty - Check whether notifier chain is 
empty
+ * @nh: Pointer to head of the blocking notifier chain
+ *
+ * Checks whether notifier chain is empty.
+ *
+ * Returns true is notifier chain is empty, false otherwise.
+ */
+bool blocking_notifier_call_chain_is_empty(struct blocking_notifier_head *nh)
+{
+   return !rcu_access_pointer(nh->head);
+}
+
 /*
  * Raw notifier chain routines.  There is no protection;
  * the caller must provide it.  Use at your own risk!
-- 
2.34.1




[PATCH v6 00/21] Introduce power-off+restart call chain API

2022-01-30 Thread Dmitry Osipenko
Problem
---

SoC devices require power-off call chaining functionality from kernel.
We have a widely used restart chaining provided by restart notifier API,
but nothing for power-off.

Solution


Introduce new API that provides both restart and power-off call chains.

Why combine restart with power-off? Because drivers often do both.
More practical to have API that provides both under the same roof.

The new API is designed with simplicity and extensibility in mind.
It's built upon the existing restart and reboot APIs. The simplicity
is in new helper functions that are convenient for drivers. The
extensibility is in the design that doesn't hardcode callback
arguments, making easy to add new parameters and remove old.

This is a third attempt to introduce the new API. First was made by
Guenter Roeck back in 2014, second was made by Thierry Reding in 2017.
In fact the work didn't stop and recently arm_pm_restart() was removed
from v5.14 kernel, which was a part of preparatory work started by
Guenter Roeck. I took into account experience and ideas from the
previous attempts, extended and polished them.

Adoption plan
-

This patchset introduces the new API. It also converts multiple drivers
and arch code to the new API to demonstrate how it all looks in practice.

The plan is:

1. Merge new API (patches 1-8). This API will co-exist with the old APIs.

2. Convert arch code to do_kernel_power_off() (patches 9-21).

3. Convert drivers and platform code to the new API.

4. Remove obsolete pm_power_off and pm_power_off_prepare variables.

5. Make restart-notifier API private to kernel/reboot.c once no users left.

6. Make uniqueness of the handlers' priority a mandatory requirement.

It's fully implemented here:

[1] https://github.com/grate-driver/linux/commits/sys-off-handler

For now I'm sending only the first 25 base patches out of ~180. It's
preferable to squash 1-2, partially 3 and 4 points of the plan into a
single patchset to ease and speed up applying of the rest of the patches.
Majority of drivers and platform patches depend on the base, hence they
will come later (and per subsystem), once base will land.

All [1] patches are compile-tested. Tegra and x86 ACPI patches are tested
on hardware. The remaining should be covered by unit tests (unpublished).

Results
---

1. Devices can be powered off properly.

2. Global variables are removed from drivers.

3. Global pm_power_off and pm_power_off_prepare callback variables are
removed once all users are converted to the new API. The latter callback
is removed by patch #25 of this series.

4. Ambiguous call chain ordering is prohibited. See patch #5 which adds
verification of restart handlers priorities, ensuring that they are unique.

Changelog:

v6: - Rebased on a recent linux-next.

- Made minor couple cosmetic changes.

v5: - Dropped patches which cleaned up notifier/reboot headers, as was
  requested by Rafael Wysocki.

- Dropped WARN_ON() from the code, as was requested by Rafael Wysocki.
  Replaced it with pr_err() appropriately.

- Dropped *_notifier_has_unique_priority() functions and added
  *_notifier_chain_register_unique_prio() instead, as was suggested
  by Michał Mirosław and Rafael Wysocki.

- Dropped export of blocking_notifier_call_chain_is_empty() symbol,
  as was suggested by Rafael Wysocki.

- Michał Mirosław suggested that will be better to split up patch
  that adds the new API to ease reviewing, but Rafael Wysocki asked
  not add more patches, so I kept it as a single patch.

- Added temporary "weak" stub for pm_power_off() which fixes linkage
  failure once symbol is removed from arch/* code. Previously I missed
  this problem because was only compile-testing object files.

v4: - Made a very minor improvement to doc comments, clarifying couple
  default values.

- Corrected list of emails recipient by adding Linus, Sebastian,
  Philipp and more NDS people. Removed bouncing emails.

- Added acks that were given to v3.

v3: - Renamed power_handler to sys_off_handler as was suggested by
  Rafael Wysocki.

- Improved doc-comments as was suggested by Rafael Wysocki. Added more
  doc-comments.

- Implemented full set of 180 patches which convert whole kernel in
  accordance to the plan, see link [1] above. Slightly adjusted API to
  better suit for the remaining converted drivers.

  * Added unregister_sys_off_handler() that is handy for a couple old
platform drivers.

  * Dropped devm_register_trivial_restart_handler(), 'simple' variant
is enough to have.

- Improved "Add atomic/blocking_notifier_has_unique_priority()" patch,
  as was suggested by Andy Shevchenko. Also replaced down_write() with
  down_read() and factored out common notifier_has_unique_priority().

- Added stop_chain field to struct restart_data and reboot_prep_data
  after discovering couple drivers 

[PATCH v6 02/21] notifier: Add atomic/blocking_notifier_chain_register_unique_prio()

2022-01-30 Thread Dmitry Osipenko
Add variant of atomic/blocking_notifier_chain_register() functions that
doesn't allow to register notifier using a duplicated priority. The -EBUSY
error code is returned in this case by the new API functions.

Signed-off-by: Dmitry Osipenko 
---
 include/linux/notifier.h |  5 +++
 kernel/notifier.c| 88 +++-
 2 files changed, 74 insertions(+), 19 deletions(-)

diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index d4717bc0ab85..ccce26197dd2 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -150,6 +150,11 @@ extern int raw_notifier_chain_register(struct 
raw_notifier_head *nh,
 extern int srcu_notifier_chain_register(struct srcu_notifier_head *nh,
struct notifier_block *nb);
 
+extern int atomic_notifier_chain_register_unique_prio(
+   struct atomic_notifier_head *nh, struct notifier_block *nb);
+extern int blocking_notifier_chain_register_unique_prio(
+   struct blocking_notifier_head *nh, struct notifier_block *nb);
+
 extern int atomic_notifier_chain_unregister(struct atomic_notifier_head *nh,
struct notifier_block *nb);
 extern int blocking_notifier_chain_unregister(struct blocking_notifier_head 
*nh,
diff --git a/kernel/notifier.c b/kernel/notifier.c
index 4ed6bda8f127..4fc32b1e6cbb 100644
--- a/kernel/notifier.c
+++ b/kernel/notifier.c
@@ -20,7 +20,8 @@ BLOCKING_NOTIFIER_HEAD(reboot_notifier_list);
  */
 
 static int notifier_chain_register(struct notifier_block **nl,
-  struct notifier_block *n)
+  struct notifier_block *n,
+  bool unique_priority)
 {
while ((*nl) != NULL) {
if (unlikely((*nl) == n)) {
@@ -30,6 +31,8 @@ static int notifier_chain_register(struct notifier_block **nl,
}
if (n->priority > (*nl)->priority)
break;
+   if (n->priority == (*nl)->priority && unique_priority)
+   return -EBUSY;
nl = &((*nl)->next);
}
n->next = *nl;
@@ -144,12 +147,35 @@ int atomic_notifier_chain_register(struct 
atomic_notifier_head *nh,
int ret;
 
spin_lock_irqsave(>lock, flags);
-   ret = notifier_chain_register(>head, n);
+   ret = notifier_chain_register(>head, n, false);
spin_unlock_irqrestore(>lock, flags);
return ret;
 }
 EXPORT_SYMBOL_GPL(atomic_notifier_chain_register);
 
+/**
+ * atomic_notifier_chain_register_unique_prio - Add notifier to an atomic 
notifier chain
+ * @nh: Pointer to head of the atomic notifier chain
+ * @n: New entry in notifier chain
+ *
+ * Adds a notifier to an atomic notifier chain if there is no other
+ * notifier registered using the same priority.
+ *
+ * Returns 0 on success, %-EEXIST or %-EBUSY on error.
+ */
+int atomic_notifier_chain_register_unique_prio(struct atomic_notifier_head *nh,
+  struct notifier_block *n)
+{
+   unsigned long flags;
+   int ret;
+
+   spin_lock_irqsave(>lock, flags);
+   ret = notifier_chain_register(>head, n, true);
+   spin_unlock_irqrestore(>lock, flags);
+   return ret;
+}
+EXPORT_SYMBOL_GPL(atomic_notifier_chain_register_unique_prio);
+
 /**
  * atomic_notifier_chain_unregister - Remove notifier from an atomic 
notifier chain
  * @nh: Pointer to head of the atomic notifier chain
@@ -209,18 +235,9 @@ NOKPROBE_SYMBOL(atomic_notifier_call_chain);
  * synchronized by an rwsem.
  */
 
-/**
- * blocking_notifier_chain_register - Add notifier to a blocking notifier 
chain
- * @nh: Pointer to head of the blocking notifier chain
- * @n: New entry in notifier chain
- *
- * Adds a notifier to a blocking notifier chain.
- * Must be called in process context.
- *
- * Returns 0 on success, %-EEXIST on error.
- */
-int blocking_notifier_chain_register(struct blocking_notifier_head *nh,
-   struct notifier_block *n)
+static int __blocking_notifier_chain_register(struct blocking_notifier_head 
*nh,
+ struct notifier_block *n,
+ bool unique_priority)
 {
int ret;
 
@@ -230,15 +247,48 @@ int blocking_notifier_chain_register(struct 
blocking_notifier_head *nh,
 * such times we must not call down_write().
 */
if (unlikely(system_state == SYSTEM_BOOTING))
-   return notifier_chain_register(>head, n);
+   return notifier_chain_register(>head, n, unique_priority);
 
down_write(>rwsem);
-   ret = notifier_chain_register(>head, n);
+   ret = notifier_chain_register(>head, n, unique_priority);
up_write(>rwsem);
return ret;
 }
+
+/**
+ * blocking_notifier_chain_register - Add notifier to a blocking notifier 
chain
+ * @nh: Pointer to head 

[PATCH] xen: update missing ioctl magic numers documentation

2022-01-30 Thread Randy Dunlap
Add missing ioctl "magic numbers" for various Xen interfaces
(xenbus_dev.h, gntalloc.h, gntdev.h, and privcmd.h).

Signed-off-by: Randy Dunlap 
Cc: Boris Ostrovsky 
Cc: Juergen Gross 
Cc: Stefano Stabellini 
Cc: xen-devel@lists.xenproject.org
---
 Documentation/userspace-api/ioctl/ioctl-number.rst |3 +++
 1 file changed, 3 insertions(+)

--- linux-next-20220128.orig/Documentation/userspace-api/ioctl/ioctl-number.rst
+++ linux-next-20220128/Documentation/userspace-api/ioctl/ioctl-number.rst
@@ -115,6 +115,7 @@ Code  Seq#Include File
 'B'   00-1F  linux/cciss_ioctl.h conflict!
 'B'   00-0F  include/linux/pmu.h conflict!
 'B'   C0-FF  advanced bbus   

+'B'   00-0F  xen/xenbus_dev.hconflict!
 'C'   alllinux/soundcard.h   conflict!
 'C'   01-2F  linux/capi.hconflict!
 'C'   F0-FF  drivers/net/wan/cosa.h  conflict!
@@ -134,6 +135,7 @@ Code  Seq#Include File
 'F'   80-8F  linux/arcfb.h   conflict!
 'F'   DD video/sstfb.h   conflict!
 'G'   00-3F  drivers/misc/sgi-gru/grulib.h   conflict!
+'E'   00-0F  xen/gntalloc.h, xen/gntdev.hconflict!
 'H'   00-7F  linux/hiddev.h  conflict!
 'H'   00-0F  linux/hidraw.h  conflict!
 'H'   01 linux/mei.h conflict!
@@ -176,6 +178,7 @@ Code  Seq#Include File
 'P'   60-6F  sound/sscape_ioctl.hconflict!
 'P'   00-0F  drivers/usb/class/usblp.c   conflict!
 'P'   01-09  drivers/misc/pci_endpoint_test.cconflict!
+'P'   00-0F  xen/privcmd.h   conflict!
 'Q'   alllinux/soundcard.h
 'R'   00-1F  linux/random.h  conflict!
 'R'   01 linux/rfkill.h  conflict!



[qemu-mainline test] 167955: tolerable FAIL - PUSHED

2022-01-30 Thread osstest service owner
flight 167955 qemu-mainline real [real]
http://logs.test-lab.xenproject.org/osstest/logs/167955/

Failures :-/ but no regressions.

Regressions which are regarded as allowable (not blocking):
 test-amd64-amd64-xl-rtds 20 guest-localmigrate/x10   fail REGR. vs. 167947

Tests which did not succeed, but are not blocking:
 test-amd64-amd64-xl-qemuu-win7-amd64 19 guest-stopfail like 167947
 test-amd64-amd64-qemuu-nested-amd 20 debian-hvm-install/l1/l2 fail like 167947
 test-armhf-armhf-libvirt 16 saverestore-support-checkfail  like 167947
 test-amd64-i386-xl-qemuu-win7-amd64 19 guest-stop fail like 167947
 test-armhf-armhf-libvirt-raw 15 saverestore-support-checkfail  like 167947
 test-amd64-i386-xl-qemuu-ws16-amd64 19 guest-stop fail like 167947
 test-amd64-amd64-xl-qemuu-ws16-amd64 19 guest-stopfail like 167947
 test-armhf-armhf-libvirt-qcow2 15 saverestore-support-check   fail like 167947
 test-arm64-arm64-xl-seattle  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-seattle  16 saverestore-support-checkfail   never pass
 test-amd64-amd64-libvirt 15 migrate-support-checkfail   never pass
 test-amd64-i386-libvirt-xsm  15 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt-xsm 15 migrate-support-checkfail   never pass
 test-amd64-i386-libvirt  15 migrate-support-checkfail   never pass
 test-amd64-i386-xl-pvshim14 guest-start  fail   never pass
 test-arm64-arm64-xl  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl  16 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl-credit1  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-credit1  16 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl-xsm  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-xsm  16 saverestore-support-checkfail   never pass
 test-arm64-arm64-libvirt-xsm 15 migrate-support-checkfail   never pass
 test-arm64-arm64-libvirt-xsm 16 saverestore-support-checkfail   never pass
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 13 migrate-support-check 
fail never pass
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 13 migrate-support-check 
fail never pass
 test-arm64-arm64-xl-thunderx 15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-thunderx 16 saverestore-support-checkfail   never pass
 test-amd64-amd64-libvirt-vhd 14 migrate-support-checkfail   never pass
 test-arm64-arm64-libvirt-raw 14 migrate-support-checkfail   never pass
 test-arm64-arm64-libvirt-raw 15 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl-vhd  14 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-vhd  15 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-credit1  15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl  15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit1  16 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl  16 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 16 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-cubietruck 15 migrate-support-checkfail never pass
 test-armhf-armhf-xl-cubietruck 16 saverestore-support-checkfail never pass
 test-arm64-arm64-xl-credit2  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-credit2  16 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt 15 migrate-support-checkfail   never pass
 test-armhf-armhf-libvirt-raw 14 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-arndale  15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-arndale  16 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-multivcpu 15 migrate-support-checkfail  never pass
 test-armhf-armhf-xl-multivcpu 16 saverestore-support-checkfail  never pass
 test-amd64-i386-libvirt-raw  14 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-vhd  14 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-vhd  15 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt-qcow2 14 migrate-support-checkfail never pass
 test-armhf-armhf-xl-credit2  15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  16 saverestore-support-checkfail   never pass

version targeted for testing:
 qemuud90e6f665d3ac197f83d93ad37147fe677521209
baseline version:
 qemuu95a6af2a006e7160c958215c20e513ed29a0a76c

Last test of basis   167947  2022-01-29 16:06:59 Z1 days
Testing same since   167955  2022-01-30 10:08:20 Z0 days1 attempts


[PATCH] xen: xenbus_dev.h: delete incorrect file name

2022-01-30 Thread Randy Dunlap
It is better/preferred not to include file names in source files
because (a) they are not needed and (b) they can be incorrect,
so just delete this incorrect file name.

Signed-off-by: Randy Dunlap 
Cc: Boris Ostrovsky 
Cc: Juergen Gross 
Cc: Stefano Stabellini 
Cc: xen-devel@lists.xenproject.org
---
 include/xen/xenbus_dev.h |1 -
 1 file changed, 1 deletion(-)

--- linux-next-20220128.orig/include/xen/xenbus_dev.h
+++ linux-next-20220128/include/xen/xenbus_dev.h
@@ -1,5 +1,4 @@
 /**
- * evtchn.h
  *
  * Interface to /dev/xen/xenbus_backend.
  *



[ovmf test] 167956: all pass - PUSHED

2022-01-30 Thread osstest service owner
flight 167956 ovmf real [real]
http://logs.test-lab.xenproject.org/osstest/logs/167956/

Perfect :-)
All tests in this flight passed as required
version targeted for testing:
 ovmf 103fa647d159e3d76be2634d2653c2d215dd0d46
baseline version:
 ovmf ba79becd553c4d9118fafcaedef4d36f1cb9c851

Last test of basis   167950  2022-01-29 20:11:41 Z0 days
Testing same since   167956  2022-01-30 11:13:00 Z0 days1 attempts


People who touched revisions under test:
  Rebecca Cran 

jobs:
 build-amd64-xsm  pass
 build-i386-xsm   pass
 build-amd64  pass
 build-i386   pass
 build-amd64-libvirt  pass
 build-i386-libvirt   pass
 build-amd64-pvopspass
 build-i386-pvops pass
 test-amd64-amd64-xl-qemuu-ovmf-amd64 pass
 test-amd64-i386-xl-qemuu-ovmf-amd64  pass



sg-report-flight on osstest.test-lab.xenproject.org
logs: /home/logs/logs
images: /home/logs/images

Logs, config files, etc. are available at
http://logs.test-lab.xenproject.org/osstest/logs

Explanation of these reports, and of osstest in general, is at
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README.email;hb=master
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README;hb=master

Test harness code can be found at
http://xenbits.xen.org/gitweb?p=osstest.git;a=summary


Pushing revision :

To xenbits.xen.org:/home/xen/git/osstest/ovmf.git
   ba79becd55..103fa647d1  103fa647d159e3d76be2634d2653c2d215dd0d46 -> 
xen-tested-master



Re: [patch V3 28/35] PCI/MSI: Simplify pci_irq_get_affinity()

2022-01-30 Thread Guenter Roeck
On Fri, Dec 10, 2021 at 11:19:26PM +0100, Thomas Gleixner wrote:
> From: Thomas Gleixner 
> 
> Replace open coded MSI descriptor chasing and use the proper accessor
> functions instead.
> 
> Signed-off-by: Thomas Gleixner 
> Reviewed-by: Greg Kroah-Hartman 
> Reviewed-by: Jason Gunthorpe 

This patch results in the following runtime warning when booting x86
(32 bit) nosmp images from NVME in qemu.

[   14.825482] nvme nvme0: 1/0/0 default/read/poll queues
ILLOPC: ca7c6d10: 0f 0b
[   14.826188] [ cut here ]
[   14.826307] WARNING: CPU: 0 PID: 7 at drivers/pci/msi/msi.c:1114 
pci_irq_get_affinity+0x80/0x90
[   14.826455] Modules linked in:
[   14.826640] CPU: 0 PID: 7 Comm: kworker/u2:0 Not tainted 
5.17.0-rc1-00419-g1d2d8baaf053 #1
[   14.826797] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 
rel-1.15.0-0-g2dd4b9b3f840-prebuilt.qemu.org 04/01/2014
[   14.827132] Workqueue: nvme-reset-wq nvme_reset_work
[   14.827336] EIP: pci_irq_get_affinity+0x80/0x90
[   14.827452] Code: e8 d5 30 af ff 85 c0 75 bd 90 0f 0b 31 c0 5b 5e 5d c3 8d 
b4 26 00 00 00 00 90 5b b8 24 32 7e cb 5e 5d c3 8d b4 26 00 00 00 00 <0f> 0b eb 
e0 8d b4 26 00 00 00 00 8d 74 26 00 90 55 89 e5 57 56 53
[   14.827717] EAX:  EBX: c18ba000 ECX:  EDX: c297c210
[   14.827816] ESI: 0001 EDI: c18ba000 EBP: c1247e24 ESP: c1247e1c
[   14.827924] DS: 007b ES: 007b FS:  GS:  SS: 0068 EFLAGS: 0246
[   14.828110] CR0: 80050033 CR2: ffda9000 CR3: 0b8ad000 CR4: 06d0
[   14.828268] Call Trace:
[   14.828554]  blk_mq_pci_map_queues+0x26/0x70
[   14.828710]  nvme_pci_map_queues+0x75/0xc0
[   14.828808]  blk_mq_update_queue_map+0x86/0xa0
[   14.828891]  blk_mq_alloc_tag_set+0xf3/0x390
[   14.828965]  ? nvme_wait_freeze+0x3d/0x50
[   14.829137]  nvme_reset_work+0xd02/0x1120
[   14.829269]  ? lock_acquire+0xc3/0x290
[   14.829435]  process_one_work+0x1ed/0x490
[   14.829569]  worker_thread+0x15e/0x3c0
[   14.829665]  kthread+0xd3/0x100
[   14.829729]  ? process_one_work+0x490/0x490
[   14.829799]  ? kthread_complete_and_exit+0x20/0x20
[   14.829890]  ret_from_fork+0x1c/0x28

Bisect results below.

#regzbot introduced: f48235900182d6

Guenter

---
# bad: [e783362eb54cd99b2cac8b3a9aeac942e6f6ac07] Linux 5.17-rc1
# good: [df0cc57e057f18e44dac8e6c18aba47ab53202f9] Linux 5.16
git bisect start 'v5.17-rc1' 'v5.16'
# good: [fef8dfaea9d6c444b6c2174b3a2b0fca4d226c5e] Merge tag 'regulator-v5.17' 
of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
git bisect good fef8dfaea9d6c444b6c2174b3a2b0fca4d226c5e
# bad: [3ceff4ea07410763d5d4cccd60349bf7691e7e61] Merge tag 'sound-5.17-rc1' of 
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
git bisect bad 3ceff4ea07410763d5d4cccd60349bf7691e7e61
# good: [57ea81971b7296b42fc77424af44c5915d3d4ae2] Merge tag 'usb-5.17-rc1' of 
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
git bisect good 57ea81971b7296b42fc77424af44c5915d3d4ae2
# bad: [feb7a43de5ef625ad74097d8fd3481d5dbc06a59] Merge tag 
'irq-msi-2022-01-13' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
git bisect bad feb7a43de5ef625ad74097d8fd3481d5dbc06a59
# good: [ce990f1de0bc6ff3de43d385e0985efa980fba24] Merge tag 
'for-linus-5.17-rc1-tag' of 
git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
git bisect good ce990f1de0bc6ff3de43d385e0985efa980fba24
# good: [4afd2a9355a9deb16ea42b896820dacf49843a8f] Merge branches 'clk-ingenic' 
and 'clk-mediatek' into clk-next
git bisect good 4afd2a9355a9deb16ea42b896820dacf49843a8f
# good: [455e73a07f6e288b0061dfcf4fcf54fa9fe06458] Merge tag 'clk-for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux
git bisect good 455e73a07f6e288b0061dfcf4fcf54fa9fe06458
# bad: [f2948df5f87a722591499da60ab91c611422f755] x86/pci/xen: Use 
msi_for_each_desc()
git bisect bad f2948df5f87a722591499da60ab91c611422f755
# good: [93296cd1325d1d9afede60202d8833011c9001f2] PCI/MSI: Allocate MSI device 
data on first use
git bisect good 93296cd1325d1d9afede60202d8833011c9001f2
# good: [82ff8e6b78fc4587a4255301f0a283506daf11b6] PCI/MSI: Use msi_get_virq() 
in pci_get_vector()
git bisect good 82ff8e6b78fc4587a4255301f0a283506daf11b6
# bad: [125282cd4f33ecd53a24ae4807409da0e5e90fd4] genirq/msi: Move descriptor 
list to struct msi_device_data
git bisect bad 125282cd4f33ecd53a24ae4807409da0e5e90fd4
# bad: [065afdc9c521f05c53f226dabe5dda2d30294d65] iommu/arm-smmu-v3: Use 
msi_get_virq()
git bisect bad 065afdc9c521f05c53f226dabe5dda2d30294d65
# bad: [f6632bb2c1454b857adcd131320379ec16fd8666] dmaengine: mv_xor_v2: Get rid 
of msi_desc abuse
git bisect bad f6632bb2c1454b857adcd131320379ec16fd8666
# bad: [f48235900182d64537c6e8f8dc0932b57a1a0638] PCI/MSI: Simplify 
pci_irq_get_affinity()
git bisect bad f48235900182d64537c6e8f8dc0932b57a1a0638
# first bad commit: [f48235900182d64537c6e8f8dc0932b57a1a0638] PCI/MSI: 
Simplify pci_irq_get_affinity()



[linux-linus test] 167954: tolerable FAIL - PUSHED

2022-01-30 Thread osstest service owner
flight 167954 linux-linus real [real]
flight 167957 linux-linus real-retest [real]
http://logs.test-lab.xenproject.org/osstest/logs/167954/
http://logs.test-lab.xenproject.org/osstest/logs/167957/

Failures :-/ but no regressions.

Tests which are failing intermittently (not blocking):
 test-armhf-armhf-libvirt-qcow2 6 host-ping-check-native fail pass in 
167957-retest
 test-armhf-armhf-xl   8 xen-bootfail pass in 167957-retest

Tests which did not succeed, but are not blocking:
 test-armhf-armhf-libvirt-qcow2 15 saverestore-support-check fail in 167957 
like 167949
 test-armhf-armhf-xl 15 migrate-support-check fail in 167957 never pass
 test-armhf-armhf-xl 16 saverestore-support-check fail in 167957 never pass
 test-armhf-armhf-libvirt-qcow2 14 migrate-support-check fail in 167957 never 
pass
 test-amd64-amd64-xl-rtds 20 guest-localmigrate/x10   fail  like 167949
 test-amd64-amd64-xl-qemut-win7-amd64 19 guest-stopfail like 167949
 test-armhf-armhf-libvirt 16 saverestore-support-checkfail  like 167949
 test-amd64-amd64-qemuu-nested-amd 20 debian-hvm-install/l1/l2 fail like 167949
 test-amd64-amd64-xl-qemuu-ws16-amd64 19 guest-stopfail like 167949
 test-amd64-amd64-xl-qemut-ws16-amd64 19 guest-stopfail like 167949
 test-amd64-amd64-xl-qemuu-win7-amd64 19 guest-stopfail like 167949
 test-armhf-armhf-libvirt-raw 15 saverestore-support-checkfail  like 167949
 test-amd64-amd64-libvirt 15 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt-xsm 15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-seattle  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-seattle  16 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl  16 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl-credit2  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-credit2  16 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl-xsm  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-xsm  16 saverestore-support-checkfail   never pass
 test-arm64-arm64-libvirt-xsm 15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-credit1  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-credit1  16 saverestore-support-checkfail   never pass
 test-arm64-arm64-libvirt-xsm 16 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl-thunderx 15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-thunderx 16 saverestore-support-checkfail   never pass
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 13 migrate-support-check 
fail never pass
 test-amd64-amd64-libvirt-qcow2 14 migrate-support-checkfail never pass
 test-amd64-amd64-libvirt-raw 14 migrate-support-checkfail   never pass
 test-arm64-arm64-libvirt-raw 14 migrate-support-checkfail   never pass
 test-arm64-arm64-libvirt-raw 15 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl-vhd  14 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-vhd  15 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-credit1  15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit1  16 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 16 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt 15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  16 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-cubietruck 15 migrate-support-checkfail never pass
 test-armhf-armhf-xl-cubietruck 16 saverestore-support-checkfail never pass
 test-armhf-armhf-xl-multivcpu 15 migrate-support-checkfail  never pass
 test-armhf-armhf-xl-multivcpu 16 saverestore-support-checkfail  never pass
 test-armhf-armhf-xl-arndale  15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-arndale  16 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt-raw 14 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-vhd  14 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-vhd  15 saverestore-support-checkfail   never pass

version targeted for testing:
 linux8dd71685dcb7839f6d91417e0a9237daca363908
baseline version:
 linuxf8c7e4ede46fe63ff1669652648aab09d112

Last test of basis   167949  2022-01-29 19:11:13 Z0 days
Testing same since   167954  2022-01-30 09:39:43 Z0 days1 attempts


People who 

[xen-unstable test] 167951: tolerable FAIL

2022-01-30 Thread osstest service owner
flight 167951 xen-unstable real [real]
http://logs.test-lab.xenproject.org/osstest/logs/167951/

Failures :-/ but no regressions.

Tests which did not succeed, but are not blocking:
 test-amd64-amd64-xl-qemut-win7-amd64 19 guest-stopfail like 167944
 test-amd64-amd64-xl-qemuu-ws16-amd64 19 guest-stopfail like 167944
 test-amd64-amd64-qemuu-nested-amd 20 debian-hvm-install/l1/l2 fail like 167944
 test-amd64-i386-xl-qemut-ws16-amd64 19 guest-stop fail like 167944
 test-amd64-i386-xl-qemut-win7-amd64 19 guest-stop fail like 167944
 test-armhf-armhf-libvirt-raw 15 saverestore-support-checkfail  like 167944
 test-amd64-i386-xl-qemuu-win7-amd64 19 guest-stop fail like 167944
 test-amd64-amd64-xl-qemut-ws16-amd64 19 guest-stopfail like 167944
 test-armhf-armhf-libvirt 16 saverestore-support-checkfail  like 167944
 test-amd64-i386-xl-qemuu-ws16-amd64 19 guest-stop fail like 167944
 test-amd64-amd64-xl-qemuu-win7-amd64 19 guest-stopfail like 167944
 test-armhf-armhf-libvirt-qcow2 15 saverestore-support-check   fail like 167944
 test-arm64-arm64-xl-seattle  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-seattle  16 saverestore-support-checkfail   never pass
 test-amd64-amd64-libvirt-xsm 15 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt 15 migrate-support-checkfail   never pass
 test-amd64-i386-libvirt-xsm  15 migrate-support-checkfail   never pass
 test-amd64-i386-libvirt  15 migrate-support-checkfail   never pass
 test-amd64-i386-xl-pvshim14 guest-start  fail   never pass
 test-arm64-arm64-xl-xsm  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-xsm  16 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl  16 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl-credit2  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-credit2  16 saverestore-support-checkfail   never pass
 test-arm64-arm64-libvirt-xsm 15 migrate-support-checkfail   never pass
 test-arm64-arm64-libvirt-xsm 16 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl-thunderx 15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-thunderx 16 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl-credit1  15 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-credit1  16 saverestore-support-checkfail   never pass
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 13 migrate-support-check 
fail never pass
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 13 migrate-support-check 
fail never pass
 test-armhf-armhf-xl-arndale  15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-arndale  16 saverestore-support-checkfail   never pass
 test-amd64-i386-libvirt-raw  14 migrate-support-checkfail   never pass
 test-amd64-amd64-libvirt-vhd 14 migrate-support-checkfail   never pass
 test-arm64-arm64-libvirt-raw 14 migrate-support-checkfail   never pass
 test-arm64-arm64-libvirt-raw 15 saverestore-support-checkfail   never pass
 test-arm64-arm64-xl-vhd  14 migrate-support-checkfail   never pass
 test-arm64-arm64-xl-vhd  15 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-multivcpu 15 migrate-support-checkfail  never pass
 test-armhf-armhf-xl-multivcpu 16 saverestore-support-checkfail  never pass
 test-armhf-armhf-xl-cubietruck 15 migrate-support-checkfail never pass
 test-armhf-armhf-xl-cubietruck 16 saverestore-support-checkfail never pass
 test-armhf-armhf-xl-vhd  14 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-vhd  15 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-credit1  15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit1  16 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-rtds 16 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt-raw 14 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl-credit2  16 saverestore-support-checkfail   never pass
 test-armhf-armhf-xl  15 migrate-support-checkfail   never pass
 test-armhf-armhf-xl  16 saverestore-support-checkfail   never pass
 test-armhf-armhf-libvirt 15 migrate-support-checkfail   never pass
 test-armhf-armhf-libvirt-qcow2 14 migrate-support-checkfail never pass

version targeted for testing:
 xen  21170a738c11b24815b4afab2151bd3aa2a29acc
baseline version:
 xen  

[libvirt test] 167952: regressions - FAIL

2022-01-30 Thread osstest service owner
flight 167952 libvirt real [real]
http://logs.test-lab.xenproject.org/osstest/logs/167952/

Regressions :-(

Tests which did not succeed and are blocking,
including tests which could not be run:
 build-amd64-libvirt   6 libvirt-buildfail REGR. vs. 151777
 build-arm64-libvirt   6 libvirt-buildfail REGR. vs. 151777
 build-i386-libvirt6 libvirt-buildfail REGR. vs. 151777
 build-armhf-libvirt   6 libvirt-buildfail REGR. vs. 151777

Tests which did not succeed, but are not blocking:
 test-amd64-amd64-libvirt  1 build-check(1)   blocked  n/a
 test-amd64-amd64-libvirt-pair  1 build-check(1)   blocked  n/a
 test-amd64-amd64-libvirt-qemuu-debianhvm-amd64-xsm 1 build-check(1) blocked n/a
 test-amd64-amd64-libvirt-vhd  1 build-check(1)   blocked  n/a
 test-amd64-amd64-libvirt-xsm  1 build-check(1)   blocked  n/a
 test-amd64-i386-libvirt   1 build-check(1)   blocked  n/a
 test-amd64-i386-libvirt-pair  1 build-check(1)   blocked  n/a
 test-amd64-i386-libvirt-qemuu-debianhvm-amd64-xsm 1 build-check(1) blocked n/a
 test-amd64-i386-libvirt-raw   1 build-check(1)   blocked  n/a
 test-amd64-i386-libvirt-xsm   1 build-check(1)   blocked  n/a
 test-arm64-arm64-libvirt  1 build-check(1)   blocked  n/a
 test-arm64-arm64-libvirt-qcow2  1 build-check(1)   blocked  n/a
 test-arm64-arm64-libvirt-raw  1 build-check(1)   blocked  n/a
 test-armhf-armhf-libvirt-raw  1 build-check(1)   blocked  n/a
 test-arm64-arm64-libvirt-xsm  1 build-check(1)   blocked  n/a
 test-armhf-armhf-libvirt  1 build-check(1)   blocked  n/a
 test-armhf-armhf-libvirt-qcow2  1 build-check(1)   blocked  n/a

version targeted for testing:
 libvirt  18813edbf28b42ad9d068e0584c4408019c09bff
baseline version:
 libvirt  2c846fa6bcc11929c9fb857a22430fb9945654ad

Last test of basis   151777  2020-07-10 04:19:19 Z  569 days
Failing since151818  2020-07-11 04:18:52 Z  568 days  550 attempts
Testing same since   167942  2022-01-29 04:18:56 Z1 days2 attempts


People who touched revisions under test:
Adolfo Jayme Barrientos 
  Aleksandr Alekseev 
  Aleksei Zakharov 
  Andika Triwidada 
  Andrea Bolognani 
  Ani Sinha 
  Balázs Meskó 
  Barrett Schonefeld 
  Bastian Germann 
  Bastien Orivel 
  BiaoXiang Ye 
  Bihong Yu 
  Binfeng Wu 
  Bjoern Walk 
  Boris Fiuczynski 
  Brad Laue 
  Brian Turek 
  Bruno Haible 
  Chris Mayo 
  Christian Borntraeger 
  Christian Ehrhardt 
  Christian Kirbach 
  Christian Schoenebeck 
  Christophe Fergeau 
  Cole Robinson 
  Collin Walling 
  Cornelia Huck 
  Cédric Bosdonnat 
  Côme Borsoi 
  Daniel Henrique Barboza 
  Daniel Letai 
  Daniel P. Berrange 
  Daniel P. Berrangé 
  Didik Supriadi 
  dinglimin 
  Divya Garg 
  Dmitrii Shcherbakov 
  Dmytro Linkin 
  Eiichi Tsukata 
  Eric Farman 
  Erik Skultety 
  Fabian Affolter 
  Fabian Freyer 
  Fabiano Fidêncio 
  Fangge Jin 
  Farhan Ali 
  Fedora Weblate Translation 
  Franck Ridel 
  Gavi Teitz 
  gongwei 
  Guoyi Tu
  Göran Uddeborg 
  Halil Pasic 
  Han Han 
  Hao Wang 
  Hela Basa 
  Helmut Grohne 
  Hiroki Narukawa 
  Hyman Huang(黄勇) 
  Ian Wienand 
  Ioanna Alifieraki 
  Ivan Teterevkov 
  Jakob Meng 
  Jamie Strandboge 
  Jamie Strandboge 
  Jan Kuparinen 
  jason lee 
  Jean-Baptiste Holcroft 
  Jia Zhou 
  Jianan Gao 
  Jim Fehlig 
  Jin Yan 
  Jinsheng Zhang 
  Jiri Denemark 
  Joachim Falk 
  John Ferlan 
  Jonathan Watt 
  Jonathon Jongsma 
  Julio Faracco 
  Justin Gatzen 
  Ján Tomko 
  Kashyap Chamarthy 
  Kevin Locke 
  Koichi Murase 
  Kristina Hanicova 
  Laine Stump 
  Laszlo Ersek 
  Lee Yarwood 
  Lei Yang 
  Liao Pingfang 
  Lin Ma 
  Lin Ma 
  Lin Ma 
  Liu Yiding 
  Luke Yue 
  Luyao Zhong 
  Marc Hartmayer 
  Marc-André Lureau 
  Marek Marczykowski-Górecki 
  Markus Schade 
  Martin Kletzander 
  Masayoshi Mizuma 
  Matej Cepl 
  Matt Coleman 
  Matt Coleman 
  Mauro Matteo Cascella 
  Meina Li 
  Michal Privoznik 
  Michał Smyk 
  Milo Casagrande 
  Moshe Levi 
  Muha Aliss 
  Nathan 
  Neal Gompa 
  Nick Chevsky 
  Nick Shyrokovskiy 
  Nickys Music Group 
  Nico Pache 
  Nicolas Lécureuil 
  Nicolas Lécureuil 
  Nikolay Shirokovskiy 
  Olaf Hering 
  Olesya Gerasimenko 
  Or Ozeri 
  Orion Poplawski 
  Pany 
  Patrick Magauran 
  Paulo de Rezende Pinatti 
  Pavel Hrdina 
  Peng Liang 
  Peter Krempa 
  Pino Toscano 
  Pino Toscano 
  Piotr Drąg 
  Prathamesh Chavan 
  Praveen K Paladugu 
  Richard W.M. Jones 
  Ricky Tigg 
  Robin Lee 
  Rohit Kumar 
  Roman Bogorodskiy 
  Roman Bolshakov 
  Ryan Gahagan 
  Ryan Schmidt 
  Sam Hartman 
  Scott Shambarger 
  Sebastian Mitterle 
  SeongHyun Jo 
  Shalini Chellathurai Saroja 
  Shaojun Yang 
  shenjiatong 
  Shi Lei 
  simmon 
  Simon 

[xen-unstable-coverity test] 167953: all pass - PUSHED

2022-01-30 Thread osstest service owner
flight 167953 xen-unstable-coverity real [real]
http://logs.test-lab.xenproject.org/osstest/logs/167953/

Perfect :-)
All tests in this flight passed as required
version targeted for testing:
 xen  21170a738c11b24815b4afab2151bd3aa2a29acc
baseline version:
 xen  9480a1a519cf016623f657dc544cb372a82b5708

Last test of basis   167855  2022-01-26 09:18:33 Z4 days
Testing same since   167953  2022-01-30 09:20:52 Z0 days1 attempts


People who touched revisions under test:
  Andrew Cooper 
  Anthony PERARD 
  James Dingwall 
  Jan Beulich 
  Juergen Gross 
  Julien Grall 
  Oleksandr Andrushchenko 
  Oleksandr Tyshchenko 
  Roger Pau Monné 
  Stefano Stabellini 
  Stefano Stabellini 

jobs:
 coverity-amd64   pass



sg-report-flight on osstest.test-lab.xenproject.org
logs: /home/logs/logs
images: /home/logs/images

Logs, config files, etc. are available at
http://logs.test-lab.xenproject.org/osstest/logs

Explanation of these reports, and of osstest in general, is at
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README.email;hb=master
http://xenbits.xen.org/gitweb/?p=osstest.git;a=blob;f=README;hb=master

Test harness code can be found at
http://xenbits.xen.org/gitweb?p=osstest.git;a=summary


Pushing revision :

To xenbits.xen.org:/home/xen/git/xen.git
   9480a1a519..21170a738c  21170a738c11b24815b4afab2151bd3aa2a29acc -> 
coverity-tested/smoke



[PATCH 5/5] tools/include: remove xen-external directory

2022-01-30 Thread Juergen Gross
There is no user of tools/include/xen-external/* left. Remove it.

Signed-off-by: Juergen Gross 
---
 tools/include/xen-external/README |   24 -
 tools/include/xen-external/bsd-COPYRIGHT  |  126 --
 tools/include/xen-external/bsd-queue.3| 1044 -
 .../xen-external/bsd-sys-queue-h-seddery  |   74 --
 tools/include/xen-external/bsd-sys-queue.h|  637 --
 5 files changed, 1905 deletions(-)
 delete mode 100644 tools/include/xen-external/README
 delete mode 100644 tools/include/xen-external/bsd-COPYRIGHT
 delete mode 100644 tools/include/xen-external/bsd-queue.3
 delete mode 100755 tools/include/xen-external/bsd-sys-queue-h-seddery
 delete mode 100644 tools/include/xen-external/bsd-sys-queue.h

diff --git a/tools/include/xen-external/README 
b/tools/include/xen-external/README
deleted file mode 100644
index 93c2bc9cd8..00
--- a/tools/include/xen-external/README
+++ /dev/null
@@ -1,24 +0,0 @@
-WARNING - DO NOT EDIT THINGS IN THIS DIRECTORY
---
-
-These files were obtained elsewhere and should only be updated by
-copying new versions from the source location, as documented below:
-
-bsd-COPYRIGHT
-bsd-sys-queue.h
-bsd-queue.3
-
-  Obtained from the FreeBSD SVN using the following commands:
-svn co -r 221843 svn://svn.freebsd.org/base/head/sys/sys/
-svn co -r 221843 svn://svn.freebsd.org/base/head/share/man/man3
-svn cat -r 221843 http://svn.freebsd.org/base/head/COPYRIGHT 
>tools/libxl/external/bsd-COPYRIGHT
-
-Exceptions:
-
-README
-
-  This file
-
-bsd-sys-queue-h-seddery
-
-  Script to transform the above into a new namespace.
diff --git a/tools/include/xen-external/bsd-COPYRIGHT 
b/tools/include/xen-external/bsd-COPYRIGHT
deleted file mode 100644
index 6dc5d16b46..00
--- a/tools/include/xen-external/bsd-COPYRIGHT
+++ /dev/null
@@ -1,126 +0,0 @@
-# $FreeBSD$
-#  @(#)COPYRIGHT   8.2 (Berkeley) 3/21/94
-
-The compilation of software known as FreeBSD is distributed under the
-following terms:
-
-Copyright (c) 1992-2011 The FreeBSD Project. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
-The 4.4BSD and 4.4BSD-Lite software is distributed under the following
-terms:
-
-All of the documentation and software included in the 4.4BSD and 4.4BSD-Lite
-Releases is copyrighted by The Regents of the University of California.
-
-Copyright 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
-   The Regents of the University of California.  All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-3. All advertising materials mentioning features or use of this software
-   must display the following acknowledgement:
-This product includes software developed by the University of
-California, Berkeley and its contributors.
-4. Neither the name of the University nor the names of its contributors
-   may be used to endorse or promote products derived from this software
-   without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, 

[PATCH 4/5] tools/libs/evtchn: use _xen_list.h

2022-01-30 Thread Juergen Gross
Instead of including xen-external/bsd-sys-queue.h use the header
_xen_list.h in minios.c.

Signed-off-by: Juergen Gross 
---
 tools/libs/evtchn/minios.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/tools/libs/evtchn/minios.c b/tools/libs/evtchn/minios.c
index 30f98bc7e4..65cfccfd09 100644
--- a/tools/libs/evtchn/minios.c
+++ b/tools/libs/evtchn/minios.c
@@ -20,7 +20,7 @@
  * Split off from xc_minios.c
  */
 
-#include "xen-external/bsd-sys-queue.h"
+#include "_xen_list.h"
 #include 
 #include 
 #include 
@@ -38,10 +38,10 @@
 
 #include "private.h"
 
-LIST_HEAD(port_list, port_info);
+XEN_LIST_HEAD(port_list, struct port_info);
 
 struct port_info {
-LIST_ENTRY(port_info) list;
+XEN_LIST_ENTRY(struct port_info) list;
 evtchn_port_t port;
 bool pending;
 bool bound;
@@ -62,7 +62,7 @@ static struct port_info *port_alloc(xenevtchn_handle *xce)
 port_info->port = -1;
 port_info->bound = false;
 
-LIST_INSERT_HEAD(port_list, port_info, list);
+XEN_LIST_INSERT_HEAD(port_list, port_info, list);
 
 return port_info;
 }
@@ -72,7 +72,7 @@ static void port_dealloc(struct port_info *port_info)
 if ( port_info->bound )
 unbind_evtchn(port_info->port);
 
-LIST_REMOVE(port_info, list);
+XEN_LIST_REMOVE(port_info, list);
 free(port_info);
 }
 
@@ -81,7 +81,7 @@ static int evtchn_close_fd(struct file *file)
 struct port_info *port_info, *tmp;
 struct port_list *port_list = file->dev;
 
-LIST_FOREACH_SAFE(port_info, port_list, list, tmp)
+XEN_LIST_FOREACH_SAFE(port_info, port_list, list, tmp)
 port_dealloc(port_info);
 free(port_list);
 
@@ -126,7 +126,7 @@ int osdep_evtchn_open(xenevtchn_handle *xce, unsigned int 
flags)
 }
 
 file->dev = list;
-LIST_INIT(list);
+XEN_LIST_INIT(list);
 xce->fd = fd;
 printf("evtchn_open() -> %d\n", fd);
 
@@ -173,7 +173,7 @@ static void evtchn_handler(evtchn_port_t port, struct 
pt_regs *regs, void *data)
 assert(file);
 port_list = file->dev;
 mask_evtchn(port);
-LIST_FOREACH(port_info, port_list, list)
+XEN_LIST_FOREACH(port_info, port_list, list)
 {
 if ( port_info->port == port )
 goto found;
@@ -257,7 +257,7 @@ int xenevtchn_unbind(xenevtchn_handle *xce, evtchn_port_t 
port)
 struct port_info *port_info;
 struct port_list *port_list = file->dev;
 
-LIST_FOREACH(port_info, port_list, list)
+XEN_LIST_FOREACH(port_info, port_list, list)
 {
 if ( port_info->port == port )
 {
@@ -314,7 +314,7 @@ xenevtchn_port_or_error_t 
xenevtchn_pending(xenevtchn_handle *xce)
 
 file->read = false;
 
-LIST_FOREACH(port_info, port_list, list)
+XEN_LIST_FOREACH(port_info, port_list, list)
 {
 if ( port_info->port != -1 && port_info->pending )
 {
-- 
2.31.1




[PATCH 2/5] tools/libs/light: replace _libxl_list.h with _xen_list.h

2022-01-30 Thread Juergen Gross
Remove generating _libxl_list.h and use the common _xen_list.h instead.

Signed-off-by: Juergen Gross 
---
 tools/include/libxl.h|   4 +-
 tools/libs/light/Makefile|  10 +--
 tools/libs/light/libxl.c |  40 -
 tools/libs/light/libxl_aoutils.c |  20 ++---
 tools/libs/light/libxl_device.c  |  27 +++---
 tools/libs/light/libxl_disk.c|   4 +-
 tools/libs/light/libxl_domain.c  |  18 ++--
 tools/libs/light/libxl_event.c   | 128 +--
 tools/libs/light/libxl_fork.c|  44 -
 tools/libs/light/libxl_internal.h|  86 +-
 tools/libs/light/libxl_qmp.c |  19 ++--
 tools/libs/light/libxl_stream_read.c |  20 ++---
 12 files changed, 206 insertions(+), 214 deletions(-)

diff --git a/tools/include/libxl.h b/tools/include/libxl.h
index 2bbbd21f0b..51a9b6cfac 100644
--- a/tools/include/libxl.h
+++ b/tools/include/libxl.h
@@ -747,7 +747,7 @@
 typedef struct libxl__ctx libxl_ctx;
 
 #include 
-#include <_libxl_list.h>
+#include <_xen_list.h>
 
 /* API compatibility. */
 #ifdef LIBXL_API_VERSION
@@ -1448,7 +1448,7 @@ typedef struct {
 } libxl_enum_string_table;
 
 struct libxl_event;
-typedef LIBXL_TAILQ_ENTRY(struct libxl_event) libxl_ev_link;
+typedef XEN_TAILQ_ENTRY(struct libxl_event) libxl_ev_link;
 
 /*
  * A boolean variable with an explicit default state.
diff --git a/tools/libs/light/Makefile b/tools/libs/light/Makefile
index be32d95d39..5642955672 100644
--- a/tools/libs/light/Makefile
+++ b/tools/libs/light/Makefile
@@ -153,14 +153,14 @@ LIBXL_TEST_OBJS += $(foreach t, 
$(LIBXL_TESTS_INSIDE),libxl_test_$t.opic)
 TEST_PROG_OBJS += $(foreach t, $(LIBXL_TESTS_PROGS),test_$t.o) test_common.o
 TEST_PROGS += $(foreach t, $(LIBXL_TESTS_PROGS),test_$t)
 
-AUTOINCS = $(XEN_INCLUDE)/_libxl_list.h _libxl_save_msgs_callout.h 
_libxl_save_msgs_helper.h
+AUTOINCS = _libxl_save_msgs_callout.h _libxl_save_msgs_helper.h
 AUTOSRCS = _libxl_save_msgs_callout.c _libxl_save_msgs_helper.c
 
 CLIENTS = testidl libxl-save-helper
 
 SAVE_HELPER_OBJS = libxl_save_helper.o _libxl_save_msgs_helper.o
 
-LIBHEADER := libxl.h libxl_event.h libxl_json.h _libxl_types.h 
_libxl_types_json.h _libxl_list.h libxl_utils.h libxl_uuid.h
+LIBHEADER := libxl.h libxl_event.h libxl_json.h _libxl_types.h 
_libxl_types_json.h libxl_utils.h libxl_uuid.h
 
 NO_HEADERS_CHK := y
 
@@ -201,17 +201,13 @@ _libxl.api-for-check: $(XEN_INCLUDE)/libxl.h $(AUTOINCS)
>$@.new
mv -f $@.new $@
 
-$(XEN_INCLUDE)/_libxl_list.h: 
$(XEN_INCLUDE)/xen-external/bsd-sys-queue-h-seddery 
$(XEN_INCLUDE)/xen-external/bsd-sys-queue.h
-   $(PERL) $^ --prefix=libxl >$(notdir $@).new
-   $(call move-if-changed,$(notdir $@).new,$@)
-
 _libxl_save_msgs_helper.c _libxl_save_msgs_callout.c \
 _libxl_save_msgs_helper.h _libxl_save_msgs_callout.h: \
libxl_save_msgs_gen.pl
$(PERL) -w $< $@ >$@.new
$(call move-if-changed,$@.new,$@)
 
-$(XEN_INCLUDE)/libxl.h: $(XEN_INCLUDE)/_libxl_types.h 
$(XEN_INCLUDE)/_libxl_list.h
+$(XEN_INCLUDE)/libxl.h: $(XEN_INCLUDE)/_libxl_types.h
 $(XEN_INCLUDE)/libxl_json.h: $(XEN_INCLUDE)/_libxl_types_json.h
 libxl_internal.h: _libxl_types_internal.h _libxl_types_private.h 
_libxl_types_internal_private.h
 libxl_internal_json.h: _libxl_types_internal_json.h
diff --git a/tools/libs/light/libxl.c b/tools/libs/light/libxl.c
index 667ae6409b..a0bf7d186f 100644
--- a/tools/libs/light/libxl.c
+++ b/tools/libs/light/libxl.c
@@ -41,29 +41,29 @@ int libxl_ctx_alloc(libxl_ctx **pctx, int version,
 ctx->nogc_gc.alloc_maxsize = -1;
 ctx->nogc_gc.owner = ctx;
 
-LIBXL_TAILQ_INIT(>occurred);
+XEN_TAILQ_INIT(>occurred);
 
 ctx->osevent_hooks = 0;
 
 ctx->poller_app = 0;
-LIBXL_LIST_INIT(>pollers_event);
-LIBXL_LIST_INIT(>pollers_idle);
-LIBXL_LIST_INIT(>pollers_active);
+XEN_LIST_INIT(>pollers_event);
+XEN_LIST_INIT(>pollers_idle);
+XEN_LIST_INIT(>pollers_active);
 
-LIBXL_LIST_INIT(>efds);
-LIBXL_TAILQ_INIT(>etimes);
+XEN_LIST_INIT(>efds);
+XEN_TAILQ_INIT(>etimes);
 
 ctx->watch_slots = 0;
-LIBXL_SLIST_INIT(>watch_freeslots);
+XEN_SLIST_INIT(>watch_freeslots);
 libxl__ev_fd_init(>watch_efd);
 
 ctx->xce = 0;
-LIBXL_LIST_INIT(>evtchns_waiting);
+XEN_LIST_INIT(>evtchns_waiting);
 libxl__ev_fd_init(>evtchn_efd);
 
-LIBXL_LIST_INIT(>aos_inprogress);
+XEN_LIST_INIT(>aos_inprogress);
 
-LIBXL_TAILQ_INIT(>death_list);
+XEN_TAILQ_INIT(>death_list);
 libxl__ev_xswatch_init(>death_watch);
 
 ctx->childproc_hooks = __childproc_default_hooks;
@@ -122,14 +122,14 @@ int libxl_ctx_alloc(libxl_ctx **pctx, int version,
 static void free_disable_deaths(libxl__gc *gc,
 struct libxl__evgen_domain_death_list *l) {
 libxl_evgen_domain_death *death;
-while ((death = LIBXL_TAILQ_FIRST(l)))
+while ((death = XEN_TAILQ_FIRST(l)))
 

[PATCH 3/5] tools/libs/toolcore: replace _xentoolcore_list.h with _xen_list.h

2022-01-30 Thread Juergen Gross
Remove generating _xentoolcore_list.h and use the common _xen_list.h
instead.

Signed-off-by: Juergen Gross 
---
 .gitignore   | 1 -
 tools/include/xentoolcore_internal.h | 4 ++--
 tools/libs/toolcore/Makefile | 8 
 3 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/.gitignore b/.gitignore
index 3f9d55ba87..afe78c787c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -227,7 +227,6 @@ tools/hotplug/NetBSD/rc.d/xencommons
 tools/hotplug/NetBSD/rc.d/xendriverdomain
 tools/include/acpi
 tools/include/_libxl*.h
-tools/include/_xentoolcore_list.h
 tools/include/xen/*
 tools/include/xen-xsm/*
 tools/include/xen-foreign/*.(c|h|size)
diff --git a/tools/include/xentoolcore_internal.h 
b/tools/include/xentoolcore_internal.h
index 04f5848f09..deccefd612 100644
--- a/tools/include/xentoolcore_internal.h
+++ b/tools/include/xentoolcore_internal.h
@@ -27,7 +27,7 @@
 #include 
 
 #include "xentoolcore.h"
-#include "_xentoolcore_list.h"
+#include "_xen_list.h"
 
 /*-- active handle registration --*/
 
@@ -87,7 +87,7 @@ typedef int 
Xentoolcore__Restrict_Callback(Xentoolcore__Active_Handle*,
 
 struct Xentoolcore__Active_Handle {
 Xentoolcore__Restrict_Callback *restrict_callback;
-XENTOOLCORE_LIST_ENTRY(Xentoolcore__Active_Handle) entry;
+XEN_LIST_ENTRY(Xentoolcore__Active_Handle) entry;
 };
 
 void xentoolcore__register_active_handle(Xentoolcore__Active_Handle*);
diff --git a/tools/libs/toolcore/Makefile b/tools/libs/toolcore/Makefile
index ed4ae00694..9c013b2879 100644
--- a/tools/libs/toolcore/Makefile
+++ b/tools/libs/toolcore/Makefile
@@ -3,7 +3,6 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 MAJOR  = 1
 MINOR  = 0
-AUTOINCS := $(XEN_INCLUDE)/_xentoolcore_list.h
 
 LIBHEADER := xentoolcore.h
 
@@ -12,10 +11,3 @@ SRCS-y   += handlereg.c
 include $(XEN_ROOT)/tools/libs/libs.mk
 
 PKG_CONFIG_DESC := Central support for Xen Hypervisor userland libraries
-
-$(LIB_OBJS): $(AUTOINCS)
-$(PIC_OBJS): $(AUTOINCS)
-
-$(XEN_INCLUDE)/_xentoolcore_list.h: 
$(XEN_INCLUDE)/xen-external/bsd-sys-queue-h-seddery 
$(XEN_INCLUDE)/xen-external/bsd-sys-queue.h
-   $(PERL) $^ --prefix=xentoolcore >$(notdir $@).new
-   $(call move-if-changed,$(notdir $@).new,$@)
-- 
2.31.1




[PATCH 1/5] tools/include: generate a _xen_list.h file

2022-01-30 Thread Juergen Gross
Today tools/include contains two basically identical header files
generated from the same source. They just differ by the used name space
and they are being generated from different Makefiles via a perl
script.

Prepare to have only one such header by using a more generic namespace
"XEN" for _xen_list.h.

As the original header hasn't been updated in the Xen tree since its
introduction about 10 years ago, and the updates of FreeBSD side have
mostly covered BSD internal debugging aids, just don't generate the
new header during build, especially as using the current FreeBSD
version of the file would require some updates of the perl script,
which are potentially more work than just doing the needed editing by
hand. Additionally this enables to remove the not needed debugging
extensions of FreeBSD.

Signed-off-by: Juergen Gross 
---
 tools/include/Makefile|   2 +
 tools/include/_xen_list.h | 523 ++
 2 files changed, 525 insertions(+)
 create mode 100644 tools/include/_xen_list.h

diff --git a/tools/include/Makefile b/tools/include/Makefile
index d7b51006e0..d965987f55 100644
--- a/tools/include/Makefile
+++ b/tools/include/Makefile
@@ -70,11 +70,13 @@ install: all
$(INSTALL_DATA) xen/io/*.h $(DESTDIR)$(includedir)/xen/io
$(INSTALL_DATA) xen/sys/*.h $(DESTDIR)$(includedir)/xen/sys
$(INSTALL_DATA) xen/xsm/*.h $(DESTDIR)$(includedir)/xen/xsm
+   $(INSTALL_DATA) _xen_list.h $(DESTDIR)$(includedir)
 
 .PHONY: uninstall
 uninstall:
echo "[FIXME] uninstall headers"
rm -rf $(DESTDIR)$(includedir)/xen
+   rm -f $(DESTDIR)$(includedir)/_xen_list.h
 
 .PHONY: clean
 clean:
diff --git a/tools/include/_xen_list.h b/tools/include/_xen_list.h
new file mode 100644
index 00..79acaf4cf3
--- /dev/null
+++ b/tools/include/_xen_list.h
@@ -0,0 +1,523 @@
+/*
+ * DO NOT EDIT THIS FILE
+ *
+ * Generated automatically by bsd-sys-queue-h-seddery to
+ *  - introduce XEN_ and XEN_ namespace prefixes
+ *  - turn "struct type" into "type" so that type arguments
+ * to the macros are type names not struct tags
+ *  - remove the reference to sys/cdefs.h, which is not needed
+ *
+ * The purpose of this seddery is to allow the resulting file to be
+ * freely included by software which might also want to include other
+ * list macros; to make it usable when struct tags are not being used
+ * or not known; to make it more portable.
+ */
+/*-
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ *may be used to endorse or promote products derived from this software
+ *without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)queue.h 8.5 (Berkeley) 8/20/94
+ * $FreeBSD$
+ */
+
+#ifndef XEN__SYS_QUEUE_H_
+#defineXEN__SYS_QUEUE_H_
+
+/* #include  */
+
+/*
+ * This file defines four types of data structures: singly-linked lists,
+ * singly-linked tail queues, lists and tail queues.
+ *
+ * A singly-linked list is headed by a single forward pointer. The elements
+ * are singly linked for minimum space and pointer manipulation overhead at
+ * the expense of O(n) removal for arbitrary elements. New elements can be
+ * added to the list after an existing element or at the head of the list.
+ * Elements being removed from the head of the list should use the explicit
+ * macro for this purpose for optimum efficiency. A singly-linked list may
+ * only be traversed in the forward direction.  Singly-linked lists are ideal
+ * for applications with large datasets and few or no removals or for
+ * implementing a LIFO queue.
+ *
+ * 

[PATCH 0/5] tools: remove include/xen-external directory

2022-01-30 Thread Juergen Gross
The tools/include/xen-external directory contains a header file from
FreeBSD used to generate Xen header files. This series is replacing the
complete directory by a single header with the same semantics.

Juergen Gross (5):
  tools/include: generate a _xen_list.h file
  tools/libs/light: replace _libxl_list.h with _xen_list.h
  tools/libs/toolcore: replace _xentoolcore_list.h with _xen_list.h
  tools/libs/evtchn: use _xen_list.h
  tools/include: remove xen-external directory

 .gitignore|1 -
 tools/include/Makefile|2 +
 tools/include/_xen_list.h |  523 +
 tools/include/libxl.h |4 +-
 tools/include/xen-external/README |   24 -
 tools/include/xen-external/bsd-COPYRIGHT  |  126 --
 tools/include/xen-external/bsd-queue.3| 1044 -
 .../xen-external/bsd-sys-queue-h-seddery  |   74 --
 tools/include/xen-external/bsd-sys-queue.h|  637 --
 tools/include/xentoolcore_internal.h  |4 +-
 tools/libs/evtchn/minios.c|   20 +-
 tools/libs/light/Makefile |   10 +-
 tools/libs/light/libxl.c  |   40 +-
 tools/libs/light/libxl_aoutils.c  |   20 +-
 tools/libs/light/libxl_device.c   |   27 +-
 tools/libs/light/libxl_disk.c |4 +-
 tools/libs/light/libxl_domain.c   |   18 +-
 tools/libs/light/libxl_event.c|  128 +-
 tools/libs/light/libxl_fork.c |   44 +-
 tools/libs/light/libxl_internal.h |   86 +-
 tools/libs/light/libxl_qmp.c  |   19 +-
 tools/libs/light/libxl_stream_read.c  |   20 +-
 tools/libs/toolcore/Makefile  |8 -
 23 files changed, 743 insertions(+), 2140 deletions(-)
 create mode 100644 tools/include/_xen_list.h
 delete mode 100644 tools/include/xen-external/README
 delete mode 100644 tools/include/xen-external/bsd-COPYRIGHT
 delete mode 100644 tools/include/xen-external/bsd-queue.3
 delete mode 100755 tools/include/xen-external/bsd-sys-queue-h-seddery
 delete mode 100644 tools/include/xen-external/bsd-sys-queue.h

-- 
2.31.1




[PATCH] gitignore: remove stale entries

2022-01-30 Thread Juergen Gross
The entries referring to tools/security have become stale more than
10 years ago. Remove them.

Signed-off-by: Juergen Gross 
---
 .gitignore | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/.gitignore b/.gitignore
index 3f9d55ba87..1f53b0320e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -252,9 +252,6 @@ tools/qemu-xen-build
 tools/xentrace/xenalyze
 tools/pygrub/build/*
 tools/python/build/*
-tools/security/secpol_tool
-tools/security/xen/*
-tools/security/xensec_tool
 tools/tests/depriv/depriv-fd-checker
 tools/tests/x86_emulator/*.bin
 tools/tests/x86_emulator/*.tmp
-- 
2.31.1