Skip to contentSkip to conversation

ide: log error when trying to use ATAPI overlapping features

PATCH In review Hervé Poussineau 6 participants 12 messages Feb 10, 2013 – Feb 12, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ide: log error when trying to use ATAPI overlapping features

---
 hw/ide/core.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/ide/core.c +3 -1
index 3743dc3..f0ab1a8 100644
@@ -1394,8 +1394,10 @@ void ide_exec_cmd(IDEBus *bus, uint32_t val)
         break;
     case WIN_PACKETCMD:
         /* overlapping commands not supported */
-        if (s->feature & 0x02)
+        if (s->feature & 0x02) {
+            qemu_log_mask(LOG_UNIMP, "ide: overlapping command not supported");
             goto abort_cmd;
+        }
         s->status = READY_STAT | SEEK_STAT;
         s->atapi_dma = s->feature & 1;
         s->nsector = 1;
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 11 lines · Hervé Poussineau
---
 hw/ide/core.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/ide/core.c +0 -0
index 3743dc3..f0ab1a8 100644

hw/ide/core.c void ide_exec_cmd(IDEBus *bus, uint32_t val) · line 1398

Quoted 6 lines
hw/ide/core.c +2 -1
@@ -1394,8 +1394,10 @@ void ide_exec_cmd(IDEBus *bus, uint32_t val)
         break;
     case WIN_PACKETCMD:
         /* overlapping commands not supported */
-        if (s->feature & 0x02)
+        if (s->feature & 0x02) {
+            qemu_log_mask(LOG_UNIMP, "ide: overlapping command not supported");

qemu_log_*() isn't used much in hw/.

I think we need to side-track this patch email to figure out what to use:

fprintf(stderr) - some warnings/errors use this error_report() - goes to the monitor, if possible, otherwise stderr qemu_log_*() - goes to the qemu log, seems a little TCG-centric

Thoughts?

Stefan

#2 lore raw

Am 11.02.2013 14:27, schrieb Stefan Hajnoczi:

Quoted 21 lines · Hervé Poussineau
Quoted 11 lines
---
 hw/ide/core.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/ide/core.c +0 -0
index 3743dc3..f0ab1a8 100644

hw/ide/core.c void ide_exec_cmd(IDEBus *bus, uint32_t val) · line 1398

Quoted 6 lines
hw/ide/core.c +2 -1
@@ -1394,8 +1394,10 @@ void ide_exec_cmd(IDEBus *bus, uint32_t val)
         break;
     case WIN_PACKETCMD:
         /* overlapping commands not supported */
-        if (s->feature & 0x02)
+        if (s->feature & 0x02) {
+            qemu_log_mask(LOG_UNIMP, "ide: overlapping command not supported");

qemu_log_*() isn't used much in hw/.

Quoted 5 lines

I think we need to side-track this patch email to figure out what to use:

fprintf(stderr) - some warnings/errors use this error_report() - goes to the monitor, if possible, otherwise stderr

These look wrong to me.

Quoted 1 line

qemu_log_*() - goes to the qemu log, seems a little TCG-centric

I would suggest either this or just trace points. (And by the way, it's a pity that -d is so TCG-centric, it's been more than once the reason why I disabled KVM when debugging a guest... Having at least -d int would be so useful.)

Kevin

#3 lore raw
Quoted 22 lines · Kevin Wolf

Am 11.02.2013 14:27, schrieb Stefan Hajnoczi:

Quoted 21 lines · Hervé Poussineau
Quoted 11 lines
---
 hw/ide/core.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/ide/core.c +0 -0
index 3743dc3..f0ab1a8 100644

hw/ide/core.c void ide_exec_cmd(IDEBus *bus, uint32_t val) · line 1398

Quoted 6 lines
hw/ide/core.c +2 -1
@@ -1394,8 +1394,10 @@ void ide_exec_cmd(IDEBus *bus, uint32_t val)
         break;
     case WIN_PACKETCMD:
         /* overlapping commands not supported */
-        if (s->feature & 0x02)
+        if (s->feature & 0x02) {
+            qemu_log_mask(LOG_UNIMP, "ide: overlapping command not supported");

qemu_log_*() isn't used much in hw/.

Quoted 7 lines
Quoted 5 lines

I think we need to side-track this patch email to figure out what to use:

fprintf(stderr) - some warnings/errors use this error_report() - goes to the monitor, if possible, otherwise stderr

These look wrong to me.

"Wrong" is a bit strong, in particular since there's ample precedence for these uses.

Quoted 6 lines
Quoted 1 line

qemu_log_*() - goes to the qemu log, seems a little TCG-centric

I would suggest either this or just trace points. (And by the way, it's a pity that -d is so TCG-centric, it's been more than once the reason why I disabled KVM when debugging a guest... Having at least -d int would be so useful.)

Tracepoints don't really fit when we want to report the guest does something we don't handle. Users deserve fair warning then, don't they?

Could qemu_log() & friends be made fit for general use? What's missing?

#4 lore raw

Am 11.02.2013 15:01, schrieb Markus Armbruster:

Quoted 42 lines
Quoted 22 lines · Kevin Wolf

Am 11.02.2013 14:27, schrieb Stefan Hajnoczi:

Quoted 21 lines · Hervé Poussineau
Quoted 11 lines
---
 hw/ide/core.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/ide/core.c +0 -0
index 3743dc3..f0ab1a8 100644

hw/ide/core.c void ide_exec_cmd(IDEBus *bus, uint32_t val) · line 1398

Quoted 6 lines
hw/ide/core.c +2 -1
@@ -1394,8 +1394,10 @@ void ide_exec_cmd(IDEBus *bus, uint32_t val)
         break;
     case WIN_PACKETCMD:
         /* overlapping commands not supported */
-        if (s->feature & 0x02)
+        if (s->feature & 0x02) {
+            qemu_log_mask(LOG_UNIMP, "ide: overlapping command not supported");

qemu_log_*() isn't used much in hw/.

Quoted 7 lines
Quoted 5 lines

I think we need to side-track this patch email to figure out what to use:

fprintf(stderr) - some warnings/errors use this error_report() - goes to the monitor, if possible, otherwise stderr

These look wrong to me.

"Wrong" is a bit strong, in particular since there's ample precedence for these uses.

Quoted 6 lines
Quoted 1 line

qemu_log_*() - goes to the qemu log, seems a little TCG-centric

I would suggest either this or just trace points. (And by the way, it's a pity that -d is so TCG-centric, it's been more than once the reason why I disabled KVM when debugging a guest... Having at least -d int would be so useful.)

Quoted 4 lines

Tracepoints don't really fit when we want to report the guest does something we don't handle. Users deserve fair warning then, don't they?

Could qemu_log() & friends be made fit for general use? What's missing?

Blue already did some work to make it more usable, and I believe Peter adopted LOG_UNIMPL for ARM devices in place of hw_error(), which is another reporting option people have chosen in the past (but which allows a guest to exit the QEMU process).

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#5 lore raw
Quoted 14 lines · Andreas Färber

Am 11.02.2013 15:01, schrieb Markus Armbruster:

Quoted 13 lines
Quoted 8 lines · Kevin Wolf

Am 11.02.2013 14:27, schrieb Stefan Hajnoczi:

Quoted 5 lines

I think we need to side-track this patch email to figure out what to use:

fprintf(stderr) - some warnings/errors use this error_report() - goes to the monitor, if possible, otherwise stderr

These look wrong to me.

"Wrong" is a bit strong, in particular since there's ample precedence for these uses.

Certainly for fprintf() I would say "deprecated" wherever we have a better API available.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 1 line

qemu_log_*() - goes to the qemu log, seems a little TCG-centric

I would suggest either this or just trace points. (And by the way, it's a pity that -d is so TCG-centric, it's been more than once the reason why I disabled KVM when debugging a guest... Having at least -d int would be so useful.)

Quoted 7 lines
Quoted 4 lines

Tracepoints don't really fit when we want to report the guest does something we don't handle. Users deserve fair warning then, don't they?

Could qemu_log() & friends be made fit for general use? What's missing?

Blue already did some work to make it more usable, and I believe Peter adopted LOG_UNIMPL for ARM devices in place of hw_error()

Yes; in particular where we have classes of error message which the user may wish to enable or disable (of which "QEMU doesn't implement this" and "the guest just did something that's probably a guest bug" are two common ones) qemu_log_mask(LOG_*, ...) is the preferred API for devices IMHO. So I think Herve's patch is entirely the right thing.

Tracepoints are IMHO pretty useless for this kind of message because they're a compile time setup, not runtime, and they don't have useful message categories. We should be expanding the use of the qemu_log() API. If we need more categories and/or more flexibility about where the logging goes [eg an option to direct the logs to monitor?] we can add them.

-- PMM

#6 lore raw
Quoted 34 lines · Peter Maydell
Quoted 14 lines · Andreas Färber

Am 11.02.2013 15:01, schrieb Markus Armbruster:

Quoted 13 lines
Quoted 8 lines · Kevin Wolf

Am 11.02.2013 14:27, schrieb Stefan Hajnoczi:

Quoted 5 lines

I think we need to side-track this patch email to figure out what to use:

fprintf(stderr) - some warnings/errors use this error_report() - goes to the monitor, if possible, otherwise stderr

These look wrong to me.

"Wrong" is a bit strong, in particular since there's ample precedence for these uses.

Certainly for fprintf() I would say "deprecated" wherever we have a better API available.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 1 line

qemu_log_*() - goes to the qemu log, seems a little TCG-centric

I would suggest either this or just trace points. (And by the way, it's a pity that -d is so TCG-centric, it's been more than once the reason why I disabled KVM when debugging a guest... Having at least -d int would be so useful.)

Quoted 7 lines
Quoted 4 lines

Tracepoints don't really fit when we want to report the guest does something we don't handle. Users deserve fair warning then, don't they?

Could qemu_log() & friends be made fit for general use? What's missing?

Blue already did some work to make it more usable, and I believe Peter adopted LOG_UNIMPL for ARM devices in place of hw_error()

Quoted 6 lines

Yes; in particular where we have classes of error message which the user may wish to enable or disable (of which "QEMU doesn't implement this" and "the guest just did something that's probably a guest bug" are two common ones) qemu_log_mask(LOG_*, ...) is the preferred API for devices IMHO. So I think Herve's patch is entirely the right thing.

qemu_log_mask() can replace fprintf() but it needs to default to stderr and a reasonable default mask. It should be used for non-monitor command errors and warnings.

Having said that, I think we should use hw_error() or fprintf() in this patch until qemu_log_mask() replaces them.

Stefan

#7 lore raw
Quoted 12 lines · Stefan Hajnoczi
Quoted 10 lines · Peter Maydell
Quoted 2 lines · Andreas Färber

Blue already did some work to make it more usable, and I believe Peter adopted LOG_UNIMPL for ARM devices in place of hw_error()

Yes; in particular where we have classes of error message which the user may wish to enable or disable (of which "QEMU doesn't implement this" and "the guest just did something that's probably a guest bug" are two common ones) qemu_log_mask(LOG_*, ...) is the preferred API for devices IMHO. So I think Herve's patch is entirely the right thing.

Quoted 2 lines

qemu_log_mask() can replace fprintf() but it needs to default to stderr and a reasonable default mask.

Feel free to send in a patch... Also, which errors did you want to enable by default? At the moment none of the categories are IMHO reasonable to default to enabled.

Quoted 4 lines

It should be used for non-monitor command errors and warnings.

Having said that, I think we should use hw_error() or fprintf() in this patch until qemu_log_mask() replaces them.

It will never replace them unless we start accepting patches like this that use qemu_log_mask() in the places where it is appropriate.

-- PMM

#8 lore raw
In reply to Stefan Hajnoczi

Am 11.02.2013 15:57, schrieb Stefan Hajnoczi:

Quoted 42 lines · Peter Maydell
Quoted 34 lines · Andreas Färber
Quoted 14 lines

Am 11.02.2013 15:01, schrieb Markus Armbruster:

Quoted 13 lines
Quoted 8 lines · Kevin Wolf

Am 11.02.2013 14:27, schrieb Stefan Hajnoczi:

Quoted 5 lines

I think we need to side-track this patch email to figure out what to use:

fprintf(stderr) - some warnings/errors use this error_report() - goes to the monitor, if possible, otherwise stderr

These look wrong to me.

"Wrong" is a bit strong, in particular since there's ample precedence for these uses.

Certainly for fprintf() I would say "deprecated" wherever we have a better API available.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 1 line

qemu_log_*() - goes to the qemu log, seems a little TCG-centric

I would suggest either this or just trace points. (And by the way, it's a pity that -d is so TCG-centric, it's been more than once the reason why I disabled KVM when debugging a guest... Having at least -d int would be so useful.)

Quoted 7 lines
Quoted 4 lines

Tracepoints don't really fit when we want to report the guest does something we don't handle. Users deserve fair warning then, don't they?

Could qemu_log() & friends be made fit for general use? What's missing?

Blue already did some work to make it more usable, and I believe Peter adopted LOG_UNIMPL for ARM devices in place of hw_error()

Quoted 6 lines

Yes; in particular where we have classes of error message which the user may wish to enable or disable (of which "QEMU doesn't implement this" and "the guest just did something that's probably a guest bug" are two common ones) qemu_log_mask(LOG_*, ...) is the preferred API for devices IMHO. So I think Herve's patch is entirely the right thing.

Quoted 6 lines

qemu_log_mask() can replace fprintf() but it needs to default to stderr and a reasonable default mask. It should be used for non-monitor command errors and warnings.

Having said that, I think we should use hw_error() or fprintf() in this patch until qemu_log_mask() replaces them.

Nack. Like I just pointed out, hw_error() is a fatal abort and not a replacement for logging. I don't mind which of the non-fatal logging methods you choose, but guest-triggerable aborting is a semantic change that we should not choose just because someone doesn't like logging API or defaults. Especially not for 1.4.

Regards,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#9 lore raw
Quoted 47 lines · Andreas Färber

Am 11.02.2013 15:57, schrieb Stefan Hajnoczi:

Quoted 46 lines · Peter Maydell
Quoted 34 lines · Andreas Färber
Quoted 14 lines

Am 11.02.2013 15:01, schrieb Markus Armbruster:

Quoted 13 lines
Quoted 8 lines · Kevin Wolf

Am 11.02.2013 14:27, schrieb Stefan Hajnoczi:

Quoted 5 lines

I think we need to side-track this patch email to figure out what to use:

fprintf(stderr) - some warnings/errors use this error_report() - goes to the monitor, if possible, otherwise stderr

These look wrong to me.

"Wrong" is a bit strong, in particular since there's ample precedence for these uses.

Certainly for fprintf() I would say "deprecated" wherever we have a better API available.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 1 line

qemu_log_*() - goes to the qemu log, seems a little TCG-centric

I would suggest either this or just trace points. (And by the way, it's a pity that -d is so TCG-centric, it's been more than once the reason why I disabled KVM when debugging a guest... Having at least -d int would be so useful.)

Quoted 7 lines
Quoted 4 lines

Tracepoints don't really fit when we want to report the guest does something we don't handle. Users deserve fair warning then, don't they?

Could qemu_log() & friends be made fit for general use? What's missing?

Blue already did some work to make it more usable, and I believe Peter adopted LOG_UNIMPL for ARM devices in place of hw_error()

Quoted 6 lines

Yes; in particular where we have classes of error message which the user may wish to enable or disable (of which "QEMU doesn't implement this" and "the guest just did something that's probably a guest bug" are two common ones) qemu_log_mask(LOG_*, ...) is the preferred API for devices IMHO. So I think Herve's patch is entirely the right thing.

qemu_log_mask() can replace fprintf() but it needs to default to stderr and a reasonable default mask. It should be used for non-monitor command errors and warnings.

Quoted 8 lines
Quoted 2 lines

Having said that, I think we should use hw_error() or fprintf() in this patch until qemu_log_mask() replaces them.

Nack. Like I just pointed out, hw_error() is a fatal abort and not a replacement for logging. I don't mind which of the non-fatal logging methods you choose, but guest-triggerable aborting is a semantic change that we should not choose just because someone doesn't like logging API or defaults. Especially not for 1.4.

You are right.

Stefan

#10 lore raw
In reply to Hervé Poussineau

hw/ide/core.c void ide_exec_cmd(IDEBus *bus, uint32_t val) · line 1398

Quoted 9 lines · Hervé Poussineau
hw/ide/core.c +2 -1
@@ -1394,8 +1394,10 @@ void ide_exec_cmd(IDEBus *bus, uint32_t val)
         break;
     case WIN_PACKETCMD:
         /* overlapping commands not supported */
-        if (s->feature & 0x02)
+        if (s->feature & 0x02) {
+            qemu_log_mask(LOG_UNIMP, "ide: overlapping command not supported");

Messages for qemu_log_mask() need to supply the trailing \n.

Otherwise looks good.

-- PMM

#11 lore raw
Quoted 12 lines · Peter Maydell

hw/ide/core.c void ide_exec_cmd(IDEBus *bus, uint32_t val) · line 1398

Quoted 9 lines · Hervé Poussineau
hw/ide/core.c +2 -1
@@ -1394,8 +1394,10 @@ void ide_exec_cmd(IDEBus *bus, uint32_t val)
         break;
     case WIN_PACKETCMD:
         /* overlapping commands not supported */
-        if (s->feature & 0x02)
+        if (s->feature & 0x02) {
+            qemu_log_mask(LOG_UNIMP, "ide: overlapping command not supported");

Messages for qemu_log_mask() need to supply the trailing \n.

OK to add the '\n' in the v2 (if required), once I know if I can keep the qemu_log_mask call, or if I have to change it to hw_error/fprintf.

Regards,

Hervé