Comments (4)
My read of the code is that currentBankInfo
is indeed a bitfield. MEM_GROW_DOWN and MEM_GROW_UP are particular fields within it. From src/nvidia/generated/g_heap_nvoc.h:
// grow direction within a bank
#define BANK_MEM_GROW_UP 0x00
#define BANK_MEM_GROW_DOWN 0x40
#define BANK_MEM_GROW_MASK 0x40
// grow direction if a bank placement fails
#define MEM_GROW_UP 0x00
#define MEM_GROW_DOWN 0x80
#define MEM_GROW_MASK 0x80
Though the code could be clearer, bitwise AND has higher precedence than ternary ?:, so I don't believe the code is wrong.
https://en.cppreference.com/w/c/language/operator_precedence
Tagging as cosmetic.
from open-gpu-kernel-modules.
Whichever version is correct, I suggest use ( and ) to make the code more clear.
Better code is more clear code. We haven't got time or inclination to master fine details
of the C standard.
from open-gpu-kernel-modules.
both of them would reach the same result anyway. i suggest currentBankInfo = currentBankInfo & BANK_MEM_GROW_DOWN ? MEM_GROW_DOWN : MEM_GROW_UP;
to clear any confusion
from open-gpu-kernel-modules.
looking at the previous section:
if (pVidHeapAlloc->flags & NVOS32_ALLOC_FLAGS_BANK_HINT)
{
if (pVidHeapAlloc->flags & NVOS32_ALLOC_FLAGS_BANK_GROW_DOWN)
currentBankInfo = MEM_GROW_DOWN;
else
currentBankInfo = MEM_GROW_UP;
pVidHeapAlloc->flags &= ~(NVOS32_ALLOC_FLAGS_BANK_HINT); // hint flag only lasts for 1 loop
}
else
{
currentBankInfo = (currentBankInfo & BANK_MEM_GROW_DOWN ? MEM_GROW_DOWN : MEM_GROW_UP);
}
it seems the original intent was to actually set currentBankInfo
to MEM_GROW_DOWN or MEM_GROW_UP, not treat it like a bitfield?
from open-gpu-kernel-modules.
Related Issues (20)
- building main against current centos stream 8 fails HOT 3
- nvidia-smi -gtt doesn't work HOT 5
- allow a way to specify the kernel HOT 1
- Error! Bad return status for module build on kernel: 6.5.2-arch1-1 (x86_64) HOT 10
- extract-firmware-nouveau.py creates wrong file names HOT 1
- Rocky Linux 8.8 crash HOT 3
- eGPU kernel modules failure - Chipset Setup Function Error! HOT 3
- Wrong version tag? HOT 2
- 545.29.02 VRR HDMI 100% broken HOT 14
- No video after waking after screen evergy saving mode (KDE Plasma) HOT 4
- The brightness control of NVIDIA seems to be broken HOT 11
- crypto_shash_ctx_aligned has been removed from the linux kernel in the linux-next version HOT 2
- libGL error: failed to load driver iris; failed to load driver swrast HOT 4
- RMAPI_GPU_LOCK_INTERNAL alloc requested without holding the RMAPI lock HOT 6
- Can't build nvidia driver on Linux 4.19 (Ubuntu 20.04) HOT 2
- Invalid pointer free HOT 4
- failed to build on RHEL 8.4 HOT 1
- Installing the NVIDIA Driver and CUDA Toolkit failed HOT 1
- Flicker on fullscreen apps in 545 driver on GNOME 44 HOT 6
- DKMS build problem in Linux 6.7 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from open-gpu-kernel-modules.