From owner-freebsd-arch@FreeBSD.ORG Mon Apr 14 08:50:40 2008 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 144BE1065674 for ; Mon, 14 Apr 2008 08:50:40 +0000 (UTC) (envelope-from Arthur.Hartwig@nokia.com) Received: from mgw-mx09.nokia.com (smtp.nokia.com [192.100.105.134]) by mx1.freebsd.org (Postfix) with ESMTP id CE3C38FC32 for ; Mon, 14 Apr 2008 08:50:39 +0000 (UTC) (envelope-from Arthur.Hartwig@nokia.com) Received: from esebh105.NOE.Nokia.com (esebh105.ntc.nokia.com [172.21.138.211]) by mgw-mx09.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id m3E8mhta027607; Mon, 14 Apr 2008 03:52:59 -0500 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by esebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 14 Apr 2008 11:49:38 +0300 Received: from syebe101.NOE.Nokia.com ([172.30.128.65]) by esebh102.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 14 Apr 2008 11:49:37 +0300 Received: from [172.30.67.155] ([172.30.67.155]) by syebe101.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 14 Apr 2008 18:49:33 +1000 Message-ID: <48031A9D.3050806@nokia.com> Date: Mon, 14 Apr 2008 18:49:33 +1000 From: Arthur Hartwig User-Agent: Thunderbird 1.5.0.12 (Windows/20070509) MIME-Version: 1.0 To: ext Jeff Roberson References: <20080412132457.W43186@desktop> <480313A2.4050306@nokia.com> <20080413222626.X959@desktop> In-Reply-To: <20080413222626.X959@desktop> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 14 Apr 2008 08:49:33.0483 (UTC) FILETIME=[75E57FB0:01C89E0C] X-Nokia-AV: Clean Cc: arch@freebsd.org Subject: Re: f_offset X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Apr 2008 08:50:40 -0000 ext Jeff Roberson wrote: > > On Mon, 14 Apr 2008, Arthur Hartwig wrote: > >> ext Jeff Roberson wrote: >>> So I'm in the midst of working on other filesystem concurrency >>> issues and that has brought me back around to f_offset again. I'm >>> working on a method to allow non-overlapping writes and reads to >>> proceed concurrently to the same file. This means the exclusive >>> vnode lock can not be used to protect f_offset even in the write case. >>> >>> To maintain the existing semantics I'm simply going to add an >>> exclusive sx_xlock() around access to f_offset. This is done >>> inconsistently today which is fine from the perspective of the >>> updates in most cases being user-space races. However, f_offset is >>> 64bit and can not be written atomically on 32bit systems and so >>> requires some extra synchronization there. >> I'm not sure of the processor family constraints of the i386 builds, >> but the Intel IA32 architecture manual says reads and writes of a >> quadword (64 bits) aligned on a quadword boundary are atomic (Pentium >> and newer CPUs). Guess that leaves out i386, i486 (any others?) > > Thanks. I hadn't seen that. Do you know which manual and section > states this? Intel 64 and IA-32 Architectures Software Developer's Manual Vol 3A: System Programming Guide, Part 1, section 7.1.1 Guaranteed Atomic Operations. You can download this (and other volumes of the Intel Architecture manuals) from http://www.intel.com/products/processor/manuals/index.htm > I was intending to simply use cmpxchg8b but it sounds like that may > not be necessary. We still have to handle other 32bit archs like > powerpc and mips but I'm not sure if any of those are SMP. Do you also have to handle i386 and i486? > > Jeff