Re: Stop calling IPsec and pf under splnet

2013-07-31 Thread David Hill
On Tue, Jul 30, 2013 at 11:30:51AM +0200, Martin Pieuchot wrote:
 On 12/07/13(Fri) 11:35, Mike Belopuhov wrote:
  Hi,
  
  As it was pointed out by dhill there are some rogue splnets in
  the tcp_input that shouldn't be there really.  The only reason
  they're still there is to match overzealous splnets in bridge_
  broadcast.  bridge_ifenqueue is the only function call in there
  that requires splnet protection since it's dealing with send
  queues.  Narrowing the range of the splnet protection allows us
  to remove all splnet protection of the IPsec SPD and TDB code.
  This as well removes the only pf_test call done under IPL_NET.
  
  Below are essentially two diffs that are rather hard to separate.
  I've tested the diff with the gif-to-ethernet IPsec bridge but
  some additional IPsec and bridge testing won't hurt.
  
  mpi@ has provided some feedback already, so I'm really looking
  for OK's on this.
 
 ok mpi@

been running this on i386 for a while with plenty of ipsec traffic.  no
issues.

 
  diff --git sys/net/if_bridge.c sys/net/if_bridge.c
  index 41d7b67..0ca2710 100644
  --- sys/net/if_bridge.c
  +++ sys/net/if_bridge.c
  @@ -969,12 +969,10 @@ bridge_output(struct ifnet *ifp, struct mbuf *m, 
  struct sockaddr *sa,
  return (ENOBUFS);
  }
  eh = mtod(m, struct ether_header *);
  dst = (struct ether_addr *)eh-ether_dhost[0];
   
  -   s = splnet();
  -
  /*
   * If bridge is down, but original output interface is up,
   * go ahead and send out that interface.  Otherwise the packet
   * is dropped below.
   */
  @@ -1007,11 +1005,10 @@ bridge_output(struct ifnet *ifp, struct mbuf *m, 
  struct sockaddr *sa,
   */
  if ((mtag = m_tag_find(m, PACKET_TAG_IPSEC_OUT_CRYPTO_NEEDED,
  NULL)) != NULL) {
  ipsp_skipcrypto_unmark((struct tdb_ident *)(mtag + 1));
  m_freem(m);
  -   splx(s);
  return (0);
  }
   #endif /* IPSEC */
  bridge_span(sc, NULL, m);
   
  @@ -1074,22 +1071,24 @@ bridge_output(struct ifnet *ifp, struct mbuf *m, 
  struct sockaddr *sa,
  m1-m_pkthdr.len = len;
  }
  mc = m1;
  }
   
  +   s = splnet();
  error = bridge_ifenqueue(sc, dst_if, mc);
  +   splx(s);
  if (error)
  continue;
  }
  if (!used)
  m_freem(m);
  -   splx(s);
  return (0);
  }
   
   sendunicast:
  bridge_span(sc, NULL, m);
  +   s = splnet();
  if ((dst_if-if_flags  IFF_RUNNING) == 0) {
  m_freem(m);
  splx(s);
  return (ENETDOWN);
  }
  @@ -1251,13 +1250,11 @@ bridgeintr_frame(struct bridge_softc *sc, struct 
  mbuf *m)
   * If the packet is a multicast or broadcast OR if we don't
   * know any better, forward it to all interfaces.
   */
  if ((m-m_flags  (M_BCAST | M_MCAST)) || dst_if == NULL) {
  sc-sc_if.if_imcasts++;
  -   s = splnet();
  bridge_broadcast(sc, src_if, eh, m);
  -   splx(s);
  return;
  }
   
  /*
   * At this point, we're dealing with a unicast frame going to a
  @@ -1496,13 +1493,11 @@ bridge_broadcast(struct bridge_softc *sc, struct 
  ifnet *ifp,
   struct ether_header *eh, struct mbuf *m)
   {
  struct bridge_iflist *p;
  struct mbuf *mc;
  struct ifnet *dst_if;
  -   int len, used = 0;
  -
  -   splassert(IPL_NET);
  +   int len, s, used = 0;
   
  TAILQ_FOREACH(p, sc-sc_iflist, next) {
  /*
   * Don't retransmit out of the same interface where
   * the packet was received from.
  @@ -1587,11 +1582,13 @@ bridge_broadcast(struct bridge_softc *sc, struct 
  ifnet *ifp,
  len += ETHER_VLAN_ENCAP_LEN;
   #endif
  if ((len - ETHER_HDR_LEN)  dst_if-if_mtu)
  bridge_fragment(sc, dst_if, eh, mc);
  else {
  +   s = splnet();
  bridge_ifenqueue(sc, dst_if, mc);
  +   splx(s);
  }
  }
   
  if (!used)
  m_freem(m);
  @@ -1643,11 +1640,11 @@ bridge_span(struct bridge_softc *sc, struct 
  ether_header *eh,
   struct mbuf *morig)
   {
  struct bridge_iflist *p;
  struct ifnet *ifp;
  struct mbuf *mc, *m;
  -   int error;
  +   int s, error;
   
  if (TAILQ_EMPTY(sc-sc_spanlist))
  return;
   
  m = m_copym2(morig, 0, M_COPYALL, M_NOWAIT);
  @@ -1679,11 +1676,13 @@ bridge_span(struct bridge_softc *sc, struct 
  ether_header *eh,
  if (mc == NULL) {
  sc-sc_if.if_oerrors++;
  continue;
  }
   
  +   s = 

Re: acpi global lock diff that needs testing

2013-07-31 Thread Norman Golisz
On Tue Jul 30 2013 00:06, Mark Kettenis wrote:
 Things to test are suspend/resume, whether the battery status is
 properly reported and updated, whether the acpitz(4) temperature
 sensors are still working, etc., etc.  So please run with it for a bit
 and report any breakage.

Lenovo T400. Tested several suspend/resume cycles, onboard-USB after
resume, checked battery/temperature status, and the system survived a
complete working day. No regressions.


OpenBSD 5.4-current (GENERIC.MP) #10: Tue Jul 30 17:30:29 CEST 2013
nor...@theos.my.domain:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 4166717440 (3973MB)
avail mem = 4047872000 (3860MB)
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.4 @ 0xe0010 (80 entries)
bios0: vendor LENOVO version 7UET93WW (3.23 ) date 12/15/2011
bios0: LENOVO 6475BE3
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP SSDT ECDT APIC MCFG HPET SLIC BOOT ASF! SSDT TCPA DMAR 
SSDT SSDT SSDT
acpi0: wakeup devices LID_(S3) SLPB(S3) UART(S3) IGBE(S4) EXP0(S4) EXP1(S4) 
EXP2(S4) EXP3(S4) EXP4(S4) PCI1(S4) USB0(S3) USB3(S3) USB5(S3) EHC0(S3) 
EHC1(S3) HDEF(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpiec0 at acpi0
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM)2 Duo CPU P8400 @ 2.26GHz, 2261.29 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,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,NXE,LONG,LAHF,PERF
cpu0: 3MB 64b/line 8-way L2 cache
cpu0: smt 0, core 0, package 0
cpu0: apic clock running at 266MHz
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Core(TM)2 Duo CPU P8400 @ 2.26GHz, 2261.01 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,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,NXE,LONG,LAHF,PERF
cpu1: 3MB 64b/line 8-way L2 cache
cpu1: smt 0, core 1, package 0
ioapic0 at mainbus0: apid 1 pa 0xfec0, version 20, 24 pins
ioapic0: misconfigured as apic 2, remapped to apid 1
acpimcfg0 at acpi0 addr 0xe000, bus 0-63
acpihpet0 at acpi0: 14318179 Hz
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (AGP_)
acpiprt2 at acpi0: bus 2 (EXP0)
acpiprt3 at acpi0: bus 3 (EXP1)
acpiprt4 at acpi0: bus -1 (EXP2)
acpiprt5 at acpi0: bus 5 (EXP3)
acpiprt6 at acpi0: bus 13 (EXP4)
acpiprt7 at acpi0: bus 21 (PCI1)
acpicpu0 at acpi0: C3, C2, C1, PSS
acpicpu1 at acpi0: C3, C2, C1, PSS
acpipwrres0 at acpi0: PUBS
acpitz0 at acpi0: critical temperature is 127 degC
acpitz1 at acpi0: critical temperature is 100 degC
acpibtn0 at acpi0: LID_
acpibtn1 at acpi0: SLPB
acpibat0 at acpi0: BAT0 model 42T5264 serial  3499 type LION oem Panasonic
acpibat1 at acpi0: BAT1 not present
acpiac0 at acpi0: AC unit online
acpithinkpad0 at acpi0
acpidock0 at acpi0: GDCK docked (15)
cpu0: Enhanced SpeedStep 2261 MHz: speeds: 2267, 2266, 1600, 800 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 Intel GM45 Host rev 0x07
vga1 at pci0 dev 2 function 0 Intel GM45 Video rev 0x07
intagp0 at vga1
agp0 at intagp0: aperture at 0xd000, size 0x1000
inteldrm0 at vga1
drm0 at inteldrm0
inteldrm0: 1440x900
wsdisplay0 at vga1 mux 1: console (std, vt100 emulation)
wsdisplay0: screen 1-5 added (std, vt100 emulation)
Intel GM45 Video rev 0x07 at pci0 dev 2 function 1 not configured
Intel GM45 HECI rev 0x07 at pci0 dev 3 function 0 not configured
em0 at pci0 dev 25 function 0 Intel ICH9 IGP M AMT rev 0x03: msi, address 
00:1c:25:95:39:e7
uhci0 at pci0 dev 26 function 0 Intel 82801I USB rev 0x03: apic 1 int 20
uhci1 at pci0 dev 26 function 1 Intel 82801I USB rev 0x03: apic 1 int 21
uhci2 at pci0 dev 26 function 2 Intel 82801I USB rev 0x03: apic 1 int 22
ehci0 at pci0 dev 26 function 7 Intel 82801I USB rev 0x03: apic 1 int 23
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 Intel EHCI root hub rev 2.00/1.00 addr 1
azalia0 at pci0 dev 27 function 0 Intel 82801I HD Audio rev 0x03: msi
azalia0: codecs: Conexant CX20561
audio0 at azalia0
ppb0 at pci0 dev 28 function 0 Intel 82801I PCIE rev 0x03: msi
pci1 at ppb0 bus 2
ppb1 at pci0 dev 28 function 1 Intel 82801I PCIE rev 0x03: msi
pci2 at ppb1 bus 3
iwn0 at pci2 dev 0 function 0 Intel WiFi Link 5300 rev 0x00: msi, MIMO 3T3R, 
MoW, address 00:16:ea:b3:62:e8
ppb2 at pci0 dev 28 function 3 Intel 82801I PCIE rev 0x03: msi
pci3 at ppb2 bus 5
ppb3 at pci0 dev 28 function 4 Intel 82801I PCIE rev 0x03: msi
pci4 at ppb3 bus 13
uhci3 at pci0 dev 29 function 0 Intel 82801I USB rev 0x03: apic 1 int 16
uhci4 at pci0 dev 29 function 1 Intel 82801I USB rev 0x03: apic 1 int 17
uhci5 at pci0 dev 29 function 2 Intel 82801I USB rev 0x03: apic 1 int 18
ehci1 at pci0 dev 29 function 7 Intel 82801I USB rev 0x03: apic 1 int 19
usb1 at ehci1: USB revision 2.0
uhub1 at usb1 Intel EHCI root hub rev 2.00/1.00 addr 1
ppb4 at pci0 dev 30 function 0 Intel 82801BAM Hub-to-PCI rev