From: Juergen Gross <jgross@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org,
x86@kernel.org
Cc: sstabellini@kernel.org, mingo@redhat.com, bp@alien8.de,
hpa@zytor.com, boris.ostrovsky@oracle.com, tglx@linutronix.de
Subject: Re: [PATCH] x86/xen: fix pv boot
Date: Wed, 7 Nov 2018 13:16:42 +0100 [thread overview]
Message-ID: <b35f5ef5-28bc-5747-63d2-3c5c82ae49e9__10508.1407040872$1541592926$gmane$org@suse.com> (raw)
In-Reply-To: <6eb96a45-393c-4e06-ee19-549fdbe9e316@citrix.com>
On 07/11/2018 13:02, Andrew Cooper wrote:
> On 07/11/18 11:55, Andrew Cooper wrote:
>> On 07/11/18 11:30, Juergen Gross wrote:
>>> + return ret;
>>> }
>>>
>>> static inline int xen_safe_read_ulong(unsigned long *addr, unsigned long *val)
>>> {
>>> - return __get_user(*val, (unsigned long __user *)addr);
>>> + int ret = 0;
>>> + unsigned long rval;
>>> +
>>> + asm volatile("1: mov"__i" %2,%"__r"1\n"
>>> + "2:\n"
>>> + ".section .fixup,\"ax\"\n"
>>> + "3: mov %3,%0\n"
>>> + " jmp 2b\n"
>>> + ".previous\n"
>>> + _ASM_EXTABLE(1b, 3b)
>>> + : "=r" (ret), "=r" (rval)
>>> + : "m" (*addr), "i" (-1), "0" (ret));
>>> + *val = rval;
>>> + return ret;
>> This also uses rval uninitialised if a fault occurs.
>>
>> Overall, how about:
>>
>> static inline int xen_safe_write_ulong(unsigned long *addr, unsigned
>> long val)
>> {
>> int ret = 0;
>>
>> asm volatile("1: mov %[val], %[ptr]\n"
>> "2:\n"
>> ".section .fixup, \"ax\"\n"
>> "3: mov %[err], %[ret]\n"
>
> Actually, if you want a shorter fixup path, `sub $1, %[ret]` would also
> do, and drop the [err] constraint.
Thanks for the review.
Will send V2 soon.
Juergen
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-11-07 12:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-07 11:30 [PATCH] x86/xen: fix pv boot Juergen Gross
2018-11-07 11:55 ` Andrew Cooper
2018-11-07 11:55 ` [Xen-devel] " Andrew Cooper
2018-11-07 12:02 ` Andrew Cooper
2018-11-07 12:16 ` Juergen Gross [this message]
2018-11-07 12:16 ` Juergen Gross
2018-11-07 12:02 ` Andrew Cooper
2018-11-07 11:30 Juergen Gross
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='b35f5ef5-28bc-5747-63d2-3c5c82ae49e9__10508.1407040872$1541592926$gmane$org@suse.com' \
--to=jgross@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=boris.ostrovsky@oracle.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=sstabellini@kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xenproject.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.