Skip to content

TLC+SLC #113

Open
Open

Description

@Funny-Boy-Max

Can the black-box mode support simulated TLC+SLC mixed SSD?

Activity

  1. huaicheng commented on Jun 20, 2023

    @huaicheng
    Contributor

    Yes, FEMU can be extended to do so but its current FTL doesn't have corresponding logics.

    What you need to do is to implement your data placement policies on SLC and TLC.

  2. huaicheng commented on Aug 30, 2026

    @huaicheng
    Contributor

    Partly, with a caveat worth being clear about.

    nand_cell_type (1 SLC .. 4 QLC) plus cell_pages selects a cell type for the device, and the media layer then applies per-page-type read/program latencies for that type:

    -device femu,...,femu_mode=1,nand_cell_type=1              # all-SLC
    -device femu,...,femu_mode=1,nand_cell_type=3,cell_pages=3 # all-TLC
    

    What is not modelled is a hybrid part — an SLC write cache in front of TLC, with data folded from one to the other. nand_cell_type is device-wide, so you cannot presently mark some blocks SLC and the rest TLC, and there is no fold/migration path between them.

    If you want the timing shape of an SLC cache today, the closest thing is the bbssd write buffer (buffer_size, in pages), which absorbs writes at DRAM latency and programs them later — it models the deferral, not the SLC media.

    Leaving this open as a real feature gap.

  3. maxDeveloper42 commented on Sep 2, 2026

    @maxDeveloper42

    Hi @huaicheng , thanks for the detailed explanation – really appreciate it.

    I'm actually want to try to implement this hybrid SLC+TLC thing mostly for my own curiosity and learning, not for any formal project.

    Since I'm pretty new to FEMU, I was wondering which layer you think would be the best place to achieve this feature?

    Looking forward to your thoughts when you have a moment.

  4. Funny-Boy-Max commented on Sep 2, 2026

    @Funny-Boy-Max
    Author

    你好@huaicheng谢谢你的详细解释,非常感谢。

    我其实想尝试实现这种混合 SLC+TLC的方法,主要是为了满足自己的好奇心和学习兴趣,而不是为了任何正式项目。

    由于我对 FEMU 还不太熟悉,我想知道您认为在哪一层实现这个功能最合适?

    期待您有空时分享一下您的想法。

    Hi,an SLC+TLC hybrid solution has been realized utilizing the FEMU platform. Researchers wishing to conduct performance investigations are invited to access the repository at: https://github.com/Funny-Boy-Max/Hybrid_FEMU". Relevant literature is available here: “Hook: A pattern locality guided prefetch with enhanced read performance for hybrid SSDs”

  5. maxDeveloper42 commented on Sep 2, 2026

    @maxDeveloper42

    @Funny-Boy-Max
    Thx! I will carefully learn your code and read your paper. I would be glad to have further communication and explore possible collaboration in the future.

  6. Funny-Boy-Max commented on Sep 2, 2026

    @Funny-Boy-Max
    Author

    @Funny-Boy-Max Thx! I will carefully learn your code and read your paper. I would be glad to have further communication and explore possible collaboration in the future.

    For inquiries, please feel free to contact us via email at mailto: zhaoyumiao99@gmail.com.

  7. Funny-Boy-Max commented on Sep 2, 2026

    @Funny-Boy-Max
    Author

    Partly, with a caveat worth being clear about.

    nand_cell_type (1 SLC .. 4 QLC) plus cell_pages selects a cell type for the device, and the media layer then applies per-page-type read/program latencies for that type:

    -device femu,...,femu_mode=1,nand_cell_type=1              # all-SLC
    -device femu,...,femu_mode=1,nand_cell_type=3,cell_pages=3 # all-TLC
    

    What is not modelled is a hybrid part — an SLC write cache in front of TLC, with data folded from one to the other. nand_cell_type is device-wide, so you cannot presently mark some blocks SLC and the rest TLC, and there is no fold/migration path between them.

    If you want the timing shape of an SLC cache today, the closest thing is the bbssd write buffer (buffer_size, in pages), which absorbs writes at DRAM latency and programs them later — it models the deferral, not the SLC media.

    Leaving this open as a real feature gap.

    Thank you for your further response!

  8. huaicheng commented on Sep 2, 2026

    @huaicheng
    Contributor

    @Funny-Boy-Max thanks for sharing Hybrid_FEMU and the Hook paper — that is the most direct starting point for anyone wanting this today.

    @maxDeveloper42 on where to put it, the short answer is: one line decides the timing, and the rest is allocation policy.

    Timing. bb_decode_loc() in hw/femu/bbssd/ftl-media.c is the single place a cell type becomes a latency — it fills NandLoc.flash_type from the device-wide n->nand_cell_type. The media layer below it (hw/femu/nand/nand-media.c) already indexes everything by that field (rd_table_ns[flash_type][page_type], wr_table_ns, er_table_ns, from hw/femu/nand/nand.c). So if you store a cell type per block in struct nand_block (hw/femu/bbssd/ftl.h) and read it there instead of the device property, per-block SLC/TLC timing works with no changes to the timing model itself.

    Allocation and folding. There is already a multi-write-pointer mechanism: ssd_write_pointer_for_class() / get_new_page_class() in hw/femu/bbssd/ftl-line-gc.c, used today for log and hot/cold. Add an SLC class and a TLC class, point host writes at SLC, and fold with the existing collection path — reclaim_line() already relocates valid pages through a write pointer, so an SLC→TLC fold is a collection whose destination is the TLC class. should_gc_high() is the shape to copy for the "SLC is filling up" trigger.

    The one real trap is capacity, not timing. An SLC block holds a third of a TLC block's data, but FEMU's geometry is uniform — pgs_per_blk is global and capacity is derived from it in hw/femu/bbssd/ftl-geom.c. Modelling the true capacity asymmetry means making usable pages per block vary, which touches the geometry and capacity accounting. If you only care about the latency behaviour, keep the page counts uniform and vary just the timing; that is far less invasive and is usually enough.

    Worth saying plainly: this is a design change rather than a missing knob, so it belongs as a feature PR rather than something nand_cell_type can be stretched to cover.

  9. huaicheng commented on Oct 10, 2026

    @huaicheng
    Contributor

    @Funny-Boy-Max thank you again for Hybrid_FEMU and the Hook paper. We would like to bring a hybrid SLC/TLC mode into FEMU, with credit to your work. Which option do you prefer?

    1. You open a pull request against current master, and we help with the port.
    2. We port your code ourselves and keep you as the commit author, so GitHub lists you as a FEMU contributor.

    Master changed a lot since early 2025: a shared NAND media layer now sets per-page latencies. So the code needs a port in either case.

    Hybrid_FEMU has no license file. Could you confirm that we may use your code under FEMU's GPL-2.0 license? Also, which of the four Hybrid_SSD variants should we use as the base?

  10. Funny-Boy-Max commented on Oct 14, 2026

    @Funny-Boy-Max
    Author

    @Funny-Boy-Max thank you again for Hybrid_FEMU and the Hook paper. We would like to bring a hybrid SLC/TLC mode into FEMU, with credit to your work. Which option do you prefer?

    1. You open a pull request against current master, and we help with the port.
    2. We port your code ourselves and keep you as the commit author, so GitHub lists you as a FEMU contributor.

    Master changed a lot since early 2025: a shared NAND media layer now sets per-page latencies. So the code needs a port in either case.

    Hybrid_FEMU has no license file. Could you confirm that we may use your code under FEMU's GPL-2.0 license? Also, which of the four Hybrid_SSD variants should we use as the base?

    Thanks for your reply. I am inclined to go with the second option: you handle the porting and retain me as the original commit author. Please mark me in the commits using Author: or Co-authored-by:, and note in the PR/README that the code originates from Hybrid_FEMU. I accept this arrangement, and I appreciate your including the contribution in FEMU.

    Regarding licensing, if it is confirmed that the relevant code in Hybrid_FEMU was written independently by me and does not include third-party code under an incompatible license, I agree to license it under GPL-2.0 or GPL-2.0-or-later, which is compatible with FEMU. I will add a LICENSE file and provenance/attribution notes to Hybrid_FEMU to avoid any ambiguity later.

    As for which variant to use as the basis, my suggestion is:

    Code integration baseline: Hybrid_SSD1. It is the minimal baseline and contains only the basic mixed SLC/TLC FTL, physical structure, latency, and management framework. It is the cleanest starting point for merging into the FEMU main branch, with the lowest review and adaptation cost.

    Final functional target: Hybrid_SSD5. It contains both the HRCMRS caching policy and the PLGDP prefetching mechanism, and is the complete version.

    If you prefer staged porting, you can first merge Hybrid_SSD1, then add the HRCMRS from Hybrid_SSD3, then add the PLGDP from Hybrid_SSD4, and the final result would be equivalent to Hybrid_SSD5.

    If you prefer to port the full solution at once, then use Hybrid_SSD5 as the basis, but the PR will be larger, and the adaptation and review costs will be higher.

    So my explicit recommendation is: use Hybrid_SSD1 as the upstream integration baseline, and Hybrid_SSD5 as the functional reference and final target. I do not recommend using Hybrid_SSD3 or Hybrid_SSD4 alone as the basis, because each contains only half of the functionality.

    In addition, because the current FEMU shared NAND media layer now determines per-page latency, during porting the latency settings in the original hb.c need to be migrated to the new media-layer model. The FTL layer should mainly handle mapping, cache migration, and prefetching logic.

    If further clarification is required regarding the project file structure, please consult “Hybrid_FEMU/代码说明.docx” (Code Documentation).

    Thanks!

  11. huaicheng commented on Nov 3, 2026

    @huaicheng
    Contributor

    @Funny-Boy-Max thanks a lot for the detailed reply and your thesis, they really helped!

    A first version of the hybrid mode is now on master (2815321). It adds an optional pSLC pool in front of MLC, TLC or QLC flash, and it's off by default:

    -device femu,femu_mode=1,nand_cell_type=3,tier_mode=static,tier_static_mb=1024
    

    Docs are in hw/femu/docs/features/tiered-nand.md. The commit and docs credit your work as the design source.

    Your HRCMRS and PLGDP policies aren't in yet. We'd love to port them on top of this later, with you as the author.

    Thanks again!

  12. Funny-Boy-Max commented on Nov 3, 2026

    @Funny-Boy-Max
    Author

    13. @Funny-Boy-Max thanks a lot for the detailed reply and your thesis, they really helped!
    A first version of the hybrid mode is now on master (2815321). It adds an optional pSLC pool in front of MLC, TLC or QLC flash, and it's off by default:
    -device femu,femu_mode=1,nand_cell_type=3,tier_mode=static,tier_static_mb=1024

     Docs are in `hw/femu/docs/features/tiered-nand.md`. The commit and docs credit your work as the design source.
     Your HRCMRS and PLGDP policies aren't in yet. We'd love to port them on top of this later, with you as the author.
     Thanks again!
    

    Thank you, Professor Huaicheng, for the recent advancement of this work and the earlier guidance. I look forward to more opportunities for collaboration in the future!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions