RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 767886 - ATS capability is disabled when NIC is assigned to a guest
Summary: ATS capability is disabled when NIC is assigned to a guest
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: kernel
Version: 6.2
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: ---
Assignee: Don Dugger
QA Contact: Endre "Hrebicek" Balint-Nagy
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-12-15 06:26 UTC by Yongjie Ren
Modified: 2014-09-24 01:29 UTC (History)
16 users (show)

Fixed In Version: kernel-2.6.32-315.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-02-21 06:00:32 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
add device info before mapping context (1.11 KB, text/plain)
2011-12-16 03:28 UTC, Hao, Xudong
no flags Details
enable ATS when restore (1.35 KB, text/plain)
2011-12-16 03:31 UTC, Hao, Xudong
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2013:0496 0 normal SHIPPED_LIVE Important: Red Hat Enterprise Linux 6 kernel update 2013-02-20 21:40:54 UTC

Description Yongjie Ren 2011-12-15 06:26:54 UTC
Description of problem:
Using a Myricom NIC with ATS capability for testing, 'lspci -vvv' or a myricom tool shows this NIC has ATS capability. But, after assigning this NIC to a guest, I found the myricom tool shows 'ATS is disabled' both in host and in guest.

Version-Release number of selected component (if applicable):
kernel-2.6.32-220.el6.x86_64.rpm   
qemu-kvm-0.12.1.2-2.209.el6.x86_64.rpm 

How reproducible:
100%

Steps to Reproduce:
1.get a Myricom NIC with ATS capability, and start rhel6.2
2.in rhel6.2, use 'lspci -vvv' or a Myricom tool to check if the NIC has ATS capability    (It will has ATS.)
3.start a guest with the Myricom NIC assigned using qemu-kvm
4.use the Myricom tool to check if the NIC has ATS capability in host and guest
  
Actual results:
it shows 'ATS is disabled'.

Expected results:
using myricom tool, we can find 'ATS is enabled' in host and guest.

Additional info:

Comment 2 Hao, Xudong 2011-12-16 03:25:19 UTC
Root caused this bug, there are 2 issues at here for both RHEL6.2 kernel and linux upstream.
1). When the device with ATS capability is assigned to guest, KVM will enable ATS as expect, however, the device info did not be added into list before do context mapping, so enable device fail. code path is:
   kvm_assign_device
           \
   iommu_attach_device
           \
   intel_iommu_attach_device
           \
   domain_add_dev_info
           \
   domain_context_mapping
           \
   domain_context_mapping_one
           \
   iommu_enable_dev_iotlb(info)
           \  /*pci_enable_ats be called only if info is not Null*/

2). ATS status did not be restore after to FLR at all; this issue also happen on system S3/S4 case, when system sleep into S3 or S4, and then system resume, pci_restore_state() did not restore the ATS status for device.

I cook two patches for these two issues fix, will attach them in this BZ.

Comment 3 Hao, Xudong 2011-12-16 03:28:20 UTC
Created attachment 547583 [details]
add device info before mapping context

Add device info into list before do context mapping, because device info will be used by iommu_enable_dev_iotlb function.

Comment 4 Hao, Xudong 2011-12-16 03:31:09 UTC
Created attachment 547584 [details]
enable ATS when restore

When system go to S3 or S4 sleep and then return, some register of PCI device does not be restored correctly, such as ATS capability. The same problem happen on pci reset function.

This patch enable ATS at the device state restore if PCIe device has ATS capability.

Comment 5 Alex Williamson 2011-12-16 03:57:46 UTC
(In reply to comment #2) 
> I cook two patches for these two issues fix, will attach them in this BZ.

Will you be submitting these upstream?  Please let us know when they are accepted.  Thanks

Comment 6 Hao, Xudong 2011-12-16 05:14:11 UTC
(In reply to comment #5)
> (In reply to comment #2) 
> > I cook two patches for these two issues fix, will attach them in this BZ.
> Will you be submitting these upstream?  Please let us know when they are
> accepted.  Thanks

Sure, I will submit to upstream and indicate commit here if they are accepted.

Comment 8 RHEL Program Management 2012-05-03 05:27:47 UTC
Since RHEL 6.3 External Beta has begun, and this bug remains
unresolved, it has been rejected as it is not proposed as
exception or blocker.

Red Hat invites you to ask your support representative to
propose this request, if appropriate and relevant, in the
next release of Red Hat Enterprise Linux.

Comment 9 Hao, Xudong 2012-05-03 07:34:15 UTC
(In reply to comment #8)
> Since RHEL 6.3 External Beta has begun, and this bug remains
> unresolved, it has been rejected as it is not proposed as
> exception or blocker.
> Red Hat invites you to ask your support representative to
> propose this request, if appropriate and relevant, in the
> next release of Red Hat Enterprise Linux.

There are two patches to try fix this issue, the 1st is iommu side and the 2nd is pci side. 

The 2nd patch has been included in linux upstream commit: 1900ca132f53c3d51e6e6b94ea8912530223c63a. 
 "PCI: Enable ATS at the device state restore"

The 1st patch did not be checked into linux yet, I'm continuing push it.

I think RHEL6.3 can merge the 2nd patch in firstly. But maybe it's still a long time for the 1st patch, so delay this bug to next release of RHEL.

Comment 10 Don Dutile (Red Hat) 2012-05-03 21:51:00 UTC
Need 1st patch to be upstream before inclusion in RHEL6.

RHEL6.3 is taking release blockers only. 
This bz is not a release blocker for 6.3,
and is targetted for 6.4.

Please continue to push upstream inclusion, so we can do backport once included.

Comment 11 Hao, Xudong 2012-05-28 01:13:45 UTC
Now all fix patches is in kernel upstream tree, which include 3 patches commit:

commit 109b9b0408e5f1dd327a44f446841a9fbe0bcd83
Author: David Woodhouse <dwmw2>
Date:   Fri May 25 17:43:02 2012 +0100

    intel-iommu: Move duplicate list-mangling code into unlink_domain_info() helper

commit e2ad23d04c1304431ab5176c89b7b476ded2d995
Author: David Woodhouse <dwmw2>
Date:   Fri May 25 17:42:54 2012 +0100

    intel-iommu: Add device info into list before doing context mapping

commit 1900ca132f53c3d51e6e6b94ea8912530223c63a
Author: Hao, Xudong <xudong.hao>
Date:   Sat Dec 17 21:24:40 2011 +0800

    PCI: Enable ATS at the device state restore

Comment 12 Don Dutile (Red Hat) 2012-09-20 20:59:49 UTC
(In reply to comment #11)
> Now all fix patches is in kernel upstream tree, which include 3 patches
> commit:
> 
> commit 109b9b0408e5f1dd327a44f446841a9fbe0bcd83
> Author: David Woodhouse <dwmw2>
> Date:   Fri May 25 17:43:02 2012 +0100
> 
>     intel-iommu: Move duplicate list-mangling code into unlink_domain_info()
> helper
> 
> commit e2ad23d04c1304431ab5176c89b7b476ded2d995
> Author: David Woodhouse <dwmw2>
> Date:   Fri May 25 17:42:54 2012 +0100
> 
>     intel-iommu: Add device info into list before doing context mapping
> 
> commit 1900ca132f53c3d51e6e6b94ea8912530223c63a
> Author: Hao, Xudong <xudong.hao>
> Date:   Sat Dec 17 21:24:40 2011 +0800
> 
>     PCI: Enable ATS at the device state restore

What we need to do to support this new functionality (ATS hasn't been supported in RHEL5 or RHEL6 to date) is determine the necessary patches for RHEL6.
For example, the last commit above is to a file that doesn't even exist in RHEL6.  That requires cherry-picking 10 patches previous to it before commit 1900ca132 can be applied.
Additionally, there are over 50 patches in upstream intel-iommu.c btwn the
above ATS patches and the rhel6 version of that file.  Many of those 50 patches aren't needed, but we have to go through them to figure out which of those 50 patches are needed before the first two patches above will enable ATS correctly.

Comment 13 Don Dugger 2012-09-21 14:44:53 UTC
Turns out RHEL 6 does support ATS, it's just that the support is tied to the config parameter CONFIG_PCI_IOV (a lot of the differences between the RHEL 6 kernel and upstrem in this area are related to refactoring to put the ATS code in separate files under the CONFIG_PCI_ATS parameter so it is separately configurable).  Intel has tested the 3 patches and they fix this BZ, I'll be posting the patches to RHML shortly.

Comment 14 RHEL Program Management 2012-09-25 18:49:51 UTC
This request was evaluated by Red Hat Product Management for
inclusion in a Red Hat Enterprise Linux release.  Product
Management has requested further review of this request by
Red Hat Engineering, for potential inclusion in a Red Hat
Enterprise Linux release for currently deployed products.
This request is not yet committed for inclusion in a release.

Comment 16 Zhang Kexin 2012-09-26 06:24:38 UTC
Hi Yongjie,
It seems we don't have the card in-house. Do you commit to test the bug in rhel6.4 testing cycle? Thanks.

Comment 17 Yongjie Ren 2012-09-26 07:01:09 UTC
(In reply to comment #16)
> Hi Yongjie,
> It seems we don't have the card in-house. Do you commit to test the bug in
> rhel6.4 testing cycle? Thanks.

Yes, sure. I'll do a testing for RHEL6.4 to verify this bug.

BTW, there might be a bug for the driver 'myri10ge' in RHEL6.3/6.4. It can't driver my Myricom NIC, which has nothing about virtualization.
So, I'll verify this bug with RHEL6.4 as my host and RHEL6.2 as a guest.

Comment 20 Don Dugger 2012-09-26 17:47:25 UTC
(Odd, for reasons that are obscure to me I can't see comment #15 where Kexin asked me for info.  Anyway...)

I think the risk associated with this patch is not that great.  The bug is fixed by 3 patches that:

1)  Add the device info at the right time.  This is current code that is just moved to the appropriate place.

2)  Consolidate some common code.

3)  Restore state after an S3 resume, the correct thing to do.

Also, we have tested it, even through S3, with no problems so I think this should be a safe change.

Comment 22 Jarod Wilson 2012-10-01 17:13:25 UTC
Patch(es) available on kernel-2.6.32-315.el6

Comment 25 Yongjie Ren 2012-12-05 09:34:46 UTC
ATS is enabled in the assigned Myricom NIC in a RHEL6.4 guest on a RHEL6.4 host.

Verified by Intel Virtualization Team.

RPM packages I used:
kernel-2.6.32-343.el6.x86_64
qemu-kvm-0.12.1.2-2.335.el6.x86_64

Comment 27 errata-xmlrpc 2013-02-21 06:00:32 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2013-0496.html


Note You need to log in before you can comment on or make changes to this bug.