From owner-svn-src-all@freebsd.org Mon Jan 30 15:32:25 2017 Return-Path: Delivered-To: svn-src-all@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 68D29CC7F05; Mon, 30 Jan 2017 15:32:25 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-qk0-x241.google.com (mail-qk0-x241.google.com [IPv6:2607:f8b0:400d:c09::241]) (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 1E427129A; Mon, 30 Jan 2017 15:32:25 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-qk0-x241.google.com with SMTP id e1so19373822qkh.1; Mon, 30 Jan 2017 07:32:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=jZbDYn1jQfj/ftnA0jhAIZDe+iy8JUpYQf1hKwj2IeY=; b=vTO7JD/2xL/q2WAlJBtLRpJ3ZyqogQXAOFX3u9/K+lwutgyCbqJi+fxkHbis+yKAi7 g9wpPPbYUy3o8clruUZkyx5bWEWqhYIVB27iKmSc3+RIePd9N2hfwX1VF1ECcAw5YSX2 UcYLLXW+Vwb95umSZwI+uTXjVL9ewxp8kjkHvJKaUrLtLPMgSv3EaXhbS2G4NZ2Q+gp5 ej+x6uhWs4ifiXHZu26pIAq4EwgBWzepzBirvWUsGTBcw9AjYVoGVGstHZLAAGQGT/0u CVGBJJYHjuEdAxzwbE53/PnrB216e0/xmHNQPt0iL1clZP1C03QJtDjpHH1aBsD8bb3o 1iWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=jZbDYn1jQfj/ftnA0jhAIZDe+iy8JUpYQf1hKwj2IeY=; b=agQelR7v1bvPICnFVh/8Oc8ynSMSfUlknOZvBiJA2454k5Ek6mTPL+pM776Dfeq1w7 TJbCn842rDEcpTojogXOf0ubMap03ycFeuiEEwiWz43Nx7Ufi2anko6G/Xwd9LIZA7+f gws6onxoCNWUD0TQx/USBeHyM+YzG1vHEMGAhrOa9/YZ49LImJiKk8IP6pgnBt74B+pq A8rZ2Cqg+8g+hiHIpZBeY/SDd88ZH9K0o8AL5oi13QFkpeG5pzlBhc6wYrPe7s5uJYNl Lz8QZcwMuM5SbyfIgubvgjdc7gAZAFxCSsvgLQacVOyfymvq9pGlCcSfYacBEx9DeoA0 ydGg== X-Gm-Message-State: AIkVDXLtjL5XmUzreZklLC9lewMy8K8RldhCmHf88NagFvWRx/dwlDT5X+S75h51wHffkLCuB5wJAkXtMhBbnA== X-Received: by 10.55.118.67 with SMTP id r64mr21465147qkc.285.1485790344345; Mon, 30 Jan 2017 07:32:24 -0800 (PST) MIME-Version: 1.0 Sender: chmeeedalf@gmail.com Received: by 10.12.157.69 with HTTP; Mon, 30 Jan 2017 07:32:23 -0800 (PST) In-Reply-To: <20170130105345.GL3018@kib.kiev.ua> References: <201701300215.v0U2Fsl0006455@repo.freebsd.org> <20170130105345.GL3018@kib.kiev.ua> From: Justin Hibbits Date: Mon, 30 Jan 2017 09:32:23 -0600 X-Google-Sender-Auth: AZj9ZLz8UbmlOwR_C-0inZyvOuo Message-ID: Subject: Re: svn commit: r312973 - head/sys/powerpc/include To: Konstantin Belousov Cc: src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jan 2017 15:32:25 -0000 On Mon, Jan 30, 2017 at 4:53 AM, Konstantin Belousov wrote: >> +#ifdef __GNUCLIKE_ASM >> + __asm __volatile ( >> + "1:\tlwarx %0, 0, %3\n\t" /* load old value */ >> + "cmplw %4, %0\n\t" /* compare */ >> + "bne 2f\n\t" /* exit if not equal */ >> + "stwcx. %5, 0, %3\n\t" /* attempt to store */ >> + "bne- 1b\n\t" /* spin if failed */ >> + "li %0, 1\n\t" /* success - retval = 1 */ >> + "b 3f\n\t" /* we've succeeded */ >> + "2:\n\t" >> + "stwcx. %0, 0, %3\n\t" /* clear reservation (74xx) */ >> + "stwx %0, 0, %7\n\t" >> + "li %0, 0\n\t" /* failure - retval = 0 */ >> + "3:\n\t" >> + : "=&r" (ret), "=m" (*p), "=m" (*cmpval) >> + : "r" (p), "r" (*cmpval), "r" (newval), "m" (*p), "r"(cmpval) >> + : "cr0", "memory"); >> +#endif > > It seems that in case of failed conditional store, the code retries. > Note that this is not incorrect but also not a desirable behaviour > with fcmpset: the function should return error and leave the retry > to the caller. There is no point in having embedded loop.