3 ## Copyright (c) 2010-2021 Intel Corporation
5 ## Licensed under the Apache License, Version 2.0 (the "License");
6 ## you may not use this file except in compliance with the License.
7 ## You may obtain a copy of the License at
9 ## http://www.apache.org/licenses/LICENSE-2.0
11 ## Unless required by applicable law or agreed to in writing, software
12 ## distributed under the License is distributed on an "AS IS" BASIS,
13 ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ## See the License for the specific language governing permissions and
15 ## limitations under the License.
17 ## This script should run after booting: see check-prox-system-setup.service
19 NCPUS="$(lscpu | egrep '^CPU\(s\):' | awk '{ print $2 }')"
20 MAXCOREID="$((NCPUS-1))"
22 tuned_config="/etc/tuned/realtime-virtual-guest-variables.conf"
23 log_file="/opt/rapid/prox_system_setup.log"
24 system_ready="/opt/rapid/system_ready_for_rapid"
25 tuned_done="/opt/rapid/tuned_done"
26 after_boot_file="/opt/rapid/after_boot.sh"
29 echo "Applying tuned profile">>$log_file
30 tuned-adm profile realtime-virtual-guest
32 echo "Rebooting...">>$log_file
37 if [ -f "$tuned_config" ]
42 isolated_cores=1-$MAXCOREID*)
43 if test ! -f "$tuned_done"; then
46 if test -f "$after_boot_file"; then
47 echo "Executing: $after_boot_file">>$log_file
50 echo "Isolated CPU(s) OK, no reboot: $line">>$log_file
51 ## rapid scripts will wait for the system_ready file to exist
52 ## Only then, they will be able to connect to the PROX instance
53 ## and start the testing
55 ## On some systems, we still need to use the igb_uio driver.
56 ## Example: good performance on AWS with the ENA interface.
57 ## Make sure that you change devbind.sh to use the preferred
58 ## driver. vfio is the default.
60 insmod /opt/rapid/dpdk/build/kmod/igb_uio.ko wc_activate=1
64 echo "Isolated CPU(s) NOK: $line">>$log_file
65 sed -i "/^isolated_cores=.*/c\isolated_cores=1-$MAXCOREID" $tuned_config
72 done < "$tuned_config"
73 echo "isolated_cores=1-$MAXCOREID" >> $tuned_config
74 echo "No Isolated CPU(s) defined in config, line added: isolated_cores=1-$MAXCOREID">>$log_file
77 echo "$tuned_config not found.">>$log_file