All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@linux.intel.com>
To: Wu Fengguang <fengguang.wu@intel.com>
Cc: Andi Kleen <andi@firstfloor.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] HWPOISON: Implement hwpoison-on-free for soft offlining
Date: Tue, 12 Oct 2010 14:37:06 +0200	[thread overview]
Message-ID: <4CB45672.7020206@linux.intel.com> (raw)
In-Reply-To: <20101012122647.GA14208@localhost>

  On 10/12/2010 2:26 PM, Wu Fengguang wrote:
>
>>
>> +#if defined(CONFIG_MEMORY_FAILURE)&&  BITS_PER_LONG == 64
> We have the simpler CONFIG_HWPOISON_ON_FREE :)
>

Leftover from when I didn't have that. Fixed.

>> +PAGEFLAG(HWPoisonOnFree, hwpoison_on_free)
>> +TESTSCFLAG(HWPoisonOnFree, hwpoison_on_free)
>> +#define __PG_HWPOISON_ON_FREE (1UL<<  PG_hwpoison_on_free)
>> +#else
>> +PAGEFLAG_FALSE(HWPoisonOnFree)
> Could define SETPAGEFLAG_NOOP(HWPoisonOnFree) too, for eliminating an
> #ifdef in the .c file.

Ok.

>
>>   	}
>> +
>> +	if (PageHWPoisonOnFree(page)) {
>> +		pr_info("soft_offline: %#lx: Delaying poision of unknown page %lx to free\n",
>> +			pfn, page->flags);
>> +		return -EIO; /* or 0? */
> -EIO looks safer because HWPoisonOnFree does not guarantee success.
>
Ok.

>
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index a8cfa9c..519c24c 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -564,6 +564,8 @@ static inline int free_pages_check(struct page *page)
>>   		(page->mapping != NULL)  |
>>   		(atomic_read(&page->_count) != 0) |
>>   		(page->flags&  PAGE_FLAGS_CHECK_AT_FREE))) {
>> +		if (PageHWPoisonOnFree(page))
>> +			hwpoison_page_on_free(page);
> hwpoison_page_on_free() seems to be undefined when
> CONFIG_HWPOISON_ON_FREE is not defined.

Yes, but I rely on the compiler never generating the call in this case 
because
the test is zero.

It would fail on a unoptimized build, but the kernel doesn't support 
that anyways.

Thanks for the review.

-Andi


WARNING: multiple messages have this Message-ID (diff)
From: Andi Kleen <ak@linux.intel.com>
To: Wu Fengguang <fengguang.wu@intel.com>
Cc: Andi Kleen <andi@firstfloor.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] HWPOISON: Implement hwpoison-on-free for soft offlining
Date: Tue, 12 Oct 2010 14:37:06 +0200	[thread overview]
Message-ID: <4CB45672.7020206@linux.intel.com> (raw)
In-Reply-To: <20101012122647.GA14208@localhost>

  On 10/12/2010 2:26 PM, Wu Fengguang wrote:
>
>>
>> +#if defined(CONFIG_MEMORY_FAILURE)&&  BITS_PER_LONG == 64
> We have the simpler CONFIG_HWPOISON_ON_FREE :)
>

Leftover from when I didn't have that. Fixed.

>> +PAGEFLAG(HWPoisonOnFree, hwpoison_on_free)
>> +TESTSCFLAG(HWPoisonOnFree, hwpoison_on_free)
>> +#define __PG_HWPOISON_ON_FREE (1UL<<  PG_hwpoison_on_free)
>> +#else
>> +PAGEFLAG_FALSE(HWPoisonOnFree)
> Could define SETPAGEFLAG_NOOP(HWPoisonOnFree) too, for eliminating an
> #ifdef in the .c file.

Ok.

>
>>   	}
>> +
>> +	if (PageHWPoisonOnFree(page)) {
>> +		pr_info("soft_offline: %#lx: Delaying poision of unknown page %lx to free\n",
>> +			pfn, page->flags);
>> +		return -EIO; /* or 0? */
> -EIO looks safer because HWPoisonOnFree does not guarantee success.
>
Ok.

>
>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>> index a8cfa9c..519c24c 100644
>> --- a/mm/page_alloc.c
>> +++ b/mm/page_alloc.c
>> @@ -564,6 +564,8 @@ static inline int free_pages_check(struct page *page)
>>   		(page->mapping != NULL)  |
>>   		(atomic_read(&page->_count) != 0) |
>>   		(page->flags&  PAGE_FLAGS_CHECK_AT_FREE))) {
>> +		if (PageHWPoisonOnFree(page))
>> +			hwpoison_page_on_free(page);
> hwpoison_page_on_free() seems to be undefined when
> CONFIG_HWPOISON_ON_FREE is not defined.

Yes, but I rely on the compiler never generating the call in this case 
because
the test is zero.

It would fail on a unoptimized build, but the kernel doesn't support 
that anyways.

Thanks for the review.

-Andi

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2010-10-12 12:37 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-06 22:09 RFC: Implement hwpoison on free for soft offlining Andi Kleen
2010-10-06 22:09 ` Andi Kleen
2010-10-06 22:09 ` [PATCH] HWPOISON: Implement hwpoison-on-free " Andi Kleen
2010-10-06 22:09   ` Andi Kleen
2010-10-12 12:26   ` Wu Fengguang
2010-10-12 12:26     ` Wu Fengguang
2010-10-12 12:37     ` Andi Kleen [this message]
2010-10-12 12:37       ` Andi Kleen
2010-10-12 12:41       ` Wu Fengguang
2010-10-12 12:41         ` Wu Fengguang
2010-10-12  8:11 ` RFC: Implement hwpoison on free " Andi Kleen
2010-10-12  8:11   ` Andi Kleen
2010-10-12  9:20   ` KOSAKI Motohiro
2010-10-12  9:20     ` KOSAKI Motohiro
2010-10-12 13:14     ` Andi Kleen
2010-10-12 13:14       ` Andi Kleen
2010-10-13  0:15       ` KOSAKI Motohiro
2010-10-13  0:15         ` KOSAKI Motohiro
2010-10-15  8:50 ` Andi Kleen
2010-10-15  8:50   ` Andi Kleen
  -- strict thread matches above, loose matches on Subject: below --
2010-10-12 12:38 [PATCH] HWPOISON: Implement hwpoison-on-free " Penttilä Mika
2010-10-12 14:06 ` Andi Kleen
2010-10-12 14:23   ` Penttilä Mika
2010-10-12 14:30     ` Andi Kleen
2010-10-12 14:33       ` Penttilä Mika

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CB45672.7020206@linux.intel.com \
    --to=ak@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=fengguang.wu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.