Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp505956imm; Mon, 9 Jul 2018 05:59:19 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcheXo2u5y+1Me3M1xlCfvpkUzKA1iDDUpDGgOk1R+MGBpP5FrV/Nq1X1KWfhXIYhugldFr X-Received: by 2002:a62:ed5:: with SMTP id 82-v6mr19978726pfo.198.1531141159662; Mon, 09 Jul 2018 05:59:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531141159; cv=none; d=google.com; s=arc-20160816; b=UnwghLKYcVYdYO923EQ0yQwkmLm6jsFdbBy1I/pTFGGF/bkWVtcV826JXdatQddWlM djosNT3P/RFjRsLLczsQHlu0TCaZKcL3kTiFtwS1PiW+F5yxlhuXX9cveJJSLx02p6h4 f53pPPzRCoU44xeC07iJjmnBVDoLil5uLq95GmDJUis+oCloGwHRzOeJrkWLRr6GtEu5 UvpdueEEOhskOvuiknuBlspOexl316Ag1a59cUHmlB1J16TBTiSUPJaydG9M/s8ZeP4R sZcpAgjET+35x6qMZz/DNPr1Y2Cy0zOeUXGl6q4lzHpl7QA3NgtlpScDGzdvFtQwpx/D dcNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:arc-authentication-results; bh=AhPJ68rgHCACTQorT8jzgCGPzpL/gR3J/ovBUjCtnn8=; b=jyxeOqoEIIFUDZ7lHPBDp7S+sgh5PrUim/ESq/PmMzq2LL6R5o9pvnuXtnSsQLEPIv HTomZZEj6qjMzU+RrWooqPHpBpoAzxvKlScDpXBBHZ+SpewaI70FTDG++K99GHM6YVaD veuMCR6Nqb0LUxo2VcGRl1o9y+Vdd7/1pEcjeIc3jKhW2gg1XScPBKx5XlK7a7qoG2J3 U3AfpaxwJ/8u+dX9JSGL+JZAHMUa7UbG4MOtwOynGWPgtzudvj693kmeDNKaO9C5PYdM NMSdG7cAuy63tpx2UuIaGZbuGzWbWhyKpMCtnIFZlj/5c7AHOgDYj9jAGgcWqvFB1ovd 7Xgg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k1-v6si14435838pld.40.2018.07.09.05.58.42; Mon, 09 Jul 2018 05:59:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754554AbeGIMzy (ORCPT + 99 others); Mon, 9 Jul 2018 08:55:54 -0400 Received: from mail-vk0-f67.google.com ([209.85.213.67]:42087 "EHLO mail-vk0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754528AbeGIMzw (ORCPT ); Mon, 9 Jul 2018 08:55:52 -0400 Received: by mail-vk0-f67.google.com with SMTP id t4-v6so10267577vke.9; Mon, 09 Jul 2018 05:55:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AhPJ68rgHCACTQorT8jzgCGPzpL/gR3J/ovBUjCtnn8=; b=PDCAtFEv0UU2L91XRgts/vwcOcvHxp3s16bAQOF03v+Pir8F/q/dfSVFtDDfOhe82n 3Uj2foXfrehg/tsMI3aosRy4wCjnc08TQhu759mOJfGL8NrFKxBb7ZzqsNr+M1235jg7 usBJ0/LY9qRdysTmq4AsYyL17taLNOtPSi1tJWbNQ+4UXI5x4LV+xjERf6I9+tQBUjbJ x47B4kuvDdBdEuU8FpJjVgTYNSUZ6Z+8KIKXnUd/jz0DhtojZ1stJWosZPCOcfC+gFRW n4P0/Lv9bcUjjN58tojvbj+RNOcwdcCt6wURYfY8FSRuK+SZx0o8WCo3ng9IQfNebIRu i8TQ== X-Gm-Message-State: APt69E3SmGhOTi72UdsYPver9af1e2q7g3l5XnQL179Yp0riPTP3kg36 6t4ynLdAmCBjVjFVrGCleMw+zX/Wj/EJ+drYL4w= X-Received: by 2002:a1f:20d4:: with SMTP id g203-v6mr11605951vkg.176.1531140951150; Mon, 09 Jul 2018 05:55:51 -0700 (PDT) MIME-Version: 1.0 References: <20180709124741.21037-1-abrodkin@synopsys.com> In-Reply-To: <20180709124741.21037-1-abrodkin@synopsys.com> From: Geert Uytterhoeven Date: Mon, 9 Jul 2018 14:55:38 +0200 Message-ID: Subject: Re: [PATCH] atomic{64}_t: Explicitly specify data storage length and alignment To: Alexey Brodkin Cc: Linux Kernel Mailing List , arcml , Linux-Arch , Will Deacon , Peter Zijlstra , Boqun Feng , Russell King , Arnd Bergmann , Thomas Gleixner , Ingo Molnar , Darren Hart , Shuah Khan , "Paul E. McKenney" , Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , David Laight , Greg KH Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Alexey, On Mon, Jul 9, 2018 at 2:48 PM Alexey Brodkin wrote: > Atomic instructions require data they operate on to be aligned > according to data size. I.e. 32-bit atomic values must be 32-bit > aligned while 64-bit values must be 64-bit aligned. > > Otherwise even if CPU may handle not-aligend normal data access, > still atomic instructions fail and typically raise an exception > leaving us dead in the water. > > This came-up during lengthly discussion here: > http://lists.infradead.org/pipermail/linux-snps-arc/2018-July/004022.html > > Signed-off-by: Alexey Brodkin Thanks for your patch! > --- a/include/asm-generic/atomic64.h > +++ b/include/asm-generic/atomic64.h > @@ -13,7 +13,7 @@ > #define _ASM_GENERIC_ATOMIC64_H > > typedef struct { > - long long counter; > + u64 __aligned(8) counter; I think you can drop the change to this file, as this is the generic implementation using spinlocks, for processors that don't have 64-bit atomic instructions. > } atomic64_t; Reviewed-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds