question about libc fopen

2016-12-23 Thread 盛慧华
hi all,

   hi~
   we are from Chinese Game Develop Corp, Netease.
   and One of our product using FreeBsd as its OS platform.
   This Game has Millions of players online , and Each Server may holds 25000+ 
tcp connection at the same time.Thanks to BSD and kqueue :)

   it's one of our server , netstat cmd to list connections overall...
   netstat -an | grep 13396 (it's our listening port) | wc -l 
   23221

recently we do some performance optimize and promote this connection limit 
to 28000+ or 3+.
  But we find Freebsd has a limit that this huge online number will take 28000+ 
fd, and bsd libc fopen FILE * struct's 
  fileno only support to SHORT . such as ..

struct __sFILE {
 ...
 short _file; /* (*) fileno, if Unix descriptor, else -1 */
 ...

  so if our server want to fopen some file when we still hold this online 
number, the fopen's fileno may easily exceed
32767, and fopen definitely return a err code. then the server will appear some 
fataly ERROR. 

  for example, if my server tcp already holds 32000 connection
  fopen only has 767 fd to use

  the problem has no bussiness with tcp fd, BUT fopen ...

  in some particular situlations , my server will open 1k+ FILE , that will 
exceed the fileno limit, and overflow occur
  my server can't open any file more ,that's the problem ~

  we do a simple test and confirm this situation.

  then in fopen's code , we notice that we can use open to return a fd instread 
of using fopen to avoid this overflow, 
   as below

68 /* 
1 * File descriptors are a full int, but _file is only a short. 
2 * If we get a valid file descriptor that is greater than 
3 * SHRT_MAX, then the fd will get sign-extended into an 
4 * invalid file descriptor. Handle this case by failing the 
5 * open. 
6 */

  BUT ... so many libc FILE series function needs a FILE * pointer as input 
argument, we can't convert all of them to fd, 
or it will be a rather suffering things to us. 

  and even in BSD 10 , it seems this SHORT fileno limit still there , but other 
OS as debian , FILE strucnt's fileno is a int .

  so i felt if bsd official could change libc FILE struct's fileno to a 
UNSIGNED SHORT that may be an effecient and convenient solution just for my 
case ?
  UNSIGNED SHORT fileno is enough for me~~~ or i should modify it by myself ?

  LoL, thank you !

yours sincerely
   winson sheng


winson sheng
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Enabling NUMA in BIOS stop booting FreeBSD

2016-12-23 Thread Slawa Olhovchenkov
On Thu, Dec 22, 2016 at 09:26:02PM +0100, Willem Jan Withagen wrote:

> On 16-12-2016 00:57, Adrian Chadd wrote:
> > heh, an updated BIOS that solves the problem will solve the problem. :)
> > 
> > I think you have enough information to provide to supermicro. Ie,
> > "SMAP says X, when physical memory pages at addresses X are accessed,
> > they don't behave like memory, maybe something is wrong".
> > 
> > All I can think of is some hack to add a blacklist for that region so
> > you can boot the unit. But it makes me wonder what else is going on.
> 
> I have an X10DRL-iT with 256Gb and 2* 2630V4 available for testing until
> begin January. Started it on 11-RELEASE and upgraded to 12-CURRENT of
> 20-12-2016.
> Boots just fine, and seems to run OKE.
> 
> If anything useful to test, just let me know.

For touch issuse you must enable in BIOS both NUMA and Memory
Interleave below 4G.
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


iwm: loosing sporadically connection - iwm has never been stable

2016-12-23 Thread Hartmann, O.
Using a Lenovo E540 laptop equipted with a Intel i7260 WiFi adapter
(iwm0:  mem 0xf0c0-0xf0c01fff at
device 0.0 on pci3), this adaptor has never been fully operational
since it got supported by FreeBSD on that specific laptop of mine.

I'm running CURRENT(12.0-CURRENT #29 r310417: Thu Dec 22 17:06:29 CET
2016 amd64). The laptop is used in the WLAN environment of the campus
and at my employer's facility and after booting the laptop, the rarest
case is to have a stable connection over the time of work (~4 - 9 hours
a day).  

At this very moment, I receive these messages on the console:

[...]
acpi_ec0: evaluation of query method _Q26 failed: AE_AML_OPERAND_TYPE
wlan0: link state changed to DOWN
wlan0: ieee80211_new_state_locked: pending INIT -> SCAN transition lost
iwm0: iwm_update_edca: called
wlan0: link state changed to UP
wlan0: link state changed to DOWN
wlan0: ieee80211_new_state_locked: pending INIT -> SCAN transition lost
iwm0: add_aux_sta failed
iwm0: iwm_send_cmd: acquiring device failed
iwm0: could not initiate 2 GHz scan
iwm0: iwm_update_edca: called
iwm0: iwm_send_cmd: acquiring device failed
iwm0: iwm_newstate: could not move to auth state: 16
iwm0: device timeout
iwm0: add_aux_sta failed
iwm_init_hw failed 35
iwm0: could not initiate 2 GHz scan
[...]

Ince a couple of days for now, I'm bothered by tons of ACPI messages on
the console as well, but I do not know whether they're linked to the
problem described above:

[...]
WARNING: attempt to domain_add(bluetooth) after domainfinalize()
iwm0: iwm_update_edca: called
wlan0: link state changed to UP
ACPI Error: Needed type [Reference], found [Processor]
0xf8000461ab80 (20161117/exresop-111) ACPI Exception:
AE_AML_OPERAND_TYPE, While resolving operands for [OpcodeName
unavailable] (20161117/dswexec-498) ACPI Error: Method parse/execution
failed [\134PNTF] (Node 0xf80003f17ac0), AE_AML_OPERAND_TYPE
(20161117/psparse-560) ACPI Error: Method parse/execution failed
[\134_SB.PCI0.LPC.EC.IPCL] (Node 0xf80004603f00),
AE_AML_OPERAND_TYPE (20161117/psparse-560) ACPI Error: Method
parse/execution failed [\134_SB.PCI0.LPC.EC.PCLK] (Node
0xf80004604000), AE_AML_OPERAND_TYPE (20161117/psparse-560) ACPI
Error: Method parse/execution failed [\134_SB.PCI0.LPC.EC._Q7B] (Node
0xf80004604300), AE_AML_OPERAND_TYPE (20161117/psparse-560)
acpi_ec0: evaluation of query method _Q7B failed: AE_AML_OPERAND_TYPE
error: [drm:pid12:i915_hangcheck_hung] *ERROR* Hangcheck timer
elapsed... GPU hung info: [drm] capturing error event; look for more
information in sysctl hw.dri.0.info.i915_error_state error:
[drm:pid1127:i915_write32] *ERROR* Unknown unclaimed register before
writing to 20a8 error: [drm:pid0:i915_write64] *ERROR* Unknown
unclaimed register before writing to 10 ACPI Error: Needed type
[Reference], found [Processor] 0xf8000461ab80
(20161117/exresop-111) ACPI Exception: AE_AML_OPERAND_TYPE, While
resolving operands for [OpcodeName unavailable] (20161117/dswexec-498)
ACPI Error: Method parse/execution failed [\134PNTF] (Node
0xf80003f17ac0), AE_AML_OPERAND_TYPE (20161117/psparse-560) ACPI
Error: Method parse/execution failed [\134_SB.PCI0.LPC.EC.IPCL] (Node
0xf80004603f00), AE_AML_OPERAND_TYPE (20161117/psparse-560) ACPI
Error: Method parse/execution failed [\134_SB.PCI0.LPC.EC.PCLK] (Node
0xf80004604000), AE_AML_OPERAND_TYPE (20161117/psparse-560) ACPI
Error: Method parse/execution failed [\134_SB.PCI0.LPC.EC._Q7B] (Node
0xf80004604300), AE_AML_OPERAND_TYPE (20161117/psparse-560)
acpi_ec0: evaluation of query method _Q7B failed: AE_AML_OPERAND_TYPE

[...]


Hope someone can have a look at this.

Thanks in advance,

Oliver Hartmann
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Enabling NUMA in BIOS stop booting FreeBSD

2016-12-23 Thread Slawa Olhovchenkov
On Fri, Dec 23, 2016 at 08:16:39PM +0100, Willem Jan Withagen wrote:

> On 23-12-2016 14:26, Slawa Olhovchenkov wrote:
> > On Thu, Dec 22, 2016 at 09:26:02PM +0100, Willem Jan Withagen wrote:
> > 
> >> On 16-12-2016 00:57, Adrian Chadd wrote:
> >>> heh, an updated BIOS that solves the problem will solve the problem. :)
> >>>
> >>> I think you have enough information to provide to supermicro. Ie,
> >>> "SMAP says X, when physical memory pages at addresses X are accessed,
> >>> they don't behave like memory, maybe something is wrong".
> >>>
> >>> All I can think of is some hack to add a blacklist for that region so
> >>> you can boot the unit. But it makes me wonder what else is going on.
> >>
> >> I have an X10DRL-iT with 256Gb and 2* 2630V4 available for testing until
> >> begin January. Started it on 11-RELEASE and upgraded to 12-CURRENT of
> >> 20-12-2016.
> >> Boots just fine, and seems to run OKE.
> >>
> >> If anything useful to test, just let me know.
> > 
> > For touch issuse you must enable in BIOS both NUMA and Memory
> > Interleave below 4G.
> 
> Numa was already on, but I cannot find the Memory Interleave option.

for X10DRi:

Advanced/Chipset Config/North Bridge/Memory Config/Socket Interleave below 4G
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Enabling NUMA in BIOS stop booting FreeBSD

2016-12-23 Thread Willem Jan Withagen
On 23-12-2016 20:30, Slawa Olhovchenkov wrote:
> On Fri, Dec 23, 2016 at 08:16:39PM +0100, Willem Jan Withagen wrote:
> 
>> On 23-12-2016 14:26, Slawa Olhovchenkov wrote:
>>> On Thu, Dec 22, 2016 at 09:26:02PM +0100, Willem Jan Withagen wrote:
>>>
 On 16-12-2016 00:57, Adrian Chadd wrote:
> heh, an updated BIOS that solves the problem will solve the problem. :)
>
> I think you have enough information to provide to supermicro. Ie,
> "SMAP says X, when physical memory pages at addresses X are accessed,
> they don't behave like memory, maybe something is wrong".
>
> All I can think of is some hack to add a blacklist for that region so
> you can boot the unit. But it makes me wonder what else is going on.

 I have an X10DRL-iT with 256Gb and 2* 2630V4 available for testing until
 begin January. Started it on 11-RELEASE and upgraded to 12-CURRENT of
 20-12-2016.
 Boots just fine, and seems to run OKE.

 If anything useful to test, just let me know.
>>>
>>> For touch issuse you must enable in BIOS both NUMA and Memory
>>> Interleave below 4G.
>>
>> Numa was already on, but I cannot find the Memory Interleave option.
> 
> for X10DRi:
> 
> Advanced/Chipset Config/North Bridge/Memory Config/Socket Interleave below 4G

The only thing that could be this is:
a7 mode,
but that is already enabled.
This speaks about a bit higher memory bandwidth.

On the PCIe page ther is something like:
above 4G encoding
but that will probably not be it.

--WjW

___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Enabling NUMA in BIOS stop booting FreeBSD

2016-12-23 Thread Slawa Olhovchenkov
On Fri, Dec 23, 2016 at 09:37:40PM +0100, Willem Jan Withagen wrote:

> On 23-12-2016 20:30, Slawa Olhovchenkov wrote:
> > On Fri, Dec 23, 2016 at 08:16:39PM +0100, Willem Jan Withagen wrote:
> > 
> >> On 23-12-2016 14:26, Slawa Olhovchenkov wrote:
> >>> On Thu, Dec 22, 2016 at 09:26:02PM +0100, Willem Jan Withagen wrote:
> >>>
>  On 16-12-2016 00:57, Adrian Chadd wrote:
> > heh, an updated BIOS that solves the problem will solve the problem. :)
> >
> > I think you have enough information to provide to supermicro. Ie,
> > "SMAP says X, when physical memory pages at addresses X are accessed,
> > they don't behave like memory, maybe something is wrong".
> >
> > All I can think of is some hack to add a blacklist for that region so
> > you can boot the unit. But it makes me wonder what else is going on.
> 
>  I have an X10DRL-iT with 256Gb and 2* 2630V4 available for testing until
>  begin January. Started it on 11-RELEASE and upgraded to 12-CURRENT of
>  20-12-2016.
>  Boots just fine, and seems to run OKE.
> 
>  If anything useful to test, just let me know.
> >>>
> >>> For touch issuse you must enable in BIOS both NUMA and Memory
> >>> Interleave below 4G.
> >>
> >> Numa was already on, but I cannot find the Memory Interleave option.
> > 
> > for X10DRi:
> > 
> > Advanced/Chipset Config/North Bridge/Memory Config/Socket Interleave below 
> > 4G
> 
> The only thing that could be this is:
>   a7 mode,
> but that is already enabled.
> This speaks about a bit higher memory bandwidth.

In may case A7 immediately below 'Socket Interleave below 4G'

> On the PCIe page ther is something like:
>   above 4G encoding
> but that will probably not be it.
> 
> --WjW
> 
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Enabling NUMA in BIOS stop booting FreeBSD

2016-12-23 Thread Willem Jan Withagen
On 23-12-2016 22:07, Slawa Olhovchenkov wrote:
> On Fri, Dec 23, 2016 at 09:37:40PM +0100, Willem Jan Withagen wrote:
> 
>> On 23-12-2016 20:30, Slawa Olhovchenkov wrote:
>>> On Fri, Dec 23, 2016 at 08:16:39PM +0100, Willem Jan Withagen wrote:
>>>
 On 23-12-2016 14:26, Slawa Olhovchenkov wrote:
> On Thu, Dec 22, 2016 at 09:26:02PM +0100, Willem Jan Withagen wrote:
>
>> On 16-12-2016 00:57, Adrian Chadd wrote:
>>> heh, an updated BIOS that solves the problem will solve the problem. :)
>>>
>>> I think you have enough information to provide to supermicro. Ie,
>>> "SMAP says X, when physical memory pages at addresses X are accessed,
>>> they don't behave like memory, maybe something is wrong".
>>>
>>> All I can think of is some hack to add a blacklist for that region so
>>> you can boot the unit. But it makes me wonder what else is going on.
>>
>> I have an X10DRL-iT with 256Gb and 2* 2630V4 available for testing until
>> begin January. Started it on 11-RELEASE and upgraded to 12-CURRENT of
>> 20-12-2016.
>> Boots just fine, and seems to run OKE.
>>
>> If anything useful to test, just let me know.
>
> For touch issuse you must enable in BIOS both NUMA and Memory
> Interleave below 4G.

 Numa was already on, but I cannot find the Memory Interleave option.
>>>
>>> for X10DRi:
>>>
>>> Advanced/Chipset Config/North Bridge/Memory Config/Socket Interleave below 
>>> 4G
>>
>> The only thing that could be this is:
>>  a7 mode,
>> but that is already enabled.
>> This speaks about a bit higher memory bandwidth.
> 
> In may case A7 immediately below 'Socket Interleave below 4G'

Right, then I do not have this option.

Sorry,
--WjW


___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Enabling NUMA in BIOS stop booting FreeBSD

2016-12-23 Thread Willem Jan Withagen
On 23-12-2016 14:26, Slawa Olhovchenkov wrote:
> On Thu, Dec 22, 2016 at 09:26:02PM +0100, Willem Jan Withagen wrote:
> 
>> On 16-12-2016 00:57, Adrian Chadd wrote:
>>> heh, an updated BIOS that solves the problem will solve the problem. :)
>>>
>>> I think you have enough information to provide to supermicro. Ie,
>>> "SMAP says X, when physical memory pages at addresses X are accessed,
>>> they don't behave like memory, maybe something is wrong".
>>>
>>> All I can think of is some hack to add a blacklist for that region so
>>> you can boot the unit. But it makes me wonder what else is going on.
>>
>> I have an X10DRL-iT with 256Gb and 2* 2630V4 available for testing until
>> begin January. Started it on 11-RELEASE and upgraded to 12-CURRENT of
>> 20-12-2016.
>> Boots just fine, and seems to run OKE.
>>
>> If anything useful to test, just let me know.
> 
> For touch issuse you must enable in BIOS both NUMA and Memory
> Interleave below 4G.

Numa was already on, but I cannot find the Memory Interleave option.

--WjW


___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"