From owner-freebsd-questions@freebsd.org Sun Apr 2 03:33:02 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4FBCBD1E59F for ; Sun, 2 Apr 2017 03:33:02 +0000 (UTC) (envelope-from jguojun@sbcglobal.net) Received: from nm41-vm10.bullet.mail.gq1.yahoo.com (nm41-vm10.bullet.mail.gq1.yahoo.com [67.195.87.149]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 23BC6B5F for ; Sun, 2 Apr 2017 03:33:01 +0000 (UTC) (envelope-from jguojun@sbcglobal.net) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sbcglobal.net; s=s2048; t=1491103794; bh=4Nin45RbXsuJryh6uXdWYFolcMZO91F0Uttt/Q3Gi/M=; h=Date:From:Reply-To:To:In-Reply-To:References:Subject:From:Subject; b=Zx3RXDxTveDPOY3jc3LApveQEVbCPARC9UeuMntd1kXH8PomaavesiW6ZfxR76QrO3UOeli1/rkqwuYVwW1o/yVNTznBwRAaqpZWlNMbd9IWmRIadlbjSr0IFj/E5wt4xMDJUj/rI+EfCnQmFNsxwA7nlrfcL3+oyEjRWiTLDybVlHK2m5eWnBA9mgE/EvN7ROZopbdem6WdirZGN+isNDirlrFaycB2HhDqxcAiFsbznaMfDF8oFS4o3UScXbrFuc37IV6EFaYOUe+exLH1t0Ds7cYqCjrvPu04laBxqrffg1PNfXlHA/bPF8rbTLESxluRgZLpnLMX3cqtbopqog== Received: from [127.0.0.1] by nm41.bullet.mail.gq1.yahoo.com with NNFMP; 02 Apr 2017 03:29:54 -0000 Received: from [98.137.12.190] by nm41.bullet.mail.gq1.yahoo.com with NNFMP; 02 Apr 2017 03:27:13 -0000 Received: from [98.139.170.181] by tm11.bullet.mail.gq1.yahoo.com with NNFMP; 02 Apr 2017 03:27:13 -0000 Received: from [98.139.212.211] by tm24.bullet.mail.bf1.yahoo.com with NNFMP; 02 Apr 2017 03:27:13 -0000 Received: from [127.0.0.1] by omp1020.mail.bf1.yahoo.com with NNFMP; 02 Apr 2017 03:27:13 -0000 X-Yahoo-Newman-Property: ymail-4 X-Yahoo-Newman-Id: 513930.23648.bm@omp1020.mail.bf1.yahoo.com X-YMail-OSG: 9FpHUVcVM1mO4ZWPcg4tTOHQvs63YDHiDsPjn27tBePApyvlnZnAmFhJ.Oi.oEw 8EC63N_nTT4aFCpzN3qdjIpWc4n9teWP9DL8HYN1iecXVUTkK018uv4ycZSDGg9JjPCeKwxWv_RA Bv9xfdiaErqBHVZWV7UtoDPtK5rNDImGN2Kxvuz1ZK3VpQXmRGexnLSmw6jC_vMQfa4nxm1HBBpS nyIWqa9lOTg6hD_0hHlDWu5RFx2qJCBVCKVNS.3BIPM7S6ynntzh8zS_I2ExYfgcHf1WbGcnuXTk quo7_lIeH6GLPZ4keFMmscbJjdVq6E2eA3QtkAVHeXXepXwoTbUZLD0uZcpfLM31YsaLtW625wVi 2sMHp0QJBAHGJaTzMBYbo4_9tyQuW2OnWOhD3zwE5e7V8C7OIqaAez2GmXsxSGDbLCYaAbN8eQSU CHnwj7QaxRxLZJU5jvaTM3LuERzjGCdMDuRNTJXTzuFe5Z3OSJXTm.iBS5913G7nopb4B3ieo5Jz G8EM.nlKQBWwZATU1bVICocjBRLhpNTuo_bUxrfwfq3oTjTc8jwwB Received: from jws400040.mail.bf2.yahoo.com by sendmailws150.mail.bf1.yahoo.com; Sun, 02 Apr 2017 03:27:13 +0000; 1491103633.158 Date: Sun, 2 Apr 2017 03:27:04 +0000 (UTC) From: Jin Guojun Reply-To: Jin Guojun To: FreeBSD Questions Mailing List Message-ID: <1167907592.9096642.1491103624078@mail.yahoo.com> In-Reply-To: <1367028502.7607768.1490997691827@mail.yahoo.com> References: <1367028502.7607768.1490997691827.ref@mail.yahoo.com> <1367028502.7607768.1490997691827@mail.yahoo.com> Subject: Re: 10.3 system hangs when existing from X with radeon cards/driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Apr 2017 03:33:02 -0000 This seems not the Xorg server issue.Replaced xf86-video-ati (ati_drv.so, radeon_drv.so) from working 11.0 system, the problem persists.Then, replace xorg-server 1.17.x from 11.0 as well, existing X using radeon video cards still hangs the system.Not sure if this is caused by some dynamic libraries X uses. On Friday, March 31, 2017 3:01 PM, Jin Guojun wrote: When using Radeon Video cards (X600/RV370, HD2400/RV610, HD4650/RV730) in FreeBSD 10.3, existing X causes system hanging.Event installed the xorg-7.7_2 with latest xf86-video-ati driver released on Feb 24, 2017, this problem still exists. The xorg-7.7_2 in FreeBSD 11.0 and 12-Current do not have this problem.Has anyone seen this problem?And any suggestion on solving this problem on 10.3-R? -Jin From owner-freebsd-questions@freebsd.org Sun Apr 2 08:30:38 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 857E3D29BAF for ; Sun, 2 Apr 2017 08:30:38 +0000 (UTC) (envelope-from ablacktshirt@gmail.com) Received: from mail-pg0-x234.google.com (mail-pg0-x234.google.com [IPv6:2607:f8b0:400e:c05::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFF0666 for ; Sun, 2 Apr 2017 08:30:38 +0000 (UTC) (envelope-from ablacktshirt@gmail.com) Received: by mail-pg0-x234.google.com with SMTP id g2so95400242pge.3 for ; Sun, 02 Apr 2017 01:30:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=BFoNGxwomHEdbNTkrQcXrlQlL/b8oD2/jKHFj5PXE3w=; b=uqNwI3FcVTEno1/TSPtcDQxEQZ8e4aafqXM0Nw3yPunyFoAtBGOiTapB1eR0NpN31u knbo1z3V6ZGKQWPcg0003B3DsUrrBVSBUR8oiTIp7aYOAg7VMzv2PQGjU35r6i2QUzex R8ukQmy/iCjcsSpWBPekEi91JPArRa0H8HwtrosP+LDThFl2vIgNlRCGW/8oUDDPxkp4 CuNA+xO7et0LE0v9F/oRlnFfVXmNvnZ3Kbe9ubEK2hTMSuhgSxKy93pA+mXTX5mFPyTF /qhTdzaxu5bRypqcMzbq3v5JXlKAhSNx7cgiYeM0RznvhTLcVRnOlwE8GwrckYeODuMn 5ijA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=BFoNGxwomHEdbNTkrQcXrlQlL/b8oD2/jKHFj5PXE3w=; b=V6Vz7OrG1nfi6LOo5aJ1OsGsiDIgeNDpaqL60ViN/yl9HuqKZlMFcgipoIU5ZYnZ0F w6Eq7YcElZnQ5dfIFOCQLsPPWigegiSgn16lnigUAIS9stTwHTT92AT2ua8koJ5sDyb+ 4kWiudySZA5tQwxquaC1lXRepB/JICLsqjGjfu8aFX2fNUTXPuc+lPFiwjvlHuRr4tee bOg2Ili19Apy8r06C5GP0FD8ArqKyhfB6O/dELFrqiCx6ObJX+gG4tM4BFk0pxAwOImv x+egEs6FVnAp292GXWCv1japjczVTgFqIqOnbSVddC8yydUh6J8Fqytzr7R7uo2ceN0u 9g7A== X-Gm-Message-State: AFeK/H0hsMdUsCIrE0izEJxMl2MtdXMEmDA6A+txqM2lh/Y8xN47J+Iln1TsR0AwoBPj2Q== X-Received: by 10.84.211.130 with SMTP id c2mr14077025pli.82.1491121837491; Sun, 02 Apr 2017 01:30:37 -0700 (PDT) Received: from [192.168.1.115] ([223.73.97.188]) by smtp.gmail.com with ESMTPSA id h9sm19294550pfd.103.2017.04.02.01.30.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Apr 2017 01:30:36 -0700 (PDT) To: freebsd-questions@freebsd.org From: Yubin Ruan Subject: Understanding the FreeBSD locking mechanism Message-ID: Date: Mon, 3 Apr 2017 00:30:22 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Apr 2017 08:30:38 -0000 Hi, I am reading the FreeBSD source code related to its locking mechanism. I have done some researches but still cannot understand some codes. Let's take `spinlock' for example. I know there are different kinds of mutex in FreeBSD: spin mutex and other kinds of mutex. I try to locate the source of spin mutex but what I find all look very weird to me. For example, the `spinlock_enter()` 1816 void 1817 spinlock_enter(void) 1818 { 1819 struct thread *td; 1820 register_t flags; 1821 1822 td = curthread; 1823 if (td->td_md.md_spinlock_count == 0) { 1824 flags = intr_disable(); 1825 td->td_md.md_spinlock_count = 1; 1826 td->td_md.md_saved_flags = flags; 1827 } else 1828 td->td_md.md_spinlock_count++; 1829 critical_enter(); 1830 } Does this function provides the ordinary "spinlock" functionality? There is no special "test-and-set" instruction, and neither any extra locking to protect internal data structure manipulation. Isn't this subjected to race condition? I also checked the `mtx_lock()`, but neither can't find a seemingly correct implementation. Do I miss anything? Which is the real implementation of the spin lock in FreeBSD? Thanks Yubin Ruan