linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Gardner <rob.gardner@oracle.com>
To: Khalid Aziz <khalid.aziz@oracle.com>,
	David Miller <davem@davemloft.net>,
	dave.hansen@linux.intel.com
Cc: mhocko@kernel.org, corbet@lwn.net, arnd@arndb.de,
	akpm@linux-foundation.org, hpa@zytor.com,
	viro@zeniv.linux.org.uk, nitin.m.gupta@oracle.com,
	chris.hyser@oracle.com, tushar.n.dave@oracle.com,
	sowmini.varadhan@oracle.com, mike.kravetz@oracle.com,
	adam.buchbinder@gmail.com, minchan@kernel.org, hughd@google.com,
	kirill.shutemov@linux.intel.com, keescook@chromium.org,
	allen.pais@oracle.com, aryabinin@virtuozzo.com,
	atish.patra@oracle.com, joe@perches.com, pmladek@suse.com,
	jslaby@suse.cz, cmetcalf@mellanox.com,
	paul.gortmaker@windriver.com, jmarchan@redhat.com,
	lstoakes@gmail.com, 0x7f454c46@gmail.com, vbabka@suse.cz,
	tglx@linutronix.de, mingo@redhat.com, dan.j.williams@intel.com,
	iamjoonsoo.kim@lge.com, mgorman@techsingularity.net,
	vdavydov.dev@gmail.com, hannes@cmpxchg.org, namit@vmware.com,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	sparclinux@vger.kernel.org, linux-arch@vger.kernel.org,
	x86@kernel.org, linux-mm@kvack.org, khalid@gonehiking.org
Subject: Re: [RFC PATCH v3] sparc64: Add support for Application Data Integrity (ADI)
Date: Fri, 6 Jan 2017 10:28:44 -0800	[thread overview]
Message-ID: <f04ef1ca-fe67-1da4-61d7-bab0ccc7e00e@oracle.com> (raw)
In-Reply-To: <7f78da33-a591-e913-d96e-fec022f2ba9e@oracle.com>

On 01/06/2017 10:18 AM, Khalid Aziz wrote:
> On 01/06/2017 10:54 AM, Rob Gardner wrote:
>> On 01/06/2017 09:10 AM, Khalid Aziz wrote:
>>> On 01/06/2017 10:02 AM, David Miller wrote:
>>>> From: Dave Hansen <dave.hansen@linux.intel.com>
>>>> Date: Fri, 6 Jan 2017 08:55:03 -0800
>>>>
>>>>> Actually, that reminds me...  How does your code interface with
>>>>> ksm?  Or
>>>>> is there no interaction needed since you're always working on virtual
>>>>> addresses?
>>>>
>>>> This reminds me, I consider this feature potentially extremely useful
>>>> for
>>>> kernel debugging.  So I would like to make sure we don't implement
>>>> anything
>>>> in a way which would preclude that in the long term.
>>>
>>> I agree and please do point out if I have made any implementation
>>> decisions that could preclude that.
>>>
>>> Thanks,
>>> Khalid
>>
>>
>> Khalid, I have already pointed out an implementation decision that
>> interferes with the potential for kernel debugging with ADI: lazy
>> clearing of version tags.
>
> This does not preclude kernel debugging. If kernel debugging ends up 
> requiring tags be cleared whenever a page is freed, we can add that 
> code as part of kernel debugging support code and enable it 
> conditionally only when kernel is being debugged. Forcing every task 
> to incur the large cost of clearing tags on every "free" all the time 
> is just not an acceptable cost only to support kernel debugging. It 
> should be a dynamic switch to be toggled on only when debugging 
> kernel. PSTATE.mcde being set is not enough to trigger a trap. It is 
> easy enough to clear TTE.mcd before block initialization of a page and 
> avoid a trap due to tag mismatch, or just use physical address with 
> block initialization.
>
> We can evaluate all of these options when we get to implementing 
> kernel debugging using ADI.

I didn't say it precludes kernel debugging, just that it interferes, and 
there will be additional work to do if we want kernel debugging 
capability with ADI.

Rob



>
> Thanks,
> Khalid
>
>
>>
>> Details: when memory is "freed" the version tags are left alone, as it
>> is an expensive operation to go through the memory and clear the tag for
>> each cache line. So this is done lazily whenever memory is "allocated".
>> More specifically, the first time a user process touches freshly
>> allocated memory, a fault occurs and the kernel then clears the page. In
>> the NG4 and M7 variants of clear_user_page, the block init store ASI is
>> used to optimize, and it has the side effect of clearing the ADI tag for
>> the cache line. BUT only if pstate.mcde is clear. If pstate.mcde is set,
>> then instead of the ADI tag being cleared, the tag is *checked*, and if
>> there is a mismatch between the version in the virtual address and the
>> version in memory, then you'll get a trap and panic. Therefore, with
>> this design, you cannot have pstate.mcde enabled while in the kernel (in
>> general). To solve this you have to check the state of pstate.mcde (or
>> just turn it off) before doing any block init store in clear_user_page,
>> memset, memcpy, etc.
>>
>> Rob
>>
>> -- 
>> To unsubscribe from this list: send the line "unsubscribe sparclinux" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
> -- 
> To unsubscribe from this list: send the line "unsubscribe sparclinux" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2017-01-06 18:30 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-04 22:46 [RFC PATCH v3] sparc64: Add support for Application Data Integrity (ADI) Khalid Aziz
2017-01-04 23:27 ` Dave Hansen
2017-01-04 23:35   ` Rob Gardner
2017-01-04 23:40     ` Dave Hansen
2017-01-04 23:44       ` Rob Gardner
2017-01-04 23:49         ` Dave Hansen
2017-01-04 23:56           ` Rob Gardner
2017-01-04 23:58           ` Khalid Aziz
2017-01-05  0:01             ` Dave Hansen
2017-01-05  0:05               ` Rob Gardner
2017-01-05  0:14                 ` Dave Hansen
2017-01-05  0:26                   ` Khalid Aziz
2017-01-05 19:22                     ` Dave Hansen
2017-01-05 20:30                       ` Khalid Aziz
2017-01-06  9:19                         ` Michal Hocko
2017-01-06 15:32                           ` Khalid Aziz
2017-01-06 15:36                             ` Dave Hansen
2017-01-06 16:22                               ` Khalid Aziz
2017-01-06 16:25                                 ` David Miller
2017-01-06 16:55                                 ` Dave Hansen
2017-01-06 17:02                                   ` David Miller
2017-01-06 17:10                                     ` Khalid Aziz
2017-01-06 17:54                                       ` Rob Gardner
2017-01-06 18:18                                         ` Khalid Aziz
2017-01-06 18:28                                           ` Rob Gardner [this message]
2017-01-06 17:08                                   ` Khalid Aziz
2017-01-04 23:43   ` Khalid Aziz
2017-01-04 23:31 ` Dave Hansen
2017-01-04 23:46   ` Khalid Aziz
2017-01-04 23:50     ` Dave Hansen
2017-01-05  9:37 ` Jerome Marchand
2017-01-05 15:13   ` Khalid Aziz

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=f04ef1ca-fe67-1da4-61d7-bab0ccc7e00e@oracle.com \
    --to=rob.gardner@oracle.com \
    --cc=0x7f454c46@gmail.com \
    --cc=adam.buchbinder@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=allen.pais@oracle.com \
    --cc=arnd@arndb.de \
    --cc=aryabinin@virtuozzo.com \
    --cc=atish.patra@oracle.com \
    --cc=chris.hyser@oracle.com \
    --cc=cmetcalf@mellanox.com \
    --cc=corbet@lwn.net \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=hannes@cmpxchg.org \
    --cc=hpa@zytor.com \
    --cc=hughd@google.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=jmarchan@redhat.com \
    --cc=joe@perches.com \
    --cc=jslaby@suse.cz \
    --cc=keescook@chromium.org \
    --cc=khalid.aziz@oracle.com \
    --cc=khalid@gonehiking.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lstoakes@gmail.com \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@kernel.org \
    --cc=mike.kravetz@oracle.com \
    --cc=minchan@kernel.org \
    --cc=mingo@redhat.com \
    --cc=namit@vmware.com \
    --cc=nitin.m.gupta@oracle.com \
    --cc=paul.gortmaker@windriver.com \
    --cc=pmladek@suse.com \
    --cc=sowmini.varadhan@oracle.com \
    --cc=sparclinux@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=tushar.n.dave@oracle.com \
    --cc=vbabka@suse.cz \
    --cc=vdavydov.dev@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).