Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5105098pxj; Wed, 26 May 2021 02:59:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgsnQfWGY0z5c5aUMA5pUeTTczpC+tbZ39dFNeXPiCv59K58cFuJUfXKTBNxYDnJF+ezT7 X-Received: by 2002:a92:d60e:: with SMTP id w14mr24913058ilm.0.1622023199565; Wed, 26 May 2021 02:59:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622023199; cv=none; d=google.com; s=arc-20160816; b=pCYjtLyHmInWTtY/rsgmqVgcGRdkHJJi6BsJ0/30uwWnHVomIJDs+ruv+tyvuH0ZZ6 XXZhiHqY+200CG3EnKYJfyFUNDiz4TRuOCwvHKI8mXIhvGSe868U4cqeglt3yccpl7Rp QLNO5kd50ESUlP+l3Tr2qAJin3AHTPeHZ36GIysG+T/6fuphvr9eYtfxJ3/SZVYqUnPn 4YxkkWarzq0W2op1T2gJaQzVeU8up9uaD0/0itCwH+HE9AlHcL7xzXXujLkPx2FPmVtM upYGqe6yzMOl2JEGSYz9HhbUWZX9dl3Du3MD7UY6p+eaeKE6p3EmwpTPg9Ub+Mb9VO4S V5cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=1I4Fgx3Wsu9b4i+qkfJ6NLcukv/nrkr5xfQ4pMZYpcM=; b=P7xMyIDHO/DvcEr2M0/38XO0Md7547NxVGu7SlqA+mfaP6xnkGZ2LW9IvNARwDWift iB8kPQHpiC2bH87QkwL/DZjXt8rNTw5vOCi1AAPRvNFr1gcqOUel9y1N7Y3wQENY+WV8 DDqFU2ptFDePThG3lNTyl5LJho1FJslkG/mly45tSFEHqa1MNiWSNASQwI1R1tr7V+SR i/oyKUcUg2Ge/NY4rV84yITKFfAITrkZ6bAB4KgvZjfMTVYGFRkkYI4LDV0taXecUJv4 4jijfu1py1OnY3zpzTmDuzke3dPtthrw45g0AOuuOWDrUyNhMIkhpI/4gjit1bJMZt5I 7dUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="jPRSzya/"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g8si9627854ild.80.2021.05.26.02.59.44; Wed, 26 May 2021 02:59:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="jPRSzya/"; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233567AbhEZJ6R (ORCPT + 99 others); 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