Re: [hatari-devel] Too many (4096) active GEMDOS HD DTA entries |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [hatari-devel] Too many (4096) active GEMDOS HD DTA entries
- From: Uwe Seimet <Uwe.Seimet@xxxxxxxxx>
- Date: Sat, 5 Oct 2024 11:50:14 +0200
- Arc-authentication-results: i=1; strato.com; arc=none; dkim=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1728121817; s=strato-dkim-0002; d=strato.com; h=In-Reply-To:References:Message-ID:Subject:To:From:Date:Cc:Date:From: Subject:Sender; bh=zH+nL2KRv/M4FnjirdzegbhV5WBwBr7E7aUNoGIinsw=; b=d1/OwY3sooIja526HasM34ljXK3DpjcC531Z9rKEm8a/XAkIgLPBtKDt/jBSYrsVPX Adn7i9GDZ1sxoIT9GatqeK3NY19kZysfuM70JFLBnDQMk/04S/LTkam62BPBXdPsel1R TU2fZb7ombeOZu7kmcQg6yNm8ZoEl8PKitJypZpr0twciHOY9BQEc3+rUrmhFY/sSKUJ pnkswe3cquKI0rGGT/93Avg7c/XUq5SB/jVGKiC0adfBO7BkOH62tDAIQ3dPZGSw6vlH sb1B+VY2sRQZJoU2Ya7IPqGx2CfqPd+BTkAc+rKKSF1a16erqSUYfYL61FgZS9qv3Eco yX0g==
- Arc-seal: i=1; a=rsa-sha256; t=1728121817; cv=none; d=strato.com; s=strato-dkim-0002; b=nwURBM9ekGvmWY1smMHDnjuaFajOxn9JNe43ME0HMRMcITakvFtFGKWD1j9O4aKTrI jnYS+LDbOUOm3+BJErbRZc2+26u/20POrrd1z1oB/hAV2tDy/+vTVBMsHzp3zCJtTp1N D5nMZAeH58V9WzqQps1lQg4J4+3JVHu1E2uXTkEdrMU2ffBDE/xbeOUs1dpvWzCK77gB 334TxWjWGT7duNfg9hmYrgWiBFVcuXLE3gk4hq3d2UlAR4SaBmpjY18P9aYT36QT0pp9 wIWpdVGN0q6sFeXPUuWKNTVpws7g9I8NTNmVMXNPe6Qdtuoc4Q5CxeNFN9kO48syUmq4 sAQw==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1728121817; s=strato-dkim-0002; d=seimet.de; h=In-Reply-To:References:Message-ID:Subject:To:From:Date:Cc:Date:From: Subject:Sender; bh=zH+nL2KRv/M4FnjirdzegbhV5WBwBr7E7aUNoGIinsw=; b=knCWSDCbrpCbKI592FcSGNk7IZyubY5n7Rowda10AfPt7G3NCgEawL6ApBe2L6O6fA WhWCAkEVVOaFRjrGZ2EUF97ihMk90x6JejQyObZe59GdueJbXj6bHZWIQ9YKRGOMoala AAdFXNeT8o9i38Yp64WaCMSpJ/FTGnz4++Ses/8tTDke676+rNprQAd8IZqoo8BY2bRK l6hiCgY1QZctCReADjscI3kIjbOyLdSAB/94lZn73d1xp7JV/xjDCrOStGpji8j8pgfz PPGxvqCm/a4KKcnWHRGOlHd7/ZK8KBjIeh5WqgJ89vP2lpIFP7jMZSHore9TwAmsu2L8 DOfw==
- Dkim-signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1728121817; s=strato-dkim-0003; d=seimet.de; h=In-Reply-To:References:Message-ID:Subject:To:From:Date:Cc:Date:From: Subject:Sender; bh=zH+nL2KRv/M4FnjirdzegbhV5WBwBr7E7aUNoGIinsw=; b=uO7SETCNx+bEL8Qs8rpf01SMtggTh8F7RxOEhCSalowEIVUO9sG8ScqHfMtkXsZhgb P1Fuzfm9u5udlZgdRJBw==
Hi,
I would still be interested to learn what the warning means for the result
of the copy operation. Have any files been damaged?
Best regards
Uwe
> Hi Eero,
>
> Yes, I was copying quite a large number of files from GEMDOS drives to
> various partitions on an image file. Several 1000 files I guess.
>
> Best regards
>
> Uwe
>
> > Hi Uwe,
> >
> > On 24.9.2024 20.32, Uwe Seimet wrote:
> > > While copying some data with KOBOLD3 Hatari displayed this warning:
> > >
> > > WARN : Too many (4096) active GEMDOS HD DTA entries, wrapping DTA index
> >
> > TOS has no "forget DTA" OS call, so Hatari has no way of knowing which
> > DTAs' data can be dropped.
> >
> > Therefore above warning just means that programs running under Hatari
> > emulation have called FsFirst() OS-call 4k times with different DTA
> > addresses, since emulation was booted.
> >
> > Did you run Kobold, or other heavy DTA using programs, several times
> > before this warning?
> >
> >
> > > May I assume that the copied data are correct, or are they broken?
> >
> > If Kobold actually does FsNext() with a DTA on which it did FsFirst()
> > over *four thousand* Fsetdta() / FsFirst() calls ago, then the filenames
> > associated with DTA would have gone after that warning.
> >
> > (Hatari searches for all the matching files on FsFirst() call, and
> > caches them to internal DTA cache entry for FsNext() calls.)
> >
> > It seems rather unlikely that Kobold would actively use that many DTAs
> > though, but attached is a patch that allows DTA cache to grow unlimited.
> >
> > You could use that to check how many DTAs Kobold copy operation actually
> > consumes...
> >
> > (DTA cache increments are logged every 256 entries.)
> >
> >
> > - Eero
>
> > From 6bf72831f6c470474047fa439d06e670422da3d7 Mon Sep 17 00:00:00 2001
> > From: Eero Tamminen <oak@xxxxxxxxxxxxxx>
> > Date: Wed, 25 Sep 2024 00:49:00 +0300
> > Subject: [PATCH] GEMDOS HD: allow unlimited DTA cache growth
> >
> > There's no "forget DTA" OS call, and no mechanism to detect that
> > process is not using DTA any more. If user keeps doing things that
> > cause more FsFirst() invocations with new DTAs, more DTA (cache)
> > entries are consumed. Let it grow, and just warn user when more is
> > allocated.
> >
> > PS. Marking current DTAs as free on program termination, and
> > compacting the cache may not work either, in case DTA has been passed
> > to another program, or DTA was created by other code (ACC, TOS
> > desktop, some other resident program) while foreground program was
> > running.
> > ---
> > src/gemdos.c | 26 +++++++++-----------------
> > 1 file changed, 9 insertions(+), 17 deletions(-)
> >
> > diff --git a/src/gemdos.c b/src/gemdos.c
> > index 38db359e..bf5c00dd 100644
> > --- a/src/gemdos.c
> > +++ b/src/gemdos.c
> > @@ -110,7 +110,6 @@ typedef enum {
> >
> > #define DTA_MAGIC_NUMBER 0x12983476
> > #define DTA_CACHE_INC 256 /* DTA cache initial and increment size (grows on demand) */
> > -#define DTA_CACHE_MAX 4096 /* max DTA cache size (multiple of DTA_CACHE_INC) */
> >
> > #define BASE_FILEHANDLE 64 /* Our emulation handles - MUST not be valid TOS ones, but MUST be <256 */
> > #define MAX_FILE_HANDLES 64 /* We can allow 64 files open at once */
> > @@ -3130,26 +3129,19 @@ static bool GemDOS_SFirst(uint32_t Params)
> >
> > if (++DTAIndex >= DTACount)
> > {
> > - if (DTACount < DTA_CACHE_MAX)
> > + INTERNAL_DTA *pNewIntDTAs;
> > + /* increase DTA cache size */
> > + pNewIntDTAs = realloc(InternalDTAs, (DTACount + DTA_CACHE_INC) * sizeof(*InternalDTAs));
> > + if (pNewIntDTAs)
> > {
> > - INTERNAL_DTA *pNewIntDTAs;
> > - /* increase DTA cache size */
> > - pNewIntDTAs = realloc(InternalDTAs, (DTACount + DTA_CACHE_INC) * sizeof(*InternalDTAs));
> > - if (pNewIntDTAs)
> > - {
> > - InternalDTAs = pNewIntDTAs;
> > - memset(InternalDTAs + DTACount, 0, DTA_CACHE_INC * sizeof(*InternalDTAs));
> > - DTACount += DTA_CACHE_INC;
> > - }
> > - else
> > - {
> > - Log_Printf(LOG_WARN, "Failed to alloc GEMDOS HD DTA entries, wrapping DTA index\n");
> > - DTAIndex = 0;
> > - }
> > + InternalDTAs = pNewIntDTAs;
> > + memset(InternalDTAs + DTACount, 0, DTA_CACHE_INC * sizeof(*InternalDTAs));
> > + DTACount += DTA_CACHE_INC;
> > + Log_Printf(LOG_WARN, "Increased GEMDOS HD DTA cache to %d entries\n", DTACount);
> > }
> > else
> > {
> > - Log_Printf(LOG_WARN, "Too many (%d) active GEMDOS HD DTA entries, wrapping DTA index\n", DTAIndex);
> > + Log_Printf(LOG_WARN, "Failed to alloc GEMDOS HD DTA entries, wrapping DTA index\n");
> > DTAIndex = 0;
> > }
> > }
> > --
> > 2.39.5
> >
>
>
>