Bug 5102

Summary: Stuck in NVSync on AMD64
Product: xorg Reporter: richard
Component: Driver/nVidia (open)Assignee: Xorg Project Team <xorg-team>
Status: RESOLVED DUPLICATE QA Contact:
Severity: critical    
Priority: high CC: alexander.pohoyda, kirillyb
Version: 6.8.99.16   
Hardware: x86-64 (AMD64)   
OS: FreeBSD   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Diff for NetBSD's xsrc tree none

Description richard 2005-11-20 09:52:52 UTC
I am using the FreeBSD xorg-server-6.8.99.16 package which includes more
recent patches to nv_* dated 29 September.

The server hangs (reproduced within 30 seconds by repeatedly hiding and exposing
emacs
or mozilla windows).  Attaching a debugger shows that it is stuck in the first loop
in NVSync.  Adding printfs shows that READ_GET is returning values that do
not correspond to those recently PUT.

I am using a "GeForce 6200 TurboCache" card, and am running the AMD64 version
of FreeBSD and X.org.  I did not encounter this problem while running the
x386 version for about a day.
Comment 1 Erik Andren 2006-05-23 16:23:46 UTC
Is this still reproducible with the 7.1 release of xorg?
Comment 2 Quentin Garnier 2006-10-01 08:17:50 UTC
I've been bitten by the same bug on NetBSD with a similar video card. I can
confirm it happens with the latest release of X.org.

The culprit is mem_barrier(), which is set to void by default.  If you look at
common/compiler.h, you'll notice that Linux/amd64 uses a different value.  Using
that one on NetBSD makes the driver behave.

Right now I'm not sure how to make things proper for a commit in our xsrc tree,
but at least I have the culprit and a fix.
Comment 3 Quentin Garnier 2006-10-01 08:23:23 UTC
Created attachment 7226 [details] [review]
Diff for NetBSD's xsrc tree

Our xsrc tree is XFree86 4.5, but I tested it first on
xf86-video-nv-X11R7.1-1.1.1, with as much success.
Comment 4 Aaron Plattner 2007-04-10 09:14:44 UTC
Over a year without an update from the reporter.  Quentin it sounds like you have a different issue that isn't an nv driver bug.  Resolving.
Comment 5 Alexander Pohoyda 2008-04-22 02:48:46 UTC
Running FreeBSD 7.0 amd64 Xorg 7.3 I'm having the same problem:

0x00000008026917f6 in NVSync (pScrn=0x801a04000) at nv_xaa.c:303
303         while(READ_GET(pNv) != pNv->dmaPut);
(gdb) l
298         NVPtr pNv = NVPTR(pScrn);
299
300         if(pNv->DMAKickoffCallback)
301            (*pNv->DMAKickoffCallback)(pScrn);
302
303         while(READ_GET(pNv) != pNv->dmaPut);
304
305         while(pNv->PGRAPH[0x0700/4]);
306     }
307
(gdb) c
Continuing.
^C
Program received signal SIGINT, Interrupt.
0x00000008026917f6 in NVSync (pScrn=0x801a04000) at nv_xaa.c:303
303         while(READ_GET(pNv) != pNv->dmaPut);
(gdb) p pNv->dmaPut
$1 = 2269
(gdb) p pNv
$2 = 0x801a04000
(gdb) p *pNv
$3 = {SavedReg = {bpp = 0, width = 0, height = 0, interlace = 255,
    repaint0 = 96, repaint1 = 40, screen = 15, scale = 286261520,
    dither = 65536, extra = 0, fifo = 24, pixel = 131, horiz = 0,
    arbitration0 = 132, arbitration1 = 192, pll = 0, pllB = 0, vpll =
136452,
    vpll2 = 267525, vpllB = 2147486979, vpll2B = 2147485698, pllsel = 516,
    control = 0, general = 537919792, crtcOwner = 0, head = 4112,
    head2 = 196608, config = 1124089344, cursorConfig = 67178497,
    cursor0 = 251, cursor1 = 225, cursor2 = 7, timingH = 0, timingV = 0,
    displayV = 0, crtcSync = 1892, crtcVSync = 1229}, ModeReg = {bpp = 32,
    width = 1920, height = 1200, interlace = 255, repaint0 = 96, repaint1 =
0,
    screen = 15, scale = 286261520, dither = 65536, extra = 0, fifo = 24,
    pixel = 131, horiz = 0, arbitration0 = 4, arbitration1 = 192,
    pll = 145674, pllB = 2147484673, vpll = 145674, vpll2 = 267525,
    vpllB = 2147484673, vpll2B = 2147485698, pllsel = 268437248, control =
0,
    general = 537919792, crtcOwner = 0, head = 4112, head2 = 196608,
    config = 1124089344, cursorConfig = 67178752, cursor0 = 1019,
    cursor1 = 225, cursor2 = 7, timingH = 0, timingV = 0, displayV = 1200,
    crtcSync = 1892, crtcVSync = 1229}, CurrentState = 0x801a04094,
  Architecture = 64, CursorStart = 133677056, pEnt = 0x801a31500,
  PciInfo = 0x801a3d280, PciTag = 65536, Chipset = 282984810, ChipRev = 161,
  Primary = 1, IOAddress = 4160749568, FbAddress = 3221225472,
  FbBase = 0x803f8a000 "ÙÙÙ", FbStart = 0x803f8a000 "ÙÙÙ",
  FbMapSize = 134217728, FbUsableSize = 133644288, ScratchBufferSize =
16384,
  ScratchBufferStart = 133627904, NoAccel = 0, HWCursor = 1, FpScale = 1,
  ShadowFB = 0, ShadowPtr = 0x0, ShadowPitch = 0, MinVClockFreqKHz = 12000,
  MaxVClockFreqKHz = 400000, CrystalFreqKHz = 27000, RamAmountKBytes =
131072,
  REGS = 0x802d06000, PCRTC0 = 0x803306000, PCRTC = 0x803306000,
  PRAMDAC0 = 0x803386000, PFB = 0x802e06000, PFIFO = 0x802d08000,
  PGRAPH = 0x803106000, PEXTDEV = 0x802e07000, PTIMER = 0x802d0f000,
  PMC = 0x802d06000, PRAMIN = 0x803416000, FIFO = 0x803506000,
  CURSOR = 0x80bf06000, PCIO0 = 0x803307000 "", PCIO = 0x803307000 "",
  PVIO = 0x802dc6000 "", PDIO0 = 0x803387000 "", PDIO = 0x803387000 "",
---Type <return> to continue, or q <return> to quit---
  PRAMDAC = 0x803386000, AccelInfoRec = 0x801a68000,
  CursorInfoRec = 0x801a342c0, DGAModes = 0x801a65000, numDGAModes = 83,
  DGAactive = 0, DGAViewportStatus = 0, PointerMoved = 0,
  BlockHandler = 0x4de7e0 <miCreateScreenResources+2736>,
  CloseScreen = 0x801ff3290 <XvCloseScreen>,
  EnableDisableFBAccess = 0x4ad180 <xf86ForceHWCursor+160>, accessEnabled =
1,
  FBDev = 0, Rotate = 0, CurrentLayout = {bitsPerPixel = 32, depth = 24,
    displayWidth = 1920, weight = {red = 8, green = 8, blue = 8},
    mode = 0x801a45030}, curFg = 4278190080, curBg = 4294967295, curImage =
{
    0, 7, 0, 0, 6, 31, 0, 0, 30, 127, 0, 0, 124, 510, 0, 0, 508, 2046, 0, 0,
    2040, 16380, 0, 0, 8184, 16380, 0, 0, 496, 16376, 0, 0, 496, 1016, 0, 0,
    608, 2032, 0, 0, 1120, 3824, 0, 0, 2112, 7392, 0, 0, 4160, 14560, 0, 0,
    8192, 28896, 0, 0, 16384, 57344, 0, 0, 0, 49152, 0 <repeats 194 times>},
  I2C = 0x801a53420, pInt = 0x0, VideoTimerCallback = 0,
  DMAKickoffCallback = 0, overlayAdaptor = 0x0, blitAdaptor = 0x801a27000,
  videoKey = 66046, FlatPanel = 1, FPDither = 0, Television = 0,
  CRTCnumber = 0, Options = 0x801a25c00, alphaCursor = 1, DDCBase = 54 '6',
  twoHeads = 1, twoStagePLL = 1, fpScaler = 1, fpWidth = 1920,
  fpHeight = 1200, fpVTotal = 1235, fpSyncs = 268435472, usePanelTweak = 0,
  PanelTweak = 0, LVDS = 0, dmaPut = 2269, dmaCurrent = 2269, dmaFree =
5915,
  dmaMax = 8191, dmaBase = 0x80befe000, currentRop = 3, WaitVSyncPossible =
1,
  BlendingPossible = 1, RandRRotation = 0, VBEDualhead = 0, pVbe = 0x0,
  pVbeInfo = 0x0, vbeMode = 0, vbeCRTC1Offset = 0}
(gdb)




I can provide any information needed to analyze this bug.
Comment 6 kirill 2008-05-05 03:45:27 UTC
If you add syslog(3) at the very beginning of NVDmaKickoff(NVPtr pNv) (nv_xaa.c line  106)  you will get rid of this bug (at least system will not hang). 

Black magic is not it?

imho syslog introduces random delay and this resolves an issue. Meanwhile neither fixed delay (i tried 10us and 100 us) nor printf help. 

My configuration:

FreeBSD7.0 release amd64 
X.Org X Server 1.4.0
nv-2.1.7
Chipset GeForce Go 7400
Fujitsu-Siemens Amilo Pa1838
Comment 7 kirill 2008-05-05 09:45:13 UTC
update. 500 nsec fixed delay via nanosleep is also seems working
Comment 8 Benjamin Close 2008-05-19 19:33:58 UTC
Common issue across all arch, combining bug reports to make fixing this easier to track

*** This bug has been marked as a duplicate of bug 3168 ***

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.