JDK-6990015 : Incorrect Icache line size is used for 64 bit x86
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: hs20
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_10
  • CPU: x86
  • Submitted: 2010-10-06
  • Updated: 2011-11-25
  • Resolved: 2011-09-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8 Other
7u2Fixed 8Fixed hs22Fixed
Related Reports
Relates :  
Description
I think when we added this code (6 years ago) for Athlon64 we used line size which could be conservative. In worst case we flashing cacheline 2 times, that is all. But you are right the line size should not be hardcoded at that place but taking from VM_Version code like L1_data_cache_line_size() which is based on cpuid.

Vladimir

Venkatachalam, Vasanth wrote:
> Hi Vladimir,
>
> We are investigating JVM optimizations for Bulldozer hardware. I noticed a file in the Hotspot source src/cpu/x86/vm/icache_x86.hpp that is setting the instruction cache line size to 32B for AMD64. Here���s a snippet of code. For brevity, I���ve stripped away some of the comments:
>
> // Interface for updating the instruction cache.  Whenever the VM modified
> // code, part of the processor instruction cache potentially has to be flushed.
>
> class ICache : public AbstractICache {
>  public:
> #ifdef AMD64
>   enum {
>     stub_size      = 64, // Size of the icache flush stub in bytes
>     line_size       = 32, // Icache line size in bytes
>     log2_line_size = 5   // log2(line_size)
>   };
>
> Maybe I���m reading this incorrectly, but the comments suggest that Hotspot is assuming the icache line size to be 32B, for the purposes of flushing the icache whenever it modifies code. It looks like this information is being used in the file src/share/vm/runtime/icache.cpp, for example, in the invalidate_word( ) method, which is getting called from nativeInst_x86.cpp.
>
> Can you explain why 32 was chosen for line_size in this code? The actual L1 ICache line size is 64B.
>
> Regards,
> Vasanth

Comments
EVALUATION http://hg.openjdk.java.net/hsx/hotspot-rt/hotspot/rev/6ae7a1561b53
08-07-2011

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-main/hotspot/rev/6ae7a1561b53
07-07-2011

EVALUATION Until 7059226 is fixed we can't use information from cpuid to determine the cache flashing size since flush_icache stub have to be generated before cpuid stub. For now I just fixed the ICache::line_size and added verification code into vm_version_x86. After 7059226 is fixed I will revisit this Icache code.
01-07-2011

EVALUATION http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/rev/6ae7a1561b53
01-07-2011