[ovs-dev,4/4] doc: Update configure section with prefetchwt1 details.

Message ID 1515778879-60075-4-git-send-email-bhanuprakash.bodireddy@intel.com
State New
Delegated to: Ian Stokes
Headers show
Series
  • [ovs-dev,1/4] compiler: Introduce OVS_PREFETCH variants.
Related show

Commit Message

Bodireddy, Bhanuprakash Jan. 12, 2018, 5:41 p.m.
Inspite of specifying -march=native when using Low Temporal Write(OPCH_LTW),
the compiler generates 'prefetchw' instruction instead of 'prefetchwt1'
instruction available on processor as in 'Case B'. To make the compiler emit
prefetchwt1 instruction, -mprefetchwt1 needs to be passed to configure
explicitly.

[Problem]
  Case A:
    OVS_PREFETCH_CACHE(addr, OPCH_HTW)  [__builtin_prefetch(addr, 1, 3)]
    [Assembly]
        leaq    -112(%rbp), %rax
        prefetchw  (%rax)

  Case B:
    OVS_PREFETCH_CACHE(addr, OPCH_LTW)  [__builtin_prefetch(addr, 1, 1)]
    [Assembly]
        leaq    -112(%rbp), %rax
        prefetchw  (%rax)             <***problem***>

[Solution]
   ./configure CFLAGS="-g -O2 -mprefetchwt1"

  Case B:
    OVS_PREFETCH_CACHE(addr, OPCH_LTW)  [__builtin_prefetch(addr, 1, 1)]
    [Assembly]
        leaq    -112(%rbp), %rax
        prefetchwt1  (%rax)

See also:
https://mail.openvswitch.org/pipermail/ovs-dev/2017-December/341591.html

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com>
---
 Documentation/intro/install/general.rst | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Patch

diff --git a/Documentation/intro/install/general.rst b/Documentation/intro/install/general.rst
index 718e5c2..4d2db45 100644
--- a/Documentation/intro/install/general.rst
+++ b/Documentation/intro/install/general.rst
@@ -280,6 +280,19 @@  With this, GCC will detect the processor and automatically set appropriate
 flags for it. This should not be used if you are compiling OVS outside the
 target machine.
 
+Compilers(gcc) won't emit prefetchwt1 instruction even with '-march=native'
+specified. In such case, -mprefetchwt1 needs to be explicitly passed during
+configuration.
+
+For example inspite of specifying -march=native when using Low Temporal Write
+i.e OVS_PREFETCH_CACHE(addr, OPCH_LTW), the compiler generates 'prefetchw'
+instruction instead of 'prefetchwt1' instruction available on processor.
+
+To make the compiler generate the appropriate instruction, it is recommended
+to pass ``-mprefetchwt1`` settings::
+
+    $ ./configure CFLAGS="-g -O2 -march=native -mprefetchwt1"
+
 .. note::
   CFLAGS are not applied when building the Linux kernel module. Custom CFLAGS
   for the kernel module are supplied using the ``EXTRA_CFLAGS`` variable when