Skip to content

Commit

Permalink
🐛 fix(1.0): 修复缩写的错误
Browse files Browse the repository at this point in the history
修复缩写的错误

refs #17

Signed-off-by: Tony Deng <wolf.deng@gmail.com>
  • Loading branch information
tonydeng committed Jun 26, 2020
1 parent 231b1a0 commit b4827d7
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions linux/sr-iov.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
`SR-IOV``Single Root I/O Virtualization`)是一个将`PCIe`共享给虚拟机的标准,通过为虚拟机提供独立的内存空间、中断、`DMA`流,来绕过`VMM`实现数据访问。SR-IOV基于两种`PCIe functions`

- `PF` (`Physical Function`): 包含完整的`PCIe`功能,包括`SR-IOV`的扩张能力,该功能用于`SR-IOV`的配置和管理。
- `FV` (`Virtual Function`): 包含轻量级的`PCIe`功能。每一个`VF`有它自己独享的`PCI`配置区域,并且可能与其他`VF`共享着同一个物理资源
- `VF` (`Virtual Function`): 包含轻量级的`PCIe`功能。每一个`VF`有它自己独享的`PCI`配置区域,并且可能与其他`VF`共享着同一个物理资源

![SR-IOV Architecture](images/sriovarchitecture.png)
![SR-IOV synthetic datapaths](images/sriovsynthetic-datapaths.png)
Expand All @@ -12,7 +12,7 @@
## SR-IOV要求

- `CPU` 必须支持`IOMMU`(比如英特尔的` VT-d` 或者`AMD``AMD-Vi``Power8` 处理器默认支持`IOMMU`
- `CPU` 必须支持`IOMMU`(比如英特尔的`VT-d` 或者`AMD``AMD-Vi``Power8` 处理器默认支持`IOMMU`
- 固件`Firmware` 必须支持`IOMMU`
- `CPU` 根桥必须支持 `ACS` 或者`ACS`等价特性
- `PCIe` 设备必须支持`ACS` 或者`ACS`等价特性
Expand All @@ -21,6 +21,7 @@
## SR-IOV vs PCI path-through

### 架构上的比较(以网卡为例)

![kvm-performance-optimization-for-ubuntu](images/kvm-performance-optimization-for-ubuntu-17-638.jpg)

![kvm-performance-optimization-for-ubuntu](images/kvm-performance-optimization-for-ubuntu-18-638.jpg)
Expand All @@ -31,10 +32,8 @@

> 图片来源[slideshare - Kvm performance optimization for ubuntu](https://www.slideshare.net/janghoonsim/kvm-performance-optimization-for-ubuntu)[KVM 介绍(4):I/O 设备直接分配和 SR-IOV [KVM PCI/PCIe Pass-Through SR-IOV]](http://www.cnblogs.com/sammyliu/p/4548194.html)

## SR-IOV vs DPDK


![sdn-fundamentals-for-nfv-openstack-and-containers-red-hat-summit](images/sdn-fundamentals-for-nfv-openstack-and-containers-red-hat-summit-2016-47-638.jpg)

![sdn-fundamentals-for-nfv-openstack-and-containers-red-hat-summit](images/sdn-fundamentals-for-nfv-openstack-and-containers-red-hat-summit-2016-48-638.jpg)
Expand All @@ -45,15 +44,15 @@

开启`VF`

```sh
```bash
modprobe -r igb
modprobe igb max_vfs=7
echo "options igb max_vfs=7" >>/etc/modprobe.d/igb.conf
```

查找`Virtual Function`

```sh
```bash
# lspci | grep 82576
0b:00.0 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)
0b:00.1 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection(rev 01)
Expand Down Expand Up @@ -90,7 +89,7 @@ pci_0000_0b_11_4
pci_0000_0b_11_5
```

```sh
```bash
$ virsh nodedev-dumpxml pci_0000_0b_00_0
<device>
<name>pci_0000_0b_00_0</name>
Expand All @@ -109,9 +108,9 @@ $ virsh nodedev-dumpxml pci_0000_0b_00_0
</device>
```

**通过libvirt绑定到虚拟机**
### 通过libvirt绑定到虚拟机

```sh
```bash
$ cat >/tmp/interface.xml <<EOF
<interface type='hostdev' managed='yes'>
<source>
Expand All @@ -126,22 +125,22 @@ $ virsh attach-device MyGuest /tmp/interface. xml --live --config

```xml
<interface type='hostdev' managed='yes'>
<source>
<address type='pci' domain='0' bus='11' slot='16' function='0'/>
</source>
<mac address='52:54:00:6d:90:02'>
<vlan>
<tag id='42'/>
</vlan>
<virtualport type='802.1Qbh'>
<parameters profileid='finance'/>
</virtualport>
</interface>
<source>
<address type='pci' domain='0' bus='11' slot='16' function='0'/>
</source>
<mac address='52:54:00:6d:90:02'>
<vlan>
<tag id='42'/>
</vlan>
<virtualport type='802.1Qbh'>
<parameters profileid='finance'/>
</virtualport>
</interface>
```

**通过Qemu绑定到虚拟机**
### 通过Qemu绑定到虚拟机

```
```bash
/usr/bin/qemu-kvm -name vdisk -enable-kvm -m 512 -smp 2 \
-hda /mnt/nfs/vdisk.img \
-monitor stdio \
Expand Down

0 comments on commit b4827d7

Please sign in to comment.