From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD83CC43387 for ; Fri, 18 Jan 2019 15:30:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A6BD320883 for ; Fri, 18 Jan 2019 15:30:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="pLE92cb1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727524AbfARPak (ORCPT ); Fri, 18 Jan 2019 10:30:40 -0500 Received: from mail-it1-f194.google.com ([209.85.166.194]:51980 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727241AbfARPak (ORCPT ); Fri, 18 Jan 2019 10:30:40 -0500 Received: by mail-it1-f194.google.com with SMTP id w18so7219352ite.1 for ; Fri, 18 Jan 2019 07:30:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7u5G5APo+ATxDkAo1zim5dz4CSaiKqFzF0CGgHkBq/Q=; b=pLE92cb1k3IjygyoCfvXx2dIPPJD5P4vAtYDSKqC+b2Sp8sq1ZwrdasXq3qB0DTmqW h1xS8l+BIDmTzi4AlRz3K/PsOEgoeOpfyOc+40zClTy68kD7IbzkC90fsHPnJfLywW22 OI5sCwNbOEwfqK1u/cuVERJDXIFM6gPYHwOlfzxe9jQbJIVRhWSJyKvc7Hum9BNWro3P jOG6i42kON2fxlVoFIdaD91KrAtzlaELRQf4PdQtXFAbWaJgd1qNtkHYb7q/bMTV5TCP UYkYgCwDS2iqEYAklScR3MxXmdqnePy4C1SMyeOp+ZCssgqhIKH7F3LD6QwPCd8ejNu9 t1dA== 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=7u5G5APo+ATxDkAo1zim5dz4CSaiKqFzF0CGgHkBq/Q=; b=R1fbpv7s7vv/gEohyUAbzltxbCYPRDL2rgmKjVKWydNjPxXOqYmPSsasfS0BGnNklZ aoOTqw2/qqX6cnuQ3iBtUS4M6HIYfZWZBXvgnf7cVux/ZzQPp08eUMKLj0UfURIaZ2eh wTKQuWcAXEBWI9O58lMdXFERxyv84UnIjgQE79UwCJOA7T3RBZnKKAI2+oSp0UwTnGB+ P3xCwRUM4jD8ykgvUF09TZWfmBJi61kJJLV3ap68wp/XV+A9Qd1SbsNrweCJzelby0Td /LlRcZR5bYb8J2c7qVkVEUQnRO0oxuKCIszy4qXPkKFB1x9crAsmBtJL6sBw2Egl6JZr eKjg== X-Gm-Message-State: AJcUukd1zvRWZFkCrUvpicfKBtC2bau5ezscHeM/OoBUGdgjUG0sdD4o YSZEuxvoOKPLaAhQ/3eUTqA+3LAAnkMgAuSM4OflYl8aYTA= X-Google-Smtp-Source: ALg8bN61jkvdOrrPtpWPwhIX2c/a/5GwWAjAlhWGO0xdhT2Wyb/wYYCDPUsojtMo+E3a30yv5bkJVvjOMOEYDZXnXgQ= X-Received: by 2002:a05:660c:f94:: with SMTP id x20mr9908486itl.144.1547825439613; Fri, 18 Jan 2019 07:30:39 -0800 (PST) MIME-Version: 1.0 References: <1547201433-10231-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp> <04c6d87c-fc26-b994-3b34-947414984abe@i-love.sakura.ne.jp> <54b68f21-c8b5-7074-74e0-06e3d7ee4003@i-love.sakura.ne.jp> <20190116104308.GC26069@quack2.suse.cz> <6ffb9790-42ff-5099-fb1f-1ef0c68a90ac@i-love.sakura.ne.jp> In-Reply-To: <6ffb9790-42ff-5099-fb1f-1ef0c68a90ac@i-love.sakura.ne.jp> From: Dmitry Vyukov Date: Fri, 18 Jan 2019 16:30:27 +0100 Message-ID: Subject: Re: [PATCH] fs: ratelimit __find_get_block_slow() failure message. To: Tetsuo Handa Cc: Jan Kara , Al Viro , linux-fsdevel Content-Type: text/plain; charset="UTF-8" Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Thu, Jan 17, 2019 at 3:11 PM Tetsuo Handa wrote: > > On 2019/01/16 19:43, Jan Kara wrote: > > On Wed 16-01-19 10:47:56, Dmitry Vyukov wrote: > >>> I still cannot catch. Read/write of sizeof(long) bytes at naturally > >>> aligned address is atomic, isn't it? > >> > >> Nobody guarantees this. According to C non-atomic conflicting > >> reads/writes of sizeof(long) cause undefined behavior of the whole > >> program. > > > > Yes, but to be fair the kernel has always relied on long accesses to be > > atomic pretty heavily so that it is now de-facto standard for the kernel > > AFAICT. I understand this makes life for static checkers hard but such is > > reality. > > Regarding "load a long word from naturally aligned address" and > "store a long word to naturally aligned address", they are required to be atomic > in Linux kernel, (for it is described as "On all systems running Linux, loads from > and stores to pointers are atomic, that is, if a store to a pointer occurs at the > same time as a load from that same pointer, the load will return either the initial > value or the value stored, never some bitwise mashup of the two." at > https://lwn.net/Articles/262464/ ) aren't they? Well, the description of the patch explains how/why a compiler can make a C pointer store non-atomic. Also you can see that list_for_each_entry_rcu uses READ_ONCE: https://elixir.bootlin.com/linux/v5.0-rc2/source/include/linux/rculist.h#L278 > And I know we need to use READ_ONCE()/WRITE_ONCE() etc. when we need to guarantee > that reordering/reloading is not acceptable. READ/WRITE_ONCE don't have anything to do with ordering. They only provide atomicity and visibility. That's various acquire/release/barriers that provide ordering guarantees. > But what damage can cause for this > specific case? Any. > It does only "compare two long variables" in addition to "load a > long word from naturally aligned address" and "store a long word to naturally > aligned address". Reordering/reloading these variables won't cause severe problems. > > > > > But in this particular case I agree with you that special logic is not > > really warranted. > > Anyway, do we apply V2 patch at > https://marc.info/?i=cd9c47c9-1dc6-6949-a138-703f6a10bc9b@i-love.sakura.ne.jp ?