Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 05 Apr 2017 00:21:21 -0700 (PDT)
From:      "Mould making/Precision stamping/ Machining parts Supply (via Google Photos)" <noreply-1a925d0d6666deae07b758152a56780a@google.com>
To:        freebsd-questions@freebsd.org
Subject:   Mould making/Precision stamping/ Machining parts Supply shared 1 photo with you
Message-ID:  <BdBm-cS1iceWy9b-GdDm5Q@notifications.google.com>

next in thread | raw e-mail | index | archive | help
R29vZ2xlIFBob3Rvcw0KDQpNb3VsZCBtYWtpbmcvUHJlY2lzaW9uIHN0YW1waW5nLyBNYWNoaW5p
bmcgcGFydHMgU3VwcGx5OiBEZWFyIFNpci9NcywgR29vZCAgDQpkYXkhIEFzIGFuIElTTyBjZXJ0
aWZpZWQgZmFjdG9yeSwgd2Ugc3BlY2lhbGl6ZWQgbWFudWZhY3R1cmUgTW91bGQgbWFraW5nLyAg
DQpTaGVldCBtZXRhbCBwcm9jZXNzLyBEaWUtY2FzdGluZy8gUHJlY2lzaW9uIHN0YW1waW5nLyBN
YWNoaW5pbmcgcGFydHMsIHdpdGggIA0Kc3Ryb25nIGNvbXBldGl0aXZlIHByaWNlIGFuZCBleGNl
bGxlbnQgcXVhbGl0eSwgZm9yIG1vcmUgdGhhbiAyMCB5ZWFycy4gQW55ICANCnF1ZXN0aW9ucyBh
bmQgZW5xdWlyaWVzIHdpbGwgYmUgaGlnaGx5IHJlZ2FyZGVkLiBKdXN0IGVtYWlsIHVzIHRoZSBk
cmF3aW5nICANCmFuZCBkZXRhaWxlZCByZXF1aXJlbWVudCwgeW91IHdpbGwgZ2V0IGEgY29tcGxl
dGUgcXVvdGF0aW9uIHdpdGggdGVjaG5pY2FsICANCmFuYWx5c2lzIHdpdGhpbiAyNCBob3Vycy4g
WW91ciBwcm9tcHQgcmVwbHkgaXMgaGlnaGx5IGFwcHJlY2lhdGVkLiBCZXN0ICANCnJlZ2FyZHMg
c2luY2VyZWx5ISBNaWNoYWVsIFNoZW56aGVuLENoaW5hbnpoZ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QwNDMgVVNBDQoNCg==
From owner-freebsd-questions@freebsd.org  Wed Apr  5 09:19:53 2017
Return-Path: <owner-freebsd-questions@freebsd.org>
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 1923BD2E712
 for <freebsd-questions@mailman.ysv.freebsd.org>;
 Wed,  5 Apr 2017 09:19:53 +0000 (UTC)
 (envelope-from ablacktshirt@gmail.com)
Received: from mail-pf0-x22c.google.com (mail-pf0-x22c.google.com
 [IPv6:2607:f8b0:400e:c00::22c])
 (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 E1EBBD5B
 for <freebsd-questions@freebsd.org>; Wed,  5 Apr 2017 09:19:52 +0000 (UTC)
 (envelope-from ablacktshirt@gmail.com)
Received: by mail-pf0-x22c.google.com with SMTP id 197so4744468pfv.1
 for <freebsd-questions@freebsd.org>; Wed, 05 Apr 2017 02:19:52 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:in-reply-to:references:from:date:message-id:subject:to;
 bh=j4wiShF3kVx7eHoJ9ZeXDIjE4L84IaYPQXMic7ZMrDQ=;
 b=M64JqE4F5V4Wtv79ReQ74U1racO74gnmHNPqaYg7MihVfGWSma7PPhXdB2JZDhCZT0
 Wkd9dy6h36Q0vW7oElFc6MUjHuirDE9vQ4INBWTWxgE82gItEJKSQfScLM6yL+cFBXrp
 QxDD/0zVLSCnmmEeuuhdMQjplcZMJy9Vj2tdCYQajQsl9wWqOZkbhVK/Lgd4TB6nJNLy
 oa6BqA60GvPmkS9vBXOiBBQgEgwFiTsv3uDXRnb6W25a8qwWN0N/W6GP85dyxhlIGWo0
 kbwtxJJbLolI3+s7Z9QZj9Nyr3Txx/wAUcX9V3hUsTNfmscwTNqXO/968eQLWMXZ9N6f
 yzfQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:in-reply-to:references:from:date
 :message-id:subject:to;
 bh=j4wiShF3kVx7eHoJ9ZeXDIjE4L84IaYPQXMic7ZMrDQ=;
 b=aLfI+f4qrXxL0yodAoWBYQ7JuwucQhl3VuV8CPjKjwveL8nB5BvRAAVFbqQDiBy9Ln
 kTg1neG1vb7Pc3ia5feSqdzzVr36k//xwILUCF3lekaaHwQSe8Yw8w+kK7vy1L7yUs5F
 tCQe3lewPXBgbnqvrZykJqZ0pvrNZ11sDvvW0tNhpojsYCtvSZg7EwESG66yPvlUgpvn
 IDIlFa1xwyz0e5angdCkUqkolKtivRJCIix4AQlTlbpCi2GZw5F7pDwP3kfbt2/Pe5KA
 ussm1KFNQpbWsfFPckVIH2yjlHk8VB1eDLEqOD87rk6vG55vHjf47I0pUS9dJAP3XWu8
 PLvw==
X-Gm-Message-State: AFeK/H3Sw0jjX6uCPz/0UrBARAb2jNXT+YV0PM/pZPcpumW0/oxGggMUGWTKHAfUXqdhqferGu7COMqspnw51g==
X-Received: by 10.98.82.204 with SMTP id g195mr28358820pfb.28.1491383992260;
 Wed, 05 Apr 2017 02:19:52 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.100.160.141 with HTTP; Wed, 5 Apr 2017 02:19:51 -0700 (PDT)
In-Reply-To: <e5b5f272-7515-05f8-ac6a-14c7bac4346c@gmail.com>
References: <e5b5f272-7515-05f8-ac6a-14c7bac4346c@gmail.com>
From: Yubin Ruan <ablacktshirt@gmail.com>
Date: Wed, 5 Apr 2017 17:19:51 +0800
Message-ID: <CAJYFCiNoV40fy7_yG=8GX1BJK4eauxmL5n3gsFj9Nx0LvCLqhw@mail.gmail.com>
Subject: Re: Understanding the FreeBSD locking mechanism
To: freebsd-questions@freebsd.org
Content-Type: text/plain; charset=UTF-8
X-BeenThere: freebsd-questions@freebsd.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: User questions <freebsd-questions.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/freebsd-questions>, 
 <mailto:freebsd-questions-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-questions/>;
List-Post: <mailto:freebsd-questions@freebsd.org>
List-Help: <mailto:freebsd-questions-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/freebsd-questions>, 
 <mailto:freebsd-questions-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 05 Apr 2017 09:19:53 -0000

All right seems like that this list is not a right place for this kind
of problem.

Any suggestion on the right mailing list to send?

regards,
yubinr

2017-04-03 0:30 GMT+08:00 Yubin Ruan <ablacktshirt@gmail.com>:
> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BdBm-cS1iceWy9b-GdDm5Q>