lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a0d73ce0-b2bd-1928-539d-39cb9da9bf1f@redhat.com>
Date:   Mon, 12 Apr 2021 16:12:11 +0200
From:   David Hildenbrand <david@...hat.com>
To:     Mel Gorman <mgorman@...hsingularity.net>,
        Vlastimil Babka <vbabka@...e.cz>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Oscar Salvador <osalvador@...e.de>,
        "Michael S. Tsirkin" <mst@...hat.com>,
        Alexander Duyck <alexanderduyck@...com>,
        Minchan Kim <minchan@...nel.org>,
        Michal Hocko <mhocko@...e.com>, Linux-MM <linux-mm@...ck.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 resend] mm/memory_hotplug: Make unpopulated zones PCP
 structures unreachable during hot remove

On 12.04.21 16:08, Mel Gorman wrote:
> On Mon, Apr 12, 2021 at 02:40:18PM +0200, Vlastimil Babka wrote:
>> On 4/12/21 2:08 PM, Mel Gorman wrote:
>>> zone_pcp_reset allegedly protects against a race with drain_pages
>>> using local_irq_save but this is bogus. local_irq_save only operates
>>> on the local CPU. If memory hotplug is running on CPU A and drain_pages
>>> is running on CPU B, disabling IRQs on CPU A does not affect CPU B and
>>> offers no protection.
>>>
>>> This patch deletes IRQ disable/enable on the grounds that IRQs protect
>>> nothing and assumes the existing hotplug paths guarantees the PCP cannot be
>>> used after zone_pcp_enable(). That should be the case already because all
>>> the pages have been freed and there is no page to put on the PCP lists.
>>>
>>> Signed-off-by: Mel Gorman <mgorman@...hsingularity.net>
>>
>> Yeah the irq disabling here is clearly bogus, so:
>>
>> Acked-by: Vlastimil Babka <vbabka@...e.cz>
>>
> 
> Thanks!
> 
>> But I think Michal has a point that we might best leave the pagesets around, by
>> a future change. I'm have some doubts that even with your reordering of the
>> reset/destroy after zonelist rebuild in v1 they cant't be reachable. We have no
>> protection between zonelist rebuild and zonelist traversal, and that's why we
>> just leave pgdats around.
>>
>> So I can imagine a task racing with memory hotremove might see watermarks as ok
>> in get_page_from_freelist() for the zone and proceeds to try_this_zone:, then
>> gets stalled/scheduled out while hotremove rebuilds the zonelist and destroys
>> the pcplists, then the first task is resumed and proceeds with rmqueue_pcplist().
>>
>> So that's very rare thus not urgent, and this patch doesn't make it less rare so
>> not a reason to block it.
>>
> 
> After v1 of the patch, the race was reduced to the point between the
> zone watermark check and the rmqueue_pcplist but yes, it still existed.
> Closing it completely was either complex or expensive. Setting
> zone->pageset = &boot_pageset before the free would shrink the race
> further but that still leaves a potential memory ordering issue.
> 
> While fixable, it's either complex, expensive or both so yes, just leaving
> the pageset structures in place would be much more straight-forward
> assuming the structures were not allocated in the zone that is being
> hot-removed. As things stand, I had trouble even testing zone hot-remove
> as there was always a few pages left behind and I did not chase down
> why.
Can you elaborate? I can reliably trigger zone present pages going to 0 
by just hotplugging a DIMM, onlining the memory block devices to the 
MOVABLE zone, followed by offlining the memory block again.

-- 
Thanks,

David / dhildenb

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ