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=-12.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 D1A97C2B9F7 for ; Wed, 26 May 2021 09:56:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B48866109F for ; Wed, 26 May 2021 09:56:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233704AbhEZJ6R (ORCPT ); Wed, 26 May 2021 05:58:17 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:47806 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233264AbhEZJ6R (ORCPT ); Wed, 26 May 2021 05:58:17 -0400 X-Greylist: delayed 555 seconds by postgrey-1.27 at vger.kernel.org; Wed, 26 May 2021 05:58:16 EDT Received: from imap.suse.de (imap-alt.suse-dmz.suse.de [192.168.254.47]) by smtp-out2.suse.de (Postfix) with ESMTP id 24CB71FD29; Wed, 26 May 2021 09:47:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1622022450; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=1I4Fgx3Wsu9b4i+qkfJ6NLcukv/nrkr5xfQ4pMZYpcM=; b=jPRSzya/SZPLGu40Y/Pn4aMJM6uQImJAsZ3cTRzh8tRnwE3Pw6drInbDphgqg4F+8ghy+3 Fe7uk+2A3BTtdCPZcWFLHs7WBHTLqQQbC1cqz1z7jxop481vQQSKiWu2cVon4urJXKjLV2 5DNss7gehP8SE3kkV0bVkIdzrgmKqfE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1622022450; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=1I4Fgx3Wsu9b4i+qkfJ6NLcukv/nrkr5xfQ4pMZYpcM=; b=HdbQ0wDwwNSJckYD2D3ngt+tcvXWBB8NmdyXbdK9MySHHUQREbZ4xSMjpwuilsBpIu/mZg V61MUy/knevzRCAw== Received: from director2.suse.de (director2.suse-dmz.suse.de [192.168.254.72]) by imap.suse.de (Postfix) with ESMTPSA id 60ADD11A98; Wed, 26 May 2021 09:47:29 +0000 (UTC) Date: Wed, 26 May 2021 11:47:27 +0200 From: Oscar Salvador To: Naoya Horiguchi Cc: linux-mm@kvack.org, Tony Luck , Aili Yao , Andrew Morton , David Hildenbrand , Borislav Petkov , Andy Lutomirski , Naoya Horiguchi , Jue Wang , linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 1/3] mm/memory-failure: Use a mutex to avoid memory_failure() races Message-ID: <20210526094722.GA1656@linux> References: <20210521030156.2612074-1-nao.horiguchi@gmail.com> <20210521030156.2612074-2-nao.horiguchi@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210521030156.2612074-2-nao.horiguchi@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 21, 2021 at 12:01:54PM +0900, Naoya Horiguchi wrote: > From: Tony Luck > > There can be races when multiple CPUs consume poison from the same > page. The first into memory_failure() atomically sets the HWPoison > page flag and begins hunting for tasks that map this page. Eventually > it invalidates those mappings and may send a SIGBUS to the affected > tasks. > > But while all that work is going on, other CPUs see a "success" > return code from memory_failure() and so they believe the error > has been handled and continue executing. > > Fix by wrapping most of the internal parts of memory_failure() in > a mutex. > > Signed-off-by: Tony Luck > Signed-off-by: Naoya Horiguchi > Reviewed-by: Borislav Petkov Reviewed-by: Oscar Salvador -- Oscar Salvador SUSE L3