[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2.2 07/15] xen: generate hypercall interface related code


  • To: Juergen Gross <jgross@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 8 Nov 2021 15:54:36 +0100
  • 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=V+K1CwSI3UjizQZfQfQcMR8jOCQ36LLX1IcuD+WYaFw=; b=JOZtnyN7brCn8ZvXwBdDb2o0cF4RhPN0CrByCE4hqB+H22YMf7Umlfre/cx5yoAcjHmA5L1CVADha/kfN0hKQsA3wQ3JpUNlPnCneVwKSAIQx0MgNBfvM/QHEjRLwRyH/+Ht/6VWBQmBj5PQnUZMHCnHEx/Oy+QIuaYCSw3jmtwlNo16Zc8Vzsn0lfP1lvuXJZj7Q1RgwZfBd23y7XluNVfeGGYvZHg+5EuIt2O/ex9EWbMhkHRavpgy+YI8iXydP5jlaEShiEu3ywaJVi5mr8yCP2MM0OnMuE6EGU2cNwdmFb35Vgi8C1ssbisAEaFZJKIIkIBepB7Haq0yvDU6Hw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C+a3EZxO3DMiiLtFdInQwnHcLRLkNneFY4CIBiJ4ZGS9KS23AtO1MSY/bpJG5e4ctK5wMIijf1/zfCfbxxWo1s4ezkbOEuh5dcx0UiJpV3MHSWeSkM1gpSgWOeQyz2xEOVGXTbUlel5cb7fBSg8FhhxJ7njz5AonGmoOd3dcln8PekXxwNfxYUILImTHIEpVXQRXCNEXphdUonJ3suNRv1Ace+OzKS8T6t+y5S2c53XTCGxmnbI8P4bXSxjYCjdD4pmXmaLMPWftkYUlhJRfsLC5JELNZJBOyLsliADnLmFKePY/PtbnAayKR4VsDvonqXFmmP4xW+u2hWt8BQ+7tg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 08 Nov 2021 14:55:00 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 08.11.2021 15:42, Juergen Gross wrote:
> On 03.11.21 16:42, Jan Beulich wrote:
>> On 03.11.2021 11:20, Juergen Gross wrote:
>>> +# Generate the output
>>> +END {
>>> +    # Verbatim generated lines
>>> +    for (i = 1; i <= e; i++)
>>> +        printf("%s\n", emit[i]);
>>> +    printf("\n");
>>> +    # Generate prototypes
>>> +    for (i = 1; i <= n; i++) {
>>> +        for (p = 1; p <= n_pre[i]; p++) {
>>> +            printf("%s %s_%s(", rettype[pre[i, p]], pre[i, p], fn[i]);
>>> +            if (n_args[i] == 0)
>>> +                printf("void");
>>> +            else
>>> +                for (j = 1; j <= n_args[i]; j++) {
>>> +                    if (j > 1)
>>> +                        printf(", ");
>>> +                    if (ptr[i, j])
>>> +                        printf("XEN_GUEST_HANDLE_PARAM(%s)", typ[i, j]);
>>> +                    else
>>> +                        printf("%s", typ[i, j]);
>>> +                    printf(" %s", arg[i, j]);
>>> +                }
>>> +            printf(");\n");
>>> +        }
>>> +    }
>>> +    # Generate call sequences and args array contents
>>> +    for (ca in caller) {
>>> +        if (caller[ca] != 1)
>>> +            continue;
>>> +        need_mask = 0;
>>> +        for (pl = 1; pl <= n_prios[ca]; pl++) {
>>> +            for (pll = pl; pll > 1; pll--) {
>>> +                if (prio_list[ca, pl] > p_list[pll - 1])
>>> +                    break;
>>> +                else
>>> +                    p_list[pll] = p_list[pll - 1];
>>> +            }
>>> +            p_list[pll] = prio_list[ca, pl];
>>> +            # If any prio but the default one has more than 1 entry we 
>>> need "mask"
>>> +            if (p_list[pll] != 100 && prios[ca, p_list[pll]] > 1)
>>> +                need_mask = 1;
>>> +        }
>>> +        printf("\n");
>>> +        printf("#define call_handlers_%s(num, ret, a1, a2, a3, a4, a5) 
>>> \\\n", ca);
>>> +        printf("{ \\\n");
>>> +        if (need_mask)
>>> +            printf("    uint64_t mask = 1ULL << num; \\\n");
>>> +        printf("    ");
>>> +        for (pl = 1; pl <= n_prios[ca]; pl++) {
>>> +            if (prios[ca, p_list[pl]] > 1) {
>>> +                if (pl < n_prios[ca]) {
>>> +                    printf("if ( likely(mask & (%s)) ) \\\n", 
>>> prio_mask[ca, p_list[pl]]);
>>> +                    printf("    { \\\n");
>>> +                }
>>> +                if (prios[ca, p_list[pl]] == 2) {
>>> +                    fnd = 0;
>>> +                    for (i = 1; i <= nc; i++)
>>> +                        if (call[i] == ca && call_prio[i] == p_list[pl]) {
>>> +                            fnd++;
>>> +                            if (fnd == 1)
>>> +                                printf("        if ( num == 
>>> __HYPERVISOR_%s ) \\\n", fn[call_fn[i]]);
>>> +                            else
>>> +                                printf("        else \\\n");
>>> +                            do_call(call_fn[i], call_p[i]);
>>> +                        }
>>> +                } else {
>>> +                    do_switch(ca, p_list[pl]);
>>> +                }
>>> +                if (pl < n_prios[ca])
>>> +                    printf("    } \\\n");
>>> +            } else {
>>> +                for (i = 1; i <= nc; i++)
>>> +                    if (call[i] == ca && call_prio[i] == p_list[pl]) {
>>> +                        printf("if ( likely(num == __HYPERVISOR_%s) ) 
>>> \\\n", fn[call_fn[i]]);
>>> +                        do_call(call_fn[i], call_p[i]);
>>> +                    }
>>> +            }
>>> +            if (pl < n_prios[ca] || prios[ca, p_list[pl]] <= 2)
>>> +                printf("    else ");
>>
>> I think there's a line continuation escape + newline missing here.
> 
> Yes and no.
> 
> This can either continue with another "if" clause not wanting a new
> line or with a final ending statement (either a "switch" or a
> "ret = -ENOSYS"), which probably would want the new line. Adding
> code for handling both cases is possible, but I'm not sure it is
> worth it. In case you are preferring an unconditional new line,
> this would be easy to arrange, of course.

I'm not going to insist; it merely looked odd to me, and I was
thinking that the alternative would overall look less odd.

Jan




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.