Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp552458rwi; Thu, 13 Oct 2022 01:44:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6YfsHVyLmw447iEcR06piALjNnVgdQDqRI5UW1nNfcGa6znxJxv0k2Q0EMtuH+4jRd7+JY X-Received: by 2002:a63:5d4e:0:b0:41d:dcc3:aa85 with SMTP id o14-20020a635d4e000000b0041ddcc3aa85mr29294167pgm.324.1665650673201; Thu, 13 Oct 2022 01:44:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665650673; cv=none; d=google.com; s=arc-20160816; b=xir7I6Pgkj6g1m5abtxpv5bJ21o1LsLIgNq9eY3IqOk8za/9LMHyAbQ/4JAKq9VtgR 4xESBFLMHVDHXkaxzRhIDVB8XOVh2dMPn/FDPg28UpGnv9W2A+mvfpZRYEsFjokViKw/ GjDiu/rky6djyft/UBm4z+m/WEweDYPvaw0xMKHsVQJ8d72YwVewrDgVDbP2mE03MoXv 0Ac/g6rTbMlA7Nw3RPcC8RQDQh7nCfRZfrXgglw9Q3JfcZJ6jeAsKshc5Kf9L2COa2iu Nu1paDnvZwCfwn+QhbLNWgX4136JfBWvDETTgaNMN2coQSo3t6B9HslfY7F+jHjIjQ/3 usOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=UykCCyJppeIUxswHlrvpiYaqBuU5BdEdPSbdjTJa47Q=; b=UvWHrZswSynrxZ31rx0LnEN/U1b7J5KwrBqSMPw6n6QrU6CUjtO0fi8kMerC3t61o3 HErezUIECCeRVrWe5XjZuUEuEx4Q73CPAYi0uuw7Lj//4CZiSt9bljgpuu5WcbRtjLWw I8Yq2Eo401w2yGrY6j1tZJxxDUreKikY2qJ1I0LJs/J7N+ynuNDynt6Zp2ukJUTGfWbj QCYm+dWyh+q/INMQSUpuMiaRM3S42RgOqBZ8vidY3m1HGVaZ2H94T1qQHAzzyk0pP1rX BLWoDHOpHNSTUTTKyTjOClDzUvAoovGs8G07R3eYts04YnhwO9f7JQpkFEkywZ88RnNq v4SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=Rc9cWLza; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=c1bxmZqV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t186-20020a6381c3000000b00459ba7ace44si21090953pgd.514.2022.10.13.01.44.21; Thu, 13 Oct 2022 01:44:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=Rc9cWLza; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=c1bxmZqV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229540AbiJMIdy (ORCPT + 99 others); Thu, 13 Oct 2022 04:33:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229492AbiJMIdv (ORCPT ); Thu, 13 Oct 2022 04:33:51 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 543BD285 for ; Thu, 13 Oct 2022 01:33:50 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 5FAF4219FD; Thu, 13 Oct 2022 08:33:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1665650028; 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=UykCCyJppeIUxswHlrvpiYaqBuU5BdEdPSbdjTJa47Q=; b=Rc9cWLzaN+2mBDp03fYhJKtCItFrzeHJFnUVYf/Chm/uom0tNUiP2Lz39xyu4OVfXQ0/FU m/XNh6OM+2z3ZbWkTTicNTczAN4rs7rls45qwp9bXENDOSNJJCPXq1W7Ba//E98zJq3Sms 5oRCjPDXxwwhVRzEqfTpczbVYTdTQzo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1665650028; 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=UykCCyJppeIUxswHlrvpiYaqBuU5BdEdPSbdjTJa47Q=; b=c1bxmZqV6zA4PCXwr2Duu/z5BawMYC/UfhCr+2HxsFxCuVQHps+0xYxUJN1aHhJf3Pj2Vy bPMMnH6yK4064oDA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A0C2013AAA; Thu, 13 Oct 2022 08:33:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id asdNJGvNR2OrbAAAMHmgww (envelope-from ); Thu, 13 Oct 2022 08:33:47 +0000 Date: Thu, 13 Oct 2022 10:33:45 +0200 From: Oscar Salvador To: Naoya Horiguchi Cc: linux-mm@kvack.org, Andrew Morton , Miaohe Lin , David Hildenbrand , Mike Kravetz , Yang Shi , Muchun Song , Jane Chu , Naoya Horiguchi , linux-kernel@vger.kernel.org Subject: Re: [PATCH v6 4/4] mm/hwpoison: introduce per-memory_block hwpoison counter Message-ID: References: <20221007010706.2916472-1-naoya.horiguchi@linux.dev> <20221007010706.2916472-5-naoya.horiguchi@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221007010706.2916472-5-naoya.horiguchi@linux.dev> X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 07, 2022 at 10:07:06AM +0900, Naoya Horiguchi wrote: > From: Naoya Horiguchi > > Currently PageHWPoison flag does not behave well when experiencing memory > hotremove/hotplug. Any data field in struct page is unreliable when the > associated memory is offlined, and the current mechanism can't tell whether > a memory block is onlined because a new memory devices is installed or > because previous failed offline operations are undone. Especially if > there's a hwpoisoned memory, it's unclear what the best option is. > > So introduce a new mechanism to make struct memory_block remember that > a memory block has hwpoisoned memory inside it. And make any online event > fail if the onlining memory block contains hwpoison. struct memory_block > is freed and reallocated over ACPI-based hotremove/hotplug, but not over > sysfs-based hotremove/hotplug. So the new counter can distinguish these > cases. > > Signed-off-by: Naoya Horiguchi > Reported-by: kernel test robot I glanzed over it and looks good overall. Have a small question though: > @@ -864,6 +878,7 @@ void remove_memory_block_devices(unsigned long start, unsigned long size) > mem = find_memory_block_by_id(block_id); > if (WARN_ON_ONCE(!mem)) > continue; > + num_poisoned_pages_sub(-1UL, memblk_nr_poison(mem)); Why does num_poisoned_pages_sub() have to make this distinction (!-1 == -1) for the hot-remove stage? -- Oscar Salvador SUSE Labs