Skip to contentSkip to conversation

Question about wbinvd

Linux-ia64 Takanori Kawano 4 participants 5 messages Jun 4, 2002 – Jun 5, 2002

lore
Share & tools
lore
#0 lore raw

Hello,

I have a question about wbinvd in acpi code.

In 2.4.18, wbinvd is implemented in drivers/acpi/include/platform/acgcc.h
as follows.

static inline void
wbinvd (void)

{
        unsigned long flags, vector, position = 0;
        long status;

        do {
                ia64_clear_ic(flags);
                status = ia64_pal_cache_flush(0x3, (PAL_CACHE_FLUSH_INVALIDATE
                                                    | PAL_CACHE_FLUSH_CHK_INTRS)
,
                                              &position, &vector);
                local_irq_restore(flags);
                if (status = 1) {
                        ia64_eoi();
                        hw_resend_irq(NULL, vector);
                }
        } while (status = 1);
}

I think it may cause infinite loop if PAL_CACHE_FLUSH continues to exit for a pending interrupt without flushing any lines. Is it correct to call hw_resend_irq as is?

regards,
---
Takanori Kawano
Hitachi Ltd,
Internet Systems Platform Division
[email protected]

#1 lore raw
Quoted 4 lines · Takanori Kawano

I have a question about wbinvd in acpi code.

In 2.4.18, wbinvd is implemented in drivers/acpi/include/platform/acgcc.h
as follows.

If you look at the latest ACPI patch (20020517), you will see:

- wbinvd();
+ ACPI_FLUSH_CPU_CACHE ();

On i386, ACPI_FLUSH_CPU_CACHE is defined to be wbinvd, but on ia64 it is defined to be a no-op. So the wbinvd in the ACPI code is no longer used. I presume it was decided it is not necessary.

Signature · 1 line
Revolutions do not require corporate support.
#2 lore raw
In reply to Takanori Kawano
Quoted 11 lines

From: Matthew Wilcox [mailto:[email protected]]
If you look at the latest ACPI patch (20020517), you will see:

(quoted diff) +1 -1
-       wbinvd();
+       ACPI_FLUSH_CPU_CACHE ();

On i386, ACPI_FLUSH_CPU_CACHE is defined to be wbinvd, but on ia64 it is
defined to be a no-op. So the wbinvd in the ACPI code is no longer used.
I presume it was decided it is not necessary.

I don't know if it is not necessary or not. We changed it because "wbinvd" is a IA32-ism. IA64 may need to define ACPI_FLUSH_CPU_CACHE to something appropriate.

Regards -- Andy

#3 lore raw
In reply to Takanori Kawano
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Andrew

Andy> I don't know if it is not necessary or not. We changed it Andy> because "wbinvd" is a IA32-ism. IA64 may need to define Andy> ACPI_FLUSH_CPU_CACHE to something appropriate.

The current implementation is most likely broken. I'm not exactly sure what the requirements of ACPI_FLUSH_CPU_CACHE are, that's why I'm saying "most likely". I suspect it ought to be using the SAL rather than the PAL flush cache routines (so that off-chip caches get flushed, too). Also, IIRC, the latest interpretation of the SAL cache-flush routines is that they flush the caches only on the CPU that is making the call. So, if the intent is to flush all the caches on all CPUs, an IPI would be needed.

	--david
#4 lore raw
In reply to Takanori Kawano

I expect ACPI_FLUSH_CPU_CACHE to use SAL_CACHE_FLUSH because there are already some ia64 boxes that have platform(non-processor) caches.

Thanks,
---
Takanori Kawano
Hitachi Ltd,
Internet Systems Platform Division
[email protected]

Quoted 21 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Andrew

Andy> I don't know if it is not necessary or not. We changed it Andy> because "wbinvd" is a IA32-ism. IA64 may need to define Andy> ACPI_FLUSH_CPU_CACHE to something appropriate.

The current implementation is most likely broken. I'm not exactly sure what the requirements of ACPI_FLUSH_CPU_CACHE are, that's why I'm saying "most likely". I suspect it ought to be using the SAL rather than the PAL flush cache routines (so that off-chip caches get flushed, too). Also, IIRC, the latest interpretation of the SAL cache-flush routines is that they flush the caches only on the CPU that is making the call. So, if the intent is to flush all the caches on all CPUs, an IPI would be needed.

	--david

_______________________________________________
Linux-IA64 mailing list
[email protected]
http://lists.linuxia64.org/lists/listinfo/linux-ia64