[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/6] xsm: refactor xsm_ops handling
- To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Fri, 18 Jun 2021 13:44:04 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tjmq/86DCfA4709Ryy1nrsKKtZ6y5S67KCEXPc2k1L0=; b=Nq/lBzlMY1G/YjN5I/4qhQkLSTOHSLoFT5sOWi6WJl44/+dclJHpNB65XEGA8mCFuI08uhhwREhyIL0qU81jeWWfYKikUzDuKM+vtphzA2+gu8ealbBsW9MB0UJDL9dnzrl0FCXTdsnAKT1TD/IRAai9q3X4eYulDssFeDyTFPCg8YkS/8mDYZo2If+CEcoG74cT08s2y5dy4b89qqL9It/CK5VRCBAiyS3y6F5+eA4CSBsyg/fix2BSUAJKMb+MoB7MBCE9megrlISlTrhGmFsUGWZS5X2MTr88wcZF93y1sSXnJS3OnDGkMbHJkGhvnFfhT5goNd+2lUwnzWoSvw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BJ+uZbf67Lp7O+dqyjmiXwkwhnVd/rVSavRlxrIJisdf13Jj6mDRSCYeJb0KbGwG1UCQXS8qL+mpjFbtCE8ky/pHhZB1zk0vCvSbn67CmGluRWxUx/IWr7U/Sq9inAHgxD0gRs3kMo0pScbmx43jIYXf2azng9DHu1PDg3ZUm4RhNHYInF8lAxaealou8woAizwfUeQ2UJbE8nX8ekNSCXd2RUmaU51IvSKZE1faATpqjS2+ndo+VXQxYhTH6mNs8fDGjjznJR5x+15lB7kw94s7EPbo/Lk2bzVWIyMDJMOmzHRowHUe6Q4pXOYrubMORuMIWzQJEUf9PqrBe/q3LA==
- Authentication-results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=suse.com;
- Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Tamas K Lengyel <tamas@xxxxxxxxxxxxx>, Tim Deegan <tim@xxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Alexandru Isaila <aisaila@xxxxxxxxxxxxxxx>, Petre Pircalabu <ppircalabu@xxxxxxxxxxxxxxx>, Dario Faggioli <dfaggioli@xxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>, persaur@xxxxxxxxx, christopher.w.clark@xxxxxxxxx, adam.schwalm@xxxxxxxxxx, scott.davis@xxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Fri, 18 Jun 2021 11:44:21 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 18.06.2021 13:34, Andrew Cooper wrote:
> On 18/06/2021 00:39, Daniel P. Smith wrote:
>> @@ -197,16 +204,21 @@ bool __init has_xsm_magic(paddr_t start)
>>
>> int __init register_xsm(struct xsm_operations *ops)
>> {
>> - if ( verify(ops) )
>> + if ( xsm_ops_registered != XSM_OPS_UNREGISTERED )
>> + return -EAGAIN;
>
> I know you moved this around the function, but it really isn't -EAGAIN
> material any more. It's "too late - nope".
>
> -EEXIST is probably best for "I'm never going to tolerate another call".
>
>> +
>> + if ( !ops )
>> {
>> - printk(XENLOG_ERR "Could not verify xsm_operations structure\n");
>> + xsm_ops_registered = XSM_OPS_REG_FAILED;
>> + printk(XENLOG_ERR "Invalid xsm_operations structure registered\n");
>> return -EINVAL;
>
> Honestly, I'd be half tempted to declare register_xsm() with
> __nonnull(0) and let the compiler reject any attempt to pass a NULL ops
> pointer.
>
> Both callers pass a pointer to a static singleton objects.
Why check at all when the source of the arguments is all internal?
We don't check pointers to be non-NULL elsewhere, with a few odd
exceptions (which imo should all be dropped).
Jan
|