[Qemu-devel] [PATCH v2 0/4] intel_iommu: misc fixes for error exposed after error_report_once()

Peter Xu posted 4 patches 5 years, 4 months ago
Test docker-mingw@fedora passed
Test docker-clang@ubuntu passed
Test asan passed
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190116030815.27273-1-peterx@redhat.com
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Richard Henderson <rth@twiddle.net>, Eduardo Habkost <ehabkost@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
hw/i386/intel_iommu.c |  3 ++-
hw/pci/msi.c          |  2 +-
include/hw/pci/msi.h  |  1 +
target/i386/kvm.c     | 14 +++++++++++---
4 files changed, 15 insertions(+), 5 deletions(-)
[Qemu-devel] [PATCH v2 0/4] intel_iommu: misc fixes for error exposed after error_report_once()
Posted by Peter Xu 5 years, 4 months ago
v2:
- dropping the last vfio patch
- add acked-by for Jason on 1&2 patches

Recently we have switched quite a few VT-d trace points into
error_report_once()s and this does expose some errors that we didn't
detect before (previously tracepoints won't trigger as long as
tracepoints weren't enabled).  These errors are not severe in that all
of them will not affect functionality of the guest otherwise we'll
notice them even earlier.  However it still worths to fix all of
them.  This patchset tries to fix quite a few errors like this.

All the errors could easily be triggered by rebooting a guest with
both vfio-pci device and vIOMMU, and we can see errors dumped in
stderr like:

qemu-kvm: vtd_iova_to_slpte: detected slpte permission error (iova=0xffd9ce00, level=0x2, slpte=0x0, write=1)
qemu-kvm: vtd_iommu_translate: detected translation failure (dev=02:00:00, iova=0x0)
qemu-kvm: vtd_interrupt_remap_msi: MSI address low 32 bit invalid: 0x0

Regarding to the patchset itself:

Patch 1:    fixes slpte permission error warning
Patch 2:    fixes intr_enabled flag reset missing
Patch 3-4:  fixes MSI translation warning

It was tested that this series can fix all the error messages observed
in below bugs:

https://bugzilla.redhat.com/show_bug.cgi?id=1662270
https://bugzilla.redhat.com/show_bug.cgi?id=1662291

Please have a look, thanks.

Peter Xu (4):
  intel_iommu: fix operator in vtd_switch_address_space
  intel_iommu: reset intr_enabled when system reset
  pci/msi: export msi_is_masked()
  i386/kvm: ignore masked irqs when update msi routes

 hw/i386/intel_iommu.c |  3 ++-
 hw/pci/msi.c          |  2 +-
 include/hw/pci/msi.h  |  1 +
 target/i386/kvm.c     | 14 +++++++++++---
 4 files changed, 15 insertions(+), 5 deletions(-)

-- 
2.17.1


Re: [Qemu-devel] [PATCH v2 0/4] intel_iommu: misc fixes for error exposed after error_report_once()
Posted by no-reply@patchew.org 5 years, 3 months ago
Patchew URL: https://patchew.org/QEMU/20190116030815.27273-1-peterx@redhat.com/



Hi,

This series failed the docker-mingw@fedora build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
time make docker-test-mingw@fedora SHOW_ENV=1 J=14
=== TEST SCRIPT END ===

  CC      hw/block/pflash_cfi01.o
In function 'acpi_table_install',
    inlined from 'acpi_table_add' at /tmp/qemu-test/src/hw/acpi/core.c:296:5:
/tmp/qemu-test/src/hw/acpi/core.c:184:9: error: 'strncpy' specified bound 4 equals destination size [-Werror=stringop-truncation]
         strncpy(ext_hdr->sig, hdrs->sig, sizeof ext_hdr->sig);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/qemu-test/src/hw/acpi/core.c:203:9: error: 'strncpy' specified bound 6 equals destination size [-Werror=stringop-truncation]
         strncpy(ext_hdr->oem_id, hdrs->oem_id, sizeof ext_hdr->oem_id);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/qemu-test/src/hw/acpi/core.c:207:9: error: 'strncpy' specified bound 8 equals destination size [-Werror=stringop-truncation]
         strncpy(ext_hdr->oem_table_id, hdrs->oem_table_id,
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                 sizeof ext_hdr->oem_table_id);
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/qemu-test/src/hw/acpi/core.c:216:9: error: 'strncpy' specified bound 4 equals destination size [-Werror=stringop-truncation]
         strncpy(ext_hdr->asl_compiler_id, hdrs->asl_compiler_id,
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                 sizeof ext_hdr->asl_compiler_id);
---
make: *** [/tmp/qemu-test/src/rules.mak:69: hw/acpi/core.o] Error 1
make: *** Waiting for unfinished jobs....
/tmp/qemu-test/src/block/sheepdog.c: In function 'find_vdi_name':
/tmp/qemu-test/src/block/sheepdog.c:1239:5: error: 'strncpy' specified bound 256 equals destination size [-Werror=stringop-truncation]
     strncpy(buf + SD_MAX_VDI_LEN, tag, SD_MAX_VDI_TAG_LEN);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [/tmp/qemu-test/src/rules.mak:69: block/sheepdog.o] Error 1
/tmp/qemu-test/src/hw/acpi/aml-build.c: In function 'build_header':
/tmp/qemu-test/src/hw/acpi/aml-build.c:1535:9: error: 'strncpy' specified bound 6 equals destination size [-Werror=stringop-truncation]
         strncpy((char *)h->oem_id, oem_id, sizeof h->oem_id);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/qemu-test/src/hw/acpi/aml-build.c:1541:9: error: 'strncpy' specified bound 8 equals destination size [-Werror=stringop-truncation]
         strncpy((char *)h->oem_table_id, oem_table_id, sizeof(h->oem_table_id));
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors


The full log is available at
http://patchew.org/logs/20190116030815.27273-1-peterx@redhat.com/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Re: [Qemu-devel] [PATCH v2 0/4] intel_iommu: misc fixes for error exposed after error_report_once()
Posted by Peter Xu 5 years, 3 months ago
On Mon, Jan 21, 2019 at 12:32:07AM -0800, no-reply@patchew.org wrote:
> Patchew URL: https://patchew.org/QEMU/20190116030815.27273-1-peterx@redhat.com/
> 
> 
> 
> Hi,
> 
> This series failed the docker-mingw@fedora build test. Please find the testing commands and
> their output below. If you have Docker installed, you can probably reproduce it
> locally.
> 
> === TEST SCRIPT BEGIN ===
> #!/bin/bash
> time make docker-test-mingw@fedora SHOW_ENV=1 J=14
> === TEST SCRIPT END ===
> 
>   CC      hw/block/pflash_cfi01.o
> In function 'acpi_table_install',
>     inlined from 'acpi_table_add' at /tmp/qemu-test/src/hw/acpi/core.c:296:5:
> /tmp/qemu-test/src/hw/acpi/core.c:184:9: error: 'strncpy' specified bound 4 equals destination size [-Werror=stringop-truncation]
>          strncpy(ext_hdr->sig, hdrs->sig, sizeof ext_hdr->sig);
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /tmp/qemu-test/src/hw/acpi/core.c:203:9: error: 'strncpy' specified bound 6 equals destination size [-Werror=stringop-truncation]
>          strncpy(ext_hdr->oem_id, hdrs->oem_id, sizeof ext_hdr->oem_id);
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /tmp/qemu-test/src/hw/acpi/core.c:207:9: error: 'strncpy' specified bound 8 equals destination size [-Werror=stringop-truncation]
>          strncpy(ext_hdr->oem_table_id, hdrs->oem_table_id,
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>                  sizeof ext_hdr->oem_table_id);
>                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /tmp/qemu-test/src/hw/acpi/core.c:216:9: error: 'strncpy' specified bound 4 equals destination size [-Werror=stringop-truncation]
>          strncpy(ext_hdr->asl_compiler_id, hdrs->asl_compiler_id,
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>                  sizeof ext_hdr->asl_compiler_id);
> ---
> make: *** [/tmp/qemu-test/src/rules.mak:69: hw/acpi/core.o] Error 1
> make: *** Waiting for unfinished jobs....
> /tmp/qemu-test/src/block/sheepdog.c: In function 'find_vdi_name':
> /tmp/qemu-test/src/block/sheepdog.c:1239:5: error: 'strncpy' specified bound 256 equals destination size [-Werror=stringop-truncation]
>      strncpy(buf + SD_MAX_VDI_LEN, tag, SD_MAX_VDI_TAG_LEN);
>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> make: *** [/tmp/qemu-test/src/rules.mak:69: block/sheepdog.o] Error 1
> /tmp/qemu-test/src/hw/acpi/aml-build.c: In function 'build_header':
> /tmp/qemu-test/src/hw/acpi/aml-build.c:1535:9: error: 'strncpy' specified bound 6 equals destination size [-Werror=stringop-truncation]
>          strncpy((char *)h->oem_id, oem_id, sizeof h->oem_id);
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /tmp/qemu-test/src/hw/acpi/aml-build.c:1541:9: error: 'strncpy' specified bound 8 equals destination size [-Werror=stringop-truncation]
>          strncpy((char *)h->oem_table_id, oem_table_id, sizeof(h->oem_table_id));
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors

I'm uncertain about these errors but it seems to be more likely to be
caused by some configuration or compiler change instead of the series
itself since this series never changed either acpi or sheepdog code.
So I'll temporarily ignore them...

Regards,

-- 
Peter Xu

Re: [Qemu-devel] [PATCH v2 0/4] intel_iommu: misc fixes for error exposed after error_report_once()
Posted by Alexey Kardashevskiy 5 years, 3 months ago

On 21/01/2019 20:35, Peter Xu wrote:
> On Mon, Jan 21, 2019 at 12:32:07AM -0800, no-reply@patchew.org wrote:
>> Patchew URL: https://patchew.org/QEMU/20190116030815.27273-1-peterx@redhat.com/
>>
>>
>>
>> Hi,
>>
>> This series failed the docker-mingw@fedora build test. Please find the testing commands and
>> their output below. If you have Docker installed, you can probably reproduce it
>> locally.
>>
>> === TEST SCRIPT BEGIN ===
>> #!/bin/bash
>> time make docker-test-mingw@fedora SHOW_ENV=1 J=14
>> === TEST SCRIPT END ===
>>
>>   CC      hw/block/pflash_cfi01.o
>> In function 'acpi_table_install',
>>     inlined from 'acpi_table_add' at /tmp/qemu-test/src/hw/acpi/core.c:296:5:
>> /tmp/qemu-test/src/hw/acpi/core.c:184:9: error: 'strncpy' specified bound 4 equals destination size [-Werror=stringop-truncation]
>>          strncpy(ext_hdr->sig, hdrs->sig, sizeof ext_hdr->sig);
>>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> /tmp/qemu-test/src/hw/acpi/core.c:203:9: error: 'strncpy' specified bound 6 equals destination size [-Werror=stringop-truncation]
>>          strncpy(ext_hdr->oem_id, hdrs->oem_id, sizeof ext_hdr->oem_id);
>>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> /tmp/qemu-test/src/hw/acpi/core.c:207:9: error: 'strncpy' specified bound 8 equals destination size [-Werror=stringop-truncation]
>>          strncpy(ext_hdr->oem_table_id, hdrs->oem_table_id,
>>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>                  sizeof ext_hdr->oem_table_id);
>>                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> /tmp/qemu-test/src/hw/acpi/core.c:216:9: error: 'strncpy' specified bound 4 equals destination size [-Werror=stringop-truncation]
>>          strncpy(ext_hdr->asl_compiler_id, hdrs->asl_compiler_id,
>>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>                  sizeof ext_hdr->asl_compiler_id);
>> ---
>> make: *** [/tmp/qemu-test/src/rules.mak:69: hw/acpi/core.o] Error 1
>> make: *** Waiting for unfinished jobs....
>> /tmp/qemu-test/src/block/sheepdog.c: In function 'find_vdi_name':
>> /tmp/qemu-test/src/block/sheepdog.c:1239:5: error: 'strncpy' specified bound 256 equals destination size [-Werror=stringop-truncation]
>>      strncpy(buf + SD_MAX_VDI_LEN, tag, SD_MAX_VDI_TAG_LEN);
>>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> cc1: all warnings being treated as errors
>> make: *** [/tmp/qemu-test/src/rules.mak:69: block/sheepdog.o] Error 1
>> /tmp/qemu-test/src/hw/acpi/aml-build.c: In function 'build_header':
>> /tmp/qemu-test/src/hw/acpi/aml-build.c:1535:9: error: 'strncpy' specified bound 6 equals destination size [-Werror=stringop-truncation]
>>          strncpy((char *)h->oem_id, oem_id, sizeof h->oem_id);
>>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> /tmp/qemu-test/src/hw/acpi/aml-build.c:1541:9: error: 'strncpy' specified bound 8 equals destination size [-Werror=stringop-truncation]
>>          strncpy((char *)h->oem_table_id, oem_table_id, sizeof(h->oem_table_id));
>>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> cc1: all warnings being treated as errors
> 
> I'm uncertain about these errors but it seems to be more likely to be
> caused by some configuration or compiler change instead of the series
> itself since this series never changed either acpi or sheepdog code.
> So I'll temporarily ignore them...


I am getting these too and I do not touch the mentioned files and
folders ever.



-- 
Alexey

Re: [Qemu-devel] [PATCH v2 0/4] intel_iommu: misc fixes for error exposed after error_report_once()
Posted by Michael S. Tsirkin 5 years, 3 months ago
On Tue, Jan 22, 2019 at 01:57:50PM +1100, Alexey Kardashevskiy wrote:
> 
> 
> On 21/01/2019 20:35, Peter Xu wrote:
> > On Mon, Jan 21, 2019 at 12:32:07AM -0800, no-reply@patchew.org wrote:
> >> Patchew URL: https://patchew.org/QEMU/20190116030815.27273-1-peterx@redhat.com/
> >>
> >>
> >>
> >> Hi,
> >>
> >> This series failed the docker-mingw@fedora build test. Please find the testing commands and
> >> their output below. If you have Docker installed, you can probably reproduce it
> >> locally.
> >>
> >> === TEST SCRIPT BEGIN ===
> >> #!/bin/bash
> >> time make docker-test-mingw@fedora SHOW_ENV=1 J=14
> >> === TEST SCRIPT END ===
> >>
> >>   CC      hw/block/pflash_cfi01.o
> >> In function 'acpi_table_install',
> >>     inlined from 'acpi_table_add' at /tmp/qemu-test/src/hw/acpi/core.c:296:5:
> >> /tmp/qemu-test/src/hw/acpi/core.c:184:9: error: 'strncpy' specified bound 4 equals destination size [-Werror=stringop-truncation]
> >>          strncpy(ext_hdr->sig, hdrs->sig, sizeof ext_hdr->sig);
> >>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >> /tmp/qemu-test/src/hw/acpi/core.c:203:9: error: 'strncpy' specified bound 6 equals destination size [-Werror=stringop-truncation]
> >>          strncpy(ext_hdr->oem_id, hdrs->oem_id, sizeof ext_hdr->oem_id);
> >>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >> /tmp/qemu-test/src/hw/acpi/core.c:207:9: error: 'strncpy' specified bound 8 equals destination size [-Werror=stringop-truncation]
> >>          strncpy(ext_hdr->oem_table_id, hdrs->oem_table_id,
> >>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >>                  sizeof ext_hdr->oem_table_id);
> >>                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >> /tmp/qemu-test/src/hw/acpi/core.c:216:9: error: 'strncpy' specified bound 4 equals destination size [-Werror=stringop-truncation]
> >>          strncpy(ext_hdr->asl_compiler_id, hdrs->asl_compiler_id,
> >>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >>                  sizeof ext_hdr->asl_compiler_id);
> >> ---
> >> make: *** [/tmp/qemu-test/src/rules.mak:69: hw/acpi/core.o] Error 1
> >> make: *** Waiting for unfinished jobs....
> >> /tmp/qemu-test/src/block/sheepdog.c: In function 'find_vdi_name':
> >> /tmp/qemu-test/src/block/sheepdog.c:1239:5: error: 'strncpy' specified bound 256 equals destination size [-Werror=stringop-truncation]
> >>      strncpy(buf + SD_MAX_VDI_LEN, tag, SD_MAX_VDI_TAG_LEN);
> >>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >> cc1: all warnings being treated as errors
> >> make: *** [/tmp/qemu-test/src/rules.mak:69: block/sheepdog.o] Error 1
> >> /tmp/qemu-test/src/hw/acpi/aml-build.c: In function 'build_header':
> >> /tmp/qemu-test/src/hw/acpi/aml-build.c:1535:9: error: 'strncpy' specified bound 6 equals destination size [-Werror=stringop-truncation]
> >>          strncpy((char *)h->oem_id, oem_id, sizeof h->oem_id);
> >>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >> /tmp/qemu-test/src/hw/acpi/aml-build.c:1541:9: error: 'strncpy' specified bound 8 equals destination size [-Werror=stringop-truncation]
> >>          strncpy((char *)h->oem_table_id, oem_table_id, sizeof(h->oem_table_id));
> >>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >> cc1: all warnings being treated as errors
> > 
> > I'm uncertain about these errors but it seems to be more likely to be
> > caused by some configuration or compiler change instead of the series
> > itself since this series never changed either acpi or sheepdog code.
> > So I'll temporarily ignore them...
> 
> 
> I am getting these too and I do not touch the mentioned files and
> folders ever.
> 
> 
> 
> -- 
> Alexey


You want 9cbb8eca1729eab1123847e37454975bb555008a I think.

-- 
MST