~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/bpf/s390.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/bpf/s390.rst (Version linux-6.12-rc7) and /Documentation/bpf/s390.rst (Version linux-4.19.323)


  1 ===================                               
  2 Testing BPF on s390                               
  3 ===================                               
  4                                                   
  5 1. Introduction                                   
  6 ***************                                   
  7                                                   
  8 IBM Z are mainframe computers, which are desce    
  9 year 1964. They are supported by the Linux ker    
 10 document describes how to test BPF in an s390     
 11                                                   
 12 2. One-time setup                                 
 13 *****************                                 
 14                                                   
 15 The following is required to build and run the    
 16                                                   
 17   * s390 GCC                                      
 18   * s390 development headers and libraries        
 19   * Clang with BPF support                        
 20   * QEMU with s390 support                        
 21   * Disk image with s390 rootfs                   
 22                                                   
 23 Debian supports installing compiler and librar    
 24 Users of other distros may use debootstrap in     
 25                                                   
 26   sudo debootstrap \                              
 27     --variant=minbase \                           
 28     --include=sudo \                              
 29     testing \                                     
 30     ./s390-toolchain                              
 31   sudo mount --rbind /dev ./s390-toolchain/dev    
 32   sudo mount --rbind /proc ./s390-toolchain/pr    
 33   sudo mount --rbind /sys ./s390-toolchain/sys    
 34   sudo chroot ./s390-toolchain                    
 35                                                   
 36 Once on Debian, the build prerequisites can be    
 37                                                   
 38   sudo dpkg --add-architecture s390x              
 39   sudo apt-get update                             
 40   sudo apt-get install \                          
 41     bc \                                          
 42     bison \                                       
 43     cmake \                                       
 44     debootstrap \                                 
 45     dwarves \                                     
 46     flex \                                        
 47     g++ \                                         
 48     gcc \                                         
 49     g++-s390x-linux-gnu \                         
 50     gcc-s390x-linux-gnu \                         
 51     gdb-multiarch \                               
 52     git \                                         
 53     make \                                        
 54     python3 \                                     
 55     qemu-system-misc \                            
 56     qemu-utils \                                  
 57     rsync \                                       
 58     libcap-dev:s390x \                            
 59     libelf-dev:s390x \                            
 60     libncurses-dev                                
 61                                                   
 62 Latest Clang targeting BPF can be installed as    
 63                                                   
 64   git clone https://github.com/llvm/llvm-proje    
 65   ln -s ../../clang llvm-project/llvm/tools/      
 66   mkdir llvm-project-build                        
 67   cd llvm-project-build                           
 68   cmake \                                         
 69     -DLLVM_TARGETS_TO_BUILD=BPF \                 
 70     -DCMAKE_BUILD_TYPE=Release \                  
 71     -DCMAKE_INSTALL_PREFIX=/opt/clang-bpf \       
 72     ../llvm-project/llvm                          
 73   make                                            
 74   sudo make install                               
 75   export PATH=/opt/clang-bpf/bin:$PATH            
 76                                                   
 77 The disk image can be prepared using a loopbac    
 78                                                   
 79   qemu-img create -f raw ./s390.img 1G            
 80   sudo losetup -f ./s390.img                      
 81   sudo mkfs.ext4 /dev/loopX                       
 82   mkdir ./s390.rootfs                             
 83   sudo mount /dev/loopX ./s390.rootfs             
 84   sudo debootstrap \                              
 85     --foreign \                                   
 86     --arch=s390x \                                
 87     --variant=minbase \                           
 88     --include=" \                                 
 89       iproute2, \                                 
 90       iputils-ping, \                             
 91       isc-dhcp-client, \                          
 92       kmod, \                                     
 93       libcap2, \                                  
 94       libelf1, \                                  
 95       netcat, \                                   
 96       procps" \                                   
 97     testing \                                     
 98     ./s390.rootfs                                 
 99   sudo umount ./s390.rootfs                       
100   sudo losetup -d /dev/loopX                      
101                                                   
102 3. Compilation                                    
103 **************                                    
104                                                   
105 In addition to the usual Kconfig options requi    
106 is also helpful to select::                       
107                                                   
108   CONFIG_NET_9P=y                                 
109   CONFIG_9P_FS=y                                  
110   CONFIG_NET_9P_VIRTIO=y                          
111   CONFIG_VIRTIO_PCI=y                             
112                                                   
113 as that would enable a very easy way to share     
114 machine.                                          
115                                                   
116 Compiling kernel, modules and testsuite, as we    
117 simplify debugging, can be done using the foll    
118                                                   
119   make ARCH=s390 CROSS_COMPILE=s390x-linux-gnu    
120   make ARCH=s390 CROSS_COMPILE=s390x-linux-gnu    
121   make ARCH=s390 CROSS_COMPILE=s390x-linux-gnu    
122     -C tools/testing/selftests \                  
123     TARGETS=bpf \                                 
124     INSTALL_PATH=$PWD/tools/testing/selftests/    
125     install                                       
126                                                   
127 4. Running the test suite                         
128 *************************                         
129                                                   
130 The virtual machine can be started as follows:    
131                                                   
132   qemu-system-s390x \                             
133     -cpu max,zpci=on \                            
134     -smp 2 \                                      
135     -m 4G \                                       
136     -kernel linux/arch/s390/boot/compressed/vm    
137     -drive file=./s390.img,if=virtio,format=ra    
138     -nographic \                                  
139     -append 'root=/dev/vda rw console=ttyS1' \    
140     -virtfs local,path=./linux,security_model=    
141     -object rng-random,filename=/dev/urandom,i    
142     -device virtio-rng-ccw,rng=rng0 \             
143     -netdev user,id=net0 \                        
144     -device virtio-net-ccw,netdev=net0            
145                                                   
146 When using this on a real IBM Z, ``-enable-kvm    
147 performance. When starting the virtual machine    
148 setup must be finalized using the following co    
149                                                   
150   /debootstrap/debootstrap --second-stage         
151                                                   
152 Directory with the code built on the host as w    
153 need to be mounted as follows::                   
154                                                   
155   mkdir -p /linux                                 
156   mount -t 9p linux /linux                        
157   mount -t proc proc /proc                        
158   mount -t sysfs sys /sys                         
159                                                   
160 After that, the test suite can be run using th    
161                                                   
162   cd /linux/tools/testing/selftests/kselftest_    
163   ./run_kselftest.sh                              
164                                                   
165 As usual, tests can be also run individually::    
166                                                   
167   cd /linux/tools/testing/selftests/bpf           
168   ./test_verifier                                 
169                                                   
170 5. Debugging                                      
171 ************                                      
172                                                   
173 It is possible to debug the s390 kernel using     
174 by passing ``-s`` to QEMU.                        
175                                                   
176 It is preferable to turn KASLR off, so that gd    
177 kernel image in memory, by building the kernel    
178                                                   
179   RANDOMIZE_BASE=n                                
180                                                   
181 GDB can then be attached using the following c    
182                                                   
183   gdb-multiarch -ex 'target remote localhost:1    
184                                                   
185 6. Network                                        
186 **********                                        
187                                                   
188 In case one needs to use the network in the vi    
189 install additional packages, it can be configu    
190                                                   
191   dhclient eth0                                   
192                                                   
193 7. Links                                          
194 ********                                          
195                                                   
196 This document is a compilation of techniques,     
197 descriptions can be found by following these l    
198                                                   
199 - `Debootstrap <https://wiki.debian.org/EmDebi    
200 - `Multiarch <https://wiki.debian.org/Multiarc    
201 - `Building LLVM <https://llvm.org/docs/CMake.    
202 - `Cross-compiling the kernel <https://wiki.ge    
203 - `QEMU s390x Guest Support <https://wiki.qemu    
204 - `Plan 9 folder sharing over Virtio <https://    
205 - `Using GDB with QEMU <https://wiki.osdev.org    
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php