From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com [209.85.212.173]) by dpdk.org (Postfix) with ESMTP id EC71469FB for ; Wed, 26 Feb 2014 10:38:33 +0100 (CET) Received: by mail-wi0-f173.google.com with SMTP id bs8so5621566wib.6 for ; Wed, 26 Feb 2014 01:40:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:organization:to:subject:date:user-agent:cc :references:in-reply-to:mime-version:content-type :content-transfer-encoding:message-id; bh=Wuq8kGCD/TNByLPNRMYjeXdpUO3NpI8UcF7hBQFphZA=; b=PEGZAhTxFAPNz7JUvlcz400JE5w0SwxXU1nlLnUK6qxY18S/LgA5AiE56fYiY0lMAH qDstFJMPl7HBkL0YycBqB7YaLExSwNCh4JiVcBcjgTr6+gwQtZ5sFimIbEyg8tkdMlCW MpgaEjVI0Pm4h0I564aBaS+5I0Yx8ZsxHcpB2HnAmHsfQAVge6ZMF10ZsG5cI6c2tHBZ tcg2fi67khtkmcbqR1F1RfI78yfX6n3ozhQ6JA9ojheRTp9xYqJVY7WkxTmFVYn32n0W erTVXbaXho2hcbZl2xQ3Vr0ctyNW6rg+IFhKL5iHjVxIZytMrLkjwHNdC73+QPPd1sX7 q3gA== X-Gm-Message-State: ALoCoQl56W5hjv35CG7oNOreDNNX97BehJihFCFYxMNvg+SmlSBmgfSbmvhtJQyHh1jc/UvDUx6w X-Received: by 10.194.89.33 with SMTP id bl1mr922175wjb.64.1393407599986; Wed, 26 Feb 2014 01:39:59 -0800 (PST) Received: from angus.localnet (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by mx.google.com with ESMTPSA id de3sm992936wjb.8.2014.02.26.01.39.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Feb 2014 01:39:59 -0800 (PST) From: Thomas Monjalon Organization: 6WIND To: Didier Pallard Date: Wed, 26 Feb 2014 10:39:56 +0100 User-Agent: KMail/1.13.7 (Linux/3.2.0-4-amd64; KDE/4.8.4; x86_64; ; ) References: <1392809945-28025-1-git-send-email-didier.pallard@6wind.com> <1392828368-8563-1-git-send-email-didier.pallard@6wind.com> In-Reply-To: <1392828368-8563-1-git-send-email-didier.pallard@6wind.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <201402261039.57202.thomas.monjalon@6wind.com> Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v3] timer: add new rte_rdtsc_precise function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Feb 2014 09:38:34 -0000 19/02/2014 17:46, Didier Pallard: > According to Intel Developer's Manual: > > "The RDTSC instruction is not a serializing instruction. It does not > necessarily wait until all previous instructions have been executed before > reading the counter. Simi- larly, subsequent instructions may begin > execution before the read operation is performed. If software requires > RDTSC to be executed only after all previous instruc- tions have completed > locally, it can either use RDTSCP (if the processor supports that > instruction) or execute the sequence LFENCE;RDTSC." > > So add a rte_rdtsc_precise function that do a memory barrier before rdtsc > to synchronize operations and ensure that the TSC read is done at the > expected place. > > Signed-off-by: Didier Pallard > --- > > Call rte_mb() and rte_rdtsc() rather than duplicating rte_rdtsc function. > Use r/w memory barrier instead of lfence to serialize both load and stores. Acked and applied. Thanks to all -- Thomas