From owner-freebsd-current@freebsd.org Mon Apr 11 12:48:06 2016 Return-Path: Delivered-To: freebsd-current@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 73948B0BF8C for ; Mon, 11 Apr 2016 12:48:06 +0000 (UTC) (envelope-from rizzo.unipi@gmail.com) Received: from mail-lf0-x231.google.com (mail-lf0-x231.google.com [IPv6:2a00:1450:4010:c07::231]) (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 EE36B185B for ; Mon, 11 Apr 2016 12:48:05 +0000 (UTC) (envelope-from rizzo.unipi@gmail.com) Received: by mail-lf0-x231.google.com with SMTP id j11so154850967lfb.1 for ; Mon, 11 Apr 2016 05:48:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=SlLDh4wXRt9wAfgRzWjM7U37ChBZXZsHlx/z9+C8tx4=; b=rfOt3tLmqC43QpsrNs4AU3cSJfVhEPnR9XdUYLIvWJrXc9i6e+3qUinXKYYjxhoEHY bIL+jil4MLCrpW0kueKYMOXpHOHkLLdzZ2BewEZd7MplM+YZl+tAwFbnhJkxVRgneJQ5 7BK0763HFfjqhUoya/DMXU+kypPLU7QFwSbpxbKD9aVz2qYsTQlUO4ajkEGWs/cPt18N VrijYgVX8mVmQ12gC5DyfbLF2qg0o0JO8GlBza7NJVb+/aq6DZ7WahrR/jAdvmAhuEGK JdGH7nKj4Q2h5FMZ8QUNdFxuaYFutjFI/8UUKAvrconvW3YtuWeuwrwPAr57DpJ03svb jd0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=SlLDh4wXRt9wAfgRzWjM7U37ChBZXZsHlx/z9+C8tx4=; b=kLC48/HLX9/PYtdJATz5fYA6emd76iA1mdSb+hsGPgamLC1jJ2oXXHpySPOHJ03F1S RlTaM1buN0FckkQn5TbcWf1TZx/ix9lkLh8s0kW+wJeHIFqz3yCz/XH6Y0vFnjicfrdZ v8+3x9qvSFPRd+e6NvJ/7at2nyjPmNv3o7wueUBYsGPeavelGBrG+fZtKOIRkRG1T64G qGpc+lRkIfTplR2wLDk6ItaDO3SmfV+MZEr9VQCf+TPl3066V7Ahz8Q2u4EcK/9QEXMy 3uk51TAZT1XTS/WXERg0sEc6lZeXjDmVKZUirWW1pthhv+ZjuejSUahlcLyDcTSP/DAM mU9Q== X-Gm-Message-State: AD7BkJLkIgmmh7lf4QqndxQtoPzxn3uu/uTp64PEC6EC57lVQ2LSZuPdF1KukrTwjtCXsmmihOvuTp5OpQMAag== MIME-Version: 1.0 X-Received: by 10.112.171.33 with SMTP id ar1mr8315852lbc.54.1460378883960; Mon, 11 Apr 2016 05:48:03 -0700 (PDT) Sender: rizzo.unipi@gmail.com Received: by 10.114.199.19 with HTTP; Mon, 11 Apr 2016 05:48:03 -0700 (PDT) In-Reply-To: <20160408212237.GA6614@zxy.spb.ru> References: <20160408162416.GA94343@onelab2.iet.unipi.it> <20160408212237.GA6614@zxy.spb.ru> Date: Mon, 11 Apr 2016 14:48:03 +0200 X-Google-Sender-Auth: -oQs6fvoFep6hwdODDi_jehRq5Q Message-ID: Subject: Re: stall-free memory reads ? (possibly stale) ? From: Luigi Rizzo To: Slawa Olhovchenkov Cc: freebsd-current Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Apr 2016 12:48:06 -0000 thank you, much appreciated. On Fri, Apr 8, 2016 at 11:22 PM, Slawa Olhovchenkov wrote: > On Fri, Apr 08, 2016 at 06:24:16PM +0200, Luigi Rizzo wrote: > > > Hi, > > I have an application with two threads sharing a memory variable, > > one continuously writing, one continuously reading. > > > > Because of the way my system works, the reader can tolerate reading > > stale data, but it should not stall on memory reads (the line > > is on the local cache for the reader, just might be invalidated). > > > > I was wondering if there is some way (either generic or > > x86-specific, either simple or convoluted, possibly using > > multiple versions of the shared variable in different cache > > lines) to make sure that reads never stalls (or, equivalently, > > let me read stale values from the cache) ? > > > > I have done some experiments and on a single-socket machines > > the stallled reads take some 50ns; on a dual socket machine > > the stall penalty grows to about 200ns. > > Can this link help to you? > > https://tu-dresden.de/die_tu_dresden/zentrale_einrichtungen/zih/forschung/projekte/benchit/2015_ICPP_authors_version.pdf > > -- -----------------------------------------+------------------------------- Prof. Luigi RIZZO, rizzo@iet.unipi.it . Dip. di Ing. dell'Informazione http://www.iet.unipi.it/~luigi/ . Universita` di Pisa TEL +39-050-2217533 . via Diotisalvi 2 Mobile +39-338-6809875 . 56122 PISA (Italy) -----------------------------------------+-------------------------------