On Sun, Jul 16, 2017 at 03:19:41PM +0200, Mark Kettenis wrote: > Can somebody test the following diff on Ivy Bridge or Haswell (Intel > HD Graphics 2500/4000/4600/4700/5000/5100/5200)? > > When I added support for the command parser, I took a bit of a > shortcut and implemented the hash tables as a single linked list. > This diff fixes that. > no regression and no more dmesg spam for me. Thanks Giovanni
> For the hash function I used a "mode (size-1)" approach that leaves > one of the hash table entries unused. Perhaps somebody with a CS > background has a better idea that isn't too complicated to implement? > > Paul, Stuart, there is a small chance that this will improve the > vncviewer performance. > > > Index: dev/pci/drm/drm_linux.h > =================================================================== > RCS file: /cvs/src/sys/dev/pci/drm/drm_linux.h,v > retrieving revision 1.56 > diff -u -p -r1.56 drm_linux.h > --- dev/pci/drm/drm_linux.h 14 Jul 2017 11:18:04 -0000 1.56 > +++ dev/pci/drm/drm_linux.h 16 Jul 2017 12:54:51 -0000 > @@ -40,6 +40,7 @@ > > #include <dev/pci/drm/linux_types.h> > #include <dev/pci/drm/drm_linux_atomic.h> > +#include <dev/pci/drm/drm_linux_list.h> > > /* The Linux code doesn't meet our usual standards! */ > #ifdef __clang__ > @@ -202,16 +203,42 @@ bitmap_weight(void *p, u_int n) > return sum; > } > > -#define DECLARE_HASHTABLE(x, y) struct hlist_head x; > +#define DECLARE_HASHTABLE(name, bits) struct hlist_head name[1 << (bits)] > > -#define hash_init(x) INIT_HLIST_HEAD(&(x)) > -#define hash_add(x, y, z) hlist_add_head(y, &(x)) > -#define hash_del(x) hlist_del_init(x) > -#define hash_empty(x) hlist_empty(&(x)) > -#define hash_for_each_possible(a, b, c, d) \ > - hlist_for_each_entry(b, &(a), c) > -#define hash_for_each_safe(a, b, c, d, e) (void)(b); \ > - hlist_for_each_entry_safe(d, c, &(a), e) > +static inline void > +__hash_init(struct hlist_head *table, u_int size) > +{ > + u_int i; > + > + for (i = 0; i < size; i++) > + INIT_HLIST_HEAD(&table[i]); > +} > + > +static inline bool > +__hash_empty(struct hlist_head *table, u_int size) > +{ > + u_int i; > + > + for (i = 0; i < size; i++) { > + if (!hlist_empty(&table[i])) > + return false; > + } > + > + return true; > +} > + > +#define __hash(table, key) &table[key % (nitems(table) - 1)] > + > +#define hash_init(table) __hash_init(table, nitems(table)) > +#define hash_add(table, node, key) \ > + hlist_add_head(node, __hash(table, key)) > +#define hash_del(node) hlist_del_init(node) > +#define hash_empty(table) __hash_empty(table, nitems(table)) > +#define hash_for_each_possible(table, obj, member, key) \ > + hlist_for_each_entry(obj, __hash(table, key), member) > +#define hash_for_each_safe(table, i, tmp, obj, member) \ > + for (i = 0; i < nitems(table); i++) \ > + hlist_for_each_entry_safe(obj, tmp, &table[i], member) > > #define ACCESS_ONCE(x) (x) > >
OpenBSD 6.1-current (GENERIC.MP) #11: Mon Jul 17 14:35:43 CEST 2017 giova...@bigio.paclan.it:/usr/src/sys/arch/amd64/compile/GENERIC.MP real mem = 4183527424 (3989MB) avail mem = 4050944000 (3863MB) mpath0 at root scsibus0 at mpath0: 256 targets mainbus0 at root bios0 at mainbus0: SMBIOS rev. 2.6 @ 0xccbff000 (42 entries) bios0: vendor TOSHIBA version "Version 5.00" date 02/15/2017 bios0: TOSHIBA PORTEGE R30-A acpi0 at bios0: rev 0 acpi0: sleep states S0 S3 S4 S5 acpi0: tables DSDT FACP HPET APIC MCFG BOOT MSDM SLIC SSDT SSDT SSDT ASF! SSDT SSDT SSDT DMAR FPDT acpi0: wakeup devices GLAN(S4) EHC1(S3) EHC2(S3) XHC_(S3) HDEF(S3) RP06(S4) PXSX(S4) PWRB(S4) LID_(S4) acpitimer0 at acpi0: 3579545 Hz, 24 bits acpihpet0 at acpi0: 14318179 Hz acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat cpu0 at mainbus0: apid 0 (boot processor) cpu0: Intel(R) Core(TM) i5-4310M CPU @ 2.70GHz, 2694.14 MHz cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,SENSOR,ARAT cpu0: 256KB 64b/line 8-way L2 cache cpu0: TSC frequency 2694141120 Hz cpu0: smt 0, core 0, package 0 mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges cpu0: apic clock running at 99MHz cpu0: mwait min=64, max=64, C-substates=0.2.1.2.4, IBE cpu1 at mainbus0: apid 1 (application processor) cpu1: Intel(R) Core(TM) i5-4310M CPU @ 2.70GHz, 2693.77 MHz cpu1: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,SENSOR,ARAT cpu1: 256KB 64b/line 8-way L2 cache cpu1: smt 1, core 0, package 0 cpu2 at mainbus0: apid 2 (application processor) cpu2: Intel(R) Core(TM) i5-4310M CPU @ 2.70GHz, 2693.77 MHz cpu2: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,SENSOR,ARAT cpu2: 256KB 64b/line 8-way L2 cache cpu2: smt 0, core 1, package 0 cpu3 at mainbus0: apid 3 (application processor) cpu3: Intel(R) Core(TM) i5-4310M CPU @ 2.70GHz, 2693.77 MHz cpu3: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,SENSOR,ARAT cpu3: 256KB 64b/line 8-way L2 cache cpu3: smt 1, core 1, package 0 ioapic0 at mainbus0: apid 2 pa 0xfec00000, version 20, 24 pins acpimcfg0 at acpi0 addr 0xf8000000, bus 0-63 acpiprt0 at acpi0: bus 0 (PCI0) acpiprt1 at acpi0: bus -1 (PEGP) acpiprt2 at acpi0: bus 4 (RP03) acpiprt3 at acpi0: bus 2 (RP06) acpiprt4 at acpi0: bus 1 (RP07) acpicpu0 at acpi0: C2(200@148 mwait.1@0x33), C1(1000@1 mwait.1), PSS acpicpu1 at acpi0: C2(200@148 mwait.1@0x33), C1(1000@1 mwait.1), PSS acpicpu2 at acpi0: C2(200@148 mwait.1@0x33), C1(1000@1 mwait.1), PSS acpicpu3 at acpi0: C2(200@148 mwait.1@0x33), C1(1000@1 mwait.1), PSS acpipwrres0 at acpi0: PDOC, resource for DOCK acpitz0 at acpi0: critical temperature is 102 degC "TOS7407" at acpi0 not configured "TTP1000" at acpi0 not configured "PNP0C14" at acpi0 not configured acpitoshiba0 at acpi0 "TOS620A" at acpi0 not configured "TOS6205" at acpi0 not configured acpiac0 at acpi0: AC unit online acpibtn0 at acpi0: PWRB acpibtn1 at acpi0: LID_ acpibat0 at acpi0: BAT1 model "G71C000GJ210" serial 0 type Li-ION oem "0" "INT340E" at acpi0 not configured acpidock0 at acpi0: DOCK not docked (0) acpivideo0 at acpi0: VGA_ acpivideo1 at acpi0: GFX0 acpivout at acpivideo1 not configured cpu0: Enhanced SpeedStep 2694 MHz: speeds: 2701, 2700, 2600, 2400, 2300, 2200, 2000, 1900, 1700, 1600, 1500, 1300, 1200, 1100, 900, 800 MHz pci0 at mainbus0 bus 0 pchb0 at pci0 dev 0 function 0 "Intel Core 4G Host" rev 0x06 inteldrm0 at pci0 dev 2 function 0 "Intel HD Graphics 4600" rev 0x06 drm0 at inteldrm0 inteldrm0: msi inteldrm0: 1366x768, 32bpp wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation) wsdisplay0: screen 1-5 added (std, vt100 emulation) azalia0 at pci0 dev 3 function 0 "Intel Core 4G HD Audio" rev 0x06: msi azalia0: No codecs found xhci0 at pci0 dev 20 function 0 "Intel 8 Series xHCI" rev 0x04: msi usb0 at xhci0: USB revision 3.0 uhub0 at usb0 configuration 1 interface 0 "Intel xHCI root hub" rev 3.00/1.00 addr 1 "Intel 8 Series MEI" rev 0x04 at pci0 dev 22 function 0 not configured puc0 at pci0 dev 22 function 3 "Intel 8 Series KT" rev 0x04: ports: 1 com com4 at puc0 port 0 apic 2 int 19: ns16550a, 16 byte fifo com4: probed fifo depth: 0 bytes em0 at pci0 dev 25 function 0 "Intel I217-LM" rev 0x04: msi, address b8:6b:23:7a:3c:8a ehci0 at pci0 dev 26 function 0 "Intel 8 Series USB" rev 0x04: apic 2 int 21 usb1 at ehci0: USB revision 2.0 uhub1 at usb1 configuration 1 interface 0 "Intel EHCI root hub" rev 2.00/1.00 addr 1 azalia1 at pci0 dev 27 function 0 "Intel 8 Series HD Audio" rev 0x04: msi azalia1: codecs: Realtek/0x0283 audio0 at azalia1 ppb0 at pci0 dev 28 function 0 "Intel 8 Series PCIE" rev 0xd4: msi pci1 at ppb0 bus 1 rtsx0 at pci1 dev 0 function 0 "Realtek RTS5227 Card Reader" rev 0x01: msi sdmmc0 at rtsx0: 4-bit ppb1 at pci0 dev 28 function 1 "Intel 8 Series PCIE" rev 0xd4: msi pci2 at ppb1 bus 2 ppb2 at pci0 dev 28 function 2 "Intel 8 Series PCIE" rev 0xd4: msi pci3 at ppb2 bus 4 iwm0 at pci3 dev 0 function 0 "Intel Dual Band Wireless AC 7260" rev 0x73, msi ehci1 at pci0 dev 29 function 0 "Intel 8 Series USB" rev 0x04: apic 2 int 23 usb2 at ehci1: USB revision 2.0 uhub2 at usb2 configuration 1 interface 0 "Intel EHCI root hub" rev 2.00/1.00 addr 1 pcib0 at pci0 dev 31 function 0 "Intel QM87 LPC" rev 0x04 ahci0 at pci0 dev 31 function 2 "Intel 8 Series AHCI" rev 0x04: msi, AHCI 1.3 ahci0: port 2: 1.5Gb/s ahci0: port 4: 6.0Gb/s scsibus1 at ahci0: 32 targets cd0 at scsibus1 targ 2 lun 0: <MATSHITA, DVD-RAM UJ8E2, 1.00> ATAPI 5/cdrom removable sd0 at scsibus1 targ 4 lun 0: <ATA, TOSHIBA MQ01ACF0, AV00> SCSI3 0/direct fixed naa.5000039793a006e9 sd0: 476940MB, 512 bytes/sector, 976773168 sectors isa0 at pcib0 isadma0 at isa0 pckbc0 at isa0 port 0x60/5 irq 1 irq 12 pckbd0 at pckbc0 (kbd slot) wskbd0 at pckbd0: console keyboard, using wsdisplay0 pms0 at pckbc0 (aux slot) wsmouse0 at pms0 mux 0 pcppi0 at isa0 port 0x61 spkr0 at pcppi0 vmm0 at mainbus0: VMX/EPT ugen0 at uhub0 port 2 "Validity Sensors product 0x0010" rev 1.10/0.78 addr 2 uhidev0 at uhub0 port 6 configuration 1 interface 0 "IBM USB Optical Mouse" rev 2.00/2.00 addr 3 uhidev0: iclass 3/1 ums0 at uhidev0: 3 buttons, Z dir wsmouse1 at ums0 mux 0 uvideo0 at uhub0 port 10 configuration 1 interface 0 "Chicony Electronics Co.,Ltd. TOSHIBA Web Camera - HD" rev 2.00/57.36 addr 4 video0 at uvideo0 uhub3 at uhub1 port 1 configuration 1 interface 0 "Intel Rate Matching Hub" rev 2.00/0.04 addr 2 uhub4 at uhub2 port 1 configuration 1 interface 0 "Intel Rate Matching Hub" rev 2.00/0.04 addr 2 vscsi0 at root scsibus2 at vscsi0: 256 targets softraid0 at root scsibus3 at softraid0: 256 targets sd1 at scsibus3 targ 1 lun 0: <OPENBSD, SR CRYPTO, 006> SCSI2 0/direct fixed sd1: 371822MB, 512 bytes/sector, 761492976 sectors root on sd1a (ec2855fdf420f9d8.a) swap on sd1b dump on sd1b iwm0: hw rev 0x140, fw ver 16.242414.0, address 48:51:b7:81:d6:f2
signature.asc
Description: PGP signature