qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Claudio Fontana <cfontana@suse.de>
To: Nina Schoetterl-Glausch <nsg@linux.ibm.com>,
	Thomas Huth <thuth@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>,
	qemu-s390x <qemu-s390x@nongnu.org>,
	Ilya Leoshkevich <iii@linux.ibm.com>
Subject: Re: [PATCH] target/s390x: improve cpu compatibility check error message
Date: Thu, 14 Mar 2024 21:26:46 +0100	[thread overview]
Message-ID: <2a7b5636-132b-17f9-bd8c-0ee4f2beef0e@suse.de> (raw)
In-Reply-To: <540bb2d3-7bd6-a4b7-32e2-5787dc1ca015@suse.de>

On 3/14/24 21:10, Claudio Fontana wrote:
> On 3/14/24 20:44, Nina Schoetterl-Glausch wrote:
>> On Thu, 2024-03-14 at 20:00 +0100, Claudio Fontana wrote:
>>> some users were confused by this message showing under TCG:
>>>
>>> Selected CPU generation is too new. Maximum supported model
>>> in the configuration: 'xyz'
>>>
>>> Try to clarify that the maximum can depend on the accel by
>>> adding also the current accelerator to the message as such:
>>>
>>> Selected CPU generation is too new. Maximum supported model
>>> in the accelerator 'tcg' configuration: 'xyz'
>>>
>>> Signed-off-by: Claudio Fontana <cfontana@suse.de>
>>> ---
>>>  target/s390x/cpu_models.c | 11 ++++++-----
>>>  1 file changed, 6 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
>>> index 1a1c096122..0d6d8fc727 100644
>>> --- a/target/s390x/cpu_models.c
>>> +++ b/target/s390x/cpu_models.c
>>> @@ -508,14 +508,14 @@ static void check_compatibility(const S390CPUModel *max_model,
>>>  
>>>      if (model->def->gen > max_model->def->gen) {
>>>          error_setg(errp, "Selected CPU generation is too new. Maximum "
>>> -                   "supported model in the configuration: \'%s\'",
>>> -                   max_model->def->name);
>>> +                   "supported model in the accelerator \'%s\' configuration: \'%s\'",
>>> +                   current_accel_name(), max_model->def->name);
>>>          return;
>>>      } else if (model->def->gen == max_model->def->gen &&
>>>                 model->def->ec_ga > max_model->def->ec_ga) {
>>>          error_setg(errp, "Selected CPU GA level is too new. Maximum "
>>> -                   "supported model in the configuration: \'%s\'",
>>> -                   max_model->def->name);
>>> +                   "supported model in the accelerator \'%s\' configuration: \'%s\'",
>>> +                   current_accel_name(), max_model->def->name);
>>>          return;
>>>      }
>>>  
>>> @@ -537,7 +537,8 @@ static void check_compatibility(const S390CPUModel *max_model,
>>>      error_setg(errp, " ");
>>>      s390_feat_bitmap_to_ascii(missing, errp, error_prepend_missing_feat);
>>>      error_prepend(errp, "Some features requested in the CPU model are not "
>>> -                  "available in the configuration: ");
>>> +                  "available in the accelerator \'%s\' configuration: ",
>>> +                  current_accel_name());
>>>  }
>>
>> I wonder if these might not be confusing in other circumstances, e.g. when
>> running with KVM and the Linux version lacks support for some feature.
> 
> Here you are referencing specifically the last hunk right? Ie the "Some features requested..." message.
> 
>> I think something along the lines of:
>>
>> error_...(errp, "... supported by the current configuration ...", ...);
>> error_append_hint(errp, "Consider using a different accelerator, a different QEMU version or, when using KVM, a different kernel");
>>
>> would be better.
> 
> Interesting I'll try something along these lines.
> 
>>
>> I'm not sure about line breaks in error message, I like the better grepability
>> of unbroken lines but the coding style guide doesn't mention anything.
> 
> better greppability in the log (as the error message in the log), or in the source code (or both)?
> I am generally in favor of both, but there might be constraints on line length, although scripts/checkpatch.pl did not complain when I attempted this (I wonder if bug or feature).
> 
> docs/devel/style.rst on the code line length topic says:
> "Lines should be 80 characters; try not to make them longer..."
> 
> and it does talk about exceptions. In the case of error message strings I think this could be one one of those exceptions.
> 
> In terms of logs, I did not find anything either, the most pertinent section should be "Error handling and reporting" in the same file,
> but there is nothing about breaking up [or not] a single message in errors with newlines.

Ah I forgot the mythical include/qapi/error.h:

for error_setg we have:

"The resulting message should be a single phrase, with no newline or trailing punctuation."

so this helps.

> 
>>>  
>>>  S390CPUModel *get_max_cpu_model(Error **errp)
>>
> 
> Thanks,
> 
> Claudio



  reply	other threads:[~2024-03-14 20:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-14 19:00 [PATCH] target/s390x: improve cpu compatibility check error message Claudio Fontana
2024-03-14 19:44 ` Nina Schoetterl-Glausch
2024-03-14 20:10   ` Claudio Fontana
2024-03-14 20:26     ` Claudio Fontana [this message]
2024-03-15 12:25 ` Christian Borntraeger

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=2a7b5636-132b-17f9-bd8c-0ee4f2beef0e@suse.de \
    --to=cfontana@suse.de \
    --cc=iii@linux.ibm.com \
    --cc=nsg@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=thuth@redhat.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).