From: "wangyanan (Y)" <wangyanan55@huawei.com>
To: Markus Armbruster <armbru@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: "Andrew Jones" <drjones@redhat.com>,
"Daniel P.Berrangé" <berrange@redhat.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Pierre Morel" <pmorel@linux.ibm.com>,
qemu-devel@nongnu.org, wanghaibin.wang@huawei.com,
"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: Re: [PATCH 1/2] hw/core/machine: Split out smp_parse as an inline API
Date: Wed, 13 Oct 2021 09:37:37 +0800 [thread overview]
Message-ID: <a57ebef5-96db-5ff3-7401-e0fa44bb5fca@huawei.com> (raw)
In-Reply-To: <87a6je48fe.fsf@dusky.pond.sub.org>
On 2021/10/12 22:36, Markus Armbruster wrote:
> "wangyanan (Y)" <wangyanan55@huawei.com> writes:
>
>> Hi Markus,
>>
>> On 2021/10/11 13:26, Markus Armbruster wrote:
>>> Yanan Wang <wangyanan55@huawei.com> writes:
>>>
>>>> Functionally smp_parse() is only called once and in one place
>>>> i.e. machine_set_smp, the possible second place where it'll be
>>>> called should be some unit tests if any.
>>>>
>>>> Actually we are going to introduce an unit test for the parser.
>>>> For necessary isolation of the tested code, split smp_parse out
>>>> into a separate header as an inline API.
>>> Why inline?
>> The motivation of the splitting is to isolate the tested smp_parse
>> from the other unrelated code in machine.c, so that we can solve
>> the build dependency problem for the unit test.
>>
>> I once tried to split smp_parse out into a source file in [1] for the
>> test, but it looks more concise and convenient to make it as an
>> inline function in a header compared to [1]. Given that we only call
>> it in one place, it may not be harmful to keep it an inline.
>>
>> Anyway, I not sure the method in this patch is most appropriate
>> and compliant. If it's just wrong I can change back to [1]. :)
>>
>> [1]
>> https://lore.kernel.org/qemu-devel/20210910073025.16480-16-wangyanan55@huawei.com/#t
> I'd prefer to keep it in .c, but I'm not the maintainer.
>
Ok, I will move it into a separate .c file in v2, which seems to meet
the standards more.
Thanks,
Yanan
next prev parent reply other threads:[~2021-10-13 1:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-10 10:39 [PATCH 0/2] hw/core/machine: An an unit test for smp_parse Yanan Wang
2021-10-10 10:39 ` [PATCH 1/2] hw/core/machine: Split out smp_parse as an inline API Yanan Wang
2021-10-11 5:26 ` Markus Armbruster
2021-10-11 7:54 ` wangyanan (Y)
2021-10-12 14:36 ` Markus Armbruster
2021-10-13 1:37 ` wangyanan (Y) [this message]
2021-10-10 10:39 ` [PATCH 2/2] tests/unit: Add an unit test for smp parsing Yanan Wang
2021-10-12 13:51 ` Andrew Jones
2021-10-13 1:23 ` wangyanan (Y)
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=a57ebef5-96db-5ff3-7401-e0fa44bb5fca@huawei.com \
--to=wangyanan55@huawei.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=drjones@redhat.com \
--cc=ehabkost@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@redhat.com \
--cc=pmorel@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=wanghaibin.wang@huawei.com \
/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).