<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
For the record, Microsoft have no published a KB article
acknowledging the problem:-<br>
<pre wrap=""><a class="moz-txt-link-freetext" href="https://support.microsoft.com/en-us/help/4567569/gdi-apis-may-fail-when-large-pages-or-vad-spanning-is-used">https://support.microsoft.com/en-us/help/4567569/gdi-apis-may-fail-when-large-pages-or-vad-spanning-is-used</a>
-phil.
</pre>
<br>
<br>
On 6/11/20, 9:12 PM, Jayathirth D v wrote:
<blockquote
cite="mid:DF98408B-1A40-4E62-B589-798685EEB45C@ORACLE.COM"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+1.
<div class=""><br class="">
</div>
<div class="">Thanks,</div>
<div class="">Jay<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 12-Jun-2020, at 12:16 AM, Philip Race <<a
moz-do-not-send="true"
href="mailto:philip.race@oracle.com" class="">philip.race@oracle.com</a>>
wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8" class="">
<div class=""> <br class="">
one more update to the tests <br class="">
<a moz-do-not-send="true"
href="http://cr.openjdk.java.net/%7Eprr/8240654.2/"
class="">cr.openjdk.java.net/~prr/8240654.2/</a><br
class="">
<br class="">
I added <br class="">
<span style="float: none; background-color: rgb(238,
238, 238); font-family: Consolas; font-size: 13.33px;
font-style: normal; font-variant-ligatures: normal;
font-variant-caps: normal; font-variant-east-asian:
normal; font-variant-position: normal; font-weight:
400; letter-spacing: normal; orphans: 2; text-align:
left; text-decoration: none; text-indent: 0px;
text-transform: none; -webkit-text-stroke-width: 0px;
white-space: pre; word-spacing: 0px; display: inline
!important;" class="">@requires vm.gc.Z
</span><span style="float: none; background-color:
rgb(238, 238, 238); font-size: 13.33px; font-style:
normal; font-variant-ligatures: normal;
font-variant-caps: normal; font-variant-east-asian:
normal; font-variant-position: normal; font-weight:
400; letter-spacing: normal; text-align: left;
text-decoration: none; text-indent: 0px;
text-transform: none; -webkit-text-stroke-width: 0px;
white-space: pre; word-spacing: 0px; display: inline
!important;" class="">per the VM folks, ZGC needs
Windows Server 2019 or the same vintage Window 10. if
run on Windows Server 2016</span><br class="">
<span style="float: none; background-color: rgb(238,
238, 238); font-size: 13.33px; font-style: normal;
font-variant-ligatures: normal; font-variant-caps:
normal; font-variant-east-asian: normal;
font-variant-position: normal; font-weight: 400;
letter-spacing: normal; text-align: left;
text-decoration: none; text-indent: 0px;
text-transform: none; -webkit-text-stroke-width: 0px;
white-space: pre; word-spacing: 0px; display: inline
!important;" class="">ZGC errors out. This should
prevent that.
-phil.
</span><span style="float: none; background-color:
rgb(238, 238, 238); font-family: Consolas; font-size:
13.33px; font-style: normal; font-variant-ligatures:
normal; font-variant-caps: normal;
font-variant-east-asian: normal;
font-variant-position: normal; font-weight: 400;
letter-spacing: normal; orphans: 2; text-align: left;
text-decoration: none; text-indent: 0px;
text-transform: none; -webkit-text-stroke-width: 0px;
white-space: pre; word-spacing: 0px; display: inline
!important;" class=""></span><br class="">
<div class="moz-cite-prefix">On 6/11/2020 11:13 AM,
Kevin Rushforth wrote:<br class="">
</div>
<blockquote type="cite"
cite="mid:2bd095d1-3542-39a3-28df-f2df1c6e3d4a@oracle.com"
class="">
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8" class="">
+1<br class="">
<br class="">
The updated <font class="">LargeWindowPaintTest fails
for me without the fix without my having to manually
set uiScale. It passes with the fix.<br class="">
<br class="">
Interestingly enough, I finally saw the problem that
Jay reported with AlphaPrintTest: without the fix I
initially get a blank (all white) window. If I
resize it then it is drawn. With the fix everything
is fine.<br class="">
<br class="">
-- Kevin<br class="">
</font><br class="">
<div class="moz-cite-prefix">On 6/11/2020 10:48 AM,
Philip Race wrote:<br class="">
</div>
<blockquote type="cite"
cite="mid:5EE26E62.1050707@oracle.com" class="">
<meta content="text/html; charset=UTF-8"
http-equiv="Content-Type" class="">
Updated webrev here<br class="">
<br class="">
<a class="moz-txt-link-freetext"
href="http://cr.openjdk.java.net/%7Eprr/8240654.1/index.html"
moz-do-not-send="true">http://cr.openjdk.java.net/~prr/8240654.1/index.html</a><br
class="">
<br class="">
The only changes are to the tests - to add
-Dsun.java2d.uiScale=1 to the onscreen test<br
class="">
and to add printer to the keys for the printing
test.<br class="">
<br class="">
It was pointed out by Stefan from the ZGC team that
the changes in awt_TrayIcon.cpp and awt_Cursor.cpp<br
class="">
should not be needed because the GDI code in
Create_BMP that ultimately consumes the data<br
class="">
has processed and copied it into memory allocated by
CreateDIBSection before passing it to<br class="">
CreateBitmap. I considered reverting those two files
but decided to keep them because I<br class="">
think I would like this fix anyway. We really don't
need to lock down the VM in these cases.<br class="">
<br class="">
-phil.<br class="">
<br class="">
<br class="">
On 6/11/20, 9:55 AM, Philip Race wrote:
<blockquote
cite="mid:9d9d3d82-49f5-df89-7e92-7b432cec05bd@oracle.com"
type="cite" class="">
<meta http-equiv="Content-Type"
content="text/html; charset=UTF-8" class="">
I have confirmed hit a different code path. It
goes through generic 2D s/w loops in this case.<br
class="">
ie we don't use GDIBlitLoops at all. The code in
sun/java2d/pipe/DrawImage.java ends up in<br
class="">
scaleSurfaceData which uses the loops in
ScaledBlit.c.<br class="">
<br class="">
It is a bit surprising to me since I'd expect us
to be able to blit directly at device resolution.<br
class="">
Could we also be taking a performance hit here ?
The D3D case doesn't not go through this loop.<br
class="">
<br class="">
However all that is outside the scope of this fix
... I think setting uiScale=1 in the test is all
that needs to be done.<br class="">
<br class="">
-phil.<br class="">
<br class="">
<div class="moz-cite-prefix">On 6/11/2020 7:51 AM,
Philip Race wrote:<br class="">
</div>
<blockquote type="cite"
cite="mid:5EE244F1.1090102@oracle.com" class="">
<meta content="text/html; charset=UTF-8"
http-equiv="Content-Type" class="">
Or, maybe we hit a different code path. I'll
check that.<br class="">
uiScale=1 is the way to ensure we hit this code
path.<br class="">
<br class="">
-phil.<br class="">
<br class="">
On 6/11/20, 7:44 AM, Philip Race wrote:
<blockquote
cite="mid:5EE24369.5000804@oracle.com"
type="cite" class="">
<meta content="text/html; charset=UTF-8"
http-equiv="Content-Type" class="">
Can I get clarification here. <br class="">
<br class="">
> I do, and had to run with
"-Dsun.java2d.uiScale=1" in order to see the
failure with <font class="">LargeWindowPaintTest.<br
class="">
<br class="">
So you both mean a JDK 15 promoted build
without this fix and without this property
passes because you have<br class="">
a hidpi setup. And to see the failure
without the fix you needed the above
property.<br class="">
If so we could just be looking at a similar
anomaly as I saw with printing which uses a
very large<br class="">
image - it reported failure but actually
worked !</font><br class="">
<br class="">
Also - for both of you - with the fix and
without forcing uiScale=1 does the test pass ?<br
class="">
<br class="">
-phil.<br class="">
<br class="">
On 6/11/20, 7:10 AM, Jayathirth D v wrote:
<blockquote
cite="mid:2D493453-9DEA-474E-8BFF-79EAD55BBECC@ORACLE.COM"
type="cite" class="">
<meta http-equiv="Content-Type"
content="text/html; charset=UTF-8"
class="">
<div class="">Yes my machine was at 150%
scaling.</div>
<div class=""><br class="">
</div>
<div class="">If I force uiScale = 1, I see
that:</div>
<div class=""><span style="" class="">LargeWindowPaintTest
fails without patch and passes with
patch.</span></div>
<div class=""><font class="">AlphaPrintTest
shows <span style="caret-color: rgb(0,
0, 0);" class="">instructions without
patch also.</span></font></div>
<div class=""><font class=""><span
style="caret-color: rgb(0, 0, 0);"
class=""><br class="">
</span></font></div>
<div class="">@Phil : I think its better if
we test at uiScale=1(larger memory
footprint). Please clarify.</div>
<div class=""><br class="">
</div>
<div class="">Thanks,</div>
<div class="">Jay</div>
<div class=""><br class="">
<div class="">
<blockquote type="cite" class="">
<div class="">On 11-Jun-2020, at 5:53
PM, Kevin Rushforth <<a
moz-do-not-send="true"
href="mailto:kevin.rushforth@oracle.com"
class="">kevin.rushforth@oracle.com</a>>
wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<meta http-equiv="Content-Type"
content="text/html; charset=UTF-8"
class="">
<div class=""> Do you have a Hi-DPI
machine? I do, and had to run with
"-Dsun.java2d.uiScale=1" in order
to see the failure with <font
class="">LargeWindowPaintTest.<br
class="">
<br class="">
For AlphaPrintTest, the test
deliberately ensures that you
print before saying whether it
passes or not. FWIW, I verified
that the printing test on my
system was hitting the fallback
code with the patch, but it
seemed to print correctly even
without the patch.<br class="">
<br class="">
-- Kevin<br class="">
</font><br class="">
<br class="">
<div class="moz-cite-prefix">On
6/11/2020 1:58 AM, Jayathirth D
v wrote:<br class="">
</div>
<blockquote type="cite"
cite="mid:40C65E05-2AA8-4C4B-98B1-6A7F58BFFD22@ORACLE.COM"
class="">
<meta http-equiv="Content-Type"
content="text/html;
charset=UTF-8" class="">
Typo : I tried tested -><span
style="caret-color: rgb(0, 0,
0);" class=""> I tried </span>testing<br
class="">
<div class=""><br class="">
<blockquote type="cite"
class="">
<div class="">On
11-Jun-2020, at 2:27 PM,
Jayathirth D v <<a
href="mailto:JAYATHIRTH.D.V@ORACLE.COM"
class=""
moz-do-not-send="true">JAYATHIRTH.D.V@ORACLE.COM</a>>
wrote:</div>
<br
class="Apple-interchange-newline">
<div class="">
<meta
http-equiv="Content-Type"
content="text/html;
charset=UTF-8" class="">
<div style="word-wrap:
break-word;
-webkit-nbsp-mode:
space; line-break:
after-white-space;"
class="">Hi Phil,
<div class=""><br
class="">
</div>
<div class="">I tried
tested the fix in my
Windows 10 machine
with Intel integrated
UHD Graphics 620.</div>
<div class=""><br
class="">
</div>
<div class=""><font
class="">LargeWindowPaintTest.java
passes with/without
fix in my machine.</font></div>
<div class=""><font
class="">AlphaPrintTest.java
without fix just
opens up blank frame
without any
instructions and
with fix it
shows instructions
for the test.</font></div>
<div class=""><span
style="caret-color:
rgb(0, 0, 0);"
class="">Is this
expected behaviour?</span></div>
<div class=""><span
style="caret-color:
rgb(0, 0, 0);"
class=""><br
class="">
</span></div>
<div class=""><span
style="caret-color:
rgb(0, 0, 0);"
class="">AlphaPrintTest.java
w</span><font
class="">ith fix
when it shows
instructions if I
click on
Pass(Since I don’t have
printer right now)
it doesn’t
pass/close the
window. Only after I
click on Print
button and then
close print dialog
it allows me to
click on Pass
button.</font></div>
<div class=""><font
class=""><span
style="caret-color:
rgb(0, 0, 0);"
class=""><br
class="">
</span></font></div>
<div class=""><font
class=""><span
style="caret-color:
rgb(0, 0, 0);"
class="">Also how
does these tests
behave in our
internal CI
machines?</span></font></div>
<div class=""><br
class="">
<div class="">Thanks,</div>
<div class="">Jay</div>
<div class=""><br
class="">
<blockquote
type="cite"
class="">
<div class="">On
11-Jun-2020, at
2:18 AM, Philip
Race <<a
href="mailto:philip.race@oracle.com"
class=""
moz-do-not-send="true">philip.race@oracle.com</a>>
wrote:</div>
<br
class="Apple-interchange-newline">
<div class="">
<meta
http-equiv="content-type"
content="text/html;
charset=UTF-8"
class="">
<div class="">
Bug: <a
class="moz-txt-link-freetext"
href="https://bugs.openjdk.java.net/browse/JDK-8240654"
moz-do-not-send="true">https://bugs.openjdk.java.net/browse/JDK-8240654</a><br
class="">
Webrev: <a
class="moz-txt-link-freetext"
href="http://cr.openjdk.java.net/%7Eprr/8240654/index.html"
moz-do-not-send="true">http://cr.openjdk.java.net/~prr/8240654/index.html</a><br
class="">
<br class="">
This is for
JDK 15 so
review ASAP
please since
RDP 1 and the
test cycle are
looming.<br
class="">
<br class="">
This is not a
fix for a JDK
bug. It is a
bunch of
workarounds
for a
Microsoft
Windows bug
affecting<br
class="">
GDI in the
context of ZGC
(<a
class="moz-txt-link-freetext"
href="http://openjdk.java.net/jeps/333" moz-do-not-send="true">http://openjdk.java.net/jeps/333</a>).<br
class="">
Some extra
details about
the Windows
bug at the
end, but first
the technical
details of the
fix.<br
class="">
<br class="">
With ZGC's
memory
allocation
requirement of
reserving
memory in 2Mb
chunks some
Windows GDI<br
class="">
functions,
mostly
involving some
bitmaps APIs
may return a
failure code
(ie fail!)<br
class="">
This typically
occurs when
Java heap
memory is used
for a Java
image and then
in a JNI<br
class="">
call we use
GetPrimitiveArrayCritical
so that Java
heap allocated
memory is
passed to a
GDI<br
class="">
function AND
the Java heap
memory spans
one of the 2Mb
boundaries. <br
class="">
This is very
easy to
trigger in
almost any
Java UI app if
the window is
of a large
enough (ie
typical) size.<br
class="">
NB: if you
have an Nvidia
or ATI card,
then you won't
see it,
because the
D3D pipeline
doesn't<br
class="">
call the
affected
method but if
you have an
Intel chip as
do 90% (?) of
laptops you
will see it.<br
class="">
There are also
several other
places we
found that are
affected.
Printing is
the other one<br
class="">
somewhat easy
to trigger.
The others :
custom cursors
and tray icons
are less
common.<br
class="">
The painful
thing here is
that there is
no definitive
list (a list
of the known
ones is below)
of<br class="">
affected
Windows GDI
APIs and we
are just
hunting around
our code
trying to see
where it<br
class="">
might be
side-swiped by
this bug.<br
class="">
<br class="">
The basic
approach in
these
workarounds is
that for cases
where
performance
does not
matter we now
copy <br
class="">
and for cases
where
performance
does matter or
larger amounts
of memory is
involved we
check if<br
class="">
the return
value of the
GDI function
indicates
failure and
then re-try
with a copy of
the heap
memory. <br
class="">
Unless GDI was
randomly
failing
already
(unlikely)
this should be
a no-risk
solution in
the high
profile cases.
<br class="">
We have done
performance
measurements
on the
important
screen case
and the
failures<br
class="">
happen fast so
the penalty is
then in the
re-try which
is only if ZGC
is enabled.<br
class="">
Always copying
the memory is
slower (and
memcpy is the
slow
operation)
than an
alternative
approach<br
class="">
that "knows"
about the
memory
allocation of
ZGC but this
coupling and
the complexity
seem like they
aren't<br
class="">
worth it since
I haven't seen
any visible
performance
consequence.
That can be
revisited<br
class="">
some day if
need be, but
for now we
have
correctness
which is the
key as well as
sufficient
performance.<br
class="">
<br class="">
I've created
an automated
test for the
most important
on-screen
case. <br
class="">
Also a manual
printing test
case which
invokes ZGC is
provided since
there we also
only<br
class="">
conditionally
copy. In the
other cases we
now always
copy so
existing test
cases should
over those.<br
class="">
<br class="">
There is some
clean up in
this fix - one
completely
unused
(provably so
because it was
#if'd out)<br
class="">
JNI method in
awt_PrintJob.cpp
is removed
since it had
code that
looked like it
needed a
workaround,<br
class="">
which would be
somewhat of a
waste of
effort.<br
class="">
<br class="">
the
doPrintBand
code and its
callee
bitsToDevice
has code I
think we can
remove too
since<br
class="">
I don't see
how it ever
gets executed
(the top down
case for
browserPrint
== true) but<br
class="">
I think I'll
save that for
a P4 follow-on
since it does
nothing that
would be
affected by
this<br
class="">
Windows bug.<br
class="">
<br class="">
One oddity is
the in the
printing case
I observed
that some
times the
rendering is
performed<br
class="">
even if an
error code is
returned. I
don't know
why, but in
code we can't
tell that it
was actually<br
class="">
rendered and
in any case
there is no
harm in
repeating the
call with
copied memory.<br
class="">
<br class="">
We are right
before the
JDK15
stabilisation
fork and this
fix needs to
go there and
will<br
class="">
but the webrev
is against
jdk/client
simply because
jdk15 does not
exist yet !<br
class="">
<br class="">
Please test
and review
ASAP.<br
class="">
<br class="">
About the bug:<br
class="">
Microsoft has
acknowleged
the bug and
will publish a
knowledge base
article about
it<br class="">
but a fix may
show up only
in a future
version of
Windows. Not,
it seems, any
time soon.<br
class="">
Below is a
list of
potentially
affected GDI
APIs. Per
microsoft
whether it
actually
manifests in<br
class="">
any specific
case depends
on "branching"<br
class="">
<span
style="font-family:"Courier
New",serif;color:#1F4E79" class=""></span>
<p
class="MsoNormal"><span
style="font-family:"Courier
New",serif" class=""><a
href="https://docs.microsoft.com/en-us/previous-versions/windows/desktop/wcs/checkbitmapbits"
class=""
moz-do-not-send="true">https://docs.microsoft.com/en-us/previous-versions/windows/desktop/wcs/checkbitmapbits</a></span></p>
<p
class="MsoNormal"><span
style="font-family:"Courier
New",serif" class=""><a
href="https://docs.microsoft.com/en-us/previous-versions/windows/desktop/wcs/createcolortransform"
class=""
moz-do-not-send="true">https://docs.microsoft.com/en-us/previous-versions/windows/desktop/wcs/createcolortransform</a></span></p>
<p
class="MsoNormal"><span
style="font-family:"Courier
New",serif" class=""><a
href="https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-setdibitstodevice"
class=""
moz-do-not-send="true">https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-setdibitstodevice</a></span></p>
<p
class="MsoNormal"><span
style="font-family:"Courier
New",serif" class=""><a
href="https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-stretchdibits"
class=""
moz-do-not-send="true">https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-stretchdibits</a></span></p>
<p
class="MsoNormal"><span
style="font-family:"Courier
New",serif" class=""><a
href="https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-getbitmapbits"
class=""
moz-do-not-send="true">https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-getbitmapbits</a></span></p>
<p
class="MsoNormal"><span
style="font-family:"Courier
New",serif" class=""><a
href="https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-createdibitmap"
class=""
moz-do-not-send="true">https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-createdibitmap</a></span></p>
<p
class="MsoNormal"><span
style="font-family:"Courier
New",serif" class=""><a
href="https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-createdibsection"
class=""
moz-do-not-send="true">https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-createdibsection</a></span></p>
<p
class="MsoNormal"><span
style="font-family:"Courier
New",serif" class=""><a
href="https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-polydraw"
class=""
moz-do-not-send="true">https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-polydraw</a></span></p>
<p
class="MsoNormal"><span
style="font-family:"Courier
New",serif" class=""><a
href="https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-drawescape"
class=""
moz-do-not-send="true">https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-drawescape</a></span></p>
<p
class="MsoNormal"><span
style="font-family:"Courier
New",serif" class=""><a
href="https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-createbitmap"
class=""
moz-do-not-send="true">https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-createbitmap</a></span></p>
<p
class="MsoNormal"><span
style="font-family:"Courier
New",serif" class=""><a
href="https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-setbitmapbits"
class=""
moz-do-not-send="true">https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-setbitmapbits</a></span></p>
<p
class="MsoNormal"><span
style="font-family:"Courier
New",serif" class=""><a
href="https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-getdibits"
class=""
moz-do-not-send="true">https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-getdibits</a></span></p>
<p
class="MsoNormal"><span
style="font-family:"Courier
New",serif" class=""><br class="">
</span></p>
<p
class="MsoNormal"><span
style="font-family:"Courier
New",serif" class="">-phil.<br class="">
</span></p>
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
</blockquote>
<br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</blockquote>
</blockquote>
</blockquote>
<br class="">
</blockquote>
</blockquote>
<br class="">
</blockquote>
<br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</blockquote>
</body>
</html>