X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:message-id:date:from:mime-version:to:subject
	:references:in-reply-to:content-type:content-transfer-encoding;
	 q=dns; s=default; b=SGDmkePn571TyaxUTYRMfPcQQinY5AOatel+yS6mbl0
	Odx8kk2jKqTq9wzM4V6MdTlRvHNVseFqUMEBzsGJnV8ClqffgmIj/OyBmsE1B+R7
	D+Lt3sZNFeII9wqhSNRRy9iEHne2dZJgM0oZu/BcD27C6zIhF91kv6U/JDBL8xas
	=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:message-id:date:from:mime-version:to:subject
	:references:in-reply-to:content-type:content-transfer-encoding;
	 s=default; bh=6FdfhtssVRjU8Wle2iFLro5LgFk=; b=gd27QPoE9Z/6dO12i
	+u5BAZPCBfNKfu0G51j3yCylli/pBsLd+0HJurftJ+4uRI4wzB8i5SOlzCJMeEsa
	nghdZxkgPNQk+WV1oKFPxoHe56MNeWmb/Q8FXGdL99aDh1hhku5YM98WLSu9aicD
	1Y5uacRXdP2XeFQ0xtecmKPH3Y=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2
X-HELO: limerock04.mail.cornell.edu
X-CornellRouted: This message has been Routed already.
Message-ID: <544CE1F7.5050603@cornell.edu>
Date: Sun, 26 Oct 2014 07:58:47 -0400
From: Ken Brown <kbrown@cornell.edu>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: Threads
References: <54450835.3050602@cornell.edu> <5448E6F9.8040005@dronecode.org.uk> <5448EEBF.3020706@cornell.edu> <20141023153730.GC20607@calimero.vinschen.de> <544A327E.9090006@dronecode.org.uk> <20141024125416.GK20607@calimero.vinschen.de> <20141024135231.GL20607@calimero.vinschen.de>
In-Reply-To: <20141024135231.GL20607@calimero.vinschen.de>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes

On 10/24/2014 9:52 AM, Corinna Vinschen wrote:
> On Oct 24 14:54, Corinna Vinschen wrote:
>> On Oct 24 12:05, Jon TURNEY wrote:
>>> On 23/10/2014 16:37, Corinna Vinschen wrote:
>>>> On Oct 23 08:04, Ken Brown wrote:
>>>>> Yes, flags register corruption is exactly what Eli suggested in the other
>>>>> bug report I cited.
>>>>
>>>> The aforementioned patch was supposed to fix this problem and it is
>>>> definitely in the current 1.7.32 release...
>>>
>>> I didn't mean to suggest otherwise, just that perhaps a similar problem
>>> exists now.
>>>
>>> So I made the attached test case to explore that.  Maybe I've made an
>>> obvious mistake with it, but on the face of it, it seems to demonstrate
>>> something...
>>>
>>> jon@tambora /
>>> $ gcc signal-stress.c  -Wall -O0 -g
>>>
>>> jon@tambora /
>>> $ ./a
>>> failed: 2144210386 isn't equal to 2144210386, apparently
>>
>> So it checks i and j for equality, fails, and then comes up with
>> "42 isn't equal to 42"?  This is weird...
>>
>>> Note there is some odd load dependency. For me, it works fine when it's the
>>> only thing running, but when I start up something CPU intensive, it often
>>> fails...
>>
>> That's... interesting.  I wonder if that only occurs in multi-core or
>> multi-CPU environments.  The fact that i and j are not the same when
>> testing, but then are the same when printf is called looks like a
>> out-of-order execution problem.
>>
>> Is it possible that we have to add CPU memory barriers to the sigdelayed
>> function to avoid stuff like this?
>
> I discussed this with my college Kai Tietz (many thanks to him from
> here), and we came up with a problem in sigdelayed in the 64 bit case:
> pushf is called *after* aligning the stack with andq.  This alignment
> potentially changes the CPU flag values so the restored flags are
> potentially not the flags when entering sigdelayed.
>
> I just applied a patch and created new snapshots on
> https://cygwin.com/snapshots/
>
> I couldn't reprocude the problem locally, so I'd be grateful if you
> could test if that fixes the problem in your testcase, Jon.

I tried Jon's testcase.  With cygwin-1.7.33-0.1, it failed within a few minutes. 
  With cygwin-1.7.33-0.2, I ran it for over an hour with no problem, with the 
system heavily loaded.  So it looks good so far.

> Ken, can you check if this snapshot helps emacs along, too?

The people who have been reporting frequent crashes are aware of the fix.  Now I 
just have to wait and hope I don't hear from them for a few days.

Ken

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

