From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?=D0=9C=D0=B8=D1=85=D0=B0=D0=B8=D0=BB_?= =?UTF-8?Q?=D0=91=D0=B0=D1=85=D1=82=D0=B5=D1=80=D0=B5=D0=B2?= Newsgroups: gmane.lisp.guile.bugs Subject: bug#32786: (system* ...) call somehow interferes with atomic-box on armv7l Date: Thu, 20 Sep 2018 22:13:06 +0500 Message-ID: <20180920171306.GA9185@k> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Kj7319i9nmIyA2yE" Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1537466773 1388 195.159.176.226 (20 Sep 2018 18:06:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 20 Sep 2018 18:06:13 +0000 (UTC) User-Agent: Mutt/1.10.1 (2018-07-13) To: 32786@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Thu Sep 20 20:06:09 2018 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g33L2-0000CA-3V for guile-bugs@m.gmane.org; Thu, 20 Sep 2018 20:06:05 +0200 Original-Received: from localhost ([::1]:52323 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g33N8-0007lq-DD for guile-bugs@m.gmane.org; Thu, 20 Sep 2018 14:08:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50755) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g33N2-0007lR-Dj for bug-guile@gnu.org; Thu, 20 Sep 2018 14:08:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g33My-00087i-6L for bug-guile@gnu.org; Thu, 20 Sep 2018 14:08:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:43049) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g33Mw-000839-Ct for bug-guile@gnu.org; Thu, 20 Sep 2018 14:08:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1g33Mw-0004ls-5T for bug-guile@gnu.org; Thu, 20 Sep 2018 14:08:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?=D0=9C=D0=B8=D1=85=D0=B0=D0=B8=D0=BB_?= =?UTF-8?Q?=D0=91=D0=B0=D1=85=D1=82=D0=B5=D1=80=D0=B5=D0=B2?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Thu, 20 Sep 2018 18:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 32786 X-GNU-PR-Package: guile X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.153746685118293 (code B ref -1); Thu, 20 Sep 2018 18:08:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 20 Sep 2018 18:07:31 +0000 Original-Received: from localhost ([127.0.0.1]:47305 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g33MQ-0004ky-NJ for submit@debbugs.gnu.org; Thu, 20 Sep 2018 14:07:31 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:41880) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g32WG-0003J7-4Q for submit@debbugs.gnu.org; Thu, 20 Sep 2018 13:13:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g32W7-0001IW-SU for submit@debbugs.gnu.org; Thu, 20 Sep 2018 13:13:31 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:39961) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g32W1-0001FL-1B for submit@debbugs.gnu.org; Thu, 20 Sep 2018 13:13:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34584) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g32Vz-0006O9-OW for bug-guile@gnu.org; Thu, 20 Sep 2018 13:13:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g32Vw-00013t-9x for bug-guile@gnu.org; Thu, 20 Sep 2018 13:13:19 -0400 Original-Received: from k.imm.uran.ru ([195.19.132.74]:49582) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g32Vv-0000x3-Fc for bug-guile@gnu.org; Thu, 20 Sep 2018 13:13:16 -0400 Original-Received: from k (k.imm.uran.ru [195.19.132.74]) by k.imm.uran.ru (Postfix) with ESMTPSA id 5497D173C5 for ; Thu, 20 Sep 2018 22:13:08 +0500 (+05) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=k.imm.uran.ru; s=kite; t=1537463588; bh=PirV7KFUmj0JDSVNYRus7sri4JwYXBsFW5qa7XNtAH4=; h=Date:From:To:Subject; b=Zf7PNpQhv7B4vkFD7qgjgaXygARdCZtdehWS4Za3Yb0ikxRSaFr8MVnKFToJLHJsV HwLDh6LybCvuYoPcmsmWUvUfxWFwMIau1bSDPMlzwrfx7oN7nWKmzU+LzR2a+2R+Xp DKaPa9ewX0G9EaIkPIar0olAi06Yy07ZMVTkk3/46AbkKFRzwqsWPln7LYYfxHSZDo eQL68ui0fnZ1D7UOmuVAF/3/Sg2l4sS+/uOMqrzu234VFrW9See1CPqp+IrA4dszX/ NQS+G+ut+MEnspSUgxVOlw+dWvVxjm/oDL9o03gNYqd/LoXiCi1BNcQFrURGp6nm0e AvF6gyqRm964Hf5AOhldbeYcRADaGna0K63erC56eHiBPwf50XJCNIVNMuSRh7uacr lSI+836oH2nZ8gra456sh1/hcXULsMU3KADGxfTo1Bas5PNWUAsGwuH1XVN9rn3fPt WRtn/3zpHR5Z9OPeviY3g3jHdOey0YffVoAdIB30f/2B3PhBLX7vIjsE4sROxMIoui zLc1qYGvJmEQ3UAeZTBtfHEWE+EnnjL82meIg/dLI4Fa1dlkSj8d8nxj2oSmwXKl1q jt5r9q/3rrseIogm+t5CH8GnVx5xXFx6cfai3UOXUj7L7gc/rLCGI8tyUj1Crhx4vG sBuK/uxd13cFnlcfYf+dkQO8= Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Mailman-Approved-At: Thu, 20 Sep 2018 14:07:29 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.org gmane.lisp.guile.bugs:9163 Archived-At: --Kj7319i9nmIyA2yE Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Greetings. I attach the code sample, which expected behaviour is: 1. to periodically restart thread, which executes =ABsleep 1s=BB with system* call; 2. and then to check if it should repeat the execution. =20 The flag, which controls that re-execution is managed by another thread through atomic-box primitive. The code does not run as expected: the sleep executing sleep starts once, and change seems to remain invisible to main thread. The code works as expected, when: 1. (sleep 1) is used instead (system* "sleep" "1s"); 2. running the code on x86_64 cpus. The use of affinity mask taskset 0x01 guile test.scm does not help. - MB. Respectfully P.S. Additional information: $ guile --version =20 guile (GNU Guile) 2.2.4 Copyright (C) 2018 Free Software Foundation, Inc. License LGPLv3+: GNU LGPL 3 or later . This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. $ sh config.guess armv7l-unknown-linux-gnueabihf $ pacman -Qi guile=20 Name : guile Version : 2.2.4-1 Description : Portable, embeddable Scheme implementation written in C Architecture : armv7h URL : https://www.gnu.org/software/guile/ Licenses : GPL Groups : None Provides : None Depends On : gmp libltdl ncurses texinfo libunistring gc libff= i Optional Deps : None Required By : make Optional For : gnutls Conflicts With : None Replaces : None Installed Size : 40.83 MiB Packager : Arch Linux ARM Build System Build Date : Tue 03 Jul 2018 04:47:53 PM +05 Install Date : Mon 09 Jul 2018 01:02:48 PM +05 Install Reason : Installed as a dependency for another package Install Script : No Validated By : Signature --Kj7319i9nmIyA2yE Content-Type: application/vnd.lotus-screencam Content-Disposition: attachment; filename="test.scm" Content-Transfer-Encoding: quoted-printable (use-modules (ice-9 atomic)=0A (ice-9 threads))=0A=0A(define du= mp=0A (let ((p (current-error-port)))=0A (lambda (fmt . args) (apply fo= rmat p fmt args))))=0A=0A(define state (make-atomic-box #:nothing-to-do))= =0A=0A(define (expect e v)=0A (when (not (eq? e v))=0A (error "Protocol= violation; (expecting . got):" (cons e v)))) =0A=0A(define (sleep-loop)=0A= (expect #:need-to-sleep (atomic-box-ref state))=0A=0A (dump "R: Going to= (sleep 1)~%")=0A (atomic-box-set! state #:accepted)=0A =0A ; SOMETHING = WRONG IS HERE=0A (system* "sleep" "1s")=0A ; (sleep 1)=0A=0A (let ((v (a= tomic-box-compare-and-swap! state #:accepted #:nothing-to-do)))=0A (when= (not (eq? #:accepted v))=0A (dump "S: Repeating sleep~%")=0A (sl= eep-loop)))=0A=0A (dump "R: sleep-loop finished~%"))=0A=0A(define (main-lo= op)=0A (define (run-thread)=0A (dump "M: new sleep thread~%")=0A (at= omic-box-set! state #:need-to-sleep)=0A (call-with-new-thread sleep-loop= )) =0A=0A (dump "M: (sleep 3)~%")=0A (sleep 3)=0A=0A (dump "M: protocol = exchange~%")=0A (let ((st (atomic-box-ref state)))=0A (case st =0A = ((#:nothing-to-do) (run-thread))=0A ((#:accepted) (let ((v (atomic-bo= x-compare-and-swap! state #:accepted #:need-to-sleep)))=0A = (when (not (eq? #:accepted v))=0A (expect #:acc= epted v)=0A (run-thread))))=0A (else (expect #:= need-to-sleep st))))=0A=0A (main-loop))=0A=0A(main-loop)=0A --Kj7319i9nmIyA2yE Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=cpuinfo processor : 0 model name : ARMv7 Processor rev 10 (v7l) BogoMIPS : 7.54 Features : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpd32 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x2 CPU part : 0xc09 CPU revision : 10 processor : 1 model name : ARMv7 Processor rev 10 (v7l) BogoMIPS : 7.54 Features : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpd32 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x2 CPU part : 0xc09 CPU revision : 10 processor : 2 model name : ARMv7 Processor rev 10 (v7l) BogoMIPS : 7.54 Features : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpd32 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x2 CPU part : 0xc09 CPU revision : 10 processor : 3 model name : ARMv7 Processor rev 10 (v7l) BogoMIPS : 7.54 Features : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpd32 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x2 CPU part : 0xc09 CPU revision : 10 Hardware : Freescale i.MX6 Quad/DualLite (Device Tree) Revision : 0000 Serial : 0000000000000000 --Kj7319i9nmIyA2yE--