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  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]
Date:   Thu, 24 Dec 2020 08:11:11 +0100
From:   SeongJae Park <sjpark@...zon.com>
To:     Shakeel Butt <shakeelb@...gle.com>
CC:     SeongJae Park <sjpark@...zon.com>, <Jonathan.Cameron@...wei.com>,
        "Andrea Arcangeli" <aarcange@...hat.com>, <acme@...nel.org>,
        <alexander.shishkin@...ux.intel.com>, <amit@...nel.org>,
        <benh@...nel.crashing.org>, <brendan.d.gregg@...il.com>,
        Brendan Higgins <brendanhiggins@...gle.com>,
        Qian Cai <cai@....pw>,
        Colin Ian King <colin.king@...onical.com>,
        Jonathan Corbet <corbet@....net>,
        "David Hildenbrand" <david@...hat.com>, <dwmw@...zon.com>,
        Marco Elver <elver@...gle.com>, "Du, Fan" <fan.du@...el.com>,
        <foersleo@...zon.de>, "Greg Thelen" <gthelen@...gle.com>,
        Ian Rogers <irogers@...gle.com>, <jolsa@...hat.com>,
        "Kirill A. Shutemov" <kirill@...temov.name>,
        Mark Rutland <mark.rutland@....com>,
        Mel Gorman <mgorman@...e.de>, Minchan Kim <minchan@...nel.org>,
        Ingo Molnar <mingo@...hat.com>, <namhyung@...nel.org>,
        "Peter Zijlstra (Intel)" <peterz@...radead.org>,
        Randy Dunlap <rdunlap@...radead.org>,
        Rik van Riel <riel@...riel.com>,
        David Rientjes <rientjes@...gle.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Mike Rapoport <rppt@...nel.org>, <sblbir@...zon.com>,
        Shuah Khan <shuah@...nel.org>, <sj38.park@...il.com>,
        <snu@...zon.de>, Vlastimil Babka <vbabka@...e.cz>,
        Vladimir Davydov <vdavydov.dev@...il.com>,
        Yang Shi <yang.shi@...ux.alibaba.com>,
        Huang Ying <ying.huang@...el.com>, <zgf574564920@...il.com>,
        <linux-damon@...zon.com>, Linux MM <linux-mm@...ck.org>,
        <linux-doc@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v23 05/15] mm/damon: Implement primitives for the virtual memory address spaces

On Wed, 23 Dec 2020 14:54:02 -0800 Shakeel Butt <shakeelb@...gle.com> wrote:

> On Wed, Dec 23, 2020 at 8:47 AM SeongJae Park <sjpark@...zon.com> wrote:
> >
> [snip]
> > > [snip]
> > > > +
> > > > +static bool damon_va_young(struct mm_struct *mm, unsigned long addr,
> > > > +                       unsigned long *page_sz)
> > > > +{
> > > > +       pte_t *pte = NULL;
> > > > +       pmd_t *pmd = NULL;
> > > > +       spinlock_t *ptl;
> > > > +       bool young = false;
> > > > +
> > > > +       if (follow_pte_pmd(mm, addr, NULL, &pte, &pmd, &ptl))
> > > > +               return false;
> > > > +
> > > > +       *page_sz = PAGE_SIZE;
> > > > +       if (pte) {
> > > > +               young = pte_young(*pte);
> > > > +               if (!young)
> > > > +                       young = !page_is_idle(pte_page(*pte));
> > > > +               pte_unmap_unlock(pte, ptl);
> > > > +               return young;
> > > > +       }
> > > > +
> > > > +#ifdef CONFIG_TRANSPARENT_HUGEPAGE
> > > > +       young = pmd_young(*pmd);
> > > > +       if (!young)
> > > > +               young = !page_is_idle(pmd_page(*pmd));
> > > > +       spin_unlock(ptl);
> > > > +       *page_sz = ((1UL) << HPAGE_PMD_SHIFT);
> > > > +#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
> > > > +
> > > > +       return young;
> > >
> > > You need mmu_notifier_test_young() here. Hmm I remember mentioning
> > > this in some previous version as well.
> >
> > Your question and my answer was as below:
> >
> >     > Don't you need mmu_notifier_clear_young() here?
> >
> >     I think we don't need it here because we only read the Accessed bit and PG_Idle
> >     if Accessed bit was not set.
> >
> > I should notice that you mean 'test_young()' but didn't, sorry.  I will add it
> > in the next version.
> >
> 
> I should have said mmu_notifier_test_young() instead of
> mmu_notifier_clear_young().
> 
> > >
> > > BTW have you tested this on a VM?
> >
> > Yes.  Indeed, I'm testing this on a QEMU/KVM environment.  You can get more
> > detail at: https://damonitor.github.io/doc/html/latest/vm/damon/eval.html#setup
> >
> 
> Hmm without mmu_notifier_test_young() you should be missing the kvm
> mmu access updates. Can you please recheck if your eval is correctly
> seeing the memory accesses from the VM?

Seems I didn't clearly answered, sorry.  My test setup installs the
DAMON-enabled kernel in a guest VM and run it for workloads in the guest,
rather than running DAMON in host to monitor accesses of VMs.  The MMU notifier
is for latter case, AFAIU, so my test setup didn't see the problem.

If I'm missing something, please let me know.


Thanks,
SeongJae Park

Powered by blists - more mailing lists