lkml.org 
[lkml]   [2024]   [Apr]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: Machine check recovery broken in v6.9-rc1
    On Sat, Apr 06, 2024 at 04:18:41AM +0200, Oscar Salvador wrote:
    > Tony, could you try the following patch, to see if that goes away?
    > It is against 6.1, but current kernel has the same problem AFAICS.
    >
    >
    > diff --git a/include/linux/swapops.h b/include/linux/swapops.h
    > index 578212fbf2be..575d428393c0 100644
    > --- a/include/linux/swapops.h
    > +++ b/include/linux/swapops.h
    > @@ -416,7 +416,7 @@ static inline bool is_pfn_swap_entry(swp_entry_t entry)
    > BUILD_BUG_ON(SWP_TYPE_SHIFT < SWP_PFN_BITS);
    >
    > return is_migration_entry(entry) || is_device_private_entry(entry) ||
    > - is_device_exclusive_entry(entry);
    > + is_device_exclusive_entry(entry) || is_hwpsoion_entry(entry);
    > }
    >
    > struct page_vma_mapped_walk;

    Sorry, I was still sleepy and I made a typo.
    Plus I realized we need to move some definitions to make them available.

    This should have been (compile tested only):

    diff --git a/include/linux/swapops.h b/include/linux/swapops.h
    index 48b700ba1d18..201efbf441d6 100644
    --- a/include/linux/swapops.h
    +++ b/include/linux/swapops.h
    @@ -390,6 +390,35 @@ static inline bool is_migration_entry_dirty(swp_entry_t entry)
    }
    #endif /* CONFIG_MIGRATION */

    +#ifdef CONFIG_MEMORY_FAILURE
    +
    +/*
    + * Support for hardware poisoned pages
    + */
    +static inline swp_entry_t make_hwpoison_entry(struct page *page)
    +{
    + BUG_ON(!PageLocked(page));
    + return swp_entry(SWP_HWPOISON, page_to_pfn(page));
    +}
    +
    +static inline int is_hwpoison_entry(swp_entry_t entry)
    +{
    + return swp_type(entry) == SWP_HWPOISON;
    +}
    +
    +#else
    +
    +static inline swp_entry_t make_hwpoison_entry(struct page *page)
    +{
    + return swp_entry(0, 0);
    +}
    +
    +static inline int is_hwpoison_entry(swp_entry_t swp)
    +{
    + return 0;
    +}
    +#endif
    +
    typedef unsigned long pte_marker;

    #define PTE_MARKER_UFFD_WP BIT(0)
    @@ -492,7 +521,7 @@ static inline bool is_pfn_swap_entry(swp_entry_t entry)
    BUILD_BUG_ON(SWP_TYPE_SHIFT < SWP_PFN_BITS);

    return is_migration_entry(entry) || is_device_private_entry(entry) ||
    - is_device_exclusive_entry(entry);
    + is_device_exclusive_entry(entry) || is_hwpoison_entry(entry);
    }

    struct page_vma_mapped_walk;
    @@ -561,35 +590,6 @@ static inline int is_pmd_migration_entry(pmd_t pmd)
    }
    #endif /* CONFIG_ARCH_ENABLE_THP_MIGRATION */

    -#ifdef CONFIG_MEMORY_FAILURE
    -
    -/*
    - * Support for hardware poisoned pages
    - */
    -static inline swp_entry_t make_hwpoison_entry(struct page *page)
    -{
    - BUG_ON(!PageLocked(page));
    - return swp_entry(SWP_HWPOISON, page_to_pfn(page));
    -}
    -
    -static inline int is_hwpoison_entry(swp_entry_t entry)
    -{
    - return swp_type(entry) == SWP_HWPOISON;
    -}
    -
    -#else
    -
    -static inline swp_entry_t make_hwpoison_entry(struct page *page)
    -{
    - return swp_entry(0, 0);
    -}
    -
    -static inline int is_hwpoison_entry(swp_entry_t swp)
    -{
    - return 0;
    -}
    -#endif
    -
    static inline int non_swap_entry(swp_entry_t entry)
    {
    return swp_type(entry) >= MAX_SWAPFILES;

    --
    Oscar Salvador
    SUSE Labs

    \
     
     \ /
      Last update: 2024-05-27 16:27    [W:2.915 / U:0.292 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site