Rate This Document
Findability
Accuracy
Completeness
Readability

Configuring ExaGear for Server on CentOS

Sharing Directories Between the Host and Guest Systems

The entire ExaGear for Server file system is visible to host system applications. Only guest system files are visible to Linux applications on x86.

Figure 1 File systems of the host and guest systems (CentOS 7)

The configuration file /opt/exagear/images/centos-<os_version>-x86_64/.exagear/vpaths-list contains directories and files shared between the host and guest systems.

1
cat /opt/exagear/images/centos-<os_version>-x86_64/.exagear/vpaths-list

Command output:

/home/

/etc/adduser.conf

/etc/deluser.conf

...

The following files and configurations are shared between the host and guest systems:

  • user accounts
  • user groups
  • user privileges
  • /home directories
  • host configurations
  • system information provided by Linux kernel
  • devices and disks
  • sockets
  • pidfiles
  • mount points
  • logs
  • temporary files

To create a shared directory or file between the host and guest systems, use either of the following methods:

  • Method 1: Modify the vpaths-list configuration file.

    To modify the vpaths-list configuration file, perform the following steps:

    1. Ensure that the required directory or file exists on the host system.
    2. Create a fake directory or file with the same name on the guest system.
    3. Add the complete path of the directory or file to a new line in the opt/exagear/images/centos-<os_version>-x86_64/.exagear/vpaths-list configuration file.

      Note that the directory of the configuration file must end with a slash (/).

  • Method 2: Mount the directory to be shared on the host system to the guest system.

    Take /newdir as an example. Use the mount program in coreutils to mount the directory to be shared on the host system to the guest system.

    1. Create a mount point in the x86 operating environment.
      1
      sudo mkdir /opt/exagear/images/centos-<os_version>-x86_64/shareddir
      
    2. Mount newdir to the shareddir mount point.
      1
      sudo mount --bind /newdir /opt/exagear/images/centos-<os_version>-x86_64/shareddir
      

    Before uninstalling the ExaGear for Server, unmount the following directories:

    1
    sudo umount /opt/exagear/images/centos-<os_version>-x86_64/shareddir
    

Configuring Proxy

/etc/environment is not shared between the host and guest systems. If you use the proxy configuration in the local network through /etc/environment, ensure that you have copied the configuration to the guest system by running the following command:

1
sudo cp /etc/environment /opt/exagear/images/centos-<os_version>-x86_64/etc/environment

Configuring sysctl and Network

The guest system can access the sysctl settings in /proc/sys/, but cannot modify /etc/sysctl.conf or /etc/sysctl.d/. The sysctl parameters must be configured on the host system.

The guest system can access the file (for example, /etc/resolv.conf) that describes the network configuration, but cannot modify the network configuration. The network settings must be configured on the host system.

Integrating Guest SysV-Style Init Script and systemd on the Host

CentOS uses systemd as the init system and supports SysV-style init scripts as legacy. Many CentOS packages provide the configuration of these services.

By default, the system uses the automatic integration mechanism to represent the guest service as the host service. The guest service is registered as a host service with the same name. Therefore, you can manage the guest service from the guest and host shell. (In this case, the host service delegates all requests such as start, stop, and testconfig to the guest service.) Take CentOS as an example:

1
exagear

Command output: Starting /bin/bash in the guest image /opt/exagear/images/centos-<os_version>-x86_64

1
2
3
4
5
6
sudo yum update
sudo yum install epel-release
sudo yum install nginx
exit
sudo service nginx start
service nginx status

Command output:

● nginx.service - nginx - high performance web server

Loaded: loaded (/run/systemd/generator.late/nginx.service; generated)

Active: active (running) since Fri 2019-05-17 11:56:35 EDT; 2h 54min ago ...

You can list the files in the /opt/exagear/images/centos-<os_version>-x86_64/etc/init.d/ and /opt/exagear/images/centos-<os_version>-x86_64/lib/systemd/system/ directories of the guest system to check which services are registered in the guest system.

Memory Ordering Model

ExaGear for Server provides a weak memory ordering model for Linux applications on x86 by default. If the software depends on the x86 strong memory ordering model, ExaGear may be forced to strictly comply with the x86 strong memory ordering model. You can run the following commands to modify the ExaGear for Server configuration files:

1
2
sudo sed -i -e '/EXAGEAR_SMO_MODE="/s/fbase"/all"/' /etc/exagear-x86_32.conf
sudo sed -i -e '/EXAGEAR_SMO_MODE="/s/fbase"/all"/' /etc/exagear-x86_64.conf

Run the following commands to restore the weak memory ordering model:

1
2
sudo sed -i -e '/EXAGEAR_SMO_MODE="/s/all"/fbase"/' /etc/exagear-x86_32.conf
sudo sed -i -e '/EXAGEAR_SMO_MODE="/s/all"/fbase"/' /etc/exagear-x86_64.conf

Dynamic Secondary Optimization

The ExaGear dynamic secondary optimization can dynamically identify optimization opportunities during program translation, further improving the translation effect. The dynamic secondary optimization depends on the hardware SPE function and exists as a system service process. You can check whether the SPE function is available by referring to FAQ. To enable the dynamic secondary optimization, set EXAGEAR_USE_OPT to "y". By default, this option is set to "n" (disabled). Configuration method: Set EXAGEAR_USE_OPT to "y" in the configuration files /etc/exagear-x86_32.conf and /etc/exagear-x86_64.conf of 32-bit and 64-bit applications, respectively, to enable the dynamic secondary optimization.

  • Start the dynamic secondary optimization service.
    1
    2
    sudo systemctl start exagear-x86_64-opt.service
    sudo systemctl start exagear-x86_32-opt.service
    
  • Check the status of the dynamic secondary optimization service.
    1
    2
    sudo systemctl status exagear-x86_64-opt.service
    sudo systemctl status exagear-x86_32-opt.service
    

The opt.x64a64.socket and opt.x32a64.socket processes are started.

  • Enable or disable automatic startup of the dynamic secondary optimization service.
    1
    2
    3
    4
    sudo systemctl enable exagear-x86_64-opt.service
    sudo systemctl disable exagear-x86_64-opt.service
    sudo systemctl enable exagear-x86_32-opt.service
    sudo systemctl disable exagear-x86_32-opt.service
    

Before setting EXAGEAR_USE_OPT to "y", ensure that the exagear-x86_*-opt.service process is started.

Return Address Optimization

By default, the return address optimization function is disabled on ExaGear for Server. The related configuration EXAGEAR_DISABLE_NATIVE_RETURN_ADDR_OPT is set to "y". You can enable the return address optimization function as follows:

1
2
sudo sed -i -e '/EXAGEAR_DISABLE_NATIVE_RETURN_ADDR_OPT="/s/y"/n"/' /etc/exagear-x86_32.conf
sudo sed -i -e '/EXAGEAR_DISABLE_NATIVE_RETURN_ADDR_OPT="/s/y"/n"/' /etc/exagear-x86_64.conf

Precision with the Same Bits as x86

In ExaGear, if you need to perform 32/64-bit floating-point calculations with precision with the same bits as x86 (for example, calculations by using SIMD registers), you can enable the additional ExaGear option EXAGEAR_X86_PRECISE_FP. This option is disabled by default, but it can be enabled by setting the EXAGEAR_X86_PRECISE_FP parameter to "y". Configuration method: Add EXAGEAR_X86_PRECISE_FP="y" to the /etc/exagear-x86_32.conf and /etc/exagear-x86_64.conf files.

Enabling the EXAGEAR_X86_PRECISE_FP option may significantly deteriorate the overall performance of ExaGear.

80-Bit x86 Precision

In ExaGear, if 80-bit x86 precision is required, the additional ExaGear option EXAGEAR_X86_PRECISE_80BIT_FP should be enabled. This option is disabled by default, but it can be enabled by setting the EXAGEAR_X86_PRECISE_80BIT_FP parameter to "y". Configuration method: Add EXAGEAR_X86_PRECISE_80BIT_FP="y" to the /etc/exagear-x86_32.conf and /etc/exagear-x86_64.conf files.

Enabling the EXAGEAR_X86_PRECISE_80BIT_FP option may significantly deteriorate the overall performance of ExaGear.